From d623e974c5f456dab9a691df3fb57c6dba1e1865 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 7 Feb 2013 16:00:40 +0100 Subject: [PATCH] =?utf8?q?Kreditorenbuchungen:=20Checkbox=20f=C3=BCr=20"La?= =?utf8?q?stschrifteinzug";=20Vorbelegung=20aus=20Stammdaten?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/AP.pm | 3 ++- SL/Form.pm | 4 ++-- bin/mozilla/ap.pl | 17 +++++++++++------ templates/webpages/ap/form_header.html | 4 ++++ 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SL/AP.pm b/SL/AP.pm index 53607fff4..03a21e3c6 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -186,7 +186,7 @@ sub post_transaction { 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}), @@ -196,6 +196,7 @@ sub post_transaction { $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); diff --git a/SL/Form.pm b/SL/Form.pm index 23ee18555..f406817f6 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2529,7 +2529,7 @@ sub all_vc { # 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); @@ -2730,7 +2730,7 @@ sub create_links { } 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 = diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index dddf6c515..581142f83 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -97,7 +97,7 @@ sub add { AP->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; - &create_links; + create_links(dont_save => 1); $form->{transdate} = $form->{initial_transdate}; &display_form; @@ -113,7 +113,7 @@ sub edit { $form->{title} = "Edit"; - &create_links; + create_links(); &display_form; $main::lxdebug->leave_sub(); @@ -135,18 +135,23 @@ sub display_form { 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; diff --git a/templates/webpages/ap/form_header.html b/templates/webpages/ap/form_header.html index 0d003c600..29e0dc43d 100644 --- a/templates/webpages/ap/form_header.html +++ b/templates/webpages/ap/form_header.html @@ -139,6 +139,10 @@ [% 'Tax Included' | $T8 %] + + + [% 'direct debit' | $T8 %] + -- 2.20.1