From 02b31f9250ed39394490ed94a08c5e96cd767a65 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 23 Jan 2017 12:55:58 +0100 Subject: [PATCH] =?utf8?q?Zahlungsein-/-ausg=C3=A4nge:=20Kunden-/Lieferant?= =?utf8?q?enpicker=20verwenden?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/CP.pm | 29 ----- bin/mozilla/cp.pl | 143 ++++--------------------- templates/webpages/cp/form_header.html | 26 ++--- 3 files changed, 29 insertions(+), 169 deletions(-) diff --git a/SL/CP.pm b/SL/CP.pm index dc52af8aa..75e753e07 100644 --- a/SL/CP.pm +++ b/SL/CP.pm @@ -101,34 +101,6 @@ sub paymentaccounts { $main::lxdebug->leave_sub(); } -sub get_openvc { - $main::lxdebug->enter_sub(); - - my ($self, $myconfig, $form) = @_; - - my $dbh = SL::DB->client->dbh; - - my $arap = ($form->{vc} eq 'customer') ? 'ar' : 'ap'; - my $vc = $form->{vc} eq "customer" ? "customer" : "vendor"; - my $query = - qq|SELECT count(*) | . - qq|FROM $vc ct, $arap a | . - qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid)|; - my ($count) = selectrow_query($form, $dbh, $query); - - # build selection list - if ($count < $myconfig->{vclimit}) { - $query = - qq|SELECT DISTINCT ct.id, ct.name | . - qq|FROM $vc ct, $arap a | . - qq|WHERE (a.${vc}_id = ct.id) AND (a.amount != a.paid) | . - qq|ORDER BY ct.name|; - $form->{"all_$form->{vc}"} = selectall_hashref_query($form, $dbh, $query); - } - - $main::lxdebug->leave_sub(); -} - sub get_openinvoices { $main::lxdebug->enter_sub(); @@ -360,4 +332,3 @@ sub _process_payment { } 1; - diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 4fdfd5ee9..d30acaf9b 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -60,27 +60,6 @@ sub payment { $form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP"; $form->{arap} = lc $form->{ARAP}; - # setup customer/vendor selection for open invoices - if ($form->{all_vc}) { - # Dieser Zweig funktioniert derzeit NIE. Ggf. ganz raus oder - # alle offenen Zahlungen wieder korrekt anzeigen. jb 12.10.2010 - $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}); - } else { - CP->get_openvc(\%myconfig, \%$form); - } - # Auswahlliste für vc zusammenbauen - # Erweiterung für schliessende option und erweiterung um value - # für bugfix 1771 (doppelte Leerzeichen werden nicht 'gepostet') - $form->{"select$form->{vc}"} = ""; - - if ($form->{"all_$form->{vc}"}) { - $form->{"select$form->{vc}"} .= "\n"; - # s.o. jb 12.10.2010 - $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id}; - # hotfix for 2450. TODO remove legacy code and use L - map { $form->{"select$form->{vc}"} .= "\n" } - @{ $form->{"all_$form->{vc}"} }; - } CP->paymentaccounts(\%myconfig, \%$form); # Standard Konto für Umlaufvermögen @@ -124,35 +103,26 @@ sub form_header { $auth->assert('cash'); - my ($vc, $arap, $exchangerate); + $::request->layout->add_javascripts("autocomplete_customer.js"); + + my ($arap, $exchangerate); - if ($form->{ $form->{vc} } eq "") { + if (!$form->{ $form->{vc} . '_id' }) { map { $form->{"addr$_"} = "" } (1 .. 4); } - # sometimes it happens that values in customer arrive without the signs '--' - # but in order to select the right option field we need values with '--' - if ($form->{vc} eq "customer" && $form->{"all_$form->{vc}"}){ - my ($customername) = split /--/, $form->{ $form->{vc} }; - $form->{ $form->{vc} } = $customername . "--" . $form->{customer_id}; - } # bugfix 1771 # geändert von # offen: $form->{ARAP} kann raus? - for my $item ($form->{vc}, "account", "currency", $form->{ARAP}) { + for my $item ("account", "currency", $form->{ARAP}) { $form->{$item} = H($form->{$item}); $form->{"select$item"} =~ s/ selected//; $form->{"select$item"} =~ s/option value="\Q$form->{$item}\E">\Q$form->{$item}\E/option selected value="$form->{$item}">$form->{$item}/; } - $vc = - ($form->{"select$form->{vc}"}) - ? qq|| - : qq|{vc} size=35 value="$form->{$form->{vc}}">|; - - $form->{openinvoices} = $form->{all_vc} ? "" : 1; + $form->{openinvoices} = 1; # $locale->text('AR') # $locale->text('AP') @@ -165,7 +135,6 @@ sub form_header { is_customer => $form->{vc} eq 'customer', is_receipt => $form->{type} eq 'receipt', arap => $arap, - vccontent => $vc, }); $lxdebug->leave_sub; @@ -204,9 +173,7 @@ sub update { $auth->assert('cash'); - my ($new_name_selected) = @_; - - my ($buysell, $newvc, $updated, $exchangerate, $amount); + my ($buysell, $updated, $exchangerate, $amount); if ($form->{vc} eq 'customer') { $buysell = "buy"; @@ -214,59 +181,6 @@ sub update { $buysell = "sell"; } - # if we switched to all_vc - # funktioniert derzeit nicht 12.10.2010 jb - if ($form->{all_vc} ne $form->{oldall_vc}) { - - $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1; - - $form->{"select$form->{vc}"} = ""; - - if ($form->{all_vc}) { - $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}); - - if ($form->{"all_$form->{vc}"}) { - map { - $form->{"select$form->{vc}"} .= - "