X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=928a0aba6109219a701d183760ec3e7c348df8c6;hb=a6c9465ac8cd4b35644f14ffec8bdb65a6093056;hp=daba6887e5944f3d4033c541dd6cd6c698f52fac;hpb=215356761a7aa1afd6d77be3aa1997bac9cf6d0e;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index daba6887e..928a0aba6 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -52,15 +52,25 @@ require "bin/mozilla/reportgenerator.pl"; 1; +# Parserhappy(R): +# type=submit $locale->text('Add Part') +# type=submit $locale->text('Add Service') +# type=submit $locale->text('Add Assembly') +# type=submit $locale->text('Edit Part') +# type=submit $locale->text('Edit Service') +# type=submit $locale->text('Edit Assembly') + # end of main sub add { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + $form->{title} = $locale->text('Add ' . ucfirst $form->{item}); $form->{callback} = - "$form->{script}?action=add&item=$form->{item}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&item=$form->{item}" unless $form->{callback}; $form->{"unit_changeable"} = 1; @@ -75,6 +85,8 @@ sub add { sub search { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + # switch for backward sorting $form->{revers} = 0; @@ -108,6 +120,8 @@ sub search { sub search_update_prices { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + my $pricegroups = IC->get_pricegroups(\%myconfig, \%$form); $form->header; @@ -120,6 +134,8 @@ sub search_update_prices { sub confirm_price_update { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + $form->{nextsub} = "update_prices"; $form->header; @@ -133,6 +149,8 @@ sub confirm_price_update { sub update_prices { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + if (IC->update_prices(\%myconfig, \%$form)) { $form->redirect($form->{update_count} . $locale->text('prices updated!')); } else { @@ -145,6 +163,8 @@ sub update_prices { sub choice { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + our ($j, $lastndx); my ($totop100); @@ -152,122 +172,70 @@ sub choice { $form->header; - print qq| - - -
{script}> - - {searchitems}> - - - - |; - - print qq| - - - - - - - - - -
| . $locale->text('Part Number') . qq|| . $locale->text('Part Description') . qq|
-
|; - - print qq| - -{login}> -{password}> - - - - - - - - - - - - - - - - - - - - - - - - - -{ndxs_counter}> - -{extras}>|; + push @custom_hiddens, qw(searchitems title bom titel revers lastsort sort ndxs_counter extras); + push @custom_hiddens, qw(itemstatus l_linetotal l_partnumber l_description l_onhand l_unit l_sellprice l_linetotalsellprice); + my @HIDDENS = ( + +{ name => 'row', value => $j }, + +{ name => 'nextsub', value => 'item_selected' }, + +{ name => 'test', value => 'item_selected' }, + +{ name => 'lastndx', value => $lastndx }, + map(+{ name => $_, value => $form->{$_} }, @custom_hiddens), + ); my ($partnumber, $description, $unit, $sellprice, $soldtotal); # if choice set data - if ($form->{ndx}) { - for (my $i = 0; $i < $form->{ndxs_counter}; $i++) { - - # prepeare data - $partnumber = $form->{"totop100_partnumber_$j"}; - $description = $form->{"totop100_description_$j"}; - $unit = $form->{"totop100_unit_$j"}; - $sellprice = $form->{"totop100_sellprice_$j"}; - $soldtotal = $form->{"totop100_soldtotal_$j"}; - - # insert data into top100 - push @{ $form->{parts} }, - { number => "", - partnumber => "$partnumber", - description => "$description", - unit => "$unit", - sellprice => "$sellprice", - soldtotal => "$soldtotal" }; - } #rof - } #fi +# if ($form->{ndx}) { +# for my $i (0 .. $form->{ndxs_counter}) { +# +# # insert data into top100 +# push @{ $form->{parts} }, +# { number => "", +# partnumber => $form->{"totop100_partnumber_$j"}, +# description => $form->{"totop100_description_$j"}, +# unit => $form->{"totop100_unit_$j"}, +# sellprice => $form->{"totop100_sellprice_$j"}, +# soldtotal => $form->{"totop100_soldtotal_$j"}, +# }; +# } #rof +# } #fi $totop100 = ""; # set data for next page - if (($form->{ndxs_counter}) > 0) { - 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"}; - $sellprice = $form->{"totop100_sellprice_$i"}; - $soldtotal = $form->{"totop100_soldtotal_$i"}; - - $totop100 .= qq| -{"totop100_partnumber_$i"}> -{"totop100_description_$i"}> -{"totop100_unit_$i"}> -{"totop100_sellprice_$i"}> -{"totop100_soldtotal_$i"}> - |; - } #rof - } #fi - - print $totop100; + for my $i (1 .. $form->{ndxs_counter}) { + $partnumber = $form->{"totop100_partnumber_$i"}; + $description = $form->{"totop100_description_$i"}; + $unit = $form->{"totop100_unit_$i"}; + $sellprice = $form->{"totop100_sellprice_$i"}; + $soldtotal = $form->{"totop100_soldtotal_$i"}; + + push @PARTS, { + totop100_partnumber => $form->{"totop100_partnumber_$i"}, + totop100_description => $form->{"totop100_description_$i"}, + totop100_unit => $form->{"totop100_unit_$i"}, + totop100_sellprice => $form->{"totop100_sellprice_$i"}, + totop100_soldtotal => $form->{"totop100_soldtotal_$i"}, + } + +# $totop100 .= qq| +#{"totop100_partnumber_$i"}> +#{"totop100_description_$i"}> +#{"totop100_unit_$i"}> +#{"totop100_sellprice_$i"}> +#{"totop100_soldtotal_$i"}> +# |; + } #rof + + print $form->parse_html_template('ic/choice', +{ HIDDENS => \@HIDDENS, PARTS => \@PARTS }); - print qq| - -
- - - |; $lxdebug->leave_sub(); } #end choice sub list { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + our ($lastndx); our ($partnumber, $description, $unit, $sellprice, $soldtotal); @@ -302,7 +270,7 @@ sub list { for ($j = 1; $j <= $i; $j++) { print qq| - |; + |; if ($j == 1) { print qq| |; @@ -328,9 +296,6 @@ sub list {
-{login}> -{password}> - @@ -392,6 +357,8 @@ sub list { sub top100 { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + if ($form->{ndx}) { $form->{ndxs_counter}++; @@ -413,6 +380,8 @@ sub top100 { sub addtop100 { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + my ($revers, $lastsort, $callback, $option, $description, $sameitem, $partnumber, $unit, $sellprice, $soldtotal, $totop100, $onhand, $align); my (@column_index, %column_header, %column_data); @@ -420,7 +389,7 @@ sub addtop100 { $form->{top100} = "top100"; $form->{l_soldtotal} = "Y"; - $form->{soldtotal} = "soldtotal"; +# $form->{soldtotal} = "soldtotal"; $form->{sort} = "soldtotal"; $form->{l_qty} = "N"; $form->{l_linetotal} = ""; @@ -442,7 +411,7 @@ sub addtop100 { } #fi $callback = - "$form->{script}?action=top100&login=$form->{login}&password=$form->{password}&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title=" + "$form->{script}?action=top100&searchitems=$form->{searchitems}&itemstatus=$form->{itemstatus}&bom=$form->{bom}&l_linetotal=$form->{l_linetotal}&title=" . $form->escape($form->{title}, 1); # if we have a serialnumber limit search @@ -545,16 +514,13 @@ sub addtop100 { } if ($form->{serialnumber}) { $callback .= "&serialnumber=$form->{serialnumber}"; - $option .= - $locale->text('Serial Number') . qq| : $form->{serialnumber}
|; + $option .= $locale->text('Serial Number') . qq| : $form->{serialnumber}
|; } if ($form->{description}) { - $callback .= "&description=$form->{description}"; + $callback .= "&description=$form->{description}"; $description = $form->{description}; - $description =~ s/ -/
/g; - $option .= - $locale->text('Part Description') . qq| : $form->{description}
|; + $description =~ s/\n/
/g; + $option .= $locale->text('Part Description') . qq| : $form->{description}
|; } if ($form->{make}) { $callback .= "&make=$form->{make}"; @@ -786,8 +752,8 @@ sub addtop100 { } #rof } #fi # build data for columns + my $i = 0; foreach my $ref (@{ $form->{parts} }) { - my $i = 0; if ($form->{l_subtotal} eq 'Y' && !$ref->{assemblyitem}) { if ($sameitem ne $ref->{ $form->{sort} }) { @@ -810,8 +776,7 @@ sub addtop100 { $onhand = 0 if ($form->{sold}); } - $ref->{description} =~ s/ -/
/g; + $ref->{description} =~ s/\n/
/g; $column_data{number} = "" @@ -873,15 +838,15 @@ sub addtop100 { $column_data{invnumber} = ($ref->{module} ne 'oe') - ? "{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{invnumber}" + ? "{module}.pl?action=edit&type=invoice&id=$ref->{trans_id}&callback=$callback>$ref->{invnumber}" : "$ref->{invnumber}"; $column_data{ordnumber} = ($ref->{module} eq 'oe') - ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{ordnumber}" + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&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}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{quonumber}" + ? "{module}.pl?action=edit&type=$ref->{type}&id=$ref->{trans_id}&callback=$callback>$ref->{quonumber}" : "$ref->{quonumber}"; $column_data{name} = "$ref->{name}"; @@ -953,9 +918,6 @@ sub addtop100 {
{script}> -{login}> -{password}> - @@ -1014,11 +976,13 @@ sub addtop100 { # l_partsgroup l_subtotal l_soldtotal l_deliverydate # # hiddens: -# nextsub login password revers lastsort sort ndxs_counter +# nextsub revers lastsort sort ndxs_counter # sub generate_report { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + my ($revers, $lastsort, $description); $form->{title} = (ucfirst $form->{searchitems}) . "s"; @@ -1337,6 +1301,8 @@ sub generate_report { sub parts_subtotal { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + # imports our (%column_data, @column_index); our ($subtotalonhand, $totalsellprice, $totallastcost, $totallistprice, $subtotalsellprice, $subtotallastcost, $subtotallistprice); @@ -1380,6 +1346,9 @@ sub parts_subtotal { sub edit { $lxdebug->enter_sub(); + + $auth->assert('part_service_assembly_edit'); + # show history button $form->{javascript} = qq||; #/show hhistory button @@ -1398,6 +1367,8 @@ sub edit { sub link_part { $lxdebug->enter_sub(); + $auth->assert('part_service_assembly_edit'); + IC->create_links("IC", \%myconfig, \%$form); # currencies @@ -1459,10 +1430,7 @@ sub link_part { if (@{ $form->{all_partsgroup} }) { $form->{selectpartsgroup} = qq||; - foreach my $item (@{ $form->{payment_terms} }) { - if ($form->{payment_id} eq $item->{id}) { - $payment .= qq||; - } else { - $payment .= qq||; - } - } - - - if (($rows = $form->numtextrows($form->{notes}, 40)) < 2) { - $rows = 4; - } - - $notes = - qq||; - if (($rows = $form->numtextrows($form->{description}, 40)) > 1) { - $description = - qq||; - } else { - $description = - qq||; - } - - $ean = qq||; + map { $form->{"is_$_"} = ($form->{item} eq $_) } qw(part service assembly); + map { $form->{$_} =~ s/"/"/g; } qw(unit); + + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); - foreach my $item (split / /, $form->{taxaccounts}) { - $form->{"IC_tax_$item"} = ($form->{"IC_tax_$item"}) ? "checked" : ""; - } + $rows = 4 if $rows = $form->numtextrows($form->{notes}, 40) < 2; + $form->{notes_rows} = $rows; IC->retrieve_buchungsgruppen(\%myconfig, $form); - if (@{ $form->{BUCHUNGSGRUPPEN} }) { - foreach my $item (@{ $form->{BUCHUNGSGRUPPEN} }) { - if ($item->{id} == $form->{buchungsgruppen_id}) { - $form->{selectbuchungsgruppe} .= - "