X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Farap.pl;h=8971da532fe5206140abd5b98390217f9bc82caa;hb=786b3862388eb8d4cdcc5dfc663a37fe0e9a82a1;hp=08cdc3be28695df54d12e2c5ae9e30e3562ed58b;hpb=40782548cf82ac1e4c0fe417113a4cb3072e9390;p=kivitendo-erp.git diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 08cdc3be2..8971da532 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -30,12 +30,14 @@ # common routines for gl, ar, ap, is, ir, oe # +use SL::Projects; + # any custom scripts for this one -if (-f "$form->{path}/custom_arap.pl") { - eval { require "$form->{path}/custom_arap.pl"; }; +if (-f "bin/mozilla/custom_arap.pl") { + eval { require "bin/mozilla/custom_arap.pl"; }; } -if (-f "$form->{path}/$form->{login}_arap.pl") { - eval { require "$form->{path}/$form->{login}_arap.pl"; }; +if (-f "bin/mozilla/$form->{login}_arap.pl") { + eval { require "bin/mozilla/$form->{login}_arap.pl"; }; } 1; @@ -47,6 +49,9 @@ require "bin/mozilla/common.pl"; sub check_name { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash'); + my ($name) = @_; $name = $name eq "customer" ? "customer" : "vendor"; @@ -125,6 +130,9 @@ sub check_name { sub select_name { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash'); + my ($table) = @_; @column_index = qw(ndx name address); @@ -208,6 +216,7 @@ sub select_name { # save all other form variables foreach $key (keys %${form}) { + next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); $form->{$key} =~ s/\"/"/g; print qq|\n|; } @@ -231,6 +240,9 @@ sub select_name { sub name_selected { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash'); + # replace the variable with the one checked # index for new item @@ -256,28 +268,12 @@ sub name_selected { $lxdebug->leave_sub(); } -sub add_transaction { - $lxdebug->enter_sub(); - - my ($module) = @_; - - delete $form->{script}; - $form->{action} = "add"; - $form->{type} = "invoice" if $module =~ /(is|ir)/; - - $form->{callback} = $form->escape($form->{callback}, 1); - map { $argv .= "$_=$form->{$_}&" } keys %$form; - - $form->{callback} = "$module.pl?$argv"; - - $form->redirect; - - $lxdebug->leave_sub(); -} - sub check_project { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); + for $i (1 .. $form->{rowcount}) { my $suffix = $i ? "_$i" : ""; my $prefix = $i ? "" : "global"; @@ -287,7 +283,8 @@ sub check_project { # get new project $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"}; - if (($rows = PE->projects(\%myconfig, $form)) > 1) { + my %params = map { $_ => $form->{$_} } qw(projectnumber description active); + if (($rows = Projects->search_projects(%params)) > 1) { # check form->{project_list} how many there are $form->{rownumber} = $i; @@ -296,12 +293,9 @@ sub check_project { } if ($rows == 1) { - $form->{"${prefix}project_id${suffix}"} = - $form->{project_list}->[0]->{id}; - $form->{"${prefix}projectnumber${suffix}"} = - $form->{project_list}->[0]->{projectnumber}; - $form->{"old${prefix}projectnumber${suffix}"} = - $form->{project_list}->[0]->{projectnumber}; + $form->{"${prefix}project_id${suffix}"} = $form->{project_list}->[0]->{id}; + $form->{"${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; + $form->{"old${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; } else { # not on file @@ -319,6 +313,9 @@ sub check_project { sub select_project { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); + my ($is_global) = @_; @column_index = qw(ndx projectnumber description); @@ -402,6 +399,7 @@ sub select_project { # save all other form variables foreach $key (keys %${form}) { + next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); $form->{$key} =~ s/\"/"/g; print qq|\n|; } @@ -425,6 +423,9 @@ sub select_project { sub project_selected { $lxdebug->enter_sub(); + $auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . + 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); + # replace the variable with the one checked # index for new item @@ -456,9 +457,4 @@ sub project_selected { } sub continue { call_sub($form->{"nextsub"}); } -sub gl_transaction { &add } -sub ar_transaction { &add_transaction('ar') } -sub ap_transaction { &add_transaction('ap') } -sub sales_invoice { &add_transaction('is') } -sub vendor_invoice { &add_transaction('ir') }