invnumber = ?, transdate = ?, ordnumber = ?, vendor_id = ?, taxincluded = ?,
amount = ?, duedate = ?, paid = ?, netamount = ?,
curr = ?, notes = ?, department_id = ?, storno = ?, storno_id = ?,
- globalproject_id = ?
+ globalproject_id = ?, direct_debit = ?
WHERE id = ?|;
@values = ($form->{invnumber}, conv_date($form->{transdate}),
$form->{ordnumber}, conv_i($form->{vendor_id}),
$form->{currency}, $form->{notes},
conv_i($form->{department_id}), $form->{storno},
$form->{storno_id}, conv_i($form->{globalproject_id}),
+ $form->{direct_debit} ? 't' : 'f',
$form->{id});
do_query($form, $dbh, $query, @values);
# Hotfix für Bug 1837 - Besser wäre es alte Buchungsbelege
# OHNE Auswahlliste (reines Textfeld) zu laden. Hilft aber auch
# nicht für veränderbare Belege (oe, do, ...)
- my $obsolete = "WHERE NOT obsolete" unless $self->{id};
+ my $obsolete = $self->{id} ? '' : "WHERE NOT obsolete";
my $query = qq|SELECT count(*) FROM $table $obsolete|;
my ($count) = selectrow_query($self, $dbh, $query);
}
my $extra_columns = '';
- $extra_columns .= 'a.direct_debit, ' if $module eq 'AR';
+ $extra_columns .= 'a.direct_debit, ' if ($module eq 'AR') || ($module eq 'AP');
if ($self->{id}) {
$query =
AP->get_transdate(\%myconfig, $form);
$form->{initial_transdate} = $form->{transdate};
- &create_links;
+ create_links(dont_save => 1);
$form->{transdate} = $form->{initial_transdate};
&display_form;
$form->{title} = "Edit";
- &create_links;
+ create_links();
&display_form;
$main::lxdebug->leave_sub();
sub create_links {
$main::lxdebug->enter_sub();
+ my %params = @_;
+
my $form = $main::form;
my %myconfig = %main::myconfig;
$main::auth->assert('general_ledger');
$form->create_links("AP", \%myconfig, "vendor");
- my $taxincluded = $form->{taxincluded};
- my $duedate = $form->{duedate};
+ my %saved;
+ if (!$params{dont_save}) {
+ %saved = map { ($_ => $form->{$_}) } qw(direct_debit taxincluded);
+ $saved{duedate} = $form->{duedate} if $form->{duedate};
+ }
IR->get_vendor(\%myconfig, \%$form);
- $form->{taxincluded} = $taxincluded;
- $form->{duedate} = $duedate if $duedate;
+
+ $form->{$_} = $saved{$_} for keys %saved;
$form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
$form->{rowcount} = 1;
<td align="right"><input name="taxincluded" class="checkbox" type="checkbox" value="1" [% IF ( taxincluded ) %]checked[% END %]></td>
<th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
</tr>
+ <tr>
+ <td align="right"><input name="direct_debit" class="checkbox" type="checkbox" value="1" [% IF direct_debit %]checked[% END %]></td>
+ <th align="left" nowrap>[% 'direct debit' | $T8 %]</th>
+ </tr>
</table>
</td>