X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=2c964d2d53d8edf820354ef2d27eda9296ce6740;hb=1228aa97dd33175f74c5dfbdf759a6b3d9458f93;hp=c44ef42f362ac41d9a9274de11d54bad3578d700;hpb=9bd3030a376850c427c102c6e0c54f19bd19332e;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index c44ef42f3..2c964d2d5 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -258,7 +258,7 @@ sub form_header { $main::auth->assert('invoice_edit'); - our %TMPL_VAR = (); + my %TMPL_VAR = (); my @custom_hiddens; $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; @@ -463,12 +463,12 @@ sub update { my $rows = scalar @{ $form->{item_list} }; if ($rows) { - $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); + $form->{"qty_$i"} = 1 unless $form->parse_amount(\%myconfig, $form->{"qty_$i"}); if ($rows > 1) { &select_item; - exit; + ::end_of_request(); } else { @@ -552,7 +552,7 @@ sub storno { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "CANCELED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history @@ -618,7 +618,7 @@ sub post_payment { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "PAYMENT POSTED"; $form->{what_done} = $form->{currency} . qq| | . $form->{paid} . qq| | . $locale->text("POSTED"); - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; # /saving the history } @@ -664,9 +664,16 @@ sub post { # if the vendor changed get new values if (&check_name('vendor')) { &update; + ::end_of_request(); + } + + if ($myconfig{mandatory_departments} && !$form->{department_id}) { + $form->{saved_message} = $::locale->text('You have to specify a department.'); + update(); exit; } + remove_emptied_rows(); &validate_items; my $closedto = $form->datetonum($form->{closedto}, \%myconfig); @@ -711,7 +718,7 @@ sub post { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED"; #$form->{what_done} = $locale->text("Rechnungsnummer") . qq| | . $form->{invnumber}; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history remove_draft() if $form->{remove_draft}; @@ -777,7 +784,7 @@ sub yes { if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history $form->redirect($locale->text('Invoice deleted!'));