X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=fab18f722e3faebc972e5ca78b8ace7291e65a01;hb=b02735f55360e5a4e02dca40458b48cf057ecd7b;hp=06f6d059b139419eba1508885cfeca448bf3e98d;hpb=2d3f862b7af94f31860dd264eef7c1bc7de7eae2;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 06f6d059b..fab18f722 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -59,7 +59,7 @@ sub add { return $main::lxdebug->leave_sub() if (load_draft_maybe()); - $form->{title} = $locale->text('Add Vendor Invoice'); + $form->{title} = $locale->text('Record Vendor Invoice'); &invoice_links; &prepare_invoice; @@ -100,7 +100,7 @@ sub invoice_links { $form->{vc} = 'vendor'; # create links - $form->{webdav} = $main::webdav; + $form->{webdav} = $::lx_office_conf{features}->{webdav}; $form->{jsscript} = 1; $form->create_links("AP", \%myconfig, "vendor"); @@ -171,7 +171,7 @@ sub invoice_links { foreach my $key (keys %{ $form->{AP_links} }) { foreach my $ref (@{ $form->{AP_links}{$key} }) { - $form->{"select$key"} .= ""; } next unless $form->{acc_trans}{$key}; @@ -226,6 +226,12 @@ sub prepare_invoice { foreach my $ref (@{ $form->{invoice_details} }) { $i++; map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; + # übernommen aus is.pl Fix für Bug 1642. Nebenwirkungen? jb 12.5.2011 + # getestet: Lieferantenauftrag -> Rechnung i.O. + # Lieferantenauftrag -> Lieferschein -> Rechnung i.O. + # Werte: 20% (Lieferantenrabatt), 12,4% individuell und 0,4 individuell s.a. + # Screenshot zu Bug 1642 + $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100); my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/); $dec = length $dec; @@ -256,9 +262,9 @@ sub form_header { my $locale = $main::locale; my $cgi = $main::cgi; - $main::auth->assert('invoice_edit'); + $main::auth->assert('vendor_invoice_edit'); - our %TMPL_VAR = (); + my %TMPL_VAR = (); my @custom_hiddens; $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; @@ -354,7 +360,7 @@ sub form_footer { my %myconfig = %main::myconfig; my $locale = $main::locale; - $main::auth->assert('invoice_edit'); + $main::auth->assert('vendor_invoice_edit'); $form->{invtotal} = $form->{invsubtotal}; $form->{oldinvtotal} = $form->{invtotal}; @@ -393,9 +399,17 @@ sub form_footer { $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); $form->{paid_indices} = [ 1 .. $form->{paidaccounts} ]; + # Standard Konto für Umlaufvermögen + my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form); + for my $i (1 .. $form->{paidaccounts}) { $form->{"selectAP_paid_$i"} = $form->{selectAP_paid}; - $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/; + if (!$form->{"AP_paid_$i"}) { + $form->{"selectAP_paid_$i"} =~ s/option>$accno_arap--(.*?)>/option selected>$accno_arap--$1>/; + } else { + $form->{"selectAP_paid_$i"} =~ s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/; + } + $totalpaid += $form->{"paid_$i"}; } @@ -467,8 +481,8 @@ sub update { if ($rows > 1) { - &select_item; - exit; + select_item(mode => 'IR'); + ::end_of_request(); } else { @@ -552,7 +566,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 +632,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,7 +678,7 @@ sub post { # if the vendor changed get new values if (&check_name('vendor')) { &update; - exit; + ::end_of_request(); } if ($myconfig{mandatory_departments} && !$form->{department_id}) { @@ -718,7 +732,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}; @@ -784,7 +798,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!'));