1 package SL::Presenter::CustomerVendor;
5 use parent qw(Exporter);
7 use Exporter qw(import);
8 our @EXPORT = qw(customer vendor);
13 my ($self, $customer, $type, %params) = @_;
14 return _customer_vendor($self, $customer, 'customer', %params);
18 my ($self, $vendor, $type, %params) = @_;
19 return _customer_vendor($self, $vendor, 'vendor', %params);
22 sub _customer_vendor {
23 my ($self, $cv, $type, %params) = @_;
25 $params{display} ||= 'inline';
27 croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
30 $params{no_link} ? '' : '<a href="controller.pl?action=CustomerVendor/edit&db=' . $type . '&id=' . $self->escape($cv->id) . '">',
31 $self->escape($cv->name),
32 $params{no_link} ? '' : '</a>',
34 return $self->escaped_text($text);
47 SL::Presenter::CustomerVendor - Presenter module for customer and
48 vendor Rose::DB objects
53 my $customer = SL::DB::Manager::Customer->get_first;
54 my $html = SL::Presenter->get->customer($customer, display => 'inline');
57 my $vendor = SL::DB::Manager::Vendor->get_first;
58 my $html = SL::Presenter->get->vendor($customer, display => 'inline');
64 =item C<customer $object, %params>
66 Returns a rendered version (actually an instance of
67 L<SL::Presenter::EscapedText>) of the customer object C<$object>.
69 C<%params> can include:
75 Either C<inline> (the default) or C<table-cell>. At the moment both
76 representations are identical and produce the customer's name linked
77 to the corresponding 'edit' action.
81 If falsish (the default) then the customer's name will be linked to
82 the "edit customer" dialog from the master data menu.
86 =item C<vendor $object, %params>
88 Returns a rendered version (actually an instance of
89 L<SL::Presenter::EscapedText>) of the vendor object C<$object>.
91 C<%params> can include:
97 Either C<inline> (the default) or C<table-cell>. At the moment both
98 representations are identical and produce the vendor's name linked
99 to the corresponding 'edit' action.
103 If falsish (the default) then the vendor's name will be linked to
104 the "edit vendor" dialog from the master data menu.
116 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>