X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fic.pl;h=3d9d6ef2de9580fff5f10a60f8455d53362b192e;hb=2efc8cbcc63c56094e0692067b7cb678c1583987;hp=7ecd3a24cff3a0dbf679738de0617ed0b70c7c61;hpb=b5ef28b5f726161fa6be4a9191f7d3f4e2972ceb;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 7ecd3a24c..3d9d6ef2d 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -36,10 +36,20 @@ use SL::IC; #use SL::PE; -require "$form->{path}/io.pl"; +use strict; +#use warnings; + +require "bin/mozilla/io.pl"; +require "bin/mozilla/common.pl"; 1; +# global imports +my $form = $main::form; +my $locale = $main::locale; +my %myconfig = %main::myconfig; +my $lxdebug = $main::lxdebug; + # end of main sub add { @@ -48,7 +58,7 @@ sub add { $form->{title} = $locale->text('Add ' . ucfirst $form->{item}); $form->{callback} = - "$form->{script}?action=add&item=$form->{item}&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; $form->{"unit_changeable"} = 1; @@ -63,6 +73,8 @@ sub add { sub search { $lxdebug->enter_sub(); + my ($button1, $button2, $onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought); + $form->{title} = (ucfirst $form->{searchitems}) . "s"; $form->{title} = $locale->text($form->{title}); @@ -79,8 +91,8 @@ sub search { # $locale->text('Services') # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; - $jsscript = ""; + $form->{jsscript} = 1; + my $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar @@ -374,7 +386,6 @@ $jsscript -{path}> {login}> {password}> @@ -400,11 +411,13 @@ $jsscript sub search_update_prices { $lxdebug->enter_sub(); + my ($onhand, $makemodel, $serialnumber, $l_serialnumber, $toplevel, $bought); + $form->{title} = $locale->text('Update prices'); IC->get_pricegroups(\%myconfig, \%$form); # use JavaScript Calendar or not -# $form->{jsscript} = $jscalendar; +# $form->{jsscript} = 1; # $jsscript = ""; # if ($form->{jsscript}) { # @@ -537,7 +550,7 @@ sub search_update_prices {
| - . $locale->text('Part Number') . qq| | -| - . $locale->text('Part Description') . qq| | +| . $locale->text('Part Number') . qq| | +| . $locale->text('Part Description') . qq| | |||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -657,7 +672,6 @@ sub choice { print qq| -{path}> {login}> {password}> @@ -689,9 +703,10 @@ sub choice { {extras}>|; + my ($partnumber, $description, $unit, $sellprice, $soldtotal); # if choice set data if ($form->{ndx}) { - for ($i = 0; $i < $form->{ndxs_counter}; $i++) { + for (my $i = 0; $i < $form->{ndxs_counter}; $i++) { # prepeare data $partnumber = $form->{"totop100_partnumber_$j"}; @@ -715,7 +730,7 @@ sub choice { # set data for next page if (($form->{ndxs_counter}) > 0) { - for ($i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { + for (my $i = 1; ($i < $form->{ndxs_counter} + 1); $i++) { $partnumber = $form->{"totop100_partnumber_$i"}; $description = $form->{"totop100_description_$i"}; $unit = $form->{"totop100_unit_$i"}; @@ -747,20 +762,11 @@ sub choice { sub list { $lxdebug->enter_sub(); - # get parts for - if (($form->{partnumber} eq "") and ($form->{description} eq "")) { - IC->get_parts(\%myconfig, \%$form, ""); - } else { - if ((!($form->{partnumber} eq "")) and ($form->{description} eq "")) { - IC->get_parts(\%myconfig, \%$form, "partnumber"); - } else { - if (($form->{partnumber} eq "") and (!($form->{description} eq ""))) { - IC->get_parts(\%myconfig, \%$form, "description"); - } else { - IC->get_parts(\%myconfig, \%$form, "all"); - } #fi - } #fi - } #fi + my $lastndx = $main::lastndx; + + my @sortorders = ("", "partnumber", "description", "all"); + my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)]; + IC->get_parts(\%myconfig, \%$form, $sortorder); $form->{title} = $locale->text('Top 100 hinzufuegen'); @@ -815,7 +821,6 @@ sub list { | {module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} | " + ? "{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber} | " : "$ref->{invnumber} | "; $column_data{ordnumber} = ($ref->{module} eq 'oe') - ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} | " + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber} | " : "$ref->{ordnumber} | "; $column_data{quonumber} = ($ref->{module} eq 'oe' && !$ref->{ordnumber}) - ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} | " + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber} | " : "$ref->{quonumber} | "; $column_data{name} = "$ref->{name} | "; @@ -1446,7 +1447,6 @@ sub addtop100 {
| - . $locale->text('Geschäftsvolumen') . qq| | + . $locale->text('Business Volume') . qq|{gv}> | |||||||||
@@ -2761,7 +2757,9 @@ sub makemodel_row { | ||||||||||
@@ -2782,6 +2780,10 @@ sub makemodel_row { sub assembly_row { $lxdebug->enter_sub(); my ($numrows) = @_; + my (@column_index, %column_data, %column_header); + my ($nochange, $callback, $previousform, $linetotal, $href); + + my $deliverydate = $main::deliverydate; # ToDO: cjeck if this indeed comes from global context @column_index = qw(runningnumber qty unit bom partnumber description partsgroup total); @@ -2802,7 +2804,7 @@ sub assembly_row { $previousform = ""; # save form variables in a previousform variable - foreach $key (sort keys %$form) { + foreach my $key (sort keys %$form) { # escape ampersands $form->{$key} =~ s/&/%26/g; @@ -2849,7 +2851,7 @@ sub assembly_row { | $form->{"partnumber_$i"} | |; $column_data{runningnumber} = @@ -2950,7 +2952,7 @@ sub update { $lxdebug->enter_sub(); if ($form->{item} eq "assembly") { - $i = $form->{assembly_rows}; + my $i = $form->{assembly_rows}; # if last row is empty check the form otherwise retrieve item if ( ($form->{"partnumber_$i"} eq "") @@ -2963,7 +2965,7 @@ sub update { IC->assembly_item(\%myconfig, \%$form); - $rows = scalar @{ $form->{item_list} }; + my $rows = scalar @{ $form->{item_list} }; if ($rows) { $form->{"qty_$i"} = 1 unless ($form->{"qty_$i"}); @@ -3013,6 +3015,8 @@ sub update { sub save { $lxdebug->enter_sub(); + my ($parts_id, %newform, $previousform, $amount, $callback); + # check if there is a part number - commented out, cause there is an automatic allocation of numbers # $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!")); @@ -3044,20 +3048,20 @@ sub save { # $locale->text('Assembly Number missing!') # save part - $lxdebug->message(LXDebug::DEBUG1, - "ic.pl: sellprice in save = $form->{sellprice}\n"); - $rc = IC->save(\%myconfig, \%$form); - if ($rc == 3) { + $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n"); + if (IC->save(\%myconfig, \%$form) == 3) { $form->error($locale->text('Partnumber not unique!')); } # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|partnumber_| . $form->{partnumber}; $form->{addition} = "SAVED"; $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history $parts_id = $form->{id}; + my $i; # load previous variables if ($form->{previousform}) { @@ -3070,8 +3074,8 @@ sub save { map { delete $form->{$_} } keys %newform; # now take it apart and restore original values - foreach $item (split /&/, $previousform) { - ($key, $value) = split /=/, $item, 2; + foreach my $item (split /&/, $previousform) { + my ($key, $value) = split /=/, $item, 2; $value =~ s/%26/&/g; $form->{$key} = $value; } @@ -3109,14 +3113,12 @@ sub save { if ($form->{exchangerate} != 0) { $form->{"sellprice_$i"} /= $form->{exchangerate}; } - $lxdebug->message(LXDebug::DEBUG1, - qq|sellprice_$i in previousform 2 = | - . $form->{"sellprice_$i"} . qq|\n|); + $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|); map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount}; chop $form->{"taxaccounts_$i"}; - foreach $item (qw(description rate taxnumber)) { - $index = $form->{"taxaccounts_$i"} . "_$item"; + foreach my $item (qw(description rate taxnumber)) { + my $index = $form->{"taxaccounts_$i"} . "_$item"; $form->{$index} = $newform{$index}; } @@ -3151,17 +3153,15 @@ sub save { $form->{makemodel_rows}--; # put callback together - foreach $key (keys %$form) { + foreach my $key (keys %$form) { # do single escape for Apache 2.0 - $value = $form->escape($form->{$key}, 1); + my $value = $form->escape($form->{$key}, 1); $callback .= qq|&$key=$value|; } $form->{callback} = $callback; } - $lxdebug->message(LXDebug::DEBUG1, - qq|ic.pl: sellprice_$i nach sub save = | - . $form->{"sellprice_$i"} . qq|\n|); + $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|); # redirect $form->redirect; @@ -3174,6 +3174,7 @@ sub save_as_new { # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|partnumber_| . $form->{partnumber}; $form->{addition} = "SAVED AS NEW"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -3191,11 +3192,12 @@ sub delete { $lxdebug->enter_sub(); # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|partnumber_| . $form->{partnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } # /saving the history - $rc = IC->delete(\%myconfig, \%$form); + my $rc = IC->delete(\%myconfig, \%$form); # redirect $form->redirect($locale->text('Item deleted!')) if ($rc > 0); @@ -3218,7 +3220,7 @@ sub price_row {| . $locale->text('Preis') . qq| | |; - for $i (1 .. $numrows) { + for my $i (1 .. $numrows) { print qq|||||||||
$form->{"pricegroup_$i"} | @@ -3240,13 +3242,14 @@ sub price_row { sub parts_language_selection { $lxdebug->enter_sub(); + my $onload = $main::onload; my $languages = IC->retrieve_languages(\%myconfig, $form); my $callback = "$form->{script}?action=parts_language_selection&"; map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" } - (qw(login path password name input_name), grep({ /^[fl]_/ } keys %$form))); + (qw(login password name input_name), grep({ /^[fl]_/ } keys %$form))); my @header_sort = qw(name longdescription); my %header_title = ( "name" => $locale->text("Name"), @@ -3269,4 +3272,4 @@ sub parts_language_selection { $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{"nextsub"}); }