X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fbp.pl;h=654a267767d1913402b34d285a727f1189b5946b;hb=e74c2ab4728dfdc932cd290db005ce2250e9d61b;hp=a39cdd1b145f7e88bb2c9a4df33487860ed2a755;hpb=72539cb39a3d19f930a8e0e41e46bf41afe9a8f1;p=kivitendo-erp.git diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index a39cdd1b1..654a26776 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -32,14 +32,47 @@ #====================================================================== use SL::BP; +use Data::Dumper; +use List::Util qw(first); 1; +require "bin/mozilla/common.pl"; + # end of main +sub assert_bp_access { + my %access_map = ( + 'invoice' => 'invoice_edit', + 'sales_order' => 'sales_order_edit', + 'sales_quotation' => 'sales_quotation_edit', + 'purchase_order' => 'purchase_order_edit', + 'request_quotation' => 'request_quotation_edit', + 'check' => 'cash', + 'receipt' => 'cash', + ); + + if ($form->{type} && $access_map{$form->{type}}) { + $auth->assert($access_map{$form->{type}}); + + } elsif ($form->{type} eq 'packing_list') { + $lxdebug->message(0, "1"); + if (!$auth->assert('sales_order_edit', 1)) { + $lxdebug->message(0, "2"); + $auth->assert('invoice_edit') ; + } + $lxdebug->message(0, "3"); + + } else { + $auth->assert('DOES_NOT_EXIST'); + } +} + sub search { $lxdebug->enter_sub(); + assert_bp_access(); + # $locale->text('Sales Invoices') # $locale->text('Packing Lists') # $locale->text('Sales Orders') @@ -152,18 +185,18 @@ sub search { } # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| - + text('button') . qq|> |; $button2 = qq| - + text('button') . qq|> |; @@ -176,17 +209,18 @@ sub search { # without JavaScript Calendar $button1 = qq| - |; + |; $button2 = qq| - |; + |; } - + $form->{javascript} .= qq||; $form->header; - + $onload = qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - + -
{script}> + {vc}> {type}> @@ -225,10 +259,6 @@ sub search { -{path}> -{login}> -{password}> -
@@ -248,6 +278,8 @@ $jsscript sub remove { $lxdebug->enter_sub(); + assert_bp_access(); + $selected = 0; for $i (1 .. $form->{rowcount}) { @@ -266,12 +298,13 @@ sub remove { print qq| -{script}> + |; map { delete $form->{$_} } qw(action header); foreach $key (keys %$form) { + next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); print qq|\n|; } @@ -297,6 +330,8 @@ sub remove { sub yes { $lxdebug->enter_sub(); + assert_bp_access(); + $form->info($locale->text('Removing marked entries from queue ...')); $form->{callback} .= "&header=1" if $form->{callback}; @@ -310,6 +345,15 @@ sub yes { sub print { $lxdebug->enter_sub(); + assert_bp_access(); + + $form->get_lists(printers => 'ALL_PRINTERS'); + # use the command stored in the databse or fall back to $myconfig{printer} + my $selected_printer = first { $_ } map ({ $_ ->{printer_command} } + grep { $_->{id} eq $form->{printer} } + @{ $form->{ALL_PRINTERS} }), + $myconfig{printer}; + if ($form->{callback}) { map { $form->{callback} .= "&checked_$_=1" if $form->{"checked_$_"} } (1 .. $form->{rowcount}); @@ -318,10 +362,9 @@ sub print { for $i (1 .. $form->{rowcount}) { if ($form->{"checked_$i"}) { - $form->{OUT} = "| $myconfig{printer}"; $form->info($locale->text('Printing ... ')); - if (BP->print_spool(\%myconfig, \%$form, $spool)) { + if (BP->print_spool(\%myconfig, \%$form, $spool, "| $selected_printer")) { print $locale->text('done'); $form->redirect($locale->text('Marked entries printed!')); } @@ -337,6 +380,8 @@ sub print { sub list_spool { $lxdebug->enter_sub(); + assert_bp_access(); + $form->{ $form->{vc} } = $form->unescape($form->{ $form->{vc} }); ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} }); @@ -344,12 +389,11 @@ sub list_spool { BP->get_spoolfiles(\%myconfig, \%$form); $title = $form->escape($form->{title}); - $href = - "$form->{script}?action=list_spool&path=$form->{path}&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title"; + $href = "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title"; $title = $form->escape($form->{title}, 1); $callback = - "$form->{script}?action=list_spool&path=$form->{path}&login=$form->{login}&password=$form->{password}&vc=$form->{vc}&type=$form->{type}&title=$title"; + "bp.pl?action=list_spool&vc=$form->{vc}&type=$form->{type}&title=$title"; if ($form->{ $form->{vc} }) { $callback .= "&$form->{vc}=" . $form->escape($form->{ $form->{vc} }, 1); @@ -448,7 +492,7 @@ sub list_spool { print qq| -{script}> + @@ -499,11 +543,11 @@ sub list_spool { } $column_data{invnumber} = - ""; + ""; $column_data{ordnumber} = - ""; + ""; $column_data{quonumber} = - ""; + ""; $column_data{name} = ""; $column_data{spoolfile} = qq| @@ -547,27 +591,31 @@ sub list_spool { - -{path}> -{login}> -{password}> |; - if ($myconfig{printer}) { +# if ($myconfig{printer}) { print qq| +{transdateto}> +{transdatefrom}> +{invnumber}> +{ordnumber}> +{quonumber}> +{customer}> +{vendor}> - + |; - } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } +$form->get_lists(printers=>"ALL_PRINTERS"); +print qq||; + +# } print qq| @@ -576,17 +624,19 @@ sub list_spool { |; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub select_all { $lxdebug->enter_sub(); + assert_bp_access(); + map { $form->{"checked_$_"} = 1 } (1 .. $form->{rowcount}); &list_spool; $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{"nextsub"}); }
{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{invnumber}{id}&type=$form->{type}&callback=$callback>$ref->{invnumber}{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{ordnumber}{id}&type=$form->{type}&callback=$callback>$ref->{ordnumber}{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&type=$form->{type}&callback=$callback>$ref->{quonumber}{id}&type=$form->{type}&callback=$callback>$ref->{quonumber}$ref->{name}{spoolfile}>$ref->{spoolfile}