Revision c84c3960
Von Sven Schöling vor etwa 1 Jahr hinzugefügt
SL/DB/Reclamation.pm | ||
---|---|---|
206 | 206 |
require SL::DB::Order; |
207 | 207 |
$order = SL::DB::Order->new_from($self, %params); |
208 | 208 |
$order->save; |
209 |
$self->link_to_record($order); |
|
210 |
foreach my $item (@{ $order->items }) { |
|
211 |
foreach (qw(reclamation_item)) { |
|
212 |
if ($item->{"converted_from_${_}_id"}) { |
|
213 |
die unless $item->{id}; |
|
214 |
RecordLinks->create_links('dbh' => $self->db->dbh, |
|
215 |
'mode' => 'ids', |
|
216 |
'from_table' => 'reclamation_items', |
|
217 |
'from_ids' => $item->{"converted_from_${_}_id"}, |
|
218 |
'to_table' => 'orderitems', |
|
219 |
'to_id' => $item->{id}, |
|
220 |
) || die; |
|
221 |
delete $item->{"converted_from_${_}_id"}; |
|
222 |
} |
|
223 |
} |
|
224 |
} |
|
225 | 209 |
|
226 | 210 |
1; |
227 | 211 |
})) { |
... | ... | |
239 | 223 |
require SL::DB::DeliveryOrder; |
240 | 224 |
$delivery_order = SL::DB::DeliveryOrder->new_from($self, %params); |
241 | 225 |
$delivery_order->save; |
242 |
$self->link_to_record($delivery_order); |
|
243 |
# TODO extend link_to_record for items, otherwise long-term no d.r.y. |
|
244 |
foreach my $item (@{ $delivery_order->items }) { |
|
245 |
foreach (qw(reclamation_items)) { |
|
246 |
if ($item->{"converted_from_${_}_id"}) { |
|
247 |
die unless $item->{id}; |
|
248 |
RecordLinks->create_links('dbh' => $self->db->dbh, |
|
249 |
'mode' => 'ids', |
|
250 |
'from_table' => $_, |
|
251 |
'from_ids' => $item->{"converted_from_${_}_id"}, |
|
252 |
'to_table' => 'delivery_order_items', |
|
253 |
'to_id' => $item->{id}, |
|
254 |
) || die; |
|
255 |
delete $item->{"converted_from_${_}_id"}; |
|
256 |
} |
|
257 |
} |
|
258 |
} |
|
259 | 226 |
|
260 | 227 |
$self->update_attributes(delivered => 1) unless $::instance_conf->get_shipped_qty_require_stock_out; |
261 | 228 |
1; |
Auch abrufbar als: Unified diff
RecordLink: converted_from_* Felder in allen convert_to und new_from korrekt setzen.
Das hier benutzt jetzt das neue Reclamation Format. Statt
wird jetzt
benutzt.