Revision 1ef85bf9
Von Jan Büren vor mehr als 9 Jahren hinzugefügt
t/db_helper/convert_invoice.t | ||
---|---|---|
1 |
use Test::More tests => 38;
|
|
1 |
use Test::More tests => 42;
|
|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
... | ... | |
98 | 98 |
'sellprice' => '242.20000', |
99 | 99 |
#'warehouse_id' => 64702, |
100 | 100 |
'weight' => '0.79', |
101 |
description => "Nussbaum, Gr.5, Unterfilz weinrot, genietet[[Aufschnittbreite: 11,0, Kernform: US]]\"" ,
|
|
101 |
description => "Pflaumenbaum, Gr.5, Unterfilz weinrot, genietet[[Aufschnittbreite: 11,0, Kernform: US]]\"" ,
|
|
102 | 102 |
buchungsgruppen_id => $buchungsgruppe->id, |
103 | 103 |
unit => $unit->name, |
104 | 104 |
id => 26321, |
... | ... | |
142 | 142 |
my $do1 = new_delivery_order('department_id' => 32149, |
143 | 143 |
'donumber' => 'L20199', |
144 | 144 |
'employee_id' => 31915, |
145 |
'intnotes' => 'Achtung: Neue Lieferadresse ab 16.02.2015 in der Carl-von-Ossietzky-Str.32! 13.02.2015/MH
|
|
145 |
'intnotes' => 'Achtung: Neue Lieferadresse ab 16.02.2015 in der Otto-Merck-Str. 7a! 13.02.2015/MH
|
|
146 | 146 |
|
147 |
Steinway-Produkte (201...) immer plus 25% dazu rechnen / BK 13.02.2014',
|
|
147 |
Yamaha-Produkte (201...) immer plus 25% dazu rechnen / BK 13.02.2014',
|
|
148 | 148 |
'ordnumber' => 'A16399', |
149 | 149 |
'payment_id' => 11276, |
150 | 150 |
'salesman_id' => 31915, |
... | ... | |
158 | 158 |
'cusordnumber' => 'b84da', |
159 | 159 |
'customer_id' => $customer->id, |
160 | 160 |
'id' => 464003, |
161 |
'notes' => '<ul><li><strong>fett</strong></li><li><strong>und</strong></li><li><strong>mit</strong></li><li><strong>bullets</strong></li><li> </li></ul>', |
|
161 | 162 |
); |
162 | 163 |
|
163 | 164 |
my $do1_item1 = SL::DB::DeliveryOrderItem->new('delivery_order_id' => 464003, |
164 | 165 |
'description' => "Flügel Hammerkopf bestehend aus: |
165 | 166 |
Bass/Diskant 26/65 Stück, Gesamtlänge 80/72, Bohrlänge 56/48 |
166 |
Nussbaum, Gr.5, Unterfilz weinrot, genietet[[Aufschnittbreite: 11,0, Kernform: US]]",
|
|
167 |
Pflaumenbaum, Gr.5, Unterfilz weinrot, genietet[[Aufschnittbreite: 11,0, Kernform: US]]",
|
|
167 | 168 |
'discount' => '0.25', |
168 | 169 |
'id' => 144736, |
169 | 170 |
'lastcost' => '49.95000', |
170 |
'longdescription' => '',
|
|
171 |
'longdescription' => "<ol><li>27</li><li>28</li><li>29</li><li><sub>asdf</sub></li><li><sub>asdf</sub></li><li><sup>oben</sup></li></ol><p><s>kommt nicht mehr vor</s></p>",
|
|
171 | 172 |
'marge_price_factor' => 1, |
172 | 173 |
'mtime' => undef, |
173 | 174 |
'ordnumber' => 'A16399', |
... | ... | |
211 | 212 |
|
212 | 213 |
# test delivery order before any conversion |
213 | 214 |
ok($do1->donumber eq "L20199", 'Delivery Order Number created'); |
215 |
ok($do1->notes eq '<ul><li><strong>fett</strong></li><li><strong>und</strong></li><li><strong>mit</strong></li><li><strong>bullets</strong></li><li> </li></ul>', "do RichText notes saved"); |
|
214 | 216 |
ok((not $do1->closed) , 'Delivery Order is not closed'); |
215 | 217 |
ok($do1_item1->parts_id eq '26321', 'doi linked with part'); |
216 | 218 |
ok($do1_item1->qty == 2, 'qty check doi'); |
217 |
ok($do1_item2->position == 2, 'doi2 position check'); |
|
218 |
ok(2 == scalar@{ SL::DB::Manager::DeliveryOrderItem->get_all(where => [ delivery_order_id => $do1->id ]) }, 'two doi linked'); |
|
219 |
ok($do1_item1->longdescription eq "<ol><li>27</li><li>28</li><li>29</li><li><sub>asdf</sub></li><li><sub>asdf</sub></li><li><sup>oben</sup></li></ol><p><s>kommt nicht mehr vor</s></p>", |
|
220 |
"do item1 rich text longdescripition"); |
|
221 |
ok ($do1_item2->position == 2, 'doi2 position check'); |
|
222 |
ok (2 == scalar@{ SL::DB::Manager::DeliveryOrderItem->get_all(where => [ delivery_order_id => $do1->id ]) }, 'two doi linked'); |
|
219 | 223 |
|
220 | 224 |
|
221 | 225 |
# convert this do to invoice |
... | ... | |
228 | 232 |
ok ($invoice->shippingpoint eq "Maisenhaus", "shipping point check"); |
229 | 233 |
ok ($invoice->ordnumber eq "A16399", "ordnumber check"); |
230 | 234 |
ok ($invoice->donumber eq "L20199", "donumber check"); |
235 |
ok ($invoice->notes eq '<ul><li><strong>fett</strong></li><li><strong>und</strong></li><li><strong>mit</strong></li><li><strong>bullets</strong></li><li> </li></ul>', "do RichText notes saved"); |
|
231 | 236 |
ok(($do1->closed) , 'Delivery Order is closed after conversion'); |
232 | 237 |
ok (SL::DB::PaymentTerm->new(id => $invoice->{payment_id})->load->description eq "14Tage 2%Skonto, 30Tage netto", 'payment term description check'); |
233 | 238 |
|
... | ... | |
280 | 285 |
ok(2 == scalar@{ $invoice->invoiceitems }, 'two invoice items linked with invoice'); |
281 | 286 |
is(@ {$invoice->items_sorted}[0]->position, 1, "position 1 order correct"); |
282 | 287 |
is(@ {$invoice->items_sorted}[1]->position, 2, "position 2 order correct"); |
288 |
is(@ {$invoice->items_sorted}[0]->longdescription, "<ol><li>27</li><li>28</li><li>29</li><li><sub>asdf</sub></li><li><sub>asdf</sub></li><li><sup>oben</sup></li></ol><p><s>kommt nicht mehr vor</s></p>", |
|
289 |
"invoice item1 rich text longdescripition"); |
|
283 | 290 |
is(@ {$invoice->items_sorted}[0]->part->partnumber, 'v-519160549', "partnumber 1 correct"); |
284 | 291 |
is(@ {$invoice->items_sorted}[1]->part->partnumber, 'v-120160086', "partnumber 2 correct"); |
285 | 292 |
is(@ {$invoice->items_sorted}[0]->qty, '2.00000', "pos 1 qty"); |
Auch abrufbar als: Unified diff
Testfall convert_invoice.t um html-formatierte texte erweitert
Beim Konvertieren von Lieferschein nach Invoice auch explizit die
Formate von CKEditor prüfen. Ferner leichte weitere Anonymisierung der
Warendaten.