1 package SL::Presenter::Order;
5 use parent qw(Exporter);
7 use Exporter qw(import);
8 our @EXPORT = qw(sales_quotation sales_order request_quotation purchase_order);
13 my ($self, $order, %params) = @_;
15 return _oe_record($self, $order, 'sales_quotation', %params);
19 my ($self, $order, %params) = @_;
21 return _oe_record($self, $order, 'sales_order', %params);
24 sub request_quotation {
25 my ($self, $order, %params) = @_;
27 return _oe_record($self, $order, 'request_quotation', %params);
31 my ($self, $order, %params) = @_;
33 return _oe_record($self, $order, 'purchase_order', %params);
37 my ($self, $order, $type, %params) = @_;
39 $params{display} ||= 'inline';
41 croak "Unknown display type '$params{display}'" unless $params{display} =~ m/^(?:inline|table-cell)$/;
43 my $number_method = $order->quotation ? 'quonumber' : 'ordnumber';
46 $params{no_link} ? '' : '<a href="oe.pl?action=edit&type=' . $type . '&id=' . $self->escape($order->id) . '">',
47 $self->escape($order->$number_method),
48 $params{no_link} ? '' : '</a>',
50 return $self->escaped_text($text);
64 SL::Presenter::Order - Presenter module for Rose::DB objects for sales
65 quotations, sales orders, requests for quotations and purchase orders
70 my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_quotation') ]);
71 my $html = SL::Presenter->get->sales_quotation($object, display => 'inline');
74 my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_order') ]);
75 my $html = SL::Presenter->get->sales_order($object, display => 'inline');
77 # Requests for quotations:
78 my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('request_quotation') ]);
79 my $html = SL::Presenter->get->request_quotation($object, display => 'inline');
82 my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('purchase_order') ]);
83 my $html = SL::Presenter->get->purchase_order($object, display => 'inline');
89 =item C<sales_quotation $object, %params>
91 Returns a rendered version (actually an instance of
92 L<SL::Presenter::EscapedText>) of the sales quotation 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
103 quotation number linked to the corresponding 'edit' action.
107 If falsish (the default) then the order number will be linked to the
108 "edit quotation" dialog from the sales menu.
112 =item C<sales_order $object, %params>
114 Returns a rendered version (actually an instance of
115 L<SL::Presenter::EscapedText>) of the sales order object C<$object>.
117 C<%params> can include:
123 Either C<inline> (the default) or C<table-cell>. At the moment both
124 representations are identical and produce the objects's
125 order number linked to the corresponding 'edit' action.
129 If falsish (the default) then the order number will be linked
130 to the "edit order" dialog from the sales menu.
134 =item C<request_quotation $object, %params>
136 Returns a rendered version (actually an instance of
137 L<SL::Presenter::EscapedText>) of the request for quotation object
140 C<%params> can include:
146 Either C<inline> (the default) or C<table-cell>. At the moment both
147 representations are identical and produce the objects's
148 quotation number linked to the corresponding 'edit' action.
152 If falsish (the default) then the order number will be linked to the
153 "edit request for quotation" dialog from the purchase menu.
157 =item C<purchase_order $object, %params>
159 Returns a rendered version (actually an instance of
160 L<SL::Presenter::EscapedText>) of the purchase order object
163 C<%params> can include:
169 Either C<inline> (the default) or C<table-cell>. At the moment both
170 representations are identical and produce the objects's
171 order number linked to the corresponding 'edit' action.
175 If falsish (the default) then the order number will be linked
176 to the "edit order" dialog from the purchase menu.
188 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>