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';
 
  47   unless ($params{no_link}) {
 
  48     my $action  = $::instance_conf->get_feature_experimental_order
 
  49                 ? 'controller.pl?action=Order/edit'
 
  50                 : 'oe.pl?action=edit';
 
  51     $link_start = '<a href="' . $action . '&type=' . $type . '&id=' . escape($order->id) . '">';
 
  55   my $text = join '', ($link_start, escape($order->$number_method), $link_end);
 
  71 SL::Presenter::Order - Presenter module for Rose::DB objects for sales
 
  72 quotations, sales orders, requests for quotations and purchase orders
 
  77   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_quotation') ]);
 
  78   my $html   = SL::Presenter::Order::sales_quotation($object, display => 'inline');
 
  81   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('sales_order') ]);
 
  82   my $html   = SL::Presenter::Order::sales_order($object, display => 'inline');
 
  84   # Requests for quotations:
 
  85   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('request_quotation') ]);
 
  86   my $html   = SL::Presenter::Order::request_quotation($object, display => 'inline');
 
  89   my $object = SL::DB::Manager::Order->get_first(where => [ SL::DB::Manager::Order->type_filter('purchase_order') ]);
 
  90   my $html   = SL::Presenter::Order::purchase_order($object, display => 'inline');
 
  96 =item C<sales_quotation $object, %params>
 
  98 Returns a rendered version (actually an instance of
 
  99 L<SL::Presenter::EscapedText>) of the sales quotation object
 
 102 C<%params> can include:
 
 108 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 109 representations are identical and produce the objects's
 
 110 quotation number linked to the corresponding 'edit' action.
 
 114 If falsish (the default) then the order number will be linked to the
 
 115 "edit quotation" dialog from the sales menu.
 
 119 =item C<sales_order $object, %params>
 
 121 Returns a rendered version (actually an instance of
 
 122 L<SL::Presenter::EscapedText>) of the sales order object C<$object>.
 
 124 C<%params> can include:
 
 130 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 131 representations are identical and produce the objects's
 
 132 order number linked to the corresponding 'edit' action.
 
 136 If falsish (the default) then the  order number will be linked
 
 137 to the "edit order" dialog from the sales menu.
 
 141 =item C<request_quotation $object, %params>
 
 143 Returns a rendered version (actually an instance of
 
 144 L<SL::Presenter::EscapedText>) of the request for quotation object
 
 147 C<%params> can include:
 
 153 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 154 representations are identical and produce the objects's
 
 155 quotation number linked to the corresponding 'edit' action.
 
 159 If falsish (the default) then the order number will be linked to the
 
 160 "edit request for quotation" dialog from the purchase menu.
 
 164 =item C<purchase_order $object, %params>
 
 166 Returns a rendered version (actually an instance of
 
 167 L<SL::Presenter::EscapedText>) of the purchase order object
 
 170 C<%params> can include:
 
 176 Either C<inline> (the default) or C<table-cell>. At the moment both
 
 177 representations are identical and produce the objects's
 
 178 order number linked to the corresponding 'edit' action.
 
 182 If falsish (the default) then the  order number will be linked
 
 183 to the "edit order" dialog from the purchase menu.
 
 195 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>