From: Niclas Zimmermann Date: Thu, 13 Sep 2012 12:49:02 +0000 (+0200) Subject: Merge branch 'master' of vc.linet-services.de:public/lx-office-erp X-Git-Tag: release-3.0.0beta1~238 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/ffac48200e07de28e9efcb20c668ba3f1e3ed12e?hp=cd98d068d97cb6a981d931898c5a230cd8efc0a2 Merge branch 'master' of vc.linet-services.de:public/lx-office-erp --- diff --git a/SL/WH.pm b/SL/WH.pm index 9a0635603..28e836e48 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -111,8 +111,7 @@ sub transfer { ); if ($unit) { - $qty *= $unit->factor || 1; - $qty /= $part->unit_obj->factor || 1 if $part->unit; + $qty = $unit->convert_to($qty, $part->unit_obj); } $params{chargenumber} ||= ''; diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 1eddce3b2..3324551f6 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1841,7 +1841,6 @@ sub save { $form->error($locale->text('Partnumber must not be set to empty!')) if $form->{id} && !$form->{partnumber}; # save part - $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n"); if (IC->save(\%myconfig, \%$form) == 3) { $form->error($locale->text('Partnumber not unique!')); } @@ -1909,8 +1908,6 @@ sub save { $form->{"sellprice_$i"} /= $form->{exchangerate}; } - $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|); - map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount}; chop $form->{"taxaccounts_$i"}; foreach my $item (qw(description rate taxnumber)) { @@ -1959,7 +1956,6 @@ sub save { } $form->{callback} = $callback; } - $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|); # redirect $form->redirect; diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 20b497c31..4716f60e3 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -90,6 +90,8 @@ sub edit { $main::auth->assert('invoice_edit'); + $form->{taxincluded_changed_by_user} = 1; + # show history button $form->{javascript} = qq||; #/show hhistory button diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index cac445036..51b3c77ca 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -153,6 +153,8 @@ sub edit { check_oe_access(); + $form->{taxincluded_changed_by_user} = 1; + # show history button $form->{javascript} = qq||; #/show hhistory button diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index aa372463a..c77d74dde 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -86,7 +86,7 @@ sub transfer_warehouse_selection { my $units = AM->retrieve_units(\%myconfig, $form); # der zweite Parameter von unit_select_data gibt den default-Namen (selected) vor - $form->{UNITS} = AM->unit_select_data($units, $form->{partunit}, 0, $form->{partunit}); + $form->{UNITS} = AM->unit_select_data($units, $form->{unit}, 0, $form->{unit}); if (scalar @{ $form->{WAREHOUSES} }) { $form->{warehouse_id} ||= $form->{WAREHOUSES}->[0]->{id}; diff --git a/t/wh/transfer.t b/t/wh/transfer.t index 94767529c..8d88fb178 100644 --- a/t/wh/transfer.t +++ b/t/wh/transfer.t @@ -8,10 +8,16 @@ use_ok 'SL::DB::Part'; use_ok 'SL::DB::Warehouse'; use_ok 'SL::WH'; +use_ok('SL::DB::Inventory'); + + Support::TestSetup::login(); -my $part = SL::DB::Manager::Part->get_first; -is(ref $part, 'SL::DB::Part', 'loading a part to test with id ' . $part->id); +my $part = SL::DB::Part->new(unit => 'mg', description => 'TestObject'); +$part->save(); + +is(ref($part), 'SL::DB::Part', 'loading a part to test with id ' . $part->id); + my $wh = SL::DB::Manager::Warehouse->get_first; is(ref $wh, 'SL::DB::Warehouse', 'loading a warehouse to test with id ' . $wh->id); @@ -71,6 +77,20 @@ test { shift->{qty}, shift->{qty} - 4, 'and back' } { chargenumber => '', }; +################################################# + +test {shift->{qty}, shift->{qty} + 4000000000, 'transfer one way with unit'} { + transfer_type => 'transfer', + parts_id => $part->id, + src_warehouse_id => $wh->id, + dst_warehouse_id => $wh->id, + src_bin_id => $bin1->id, + dst_bin_id => $bin2->id, + qty => 4, + unit => 't', + chargenumber => '', +}; + ############################################## use_ok 'SL::DB::TransferType'; @@ -138,6 +158,10 @@ test { shift->{qty}, shift->{qty}, 'warehouse reduced interface' } { }; +SL::DB::Manager::Inventory->delete_objects(where => [parts_id => $part->id]); + +$part->delete(); + done_testing; 1; diff --git a/templates/webpages/ct/form_header.html b/templates/webpages/ct/form_header.html index 26e71b139..8530b1e14 100644 --- a/templates/webpages/ct/form_header.html +++ b/templates/webpages/ct/form_header.html @@ -404,7 +404,7 @@ [% L.date_tag('FU_date', FU_date) %] [% 'for' | $T8 %] - [% L.select_tag('FU_created_for_user', ALL_EMPLOYEES, default = (FU_created_for_user ? FU_created_for_user : USER.id), title='safe_name') %] + [% L.select_tag('FU_created_for_user', ALL_EMPLOYEES, default = (FU_created_for_user ? FU_created_for_user : USER.id), title_key='safe_name') %] diff --git a/templates/webpages/do/form_header.html b/templates/webpages/do/form_header.html index b9c1d690b..e12f0da9b 100644 --- a/templates/webpages/do/form_header.html +++ b/templates/webpages/do/form_header.html @@ -139,7 +139,7 @@ [%- HTML.escape(row.cp_name) %][%- IF row.cp_abteilung %] ([% HTML.escape(row.cp_abteilung) %])[% END -%] [%- END %] [%- ELSE %] - [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value = 'cp_id', title = 'full_name_dep', with_empty = 1, style='width: 250px') %] + [% L.select_tag('cp_id', ALL_CONTACTS, default = cp_id, value_key = 'cp_id', title_key = 'full_name_dep', with_empty = 1, style='width: 250px') %] [%- END %] @@ -192,7 +192,7 @@ [% IF ( delivered ) %] [% L.hidden_tag('department_id', department_id) %] [% END %] - [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%] + [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style = 'width: 250px', disabled = delivered )%] [%- END %] @@ -253,7 +253,7 @@ [% IF row.id == employee_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %] [%- END %] [%- ELSE %] - [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title = 'safe_name') %] + [% L.select_tag('employee_id', ALL_EMPLOYEES, default = employee_id, title_key = 'safe_name') %] [%- END %] @@ -273,7 +273,7 @@ [% IF row.id == the_salesman_id %][%- IF row.name %][%- HTML.escape(row.name) %][%- ELSE %][% HTML.escape(row.login) %][%- END %][% END %] [%- END %] [%- ELSE %] - [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title = 'safe_name') %] + [% L.select_tag('salesman_id', ALL_SALESMEN, default = (salesman_id ? salesman_id : employee_id), title_key = 'safe_name') %] [%- END %] diff --git a/templates/webpages/is/form_header.html b/templates/webpages/is/form_header.html index 24b253f04..433d3b14e 100644 --- a/templates/webpages/is/form_header.html +++ b/templates/webpages/is/form_header.html @@ -226,7 +226,7 @@ [% 'Project Number' | $T8 %] - [%- L.select_tag('globalproject_id', ALL_PROJECTS, title='projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %] + [%- L.select_tag('globalproject_id', ALL_PROJECTS, title_key = 'projectnumber', default = globalproject_id, with_empty = '1', onChange = "document.getElementById('update_button').click();") %]