X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fic.pl;h=d4ad5f14f7949acd84b860dba113a89ac50d864b;hb=4d261fb7ccec8e5db782c73623dfd7beba6d7e83;hp=0b607da1d5a95f789fe7bb337b18dc97b3368ef9;hpb=573ba300b9417ba750d6d2486647535231bbcdea;p=kivitendo-erp.git
diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl
index 0b607da1d..d4ad5f14f 100644
--- a/bin/mozilla/ic.pl
+++ b/bin/mozilla/ic.pl
@@ -24,7 +24,8 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1335, USA.
#======================================================================
#
# Inventory Control module
@@ -38,6 +39,8 @@ use List::MoreUtils qw(any);
use SL::AM;
use SL::CVar;
use SL::IC;
+use SL::Helper::Flash qw(flash);
+use SL::HTML::Util;
use SL::ReportGenerator;
#use SL::PE;
@@ -49,7 +52,6 @@ use strict;
our ($form, $locale, %myconfig, $lxdebug, $auth);
require "bin/mozilla/io.pl";
-require "bin/mozilla/invoice_io.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/reportgenerator.pl";
@@ -73,39 +75,18 @@ require "bin/mozilla/reportgenerator.pl";
# end of main
-sub add {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- my $title = 'Add ' . ucfirst $form->{item};
- $form->{title} = $locale->text($title);
- $form->{callback} = "$form->{script}?action=add&item=$form->{item}" unless $form->{callback};
- $form->{unit_changeable} = 1;
-
- IC->get_pricegroups(\%myconfig, \%$form);
- &link_part;
- &display_form;
-
- $lxdebug->leave_sub();
-}
-
sub search {
$lxdebug->enter_sub();
- $auth->assert('part_service_assembly_edit');
+ $auth->assert('part_service_assembly_details');
$form->{revers} = 0; # switch for backward sorting
$form->{lastsort} = ""; # memory for which table was sort at last time
$form->{ndxs_counter} = 0; # counter for added entries to top100
- my %is_xyz = map { +"is_$_" => ($form->{searchitems} eq $_) } qw(part service assembly);
-
$form->{title} = (ucfirst $form->{searchitems}) . "s";
+ $form->{title} =~ s/ys$/ies/;
$form->{title} = $locale->text($form->{title});
- $form->{title} = $locale->text('Assemblies') if ($is_xyz{is_assembly});
-
- $form->{jsscript} = 1;
$form->{CUSTOM_VARIABLES} = CVar->get_configs('module' => 'IC');
($form->{CUSTOM_VARIABLES_FILTER_CODE},
@@ -113,881 +94,40 @@ sub search {
'include_prefix' => 'l_',
'include_value' => 'Y');
+ setup_ic_search_action_bar();
$form->header;
$form->get_lists('partsgroup' => 'ALL_PARTSGROUPS');
- print $form->parse_html_template('ic/search', { %is_xyz,
- dateformat => $myconfig{dateformat},
- limit => $myconfig{vclimit}, });
+ print $form->parse_html_template('ic/search');
$lxdebug->leave_sub();
} #end search()
-sub search_update_prices {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- my $pricegroups = IC->get_pricegroups(\%myconfig, \%$form);
-
- $form->{title} = $locale->text('Update Prices');
-
- $form->header;
-
- print $form->parse_html_template('ic/search_update_prices', { PRICE_ROWS => $pricegroups });
-
- $lxdebug->leave_sub();
-} #end search()
-
-sub confirm_price_update {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- my @errors = ();
- my $value_found = undef;
-
- foreach my $idx (qw(sellprice listprice), (1..$form->{price_rows})) {
- my $name = $idx =~ m/\d/ ? $form->{"pricegroup_${idx}"} : $idx eq 'sellprice' ? $locale->text('Sell Price') : $locale->text('List Price');
- my $type = $idx =~ m/\d/ ? $form->{"pricegroup_type_${idx}"} : $form->{"${idx}_type"};
- my $value_idx = $idx =~ m/\d/ ? "price_${idx}" : $idx;
- my $value = $form->parse_amount(\%myconfig, $form->{$value_idx});
-
- if ((0 > $value) && ($type eq 'percent')) {
- push @errors, $locale->text('You cannot adjust the price for pricegroup "#1" by a negative percentage.', $name);
-
- } elsif (!$value && ($form->{$value_idx} ne '')) {
- push @errors, $locale->text('No valid number entered for pricegroup "#1".', $name);
-
- } elsif (0 < $value) {
- $value_found = 1;
- }
- }
-
- push @errors, $locale->text('No prices will be updated because no prices have been entered.') if (!$value_found);
-
- my $num_matches = IC->get_num_matches_for_priceupdate();
-
- $form->header();
-
- if (@errors) {
- $form->show_generic_error(join('
', @errors), 'back_button' => 1);
- }
-
- $form->{nextsub} = "update_prices";
-
- map { delete $form->{$_} } qw(action header);
-
- print $form->parse_html_template('ic/confirm_price_update', { HIDDENS => [ map { name => $_, value => $form->{$_} }, keys %$form ],
- num_matches => $num_matches });
-
- $lxdebug->leave_sub();
-}
-
-sub update_prices {
- $lxdebug->enter_sub();
-
- $auth->assert('part_service_assembly_edit');
-
- my $num_updated = IC->update_prices(\%myconfig, \%$form);
-
- if (-1 != $num_updated) {
- $form->redirect($locale->text('#1 prices were updated.', $num_updated));
- } else {
- $form->error($locale->text('Could not update prices!'));
- }
-
- $lxdebug->leave_sub();
-}
-
-#sub choice {
-# $lxdebug->enter_sub();
-#
-# $auth->assert('part_service_assembly_edit');
-#
-# our ($j, $lastndx);
-# my ($totop100);
-#
-# $form->{title} = $locale->text('Top 100 hinzufuegen');
-#
-# $form->header;
-#
-# 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 .. $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
-# 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 });
-#
-# $lxdebug->leave_sub();
-#} #end choice
-
-#sub list {
-# $lxdebug->enter_sub();
-#
-# $auth->assert('part_service_assembly_edit');
-#
-# 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);
-#
-# $form->{title} = $locale->text('Top 100 hinzufuegen');
-#
-# $form->header;
-#
-# print qq|
-#