$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();
"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 });
my ($new_item, $callback_sub);
- my $re = "^new_.*_" . $form->{selection};
+ my $re = "^new_.*_$form->{selection}\$";
foreach (grep /$re/, keys %{ $form }) {
my $new_key = $_;
$order_dir = 1;
$order_dir = $form->{"order_dir"} if (defined($form->{"order_dir"}));
- %options = map { $_ => 1 } split m/:/, $form->{options};
+ my %options;
- map { $form->{$_} = 1 if ($options{$_}) } qw(no_services no_assemblies);
+ foreach my $opt (split m/:/, $form->{options}) {
+ if ($opt =~ /=/) {
+ my ($key, $value) = split m/=/, $opt, 2;
+ $options{$key} = $value;
+
+ } else {
+ $options{$opt} = 1;
+ }
+ }
+
+ map { $form->{$_} = $options{$_} if ($options{$_}) } qw(no_services no_assemblies assemblies click_button);
$parts = Common->retrieve_parts(\%myconfig, $form, $order_by, $order_dir);
},
@header_sort);
+ $form->{formname} ||= 'Form';
+
$form->{title} = $locale->text("Select a part");
$form->header();
print $form->parse_html_template("generic/part_selection", { "HEADER" => \@header,
# -------------------------------------------------------------------------
sub H {
- return $form->quote_html($_[0]);
+ return $locale->quote_special_chars('HTML', $_[0]);
}
sub Q {
- return $form->quote($_[0]);
+ return $locale->quote_special_chars('URL@HTML', $_[0]);
}
sub E {
} 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|<body>|;
print qq|<p><b>|.$locale->text('Mark as paid?').qq|</b></p>|;
$lxdebug->leave_sub();
}
+
+# 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;