Revision 4ad23419
Von Sven Schöling vor fast 7 Jahren hinzugefügt
SL/Presenter/CustomerVendor.pm | ||
---|---|---|
6 | 6 |
use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag); |
7 | 7 |
|
8 | 8 |
use Exporter qw(import); |
9 |
our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker); |
|
9 |
our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker customer_picker vendor_picker);
|
|
10 | 10 |
|
11 | 11 |
use Carp; |
12 | 12 |
|
... | ... | |
46 | 46 |
sub customer_vendor_picker { |
47 | 47 |
my ($name, $value, %params) = @_; |
48 | 48 |
|
49 |
$params{type} //= 'customer' if 'SL::DB::Customer' eq ref $value; |
|
50 |
$params{type} //= 'vendor' if 'SL::DB::Vendor' eq ref $value; |
|
51 |
|
|
49 | 52 |
croak 'Unknown "type" parameter' unless $params{type} =~ m{^(?:customer|vendor)$}; |
50 | 53 |
croak 'Unknown value class' if $value && ref($value) && (ref($value) !~ m{^SL::DB::(?:Customer|Vendor)$}); |
51 | 54 |
|
... | ... | |
71 | 74 |
html_tag('span', $ret, class => 'customer_vendor_picker'); |
72 | 75 |
} |
73 | 76 |
|
74 |
sub picker { goto &customer_vendor_picker } |
|
77 |
sub customer_picker { my ($name, $value, @slurp) = @_; customer_vendor_picker($name, $value, @slurp, type => 'customer') } |
|
78 |
sub vendor_picker { my ($name, $value, @slurp) = @_; customer_vendor_picker($name, $value, @slurp, type => 'vendor') } |
|
79 |
sub picker { goto &customer_vendor_picker } |
|
75 | 80 |
|
76 | 81 |
1; |
77 | 82 |
|
Auch abrufbar als: Unified diff
Presenter::CustomerVendor: interface normalisiert
es gibt jetzt zusätzlich:
- customer_picker
- vendor_picker
die auf den jeweiligen typ gecrurried sind