X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=9c71519c0a254ed72e0564e4822fa2096970d881;hb=f5ab83507b71d551147835d84ec8317afd2842e9;hp=43a025fd25c2d8afd28c8bc20143100c1fd3b233;hpb=a0f6a00c1db8152633841777a95f5420b56b42ee;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 43a025fd2..9c71519c0 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -35,7 +35,7 @@ use SL::AP; use SL::IR; use SL::PE; -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; @@ -79,7 +79,7 @@ sub add { $form->{title} = "Add"; $form->{callback} = - "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&login=$form->{login}&password=$form->{password}" unless $form->{callback}; AP->get_transdate(\%myconfig, $form); @@ -93,9 +93,6 @@ sub add { sub edit { $lxdebug->enter_sub(); - # show history button - $form->{javascript} = qq||; - #/show hhistory button $form->{title} = "Edit"; @@ -319,6 +316,9 @@ sub form_header { }; //--> |; + # show history button + $form->{javascript} .= qq||; + #/show hhistory button # set option selected foreach $item (qw(vendor currency department)) { @@ -455,18 +455,18 @@ selectvendor } | } # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| - {transdate} onBlur=\"check_right_date_format(this)\"> $readonly + $readonly text('button') . qq|> |; $button2 = qq| - {duedate} onBlur=\"check_right_date_format(this)\"> $readonly + $readonly text('button') . qq|> |; @@ -479,11 +479,13 @@ selectvendor } | # without JavaScript Calendar $button1 = - qq|{transdate} onBlur=\"check_right_date_format(this)\"> $readonly|; + qq| $readonly|; $button2 = - qq|{duedate} onBlur=\"check_right_date_format(this)\"> $readonly|; + qq| $readonly|; } $form->{javascript} .= qq||; + $form->{javascript} .= qq||; + $form->header; $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; @@ -513,7 +515,7 @@ selectvendor } | - + @@ -776,12 +778,12 @@ $jsscript |; $column_data{"paid_$i"} = - qq||; + qq||; $column_data{"AP_paid_$i"} = qq||; $column_data{"exchangerate_$i"} = qq||; $column_data{"datepaid_$i"} = - qq||; $column_data{"source_$i"} = qq||; @@ -826,7 +828,6 @@ sub form_footer { -{path}> {login}> {password}> | @@ -881,11 +882,11 @@ sub form_footer { # button for saving history if($form->{id} ne "") { print qq| - |; } # /button for saving history print " @@ -992,7 +993,7 @@ sub update { sub post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { - if ($form->{"paid_$i"}) { + if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); @@ -1030,9 +1031,17 @@ sub post { $closedto = $form->datetonum($form->{closedto}, \%myconfig); $transdate = $form->datetonum($form->{transdate}, \%myconfig); + $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto); + + my $zero_amount_posting = 1; + for $i (1 .. $form->{rowcount}) { + if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) { + $zero_amount_posting = 0; + last; + } + } - $form->error($locale->text('Cannot post transaction for a closed period!')) - if ($transdate <= $closedto); + $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting; $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) if ($form->{currency} ne $form->{defaultcurrency}); @@ -1075,7 +1084,7 @@ sub post { if (AP->post_transaction(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { - $form->{snumber} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1094,7 +1103,7 @@ sub post_as_new { $form->{postasnew} = 1; # saving the history if(!exists $form->{addition} && $form->{id} ne "") { - $form->{snumber} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED AS NEW"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1159,7 +1168,7 @@ sub yes { if (AP->delete_transaction(\%myconfig, \%$form, $spool)) { # saving the history if(!exists $form->{addition}) { - $form->{snumber} = qq|invnumber_| . $form->{invnumber}; + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1205,7 +1214,7 @@ sub search { $form->{title} = $locale->text('AP Transactions'); # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -1366,7 +1375,6 @@ $jsscript
{nextsub}> -{path}> {login}> {password}> @@ -1390,7 +1398,7 @@ sub ap_transactions { AP->ap_transactions(\%myconfig, \%$form); $callback = - "$form->{script}?action=ap_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}"; + "$form->{script}?action=ap_transactions&login=$form->{login}&password=$form->{password}"; $href = $callback; if ($form->{vendor}) { @@ -1458,9 +1466,11 @@ sub ap_transactions { } @columns = - qw(transdate id invnumber ordnumber name netamount tax amount paid datepaid + qw(transdate id type invnumber ordnumber name netamount tax amount paid datepaid due duedate notes employee globalprojectnumber); + $form->{"l_type"} = "Y"; + foreach $item (@columns) { if ($form->{"l_$item"} eq "Y") { push @column_index, $item; @@ -1484,6 +1494,8 @@ sub ap_transactions { qq||; + $column_header{type} = + ""; $column_header{duedate} = qq|"; + $column_data{type} = ""; $column_data{duedate} = ""; $column_data{datepaid} = ""; $module = ($ap->{invoice}) ? "ir.pl" : $form->{script}; $column_data{invnumber} = - qq||; + qq||; $column_data{id} = ""; $column_data{ordnumber} = ""; $column_data{name} = ""; @@ -1673,7 +1689,6 @@ sub ap_transactions { -{path}> {login}> {password}>
| . $locale->text('Vendor') . qq|$vendor$vendor {"paid_$i"} onBlur=\"check_right_number_format(this)\">${selectAP_paid}$exchangerate{"datepaid_$i"} onBlur=\"check_right_date_format(this)\"> + qq| | . $locale->text('Date') . qq|" . $locale->text('Type') . "| . $locale->text('Due Date') @@ -1598,13 +1610,17 @@ sub ap_transactions { $subtotaldue += ($ap->{amount} - $ap->{paid}); $column_data{transdate} = "$ap->{transdate} " . + ($ap->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : + $locale->text("AP Transaction (abbreviation)")) + . "$ap->{duedate} $ap->{datepaid} $ap->{invnumber}$ap->{invnumber}$ap->{id}$ap->{ordnumber} $ap->{name}