X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=215ec16ab1fdfdfbe33a5ca1b791a3e6209c3a52;hb=b02735f55360e5a4e02dca40458b48cf057ecd7b;hp=28bc105e258b06038a0efb638a9d591e37e4eeb5;hpb=cb25314000db992f8b413d10a0d20f0e80b4b677;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 28bc105e2..215ec16ab 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -32,7 +32,7 @@ #====================================================================== use POSIX qw(strftime); -use List::Util qw(max); +use List::Util qw(first max); use List::MoreUtils qw(any); use SL::AM; @@ -115,8 +115,10 @@ sub search { $form->header; + $form->get_lists('partsgroup' => 'ALL_PARTSGROUPS'); print $form->parse_html_template('ic/search', { %is_xyz, - dateformat => $myconfig{dateformat}, }); + dateformat => $myconfig{dateformat}, + limit => $myconfig{vclimit}, }); $lxdebug->leave_sub(); } #end search() @@ -1103,6 +1105,13 @@ sub generate_report { no_sn_joins => [ qw(bought sold) ], ); + # get name of partsgroup if id is given + my $pg_name; + if ($form->{partsgroup_id}) { + my $pg = SL::DB::PartsGroup->new(id => $form->{partsgroup_id})->load; + $pg_name = $pg->{'partsgroup'}; + } + # these strings get displayed at the top of the results to indicate the user which switches were used my %optiontexts = ( active => $locale->text('Active'), @@ -1120,6 +1129,7 @@ sub generate_report { transdateto => $locale->text('To (time)') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1), partnumber => $locale->text('Part Number') . ": '$form->{partnumber}'", partsgroup => $locale->text('Group') . ": '$form->{partsgroup}'", + partsgroup_id => $locale->text('Group') . ": '$pg_name'", serialnumber => $locale->text('Serial Number') . ": '$form->{serialnumber}'", description => $locale->text('Part Description') . ": '$form->{description}'", make => $locale->text('Make') . ": '$form->{make}'", @@ -1131,7 +1141,7 @@ sub generate_report { ); my @itemstatus_keys = qw(active obsolete orphaned onhand short); - my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup serialnumber description make model + my @callback_keys = qw(onorder ordered rfq quoted bought sold partnumber partsgroup partsgroup_id serialnumber description make model drawing microfiche l_soldtotal l_deliverydate transdatefrom transdateto ean); # calculate dependencies @@ -1528,7 +1538,9 @@ sub form_header { $auth->assert('part_service_assembly_edit'); - $form->{eur} = $::lx_office_conf{system}->{eur}; # config dumps into namespace - yuck + # what does eur set here? why is it in namespace? + # call of get_accounting_method preserves format of $form->{eur}, which expects 1 or 0 + $form->{eur} = $::instance_conf->get_accounting_method eq 'cash' ? 1 : 0; # config dumps into namespace - yuck $form->{pg_keys} = sub { "$_[0]->{partsgroup}--$_[0]->{id}" }; $form->{description_area} = ($form->{rows} = $form->numtextrows($form->{description}, 40)) > 1; $form->{notes_rows} = max 4, $form->numtextrows($form->{notes}, 40), $form->numtextrows($form->{formel}, 40); @@ -2030,4 +2042,22 @@ sub ajax_autocomplete { $main::lxdebug->leave_sub(); } +sub back_to_record { + _check_io_auth(); + + $::auth->restore_form_from_session($::form->{previousform}, clobber => 1); + $::form->{rowcount}--; + $::form->{action} = 'display_form'; + $::form->{callback} = $::form->{script} . '?' . join('&', map { $::form->escape($_) . '=' . $::form->escape($::form->{$_}) } sort keys %{ $::form }); + $::form->redirect; +} + sub continue { call_sub($form->{"nextsub"}); } + +sub dispatcher { + my $action = first { $::form->{"action_${_}"} } qw(add back_to_record); + $::form->error($::locale->text('No action defined.')) unless $action; + + $::form->{dispatched_action} = $action; + call_sub($action); +}