X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Farap.pl;h=3b1a443113e2dcc28f59bfa6e715f49db5f24967;hb=0c2be9979d3c323a8f88ca372c0e1314774d7293;hp=e7e2378a9e80eb4158d554fc4ccdc3461dd88676;hpb=ee072e4f077213bf6f8792ca8f0a1afebbb6282f;p=kivitendo-erp.git
diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl
index e7e2378a9..3b1a44311 100644
--- a/bin/mozilla/arap.pl
+++ b/bin/mozilla/arap.pl
@@ -30,32 +30,47 @@
# common routines for gl, ar, ap, is, ir, oe
#
+use SL::Projects;
+
+use strict;
+
# 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/$main::form->{login}_arap.pl") {
+ eval { require "bin/mozilla/$main::form->{login}_arap.pl"; };
}
1;
+require "bin/mozilla/common.pl";
+
# end of main
sub check_name {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
+ 'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash |' .
+ 'purchase_delivery_order_edit | sales_delivery_order_edit');
- my ($name) = @_;
+ my ($name, %params) = @_;
+
+ $name = $name eq "customer" ? "customer" : "vendor";
my ($new_name, $new_id) = split /--/, $form->{$name};
my $i = 0;
-
# if we use a selection
if ($form->{"select$name"}) {
if ($form->{"old$name"} ne $form->{$name}) {
# this is needed for is, ir and oe
-
+ $form->{update} = 0;
# for credit calculations
$form->{oldinvtotal} = 0;
$form->{oldtotalpaid} = 0;
@@ -76,6 +91,7 @@ sub check_name {
if ($form->{"old$name"} ne qq|$form->{$name}--$form->{"${name}_id"}|) {
# this is needed for is, ir and oe
+ $form->{update} = 0;
# for credit calculations
$form->{oldinvtotal} = 0;
@@ -83,9 +99,17 @@ sub check_name {
$form->{calctax} = 1;
# return one name or a list of names in $form->{name_list}
- if (($i = $form->get_name(\%myconfig, $name)) > 1) {
- &select_name($name);
- exit;
+ $i = $form->get_name(\%myconfig, $name);
+
+ if ($i > 1) {
+ if ($params{no_select}) {
+ # $locale->text('Customer')
+ # $locale->text('Vendor')
+ $form->error($locale->text("More than one #1 found matching, please be more specific.", $locale->text(ucfirst $name)));
+ } else {
+ &select_name($name);
+ ::end_of_request();
+ }
}
if ($i == 1) {
@@ -101,13 +125,16 @@ sub check_name {
} else {
# name is not on file
- $msg = ucfirst $name . " not on file or locked!";
+ # $locale->text('Customer not on file or locked!')
+ # $locale->text('Vendor not on file or locked!')
+ my $msg = ucfirst $name . " not on file or locked!";
$form->error($locale->text($msg));
}
}
}
+ $form->language_payment(\%myconfig);
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
return $i;
}
@@ -116,13 +143,20 @@ sub check_name {
# $locale->text('Vendor not on file!')
sub select_name {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my $locale = $main::locale;
+
+ $main::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);
+ my @column_index = qw(ndx name address);
- $label = ucfirst $table;
+ my $label = ucfirst $table;
+ my %column_data;
$column_data{ndx} = qq|
|;
$column_data{name} =
qq|
| . $locale->text($label) . qq|
|;
@@ -132,7 +166,7 @@ sub select_name {
# list items with radio button on a form
$form->header;
- $title = $locale->text('Select from one of the names below');
+ my $title = $locale->text('Select from one of the names below');
print qq|
@@ -147,17 +181,18 @@ sub select_name {