Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
authorNiclas Zimmermann <niclas@lx-office-hosting.de>
Thu, 13 Sep 2012 12:49:02 +0000 (14:49 +0200)
committerNiclas Zimmermann <niclas@lx-office-hosting.de>
Thu, 13 Sep 2012 12:49:02 +0000 (14:49 +0200)
SL/WH.pm
bin/mozilla/ic.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
bin/mozilla/wh.pl
t/wh/transfer.t
templates/webpages/ct/form_header.html
templates/webpages/do/form_header.html
templates/webpages/is/form_header.html

index 9a06356..28e836e 100644 (file)
--- 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} ||= '';
index 1eddce3..3324551 100644 (file)
@@ -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;
index 20b497c..4716f60 100644 (file)
@@ -90,6 +90,8 @@ sub edit {
 
   $main::auth->assert('invoice_edit');
 
+  $form->{taxincluded_changed_by_user} = 1;
+
   # show history button
   $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
   #/show hhistory button
index cac4450..51b3c77 100644 (file)
@@ -153,6 +153,8 @@ sub edit {
 
   check_oe_access();
 
+  $form->{taxincluded_changed_by_user} = 1;
+
   # show history button
   $form->{javascript} = qq|<script type="text/javascript" src="js/show_history.js"></script>|;
   #/show hhistory button
index aa37246..c77d74d 100644 (file)
@@ -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};
index 9476752..8d88fb1 100644 (file)
@@ -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;
index 26e71b1..8530b1e 100644 (file)
        <td>
         [% 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') %]
        </td>
       </tr>
 
index b9c1d69..e12f0da 100644 (file)
           [%- 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 %]
          </td>
         </tr>
           [% 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 )%]
        </td>
        </tr>
        [%- END %]
          [% 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 %]
         </td>
        </tr>
          [% 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 %]
         </td>
        </tr>
index 24b253f..433d3b1 100644 (file)
         <tr>
           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
           <td>
-            [%- 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();") %]
           </td>
         </tr>
       </table>