Revision 2aec7b6d
Von Tamino Steinert vor 12 Monaten hinzugefügt
SL/Controller/Reclamation.pm | ||
---|---|---|
81 | 81 |
save_and_credit_note |
82 | 82 |
)]); |
83 | 83 |
|
84 |
__PACKAGE__->run_before('get_record_links_data_from_form', |
|
85 |
only => [qw( |
|
86 |
save save_as_new print preview_pdf send_email |
|
87 |
save_and_show_email_dialog |
|
88 |
save_and_new_record |
|
89 |
save_and_credit_note |
|
90 |
)]); |
|
91 |
|
|
92 | 84 |
# |
93 | 85 |
# actions |
94 | 86 |
# |
... | ... | |
1536 | 1528 |
} |
1537 | 1529 |
} |
1538 | 1530 |
|
1539 |
# get data for record_links from form and store it in the object |
|
1540 |
sub get_record_links_data_from_form { |
|
1541 |
my ($self) = @_; |
|
1542 |
|
|
1543 |
my $reclamation = $self->reclamation; |
|
1544 |
|
|
1545 |
$reclamation->{RECORD_ID()} = delete $::form->{converted_from_record_id}; |
|
1546 |
$reclamation->{RECORD_TYPE_REF()} = delete $::form->{converted_from_record_type_ref}; |
|
1547 |
|
|
1548 |
my $from_record_item_ids = delete $::form->{converted_from_record_item_ids} ; |
|
1549 |
my $from_record_item_type_refs = delete $::form->{converted_from_record_item_type_refs} ; |
|
1550 |
|
|
1551 |
if (scalar @{ $from_record_item_ids || [] }) { |
|
1552 |
for my $idx (0 .. $#{ $reclamation->items_sorted }) { |
|
1553 |
my $reclamation_item = $reclamation->items_sorted->[$idx]; |
|
1554 |
$reclamation_item->{RECORD_ITEM_ID()} = $from_record_item_ids->[$idx]; |
|
1555 |
$reclamation_item->{RECORD_ITEM_TYPE_REF()} = $from_record_item_type_refs->[$idx]; |
|
1556 |
} |
|
1557 |
} |
|
1558 |
} |
|
1559 |
|
|
1560 | 1531 |
# save the reclamation |
1561 | 1532 |
# |
1562 | 1533 |
# And delete items that are deleted in the form. |
1563 | 1534 |
sub save { |
1564 | 1535 |
my ($self) = @_; |
1565 | 1536 |
|
1537 |
set_record_link_conversions($self->order, |
|
1538 |
delete $::form->{RECORD_TYPE_REF()} |
|
1539 |
=> delete $::form->{RECORD_ID()}, |
|
1540 |
delete $::form->{RECORD_ITEM_TYPE_REF()} |
|
1541 |
=> delete $::form->{RECORD_ITEM_ID()}, |
|
1542 |
); |
|
1543 |
|
|
1566 | 1544 |
my $items_to_delete = scalar @{ $self->item_ids_to_delete || [] } |
1567 | 1545 |
? SL::DB::Manager::ReclamationItem->get_all(where => [id => $self->item_ids_to_delete]) |
1568 | 1546 |
: undef; |
Auch abrufbar als: Unified diff
Reclamation: Angepasst Type und ID zum Erstellen von verknüpften Belegen