X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcommon.pl;h=0d7862b30496a1bca441c0dd696363a519d2bf9a;hb=ff71dc3fb3a632a6a5856d94c3b336aa5ef6d6d2;hp=16e1b46755df3ecbc95495a41984bcde2be67fc1;hpb=0975a120536e57a0f563e04b33f33f14ce8ba89e;p=kivitendo-erp.git diff --git a/bin/mozilla/common.pl b/bin/mozilla/common.pl index 16e1b4675..0d7862b30 100644 --- a/bin/mozilla/common.pl +++ b/bin/mozilla/common.pl @@ -69,6 +69,11 @@ sub select_part { $has_charge = 1; map { $_->{has_charge} = 1; } @parts; } + my $has_ean = 0; + if (defined($parts[0]->{ean})) { + $has_ean = 1; + map { $_->{has_ean} = 1; } @parts; + } my $old_form = save_form(); @@ -80,6 +85,7 @@ sub select_part { "nextsub" => "select_part_internal", "callback_sub" => $callback_sub, "has_charge" => $has_charge, + "has_ean" => $has_ean, "remap_parts_id" => $remap_parts_id, "remap_partnumber" => $remap_partnumber }); @@ -139,7 +145,7 @@ sub part_selection_internal { } } - map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies click_button); + map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies assemblies click_button); $parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir); @@ -515,7 +521,15 @@ sub mark_as_paid_common { } else { my $referer = $ENV{HTTP_REFERER}; - $referer =~ s/^(.*)action\=.*\&(.*)$/$1action\=mark_as_paid\&mark_as_paid\=1\&id\=$form->{id}\&$2/; + if ($referer =~ /action/) { + $referer =~ /^(.*)\?action\=[^\&]*(\&.*)$/; + $script = $1; + $callback = $2; + } else { + $script = $referer; + $callback = ""; + } + $referer = $script . "?action=mark_as_paid&mark_as_paid=1&id=$form->{id}" . $callback; $form->header(); print qq||; print qq|

|.$locale->text('Mark as paid?').qq|

|; @@ -580,31 +594,89 @@ sub cov_selection_internal { $lxdebug->leave_sub(); } -sub cross(&\@\@) { - my $op = shift; - use vars qw/@A @B/; - local (*A, *B) = @_; # syms for caller's input arrays - - # Localise $a, $b - my ($caller_a, $caller_b) = do - { - my $pkg = caller(); - no strict 'refs'; - \*{$pkg.'::a'}, \*{$pkg.'::b'}; - }; - - my $limit = $#A > $#B? $#A : $#B; # loop iteration limit - - local(*$caller_a, *$caller_b); - - # This map expression is also the return value. - map { my $b_index = $_; - map { my $a_index = $_; - # assign to $a, $b as refs to caller's array elements - (*$caller_a, *$caller_b) = \($A[$a_index], $B[$b_index]); - $op->(); # perform the transformation - } 0 .. $#A; - } 0 .. $#B; + +# Functions to call add routines beneath different reports + +sub sales_invoice { + $lxdebug->enter_sub(); + + $auth->assert('invoice_edit'); + + + $form->{script} = 'is.pl'; + $script = "is"; + $form->{type} = "invoice"; + $locale = new Locale "$myconfig{countrycode}", "$script"; + + require "bin/mozilla/$form->{script}"; + &add; + + $lxdebug->leave_sub(); +} + +sub ar_transaction { + $lxdebug->enter_sub(); + + $auth->assert('general_ledger'); + + + $form->{script} = 'ar.pl'; + $script = "ar"; + $locale = new Locale "$myconfig{countrycode}", "$script"; + + require "bin/mozilla/$form->{script}"; + &add; + + $lxdebug->leave_sub(); +} + +sub vendor_invoice { + $lxdebug->enter_sub(); + + $auth->assert('invoice_edit'); + + + $form->{script} = 'ir.pl'; + $script = "ir"; + $form->{type} = "invoice"; + $locale = new Locale "$myconfig{countrycode}", "$script"; + + require "bin/mozilla/$form->{script}"; + &add; + + $lxdebug->leave_sub(); +} + +sub ap_transaction { + $lxdebug->enter_sub(); + + $auth->assert('general_ledger'); + + + $form->{script} = 'ap.pl'; + $script = "ap"; + $locale = new Locale "$myconfig{countrycode}", "$script"; + + require "bin/mozilla/$form->{script}"; + &add; + + $lxdebug->leave_sub(); +} + +sub gl_transaction { + $lxdebug->enter_sub(); + + $auth->assert('general_ledger'); + + + $form->{script} = 'gl.pl'; + $script = "gl"; + $locale = new Locale "$myconfig{countrycode}", "$script"; + + require "bin/mozilla/$form->{script}"; + &add; + + $lxdebug->leave_sub(); } 1;