From: Sven Schöling Date: Tue, 2 Jan 2018 12:22:03 +0000 (+0100) Subject: Presenter::CustomerVendor: interface normalisiert X-Git-Tag: release-3.5.4~542 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4ad234198fff37e69137529a6eafbfd647fd6898;p=kivitendo-erp.git Presenter::CustomerVendor: interface normalisiert es gibt jetzt zusätzlich: - customer_picker - vendor_picker die auf den jeweiligen typ gecrurried sind --- diff --git a/SL/Presenter/CustomerVendor.pm b/SL/Presenter/CustomerVendor.pm index 80b85f9e3..4a563e46c 100644 --- a/SL/Presenter/CustomerVendor.pm +++ b/SL/Presenter/CustomerVendor.pm @@ -6,7 +6,7 @@ use SL::Presenter::EscapedText qw(escape is_escaped); use SL::Presenter::Tag qw(input_tag html_tag name_to_id select_tag); use Exporter qw(import); -our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker); +our @EXPORT_OK = qw(customer_vendor customer vendor customer_vendor_picker customer_picker vendor_picker); use Carp; @@ -46,6 +46,9 @@ sub _customer_vendor { sub customer_vendor_picker { my ($name, $value, %params) = @_; + $params{type} //= 'customer' if 'SL::DB::Customer' eq ref $value; + $params{type} //= 'vendor' if 'SL::DB::Vendor' eq ref $value; + croak 'Unknown "type" parameter' unless $params{type} =~ m{^(?:customer|vendor)$}; croak 'Unknown value class' if $value && ref($value) && (ref($value) !~ m{^SL::DB::(?:Customer|Vendor)$}); @@ -71,7 +74,9 @@ sub customer_vendor_picker { html_tag('span', $ret, class => 'customer_vendor_picker'); } -sub picker { goto &customer_vendor_picker } +sub customer_picker { my ($name, $value, @slurp) = @_; customer_vendor_picker($name, $value, @slurp, type => 'customer') } +sub vendor_picker { my ($name, $value, @slurp) = @_; customer_vendor_picker($name, $value, @slurp, type => 'vendor') } +sub picker { goto &customer_vendor_picker } 1;