Revision 3b01b816
Von Moritz Bunkus vor fast 10 Jahren hinzugefügt
SL/Presenter/CustomerVendor.pm | ||
---|---|---|
39 | 39 |
sub customer_vendor_picker { |
40 | 40 |
my ($self, $name, $value, %params) = @_; |
41 | 41 |
|
42 |
$value = SL::DB::Manager::Customer->find_by(id => $value) if $value && !ref $value; |
|
42 |
croak 'Unknown "type" parameter' unless $params{type} =~ m{^(?:customer|vendor)$}; |
|
43 |
croak 'Unknown value class' if $value && (ref($value) !~ m{^SL::DB::(?:Customer|Vendor)$}); |
|
44 |
|
|
45 |
if ($value && !ref $value) { |
|
46 |
my $class = $params{type} eq 'customer' ? 'SL::DB::Manager::Customer' : 'SL::DB::Manager::Vendor'; |
|
47 |
$value = $class->find_by(id => $value); |
|
48 |
} |
|
49 |
|
|
43 | 50 |
my $id = delete($params{id}) || $self->name_to_id($name); |
44 | 51 |
my $fat_set_item = delete $params{fat_set_item}; |
45 | 52 |
|
Auch abrufbar als: Unified diff
CustomerVendor-Presenter: croaken, wenn Parameter fehlen oder falsch sind