X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=7b16657e578c9f11824bc7592df27be8345b46d3;hb=1f9b0c55e2288183a36b9026f1758a3921967811;hp=581142f830d494361d3cac9f1cbf5f7bc66f4488;hpb=d623e974c5f456dab9a691df3fb57c6dba1e1865;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 581142f83..7b16657e5 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -198,7 +198,7 @@ sub form_header { $main::auth->assert('general_ledger'); $form->{title_} = $form->{title}; - $form->{title} = $locale->text($form->{title} .' Accounts Payables Transaction'); + $form->{title} = $form->{title} eq 'Add' ? $locale->text('Add Accounts Payables Transaction') : $locale->text('Edit Accounts Payables Transaction'); # type=submit $locale->text('Add Accounts Payables Transaction') # type=submit $locale->text('Edit Accounts Payables Transaction') @@ -296,8 +296,6 @@ sub form_header { $taxcharts{$item->{id}} = $item; } - $form->{jsscript} = 1; - my $follow_up_vc = $form->{vendor}; $follow_up_vc =~ s/--.*?//; my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)"; @@ -377,6 +375,10 @@ sub form_header { if ( $form->{'paid_'. $form->{paidaccounts}} ) { $form->{paidaccounts}++; } + + # default account for current assets (i.e. 1801 - SKR04) + $form->{accno_arap} = IS->get_standard_accno_current_assets(\%myconfig, \%$form); + for my $i (1 .. $form->{paidaccounts}) { $form->{totalpaid} += $form->{"paid_$i"}; @@ -608,10 +610,11 @@ sub post { my ($inline) = @_; - # check if there is a vendor, invoice and due date + # check if there is a vendor, invoice, due date and invnumber $form->isblank("transdate", $locale->text("Invoice Date missing!")); $form->isblank("duedate", $locale->text("Due Date missing!")); $form->isblank("vendor", $locale->text('Vendor missing!')); + $form->isblank("invnumber", $locale->text('Invoice Number missing!')); if ($myconfig{mandatory_departments} && !$form->{department}) { $form->{saved_message} = $::locale->text('You have to specify a department.'); @@ -621,6 +624,9 @@ sub post { my $closedto = $form->datetonum($form->{closedto}, \%myconfig); my $transdate = $form->datetonum($form->{transdate}, \%myconfig); + + $form->error($locale->text('Cannot post transaction above the maximum future booking date!')) + if ($form->date_max_future($form->{"transdate"}, \%myconfig)); $form->error($locale->text('Cannot post transaction for a closed period!')) if ($form->date_closed($form->{"transdate"}, \%myconfig)); my $zero_amount_posting = 1; @@ -794,7 +800,7 @@ sub yes { sub search { $main::lxdebug->enter_sub(); - $main::auth->assert('general_ledger | vendor_invoice_edit'); + $main::auth->assert('vendor_invoice_edit'); my $form = $main::form; my %myconfig = %main::myconfig; @@ -804,15 +810,12 @@ sub search { $form->all_vc(\%myconfig, "vendor", "AP"); $form->{title} = $locale->text('AP Transactions'); - $::request->{layout}->focus('#vendor'); - $form->{jsscript} = 1; $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, "departments" => "ALL_DEPARTMENTS", "vendors" => "ALL_VC"); # constants and subs for template - $form->{jsscript} = 1; $form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; $form->header; @@ -849,7 +852,7 @@ sub ap_transactions { my %myconfig = %main::myconfig; my $locale = $main::locale; - $main::auth->assert('general_ledger | vendor_invoice_edit'); + $main::auth->assert('vendor_invoice_edit'); ($form->{vendor}, $form->{vendor_id}) = split(/--/, $form->{vendor});