1 package SL::Presenter::DeliveryOrder;
5 use parent qw(Exporter);
7 use Exporter qw(import);
8 our @EXPORT = qw(sales_delivery_order purchase_delivery_order);
12 sub sales_delivery_order {
13 my ($self, $delivery_order, %params) = @_;
15 return _do_record($self, $delivery_order, 'sales_delivery_order', %params);
18 sub purchase_delivery_order {
19 my ($self, $delivery_order, %params) = @_;
21 return _do_record($self, $delivery_order, 'purchase_delivery_order', %params);
25 my ($self, $delivery_order, $type, %params) = @_;
27 $params{display} ||= 'inline';
29 croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
32 $params{no_link} ? '' : '<a href="do.pl?action=edit&type=' . $type . '&id=' . $self->escape($delivery_order->id) . '">',
33 $self->escape($delivery_order->donumber),
34 $params{no_link} ? '' : '</a>',
36 return $self->escaped_text($text);
49 SL::Presenter::DeliveryOrder - Presenter module for Rose::DB objects
50 for sales and purchase delivery orders
54 # Sales delivery orders:
55 my $object = SL::DB::Manager::DeliveryOrder->get_first(where => [ is_sales => 1 ]);
56 my $html = SL::Presenter->get->sales_delivery_order($object, display => 'inline');
58 # Purchase delivery orders:
59 my $object = SL::DB::Manager::DeliveryOrder->get_first(where => [ or => [ is_sales => undef, is_sales => 0 ]]);
60 my $html = SL::Presenter->get->purchase_delivery_order($object, display => 'inline');
66 =item C<sales_delivery_order $object, %params>
68 Returns a rendered version (actually an instance of
69 L<SL::Presenter::EscapedText>) of the sales delivery order object
72 C<%params> can include:
78 Either C<inline> (the default) or C<table-cell>. At the moment both
79 representations are identical and produce the objects's delivery
80 order number linked to the corresponding 'edit' action.
84 If falsish (the default) then the delivery order number will be linked
85 to the "edit delivery order" dialog from the sales menu.
89 =item C<purchase_delivery_order $object, %params>
91 Returns a rendered version (actually an instance of
92 L<SL::Presenter::EscapedText>) of the purchase delivery order object
95 C<%params> can include:
101 Either C<inline> (the default) or C<table-cell>. At the moment both
102 representations are identical and produce the objects's delivery
103 order number linked to the corresponding 'edit' action.
107 If falsish (the default) then the delivery order number will be linked
108 to the "edit delivery order" dialog from the purchase menu.
120 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>