Revision 093eb08b
Von Sven Schöling vor mehr als 1 Jahr hinzugefügt
SL/DB/DeliveryOrder.pm | ||
---|---|---|
$self,
|
||
\@allowed_record_sources,
|
||
\@allowed_item_sources,
|
||
close_source_quotations => 1,
|
||
);
|
||
}
|
||
|
SL/DB/Helper/RecordLink.pm | ||
---|---|---|
our @EXPORT_OK = qw(RECORD_ID RECORD_TYPE_REF RECORD_ITEM_ID RECORD_ITEM_TYPE_REF set_record_link_conversions);
|
||
|
||
sub link_records {
|
||
my ($self, $allowed_linked_records, $allowed_linked_record_items, %flags) = @_;
|
||
my ($self, $allowed_linked_records, $allowed_linked_record_items) = @_;
|
||
|
||
my %allowed_linked_records = map {$_ => 1} @$allowed_linked_records;
|
||
my %allowed_linked_record_items = map {$_ => 1} @$allowed_linked_record_items;
|
||
... | ... | |
for my $id (listify($from_record_ids)) {
|
||
my $from_record = $from_record_type->new(id => $id)->load;
|
||
$from_record->link_to_record($self);
|
||
|
||
close_quotations($from_record, %flags);
|
||
}
|
||
|
||
#clear converted_from;
|
||
... | ... | |
}
|
||
|
||
|
||
sub close_quotations {
|
||
my ($from_record, %flags) = @_;
|
||
|
||
return unless $flags{close_source_quotations};
|
||
return unless 'SL::DB::Order' eq ref $from_record;
|
||
return unless $from_record->type =~ /quotation/;
|
||
|
||
$from_record->update_attributes(closed => 1);
|
||
}
|
||
|
||
sub set_record_link_conversions {
|
||
my ($record, $from_type, $from_ids, $item_type, $item_ids) = @_;
|
||
|
||
... | ... | |
$self,
|
||
[ qw(SL::DB::Order) ], # list of allowed record sources
|
||
[ qw(SL::DB::OrderItem) ], # list of allowed record item sources
|
||
close_source_quotations => 1, # if the link source is a quotation - close it
|
||
)
|
||
}
|
||
|
SL/DB/Order.pm | ||
---|---|---|
$self,
|
||
\@allowed_record_sources,
|
||
\@allowed_item_sources,
|
||
close_source_quotations => 1,
|
||
);
|
||
}
|
||
|
Auch abrufbar als: Unified diff
LinkRecord: close_quotations nicht mehr im link record post save hook ausführen
Das war Teil der link_record behandlung, ist aber so unintuitiv, dass es
jetzt vom Controller an den Model::Record gegeben wird.