);
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} ||= '';
$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!'));
}
$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)) {
}
$form->{callback} = $callback;
}
- $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|);
# redirect
$form->redirect;
$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
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
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};
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);
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';
};
+SL::DB::Manager::Inventory->delete_objects(where => [parts_id => $part->id]);
+
+$part->delete();
+
done_testing;
1;
<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>
[%- 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>
<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>