X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=913c92d2ca9a0ffb6448c42c253080698551ea0c;hb=3f4a45a96efc9e44bc3cd58874128dc36cc667cf;hp=61a820b39dbda3698e0272617e9acb9e0c43a74a;hpb=34dc226c4ddd6aa05c602b5082fb06bc70719abd;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 61a820b39..913c92d2c 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -32,11 +32,22 @@ #====================================================================== #$locale->text('ea'); +use POSIX qw(strftime); + use SL::IC; +use SL::ReportGenerator; #use SL::PE; -require "$form->{path}/io.pl"; +# use strict; +#use warnings; + +# global imports +our ($form, $locale, %myconfig, $lxdebug); + +require "bin/mozilla/io.pl"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/reportgenerator.pl"; 1; @@ -48,7 +59,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 +74,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 +92,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 +387,6 @@ $jsscript -{path}> {login}> {password}> @@ -400,11 +412,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 +551,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 +671,6 @@ sub choice { print qq| -{path}> {login}> {password}> @@ -689,9 +702,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 +729,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,6 +761,9 @@ sub choice { sub list { $lxdebug->enter_sub(); + our ($lastndx); + our ($partnumber, $description, $unit, $sellprice, $soldtotal); + my @sortorders = ("", "partnumber", "description", "all"); my $sortorder = $sortorders[($form->{description} ? 2 : 0) + ($form->{partnumber} ? 1 : 0)]; IC->get_parts(\%myconfig, \%$form, $sortorder); @@ -804,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} | "; @@ -1435,7 +1446,6 @@ sub addtop100 { - - - -|; + $report->generate_with_headers(); $lxdebug->leave_sub(); } #end generate_report sub parts_subtotal { $lxdebug->enter_sub(); + + # imports + our (%column_data, @column_index); + our ($subtotalonhand, $totalsellprice, $totallastcost, $totallistprice, $subtotalsellprice, $subtotallastcost, $subtotallistprice); map { $column_data{$_} = "" } @column_index; $subtotalonhand = 0 if ($form->{searchitems} eq 'assembly' && $form->{bom}); @@ -2069,15 +1891,15 @@ sub link_part { split(/:/, $form->{currencies})); # parts and assemblies have the same links - $item = $form->{item}; + my $item = $form->{item}; if ($form->{item} eq 'assembly') { $item = 'part'; } # build the popup menus $form->{taxaccounts} = ""; - foreach $key (keys %{ $form->{IC_links} }) { - foreach $ref (@{ $form->{IC_links}{$key} }) { + foreach my $key (keys %{ $form->{IC_links} }) { + foreach my $ref (@{ $form->{IC_links}{$key} }) { # if this is a tax field if ($key =~ /IC_tax/) { @@ -2131,7 +1953,7 @@ sub link_part { if ($form->{item} eq 'assembly') { - foreach $i (1 .. $form->{assembly_rows}) { + foreach my $i (1 .. $form->{assembly_rows}) { if ($form->{"partsgroup_id_$i"}) { $form->{"partsgroup_$i"} = qq|$form->{"partsgroup_$i"}--$form->{"partsgroup_id_$i"}|; @@ -2154,18 +1976,23 @@ sub link_part { sub form_header { $lxdebug->enter_sub(); + my ($payment, $rows, $notes, $description, $ean, $buchungsgruppe, $partsgroup, $group, $tax, $lastcost, $eur, $linkaccounts, $weight, $n, $rop, $bin, $vegv); + my ($notdiscountableok, $notdiscountable); + my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop); + + map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) } qw(sellprice listprice lastcost gv)); map { $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}) } qw(weight rop stock); - foreach $item (qw(partnumber description unit notes)) { + foreach my $item (qw(partnumber description unit notes)) { $form->{$item} =~ s/\"/"/g; } $payment = qq||; - foreach $item (@{ $form->{payment_terms} }) { + foreach my $item (@{ $form->{payment_terms} }) { if ($form->{payment_id} eq $item->{id}) { $payment .= qq||; } else { @@ -2190,13 +2017,13 @@ sub form_header { $ean = qq||; - foreach $item (split / /, $form->{taxaccounts}) { + foreach my $item (split / /, $form->{taxaccounts}) { $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : ""; } IC->retrieve_buchungsgruppen(\%myconfig, $form); if (@{ $form->{BUCHUNGSGRUPPEN} }) { - foreach $item (@{ $form->{BUCHUNGSGRUPPEN} }) { + foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) { if ($item->{id} == $form->{buchungsgruppen_id}) { $form->{selectbuchungsgruppe} .= " |
| - . $locale->text('Geschäftsvolumen') . qq| | + . $locale->text('Business Volume') . qq|{gv}> | ||||||||||
@@ -2460,7 +2290,8 @@ sub form_header { # type=submit $locale->text('Edit Service') # type=submit $locale->text('Edit Assembly') # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + my ($jsscript, $button1); + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -2552,14 +2383,14 @@ sub form_header { | |||||||||||
| . $locale->text('Notes') . qq| | -| . $locale->text('Formula') . qq| | +$formula_label | |||||||||
$notes | - $formel + $formula | ||||||||||
@@ -2750,7 +2577,9 @@ sub makemodel_row { | |||||||||||
@@ -2771,6 +2600,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); + + our ($deliverydate); # ToDO: cjeck if this indeed comes from global context @column_index = qw(runningnumber qty unit bom partnumber description partsgroup total); @@ -2791,7 +2624,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; @@ -2838,7 +2671,7 @@ sub assembly_row { | $form->{"partnumber_$i"} | |; $column_data{runningnumber} = @@ -2939,7 +2772,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 "") @@ -2952,7 +2785,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"}); @@ -2982,26 +2815,19 @@ sub update { } } - } - if ($form->{item} eq "part") { + } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) { &check_form; } - if ($form->{item} eq 'service') { - map({ $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } - qw(sellprice listprice lastcost)); - &form_header; - &price_row; - &form_footer; - } - $lxdebug->leave_sub(); } 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!")); @@ -3033,20 +2859,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}) { @@ -3059,8 +2885,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; } @@ -3098,14 +2924,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}; } @@ -3140,17 +2964,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; @@ -3163,6 +2985,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)); } @@ -3180,11 +3003,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); @@ -3207,7 +3031,7 @@ sub price_row {| . $locale->text('Preis') . qq| | |; - for $i (1 .. $numrows) { + for my $i (1 .. $numrows) { print qq||||||||||
$form->{"pricegroup_$i"} | @@ -3229,13 +3053,14 @@ sub price_row { sub parts_language_selection { $lxdebug->enter_sub(); + our ($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"), @@ -3258,4 +3083,4 @@ sub parts_language_selection { $lxdebug->leave_sub(); } -sub continue { &{ $form->{nextsub} } } +sub continue { call_sub($form->{"nextsub"}); }