1 package SL::Presenter::Order;
 
   5 use SL::Presenter::EscapedText qw(escape is_escaped);
 
   7 use Exporter qw(import);
 
   8 our @EXPORT_OK = qw(sales_quotation sales_order request_quotation purchase_order);
 
  13   my ($order, %params) = @_;
 
  15   return _oe_record($order, 'sales_quotation', %params);
 
  19   my ($order, %params) = @_;
 
  21   return _oe_record($order, 'sales_order', %params);
 
  24 sub request_quotation {
 
  25   my ($order, %params) = @_;
 
  27   return _oe_record($order, 'request_quotation', %params);
 
  31   my ($order, %params) = @_;
 
  33   return _oe_record($order, 'purchase_order', %params);
 
  37   my ($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=' . escape($order->id) . '">',
 
  47     escape($order->$number_method),
 
  48     $params{no_link} ? '' : '</a>',
 
  65 SL::Presenter::Order - Presenter module for Rose::DB objects for sales
 
  66 quotations, sales orders, requests for quotations and purchase orders
 
  71   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_quotation') ]);
 
  72   my $html   = SL::Presenter::Order::sales_quotation($object, display => 'inline');
 
  75   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_order') ]);
 
  76   my $html   = SL::Presenter::Order::sales_order($object, display => 'inline');
 
  78   # Requests for quotations:
 
  79   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('request_quotation') ]);
 
  80   my $html   = SL::Presenter::Order::request_quotation($object, display => 'inline');
 
  83   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('purchase_order') ]);
 
  84   my $html   = SL::Presenter::Order::purchase_order($object, display => 'inline');
 
  90 =item C<sales_quotation $object, %params>
 
  92 Returns a rendered version (actually an instance of
 
  93 L<SL::Presenter::EscapedText>) of the sales quotation object
 
  96 C<%params> can include:
 
 102 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 103 representations are identical and produce the objects's
 
 104 quotation number linked to the corresponding 'edit' action.
 
 108 If falsish (the default) then the order number will be linked to the
 
 109 "edit quotation" dialog from the sales menu.
 
 113 =item C<sales_order $object, %params>
 
 115 Returns a rendered version (actually an instance of
 
 116 L<SL::Presenter::EscapedText>) of the sales order object C<$object>.
 
 118 C<%params> can include:
 
 124 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 125 representations are identical and produce the objects's
 
 126 order number linked to the corresponding 'edit' action.
 
 130 If falsish (the default) then the  order number will be linked
 
 131 to the "edit order" dialog from the sales menu.
 
 135 =item C<request_quotation $object, %params>
 
 137 Returns a rendered version (actually an instance of
 
 138 L<SL::Presenter::EscapedText>) of the request for quotation object
 
 141 C<%params> can include:
 
 147 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 148 representations are identical and produce the objects's
 
 149 quotation number linked to the corresponding 'edit' action.
 
 153 If falsish (the default) then the order number will be linked to the
 
 154 "edit request for quotation" dialog from the purchase menu.
 
 158 =item C<purchase_order $object, %params>
 
 160 Returns a rendered version (actually an instance of
 
 161 L<SL::Presenter::EscapedText>) of the purchase order object
 
 164 C<%params> can include:
 
 170 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 171 representations are identical and produce the objects's
 
 172 order number linked to the corresponding 'edit' action.
 
 176 If falsish (the default) then the  order number will be linked
 
 177 to the "edit order" dialog from the purchase menu.
 
 189 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>