X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fdo.pl;h=9d28bbb0d8c4a6602b578ad5f4cca7811c2dac49;hb=3adb0cb772af4bcdbd867b5688b3e02356a2e613;hp=e95aaf82c634dda5b3c86a8187505319bc35cfda;hpb=de9a3d743c168703dcaf3aef85dd2d117aacecc9;p=kivitendo-erp.git
diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl
index e95aaf82c..9d28bbb0d 100644
--- a/bin/mozilla/do.pl
+++ b/bin/mozilla/do.pl
@@ -40,7 +40,6 @@ use SL::IR;
use SL::IS;
use SL::ReportGenerator;
use SL::WH;
-
require "bin/mozilla/arap.pl";
require "bin/mozilla/common.pl";
require "bin/mozilla/invoice_io.pl";
@@ -174,8 +173,8 @@ sub order_links {
DO->retrieve('vc' => $form->{vc},
'ids' => $form->{id});
- $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes));
- $form->{shipto} = 1 if $form->{id};
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes currency));
+ $form->{shipto} = 1 if $form->{id} || $form->{convert_from_oe_ids};
# get customer / vendor
if ($form->{vc} eq 'vendor') {
@@ -187,6 +186,7 @@ sub order_links {
}
$form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(currency)) if ($form->{id} || $form->{convert_from_oe_ids});
$form->restore_vars(qw(taxincluded)) if $form->{id};
$form->restore_vars(qw(salesman_id)) if $editing;
@@ -301,8 +301,17 @@ sub form_header {
$form->header();
# Fix für Bug 1082 Erwartet wird: 'abteilungsNAME--abteilungsID'
- $form->{department} .= '--' . $form->{department_id};
-
+ # und Erweiterung für Bug 1760:
+ # Das war leider nur ein Teil-Fix, da das Verhalten den 'Erneuern'-Knopf
+ # nicht überlebt. Konsequent jetzt auf L umgestellt
+ # $ perldoc SL::Template::Plugin::L
+ # Daher entsprechend nur die Anpassung in form_header
+ # und in DO.pm gemacht. 4 Testfälle:
+ # department_id speichern | i.O.
+ # department_id lesen | i.O.
+ # department leer überlebt erneuern | i.O.
+ # department nicht leer überlebt erneuern | i.O.
+ # $main::lxdebug->message(0, 'ABTEILUNGS ID in form?' . $form->{department_id});
print $form->parse_html_template('do/form_header');
$main::lxdebug->leave_sub();
@@ -364,10 +373,13 @@ sub update_delivery_order {
} else {
+ my $mode;
if ($form->{type} eq 'purchase_delivery_order') {
IR->retrieve_item(\%myconfig, $form);
+ $mode = 'IR';
} else {
IS->retrieve_item(\%myconfig, $form);
+ $mode = 'IS';
}
my $rows = scalar @{ $form->{item_list} };
@@ -377,7 +389,7 @@ sub update_delivery_order {
if ($rows > 1) {
- select_item();
+ select_item(mode => $mode);
::end_of_request();
} else {
@@ -451,7 +463,7 @@ sub orders {
my $form = $main::form;
my %myconfig = %main::myconfig;
my $locale = $main::locale;
- my $cgi = $main::cgi;
+ my $cgi = $::request->{cgi};
($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
@@ -465,7 +477,7 @@ sub orders {
ids transdate
id donumber
ordnumber
- name employee
+ name employee salesman
shipvia globalprojectnumber
transaction_description
open delivered
@@ -494,6 +506,7 @@ sub orders {
'ordnumber' => { 'text' => $locale->text('Order'), },
'name' => { 'text' => $form->{vc} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
'employee' => { 'text' => $locale->text('Employee'), },
+ 'salesman' => { 'text' => $locale->text('Salesman'), },
'shipvia' => { 'text' => $locale->text('Ship via'), },
'globalprojectnumber' => { 'text' => $locale->text('Project Number'), },
'transaction_description' => { 'text' => $locale->text('Transaction description'), },
@@ -501,7 +514,7 @@ sub orders {
'delivered' => { 'text' => $locale->text('Delivered'), },
);
- foreach my $name (qw(id transdate donumber ordnumber name employee shipvia transaction_description)) {
+ foreach my $name (qw(id transdate donumber ordnumber name employee salesman shipvia transaction_description)) {
my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
$column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
}
@@ -769,6 +782,7 @@ sub invoice {
require "bin/mozilla/$form->{script}";
my $currency = $form->{currency};
+ $form->{shipto} = 1 if $form->{convert_from_do_ids};
invoice_links();
if ($form->{ordnumber}) {
@@ -815,6 +829,13 @@ sub invoice {
}
+ # show pricegroup in newly loaded invoice when creating invoice from delivery order
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"sellprice_pg_$i"} = join '--', $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
+ }
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
+
display_form();
$main::lxdebug->leave_sub();
@@ -913,6 +934,14 @@ sub invoice_multi {
invoice_links();
prepare_invoice();
+
+ # show pricegroup in newly loaded invoice when creating invoice from delivery order
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"sellprice_pg_$i"} = join '--', $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
+ }
+ IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+ set_pricegroup($_) for 1 .. $form->{rowcount};
+
display_form();
$main::lxdebug->leave_sub();
@@ -981,14 +1010,16 @@ sub calculate_stock_in_out {
my $in_out = $form->{type} =~ /^sales/ ? 'out' : 'in';
my $sinfo = DO->unpack_stock_information('packed' => $form->{"stock_${in_out}_${i}"});
+ my $do_qty = AM->sum_with_unit($::form->{"qty_$i"}, $::form->{"unit_$i"});
my $sum = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $sinfo });
+ my $matches = $do_qty == $sum;
my $content = $form->format_amount_units('amount' => $sum * 1,
'part_unit' => $form->{"partunit_$i"},
'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit},
'conv_units' => 'convertible_not_smaller',
'max_places' => 2);
- $content = qq|${content} |;
+ $content = qq|${content} |;
$main::lxdebug->leave_sub();
@@ -1143,8 +1174,13 @@ sub set_stock_in {
_stock_in_out_set_qty_display($stock_info);
+ my $do_qty = AM->sum_with_unit($::form->parse_amount(\%::myconfig, $::form->{do_qty}), $::form->{do_unit});
+ my $transfer_qty = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info });
+
$form->header();
- print $form->parse_html_template('do/set_stock_in_out');
+ print $form->parse_html_template('do/set_stock_in_out', {
+ qty_matches => $do_qty == $transfer_qty,
+ });
$main::lxdebug->leave_sub();
}
@@ -1238,8 +1274,13 @@ sub set_stock_out {
} else {
_stock_in_out_set_qty_display($stock_info);
+ my $do_qty = AM->sum_with_unit($::form->parse_amount(\%::myconfig, $::form->{do_qty}), $::form->{do_unit});
+ my $transfer_qty = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info });
+
$form->header();
- print $form->parse_html_template('do/set_stock_in_out');
+ print $form->parse_html_template('do/set_stock_in_out', {
+ qty_matches => $do_qty == $transfer_qty,
+ });
}
$main::lxdebug->leave_sub();