X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fcp.pl;h=9b77e5766b1a7b8f273429fbb7bcb36d65c67dbf;hb=3c22e5f4b953f463a33b722d6f4f122e4a20c99a;hp=8e31a8f1a588b7ea300f32f2aa65ef978c4a3f80;hpb=8ec0d29a33e23ce962b807e87cc8b577c8c98ec2;p=kivitendo-erp.git diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 8e31a8f1a..9b77e5766 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -24,7 +24,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Payment module @@ -32,11 +33,18 @@ #====================================================================== use SL::CP; -use SL::OP; use SL::IS; use SL::IR; +use SL::AR; +use SL::AP; +use Data::Dumper; +use SL::Locale::String qw(t8); +use strict; +#use warnings; -require "$form->{path}/arap.pl"; +require "bin/mozilla/common.pl"; + +our ($form, %myconfig, $lxdebug, $locale, $auth); 1; @@ -45,57 +53,44 @@ require "$form->{path}/arap.pl"; sub payment { $lxdebug->enter_sub(); - $form->{ARAP} = ($form->{type} eq 'receipt') ? "AR" : "AP"; - $form->{arap} = lc $form->{ARAP}; - - # setup customer/vendor selection for open invoices - if ($form->{all_vc}) { - $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}); - } else { - CP->get_openvc(\%myconfig, \%$form); - } - - $form->{"select$form->{vc}"} = ""; + $auth->assert('cash'); - if ($form->{"all_$form->{vc}"}) { - $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id}; - map { $form->{"select$form->{vc}"} .= "\n"; + $form->{account} = "$_->{accno}--$_->{description}" if ($_->{accno} eq $accno_arap) } @{ $form->{PR}{"$form->{ARAP}_paid"} }; # currencies - @curr = split /:/, $form->{currencies}; - chomp $curr[0]; + # oldcurrency ist zwar noch hier als fragment enthalten, wird aber bei + # der aktualisierung der form auch nicht mitübernommen. das konzept + # old_$FOO habe ich auch noch nicht verstanden ... + # Ok. Wenn currency übernommen werden, dann in callback-string über- + # geben und hier reinparsen, oder besser multibox oder html auslagern? + # Antwort: form->currency wird mit oldcurrency oder curr[0] überschrieben + # Wofür macht das Sinn? + @curr = $form->get_all_currencies(); $form->{defaultcurrency} = $form->{currency} = $form->{oldcurrency} = - $curr[0]; + $form->get_default_currency(\%myconfig); + # Entsprechend präventiv die Auswahlliste für Währungen + # auch mit value= zusammenbauen (s.a. oben bugfix 1771) $form->{selectcurrency} = ""; - map { $form->{selectcurrency} .= "\n" } @curr; - $form->{media} = "screen"; &form_header; &form_footer; @@ -104,399 +99,83 @@ sub payment { } sub form_header { - $lxdebug->enter_sub(); + $lxdebug->enter_sub; - $vclabel = ucfirst $form->{vc}; - $vclabel = $locale->text($vclabel); + $auth->assert('cash'); - if ($form->{type} eq 'receipt') { - $form->{title} = $locale->text('Receipt'); - $form->{origtitle} = "Receipt"; - } - if ($form->{type} eq 'check') { - $form->{title} = $locale->text('Payment'); - $form->{origtitle} = "Payment"; - } + $::request->layout->add_javascripts("kivi.CustomerVendor.js"); - # $locale->text('Customer') - # $locale->text('Vendor') + my ($arap, $exchangerate); - if ($form->{ $form->{vc} } eq "") { + if (!$form->{ $form->{vc} . '_id' }) { map { $form->{"addr$_"} = "" } (1 .. 4); } - if ($form->{currency} ne $form->{defaultcurrency}) { - $form->{exchangerate} = - $form->format_amount(\%myconfig, $form->{exchangerate}); - if ($form->{forex}) { - $exchangerate = qq| -