X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=80faa1b063c6e473ae54639511e6dd7734801854;hb=4aa816112a8b9f2d2959c92cfaa2f2954bdeceb2;hp=70e020fcc54c933a30c0a36dd289ad89c09a0821;hpb=1df2efffbb760f0c7ad5e32e40807beadc227b80;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 70e020fcc..80faa1b06 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -181,7 +181,8 @@ sub edit { my ($language_id, $printer_id); if ($form->{print_and_save}) { - $form->{action} = "print"; + $form->{action} = "dispatcher"; + $form->{action_print} = "1"; $form->{resubmit} = 1; $language_id = $form->{language_id}; $printer_id = $form->{printer_id}; @@ -388,14 +389,21 @@ sub form_header { } } - my $onload = ($form->{resubmit} && ($form->{format} eq "html")) ? "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()" - : ($form->{resubmit}) ? "document.oe.submit()" - : ($creditwarning) ? "alert('$credittext')" - : ""; + my $onload = ""; + if ($form->{resubmit} && ($form->{format} eq "html")) { + $onload = "window.open('about:blank','Beleg'); document.oe.target = 'Beleg';"; + $onload .= "document.do.submit();"; + } elsif ($form->{resubmit}) { + # emulate click for resubmitting actions + $onload = "document.oe.${_}.click(); " for grep { /^action_/ } keys %$form; + $onload .= "document.oe.submit();"; + } elsif ($creditwarning) { + $onload = "alert('$credittext')"; + } - $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; $TMPL_VAR{onload} = $onload; + $TMPL_VAR{dateformat} = $myconfig{dateformat}; + $TMPL_VAR{numberformat} = $myconfig{numberformat}; if ($form->{type} eq 'sales_order') { if (!$form->{periodic_invoices_config}) { @@ -418,7 +426,7 @@ sub form_header { title creditlimit creditremaining tradediscount business max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax - shiptodepartment_1 shiptodepartment_2 shiptoemail + shiptodepartment_1 shiptodepartment_2 shiptoemail shiptocp_gender message email subject cc bcc taxpart taxservice taxaccounts cursor_fokus), @custom_hiddens, map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ]; # deleted: discount @@ -523,8 +531,6 @@ sub update { check_oe_access(); -# $main::lxdebug->message(0, Dumper($form)); - set_headings($form->{"id"} ? "edit" : "add"); map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate) unless $recursive_call; @@ -551,10 +557,13 @@ sub update { &check_form; } else { + my $mode; if ($form->{type} =~ /^sales/) { IS->retrieve_item(\%myconfig, \%$form); + $mode = 'IS'; } else { IR->retrieve_item(\%myconfig, \%$form); + $mode = 'IR'; } my $rows = scalar @{ $form->{item_list} }; @@ -572,7 +581,7 @@ sub update { if ($rows > 1) { - &select_item; + select_item(mode => $mode); ::end_of_request(); } else { @@ -702,7 +711,7 @@ sub search { print $form->parse_html_template('oe/search', { %myconfig, - is_order => $form->{type} =~ /_order/, + is_order => scalar($form->{type} =~ /_order/), }); $main::lxdebug->leave_sub(); @@ -2023,7 +2032,6 @@ sub dispatcher { foreach my $action (qw(delete delivery_order e_mail invoice print purchase_order purchase_order quotation request_for_quotation sales_order sales_order save save_and_close save_as_new ship_to update)) { if ($::form->{"action_${action}"}) { - $::form->{dispatched_action} = $action; call_sub($action); return; }