X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fis.pl;h=f39ff1368d6150f486b3272dc81220654fd88266;hb=358f1ed4ec3370dd9ffc7cb9505e7960fa719205;hp=3fc4b2caaa5f65783d18d595ec53fa25d48266fc;hpb=ac517355778ec8b682f7cdd1ef203be99e545a53;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 3fc4b2caa..f39ff1368 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -31,12 +31,14 @@ # #====================================================================== +use SL::FU; use SL::IS; use SL::PE; use Data::Dumper; -use List::Util qw(max); +use List::Util qw(max sum); require "bin/mozilla/io.pl"; +require "bin/mozilla/invoice_io.pl"; require "bin/mozilla/arap.pl"; require "bin/mozilla/drafts.pl"; @@ -47,6 +49,8 @@ require "bin/mozilla/drafts.pl"; sub add { $lxdebug->enter_sub(); + $auth->assert('invoice_edit'); + return $lxdebug->leave_sub() if (load_draft_maybe()); if ($form->{type} eq "credit_note") { @@ -61,16 +65,10 @@ sub add { } - $form->{callback} = - "$form->{script}?action=add&type=$form->{type}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; + $form->{callback} = "$form->{script}?action=add&type=$form->{type}" unless $form->{callback}; $form{jsscript} = "date"; - if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR") - { - $form->error("Access Denied"); - } &invoice_links; &prepare_invoice; &display_form; @@ -81,14 +79,12 @@ sub add { sub edit { $lxdebug->enter_sub(); + $auth->assert('invoice_edit'); + # show history button $form->{javascript} = qq||; #/show hhistory button - if ($myconfig{acs} =~ "AR--Add Sales Invoice" || $myconfig{acs} =~ "AR--AR") - { - $form->error("Access Denied"); - } $edit = 1; if ($form->{print_and_post}) { $form->{action} = "print"; @@ -111,6 +107,8 @@ sub edit { sub invoice_links { $lxdebug->enter_sub(); + $auth->assert('invoice_edit'); + $form->{vc} = 'customer'; # create links @@ -230,6 +228,8 @@ sub invoice_links { sub prepare_invoice { $lxdebug->enter_sub(); + $auth->assert('invoice_edit'); + if ($form->{type} eq "credit_note") { $form->{type} = "credit_note"; $form->{formname} = "credit_note"; @@ -240,8 +240,6 @@ sub prepare_invoice { if ($form->{id}) { - map { $form->{$_} =~ s/\"/"/g } - qw(invnumber ordnumber quonumber shippingpoint shipvia notes intnotes); # # get pricegroups for parts # IS->get_pricegroups_for_parts(\%myconfig, \%$form); @@ -268,8 +266,6 @@ sub prepare_invoice { $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty); - map { $form->{"${_}_$i"} =~ s/\"/"/g } - qw(partnumber description unit partnotes); $form->{rowcount} = $i; } @@ -280,6 +276,8 @@ sub prepare_invoice { sub form_header { $lxdebug->enter_sub(); + $auth->assert('invoice_edit'); + $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id}; @@ -304,7 +302,7 @@ sub form_header { } } - my $set_duedate_url = "$form->{script}?login=$form->{login}&password=$form->{password}&action=set_duedate"; + my $set_duedate_url = "$form->{script}?action=set_duedate"; my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url ); push(@ { $form->{AJAX} }, $pjx); @@ -327,7 +325,7 @@ sub form_header { my @values = (undef); foreach my $item (@{ $form->{"ALL_CONTACTS"} }) { push(@values, $item->{"cp_id"}); - $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); + $labels{$item->{"cp_id"}} = join(',', $item->{"cp_name"}, $item->{"cp_givenname"}) . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : ""); } my $contact; if (scalar @values > 1) { @@ -373,7 +371,7 @@ sub form_header { : (NTI($cgi->popup_menu('-name' => 'customer', '-default' => $form->{oldcustomer}, '-onChange' => 'document.getElementById(\'update_button\').click();', '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq| - + |; %labels = (); @@ -530,7 +528,7 @@ sub form_header { $jsscript = ""; if ($form->{type} eq "credit_note") { $button1 = qq| -