X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fio.pl;h=d47168bc476155e28d4a5302c0e3cc2add2203f8;hb=b28b0afc6b991b5050ea39f66fd1870ca27f400f;hp=3afcbd1dc21d3d9c183b16eb12e1c72b9284a556;hpb=f0bca038e659057fd046358b9201b5a374dc2d25;p=kivitendo-erp.git diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 3afcbd1dc..d47168bc4 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -50,6 +50,7 @@ use SL::IO; use SL::DB::Default; use SL::DB::Language; use SL::DB::Printer; +use SL::Helper::CreatePDF; use SL::Helper::Flash; require "bin/mozilla/common.pl"; @@ -225,6 +226,10 @@ sub display_row { qw(qty discount sellprice lastcost price_new price_old) unless ($form->{simple_save}); + if ($form->{"prices_$i"} && ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"})) { + $form->{"sellprice_$i"} = $form->{"price_new_$i"}; + } + # unit begin $form->{"unit_old_$i"} ||= $form->{"unit_$i"}; $form->{"selected_unit_$i"} ||= $form->{"unit_$i"}; @@ -270,12 +275,12 @@ sub display_row { my $linetotal = $form->round_amount($form->{"qty_$i"} * $form->{"sellprice_$i"} * (100 - $form->{"discount_$i"}) / 100 / $price_factor, 2); my $rows = $form->numtextrows($form->{"description_$i"}, 30, 6); - $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -size => 5, -value => $i); # HuT - $column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"}); + $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -id => "runningnumber_$i", -size => 5, -value => $i); # HuT + $column_data{partnumber} = $cgi->textfield(-name => "partnumber_$i", -id => "partnumber_$i", -size => 12, -value => $form->{"partnumber_$i"}); $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead - ? $cgi->textarea( -name => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30) - : $cgi->textfield(-name => "description_$i", -size => 30, -value => $form->{"description_$i"})) - . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')"); + ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30) + : $cgi->textfield(-name => "description_$i", -id => "description_$i", -value => $form->{"description_$i"}, -size => 30)) + . $cgi->button(-value => $locale->text('L'), -onClick => "kivi.SalesPurchase.edit_longdescription($i)"); my $qty_dec = ($form->{"qty_$i"} =~ /\.(\d+)/) ? length $1 : 2; @@ -430,9 +435,9 @@ sub display_row { my @HIDDENS = map { value => $_}, ( $cgi->hidden("-name" => "unit_old_$i", "-value" => $form->{"selected_unit_$i"}), $cgi->hidden("-name" => "price_new_$i", "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})), - map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } + map { ($cgi->hidden("-name" => $_, "-id" => $_, "-value" => $form->{$_})); } map { $_."_$i" } (qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes - income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber + income_accno expense_accno listprice assembly taxaccounts ordnumber donumber transdate cusordnumber longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars) ); @@ -745,7 +750,7 @@ sub remove_emptied_rows { taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values - sellprice_pg pricegroup_old price_old price_new unit_old ordnumber + sellprice_pg pricegroup_old price_old price_new unit_old ordnumber donumber transdate longdescription basefactor marge_total marge_percent marge_price_factor lastcost price_factor_id partnotes stock_out stock_in has_sernumber reqdate); @@ -1202,17 +1207,12 @@ sub print { } $form->{print_and_save} = 1; my $formname = $form->{formname}; - save(); + &save(); $form->{formname} = $formname; - edit(); + &edit(); $::lxdebug->leave_sub(); ::end_of_request(); } - elsif (($form->{type} =~ /_order$/) || ($form->{type} =~ /_quotation$/)) { - $form->{print_and_save} = 1; - save(); - } - &print_form($old_form); @@ -1506,18 +1506,20 @@ sub print_form { } # search for the template - my @template_files; - push @template_files, "$form->{formname}_email$form->{language}$printer_code.$extension" if $form->{media} eq 'email'; - push @template_files, "$form->{formname}$form->{language}$printer_code.$extension"; - push @template_files, "$form->{formname}.$extension"; - push @template_files, "default.$extension"; - @template_files = uniq @template_files; - $form->{IN} = first { -f ($defaults->templates . "/$_") } @template_files; - - if (!defined $form->{IN}) { + my ($template_file, @template_files) = SL::Helper::CreatePDF->find_template( + name => $form->{formname}, + email => $form->{media} eq 'email', + language_id => $form->{language_id}, + printer_id => $form->{printer_id}, + extension => $extension, + ); + + if (!defined $template_file) { $::form->error($::locale->text('Cannot find matching template for this print request. Please contact your template maintainer. I tried these: #1.', join ', ', map { "'$_'"} @template_files)); } + $form->{IN} = $template_file; + delete $form->{OUT}; if ($form->{media} eq 'printer') {