X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Farap.pl;h=f2e4e822b7a712453e5e95609c06cadb2a17c2fd;hb=f65faf202a24a1f1316f45e3695d3d9390dc0793;hp=8c495f74eb4e35259b59d67ec0f3381feda28193;hpb=e2f6b9d3965445c69b2efb2b3fd4a025b3c1b37c;p=kivitendo-erp.git diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 8c495f74e..f2e4e822b 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -47,15 +47,16 @@ sub check_name { my ($name) = @_; + $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 +77,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; @@ -101,11 +103,14 @@ sub check_name { } else { # name is not on file + # $locale->text('Customer not on file or locked!') + # $locale->text('Vendor not on file or locked!') $msg = ucfirst $name . " not on file or locked!"; $form->error($locale->text($msg)); } } } + $form->language_payment(\%myconfig); $lxdebug->leave_sub(); @@ -272,25 +277,28 @@ sub check_project { $lxdebug->enter_sub(); for $i (1 .. $form->{rowcount}) { - $form->{"project_id_$i"} = "" unless $form->{"projectnumber_$i"}; - if ($form->{"projectnumber_$i"} ne $form->{"oldprojectnumber_$i"}) { - if ($form->{"projectnumber_$i"}) { + my $suffix = $i ? "_$i" : ""; + my $prefix = $i ? "" : "global"; + $form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"}; + if ($form->{"${prefix}projectnumber${suffix}"} ne $form->{"old${prefix}projectnumber${suffix}"}) { + if ($form->{"${prefix}projectnumber${suffix}"}) { # get new project - $form->{projectnumber} = $form->{"projectnumber_$i"}; + $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"}; if (($rows = PE->projects(\%myconfig, $form)) > 1) { # check form->{project_list} how many there are $form->{rownumber} = $i; - &select_project; + &select_project($i ? undef : 1); exit; } if ($rows == 1) { - $form->{"project_id_$i"} = $form->{project_list}->[0]->{id}; - $form->{"projectnumber_$i"} = + $form->{"${prefix}project_id${suffix}"} = + $form->{project_list}->[0]->{id}; + $form->{"${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; - $form->{"oldprojectnumber_$i"} = + $form->{"old${prefix}projectnumber${suffix}"} = $form->{project_list}->[0]->{projectnumber}; } else { @@ -298,7 +306,7 @@ sub check_project { $form->error($locale->text('Project not on file!')); } } else { - $form->{"oldprojectnumber_$i"} = ""; + $form->{"old${prefix}projectnumber${suffix}"} = ""; } } } @@ -309,6 +317,8 @@ sub check_project { sub select_project { $lxdebug->enter_sub(); + my ($is_global) = @_; + @column_index = qw(ndx projectnumber description); $column_data{ndx} = qq|