X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Farap.pl;h=073b51c72f2db2f3ce7311cd821899f8ce0236ac;hb=ebef09a8bde1d401fc7b0d60cfe09393e9a84c0f;hp=534a702feffcf03c6e66971267eecb35b469f22c;hpb=54e4131e091831e00a861fe2c4f53e344b87ddca;p=kivitendo-erp.git diff --git a/bin/mozilla/arap.pl b/bin/mozilla/arap.pl index 534a702fe..073b51c72 100644 --- a/bin/mozilla/arap.pl +++ b/bin/mozilla/arap.pl @@ -273,25 +273,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 { @@ -299,7 +302,7 @@ sub check_project { $form->error($locale->text('Project not on file!')); } } else { - $form->{"oldprojectnumber_$i"} = ""; + $form->{"old${prefix}projectnumber${suffix}"} = ""; } } } @@ -310,6 +313,8 @@ sub check_project { sub select_project { $lxdebug->enter_sub(); + my ($is_global) = @_; + @column_index = qw(ndx projectnumber description); $column_data{ndx} = qq|