X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=a6e122067512ee8e52fa1535fc68e9ed24969d13;hb=71e8211613ad1bfb473f33588521d70c27be1de3;hp=8ec365ada12d758fcf0dddf84e15c02a51f50ce8;hpb=62ffcb1aa838fa3d4e266aef02918574bc7ca6be;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index 8ec365ada..a6e122067 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -215,7 +215,7 @@ 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); @@ -734,14 +734,31 @@ $jsscript $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); } + print qq|{"acc_trans_id_$i"}>\n|; + print qq|{"gldate_$i"}>\n|; + my $changeable = 1; + if ($::lx_office_conf{features}->{payments_changeable} == 0) { + # never + $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1; + } + if ($::lx_office_conf{features}->{payments_changeable} == 2) { + # on the same day + $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); + } + $exchangerate = qq| |; if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { if ($form->{"forex_$i"}) { $exchangerate = qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; } else { - $exchangerate = - qq|{"exchangerate_$i"}>|; + if ($changeable) { + $exchangerate = + qq|{"exchangerate_$i"}>|; + } else { + $exchangerate = + qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; + } } } @@ -749,33 +766,78 @@ $jsscript {"forex_$i"}> |; - $column_data{paid} = - qq||; - $column_data{AR_paid} = - qq|${selectAR_paid}|; - $column_data{exchangerate} = qq|$exchangerate|; - $column_data{datepaid} = - qq| + my $datepaid; + if ($changeable) { + $datepaid = qq| |; - $column_data{source} = - qq||; - $column_data{memo} = - qq||; + } else { + $datepaid = qq|$form->{"datepaid_$i"}|. + qq|{"datepaid_$i"}>|; + } + + my $paid; + if ($changeable) { + $paid = qq||; + } else { + $paid = qq|$form->{"paid_$i"}|. + qq|{"paid_$i"}>|; + } + + my $source; + if ($changeable) { + $source = qq||; + } else { + $source = qq|$form->{"source_$i"}|. + qq|{"source_$i"}>|; + } + + my $memo; + if ($changeable) { + $memo = qq||; + } else { + $memo = qq|$form->{"memo_$i"}|. + qq|{"memo_$i"}>|; + } + + my $AR_paid; + if ($changeable) { + $AR_paid = qq|${selectAR_paid}|; + } else { + $AR_paid = qq|$form->{"AR_paid_$i"}|. + qq|{"AR_paid_$i"}>|; + } - $column_data{paid_project_id} = + my $paid_project_id; + if ($changeable) { + $paid_project_id = qq|| . NTI($cgi->popup_menu('-name' => "paid_project_id_$i", '-values' => \@project_values, '-labels' => \%project_labels, '-default' => $form->{"paid_project_id_$i"} )) . qq||; + } else { + my $projectnumber = $project_labels{$form->{"paid_project_id_$i"}}; + $paid_project_id = qq|$projectnumber|. + qq|{"paid_project_id_$i"}>|; + } + + $column_data{paid} = $paid; + $column_data{AR_paid} = $AR_paid; + $column_data{exchangerate} = qq|$exchangerate|; + $column_data{datepaid} = $datepaid; + $column_data{source} = $source; + $column_data{memo} = $memo; + $column_data{paid_project_id} = $paid_project_id; map { print qq|$column_data{$_}\n| } @column_index; print " "; - push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); + if ($changeable) { + push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); + } } my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid}; @@ -817,7 +879,7 @@ sub form_footer { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($transdate, $closedto); @@ -984,13 +1046,12 @@ sub update { $form->{invdate} = $form->{transdate}; - my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 oldcustomer); + my %saved_variables = map +( $_ => $form->{$_} ), qw(AR AR_amount_1 taxchart_1 customer_id); &check_name("customer"); - # check_name ruft get_customer auf, oldcustomer wird überschrieben, daher wird dies vorher gemerkt - # get_customer holt Bemerkungen als intnotes, für Debitorenbuchungen gibt es aber nur das Feld notes - $form->{notes} = $form->{intnotes} if $saved_variables{oldcustomer} ne $form->{customer}; + # check_name loads customer notes into notes, but ar only knows intnotes, so copy them + $form->{notes} = $form->{intnotes} if $saved_variables{customer_id} != $form->{customer_id}; $form->{AR} = $saved_variables{AR}; if ($saved_variables{AR_amount_1} =~ m/.--./) { @@ -1185,7 +1246,7 @@ sub use_as_template { my $form = $main::form; my %myconfig = %main::myconfig; - map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); + map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); $form->{paidaccounts} = 1; $form->{rowcount}--; $form->{invdate} = $form->current_date(\%myconfig); @@ -1270,7 +1331,7 @@ sub search { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; my ($customer, $department); my ($jsscript, $button1, $button2, $onload);