($form->{AR_paid}) = split /--/, $form->{AR_paid};
$form->{storno} ||= 0;
- $form->{label} = $locale->text('Invoice');
+ $form->{label} = $form->{type} eq 'credit_note' ? $locale->text('Credit Note') : $locale->text('Invoice');
$form->{id} = 0 if $form->{postasnew};
remove_draft() if $form->{remove_draft};
if(!exists $form->{addition}) {
- $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{snumbers} = 'invnumber' .'_'. $form->{invnumber}; # ($form->{type} eq 'credit_note' ? 'cnnumber' : 'invnumber') .'_'. $form->{invnumber};
$form->{addition} = $form->{print_and_post} ? "PRINTED AND POSTED" :
$form->{storno} ? "STORNO" :
"POSTED";
if (IS->delete_invoice(\%myconfig, \%$form)) {
# saving the history
if(!exists $form->{addition}) {
- $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
+ $form->{snumbers} = 'invnumber' .'_'. $form->{invnumber}; # ($form->{type} eq 'credit_note' ? 'cnnumber' : 'invnumber') .'_'. $form->{invnumber};
$form->{addition} = "DELETED";
$form->save_history;
}
$config->{numberformat} = '1.000,00';
-is($form->format_amount($config, '1e1', 2), '10,00', 'blaa');
-is($form->format_amount($config, 1000, 2), '1.000,00', 'blaa');
-is($form->format_amount($config, 1000.1234, 2), '1.000,12', 'blaa');
-is($form->format_amount($config, 1000000000.1234, 2), '1.000.000.000,12', 'blaa');
-is($form->format_amount($config, -1000000000.1234, 2), '-1.000.000.000,12', 'blaa');
+is($form->format_amount($config, '1e1', 2), '10,00', 'format 1e1 (numberformat: 1.000,00)');
+is($form->format_amount($config, 1000, 2), '1.000,00', 'format 1000 (numberformat: 1.000,00)');
+is($form->format_amount($config, 1000.1234, 2), '1.000,12', 'format 1000.1234 (numberformat: 1.000,00)');
+is($form->format_amount($config, 1000000000.1234, 2), '1.000.000.000,12', 'format 1000000000.1234 (numberformat: 1.000,00)');
+is($form->format_amount($config, -1000000000.1234, 2), '-1.000.000.000,12', 'format -1000000000.1234 (numberformat: 1.000,00)');
$config->{numberformat} = '1,000.00';
-is($form->format_amount($config, '1e1', 2), '10.00', 'blaa');
-is($form->format_amount($config, 1000, 2), '1,000.00', 'blaa');
-is($form->format_amount($config, 1000.1234, 2), '1,000.12', 'blaa');
-is($form->format_amount($config, 1000000000.1234, 2), '1,000,000,000.12', 'blaa');
-is($form->format_amount($config, -1000000000.1234, 2), '-1,000,000,000.12', 'blaa');
+is($form->format_amount($config, '1e1', 2), '10,00', 'format 1e1 (numberformat: 1,000.00)');
+is($form->format_amount($config, 1000, 2), '1.000,00', 'format 1000 (numberformat: 1,000.00)');
+is($form->format_amount($config, 1000.1234, 2), '1.000,12', 'format 1000.1234 (numberformat: 1,000.00)');
+is($form->format_amount($config, 1000000000.1234, 2), '1.000.000.000,12', 'format 1000000000.1234 (numberformat: 1,000.00)');
+is($form->format_amount($config, -1000000000.1234, 2), '-1.000.000.000,12', 'format -1000000000.1234 (numberformat: 1,000.00)');
done_testing;