X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=e1b10f63c0b5270e1a3b6444f8121f5446758f5a;hb=6f398b352e3b28af6b00852da08193727f803aee;hp=e2777bd49f5c021e5d0bc70ef381bd7682aa22c1;hpb=6a8787147ad643549eb26cb4f9a373b5b354b8b9;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index e2777bd49..e1b10f63c 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -32,12 +32,13 @@ #====================================================================== use POSIX qw(strftime); -use List::Util qw(sum first); +use List::Util qw(sum first max); use SL::AR; use SL::FU; use SL::IS; use SL::PE; +use SL::DB::Default; use SL::ReportGenerator; require "bin/mozilla/arap.pl"; @@ -95,11 +96,11 @@ sub add { # /saving the history $form->{title} = "Add"; - $form->{callback} = "ar.pl?action=add" unless $form->{callback}; + $form->{callback} = "ar.pl?action=add&DONT_LOAD_DRAFT=1" unless $form->{callback}; AR->get_transdate(\%myconfig, $form); $form->{initial_transdate} = $form->{transdate}; - &create_links; + create_links(dont_save => 1); $form->{transdate} = $form->{initial_transdate}; &display_form; $main::lxdebug->leave_sub(); @@ -118,7 +119,7 @@ sub edit { $form->{javascript} .= qq||; $form->{title} = "Edit"; - &create_links; + create_links(); &display_form; $main::lxdebug->leave_sub(); @@ -142,27 +143,24 @@ sub create_links { $main::auth->assert('general_ledger'); + my %params = @_; my $form = $main::form; my %myconfig = %main::myconfig; - my ($duedate, $taxincluded); - $form->create_links("AR", \%myconfig, "customer"); - $duedate = $form->{duedate}; - $taxincluded = $form->{taxincluded}; - my $id = $form->{id}; + my %saved; + if (!$params{dont_save}) { + %saved = map { ($_ => $form->{$_}) } qw(direct_debit id taxincluded); + $saved{duedate} = $form->{duedate} if $form->{duedate}; + } + IS->get_customer(\%myconfig, \%$form); - $form->{taxincluded} = $taxincluded; - $form->{id} = $id; - $form->{duedate} = $duedate if $duedate; + $form->{$_} = $saved{$_} for keys %saved; $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; $form->{rowcount} = 1; - # notes - $form->{notes} = $form->{intnotes} unless $form->{notes}; - # currencies $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); @@ -215,22 +213,18 @@ sub form_header { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($title, $readonly, $exchangerate, $rows); - my ($taxincluded, $notes, $department, $customer, $employee, $amount, $project); - my ($jsscript, $button1, $button2, $onload); - my ($selectAR_amount, $selectAR_paid, $ARselected, $tax); - my (@column_index, %column_data); + my ($notes, $department, $customer, $employee, $amount, $project); + my ($ARselected); $title = $form->{title}; - $form->{title} = $locale->text("$title Accounts Receivables Transaction"); - - $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : ""; - # $locale->text('Add Accounts Receivables Transaction') # $locale->text('Edit Accounts Receivables Transaction') + $form->{title} = $locale->text("$title Accounts Receivables Transaction"); + $form->{javascript} = qq|