X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdo.pl;h=7f83bf399b7398b0083096116fd3ae7819e96863;hb=34211d2356367e21aa8f624caa7b17ee4b8ec4ac;hp=130cca13039cd799fb844ce645fb65bbee043cd3;hpb=99065c25a9fbb661e02a3b99d213e70e8a830264;p=kivitendo-erp.git diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 130cca130..7f83bf399 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -121,7 +121,8 @@ sub edit { } 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}; @@ -182,12 +183,8 @@ sub order_links { ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} }; $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; - $form->{taxincluded} = $taxincluded if ($form->{id}); - $form->{employee} = "$form->{employee}--$form->{employee_id}"; - $form->{salesman_id} = $salesman_id if ($editing); - $lxdebug->leave_sub(); } @@ -274,10 +271,15 @@ sub form_header { if ($form->{format} eq "html") { $form->{onload} = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';"; } + # emulate click for resubmitting actions + $form->{onload} .= "document.do.${_}.click(); " for grep { /^action_/ } keys %$form; $form->{onload} .= "document.do.submit();" } $form->header(); + # Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID' + $form->{department} .= '--' . $form->{department_id}; + print $form->parse_html_template('do/form_header'); $lxdebug->leave_sub(); @@ -460,7 +462,7 @@ sub orders { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('orders', @hidden_variables); + $report->set_export_options('orders', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); @@ -485,10 +487,10 @@ sub orders { push @options, $locale->text('Transaction description') . " : $form->{transaction_description}"; } if ($form->{transdatefrom}) { - push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1); + push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1); } if ($form->{transdateto}) { - push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); + push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1); } if ($form->{open}) { push @options, $locale->text('Open'); @@ -655,6 +657,7 @@ sub invoice { $form->{title} = $locale->text('Add Vendor Invoice'); $form->{script} = 'ir.pl'; $script = "ir"; + $buysell = 'sell'; } else { $form->{title} = $locale->text('Add Sales Invoice'); @@ -733,7 +736,13 @@ sub invoice_multi { 'back_button' => 1); } + my $source_type = $form->{type}; $form->{convert_from_do_ids} = join ' ', @do_ids; + # bei der auswahl von mehreren Lieferscheinen fuer eine Rechnung, die einfach in donumber_array + # zwischenspeichern (DO.pm) und als ' '-separierte Liste wieder zurueckschreiben + # Hinweis: delete gibt den wert zurueck und loescht danach das element (nett und einfach) + # $shell: perldoc perlunc; /delete EXPR + $form->{donumber} = delete $form->{donumber_array}; $form->{deliverydate} = $form->{transdate}; $form->{transdate} = $form->current_date(\%myconfig); $form->{duedate} = $form->current_date(\%myconfig, $form->{invdate}, $form->{terms} * 1); @@ -742,7 +751,7 @@ sub invoice_multi { $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); my $buysell; - if ($form->{type} eq 'purchase_delivery_order') { + if ($source_type eq 'purchase_delivery_order') { $form->{title} = $locale->text('Add Vendor Invoice'); $form->{script} = 'ir.pl'; $script = "ir"; @@ -760,8 +769,12 @@ sub invoice_multi { $form->{rowcount} = 0; foreach my $ref (@{ $form->{form_details} }) { $form->{rowcount}++; + $ref->{reqdate} ||= $ref->{dord_transdate}; # copy transdates into each invoice row map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref }; map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice discount lastcost); + $form->{"discount_$form->{rowcount}"} = $form->{"discount_$form->{rowcount}"} * 100; #s.a. Bug 1151 + # Anm.: Eine Änderung des discounts in der SL/DO.pm->retrieve (select (doi.discount * 100) as discount) ergibt in psql einen + # Wert von 10.0000001490116. Ferner ist der Rabatt in der Rechnung dann bei 1.0 (?). Deswegen lasse ich das hier. jb 10.10.09 } delete $form->{form_details}; @@ -1231,3 +1244,14 @@ sub no { sub update { call_sub($form->{update_nextsub} || $form->{nextsub} || 'update_delivery_order'); } + +sub dispatcher { + foreach my $action (qw(update ship_to print e_mail save transfer_out transfer_in mark_closed save_as_new invoice delete)) { + if ($form->{"action_${action}"}) { + call_sub($action); + return; + } + } + + $form->error($locale->text('No action defined.')); +}