Presenter: Neue Struktur in Belegen umgesetzt
authorSven Schöling <s.schoeling@linet-services.de>
Tue, 19 Dec 2017 14:30:27 +0000 (15:30 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Tue, 19 Dec 2017 14:37:19 +0000 (15:37 +0100)
23 files changed:
SL/Controller/Order.pm
SL/DB/DeliveryOrderItem.pm
SL/DB/GLTransaction.pm
SL/DB/Invoice.pm
SL/DB/PurchaseInvoice.pm
SL/IR.pm
SL/IS.pm
bin/mozilla/io.pl
templates/webpages/ap/form_header.html
templates/webpages/ap/search.html
templates/webpages/ar/form_header.html
templates/webpages/ar/search.html
templates/webpages/do/form_header.html
templates/webpages/ir/form_header.html
templates/webpages/is/form_header.html
templates/webpages/oe/form_header.html
templates/webpages/oe/search.html
templates/webpages/order/tabs/_item_input.html
templates/webpages/order/tabs/_row.html
templates/webpages/order/tabs/_second_row.html
templates/webpages/order/tabs/basic_data.html
templates/webpages/order_items_search/_order_item_list.html
templates/webpages/order_items_search/order_items.html

index 7c82105..06a9f74 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use parent qw(SL::Controller::Base);
 
 use SL::Helper::Flash qw(flash_later);
-use SL::Presenter;
+use SL::Presenter::Tag qw(select_tag);
 use SL::Locale::String qw(t8);
 use SL::SessionFile::Random;
 use SL::PriceSource;
@@ -771,12 +771,12 @@ sub _check_auth {
 sub build_contact_select {
   my ($self) = @_;
 
-  $self->p->select_tag('order.cp_id', [ $self->order->{$self->cv}->contacts ],
-                       value_key  => 'cp_id',
-                       title_key  => 'full_name_dep',
-                       default    => $self->order->cp_id,
-                       with_empty => 1,
-                       style      => 'width: 300px',
+  select_tag('order.cp_id', [ $self->order->{$self->cv}->contacts ],
+    value_key  => 'cp_id',
+    title_key  => 'full_name_dep',
+    default    => $self->order->cp_id,
+    with_empty => 1,
+    style      => 'width: 300px',
   );
 }
 
@@ -786,12 +786,12 @@ sub build_contact_select {
 sub build_shipto_select {
   my ($self) = @_;
 
-  $self->p->select_tag('order.shipto_id', [ $self->order->{$self->cv}->shipto ],
-                       value_key  => 'shipto_id',
-                       title_key  => 'displayable_id',
-                       default    => $self->order->shipto_id,
-                       with_empty => 1,
-                       style      => 'width: 300px',
+  select_tag('order.shipto_id', [ $self->order->{$self->cv}->shipto ],
+    value_key  => 'shipto_id',
+    title_key  => 'displayable_id',
+    default    => $self->order->shipto_id,
+    with_empty => 1,
+    style      => 'width: 300px',
   );
 }
 
index c60b2a5..045e2e6 100644 (file)
@@ -43,7 +43,7 @@ sub displayable_delivery_order_info {
 
   $dec //= 2;
 
-  return SL::Presenter->get->sales_delivery_order($self->delivery_order, display => 'inline')
+  $self->delivery_order->presenter->sales_delivery_order(display => 'inline')
          . " " . $::form->format_amount(\%::myconfig, $self->qty, $dec) . " " . $self->unit
          . " (" . $self->delivery_order->transdate->to_kivitendo . ")";
 };
index 2ad8e0c..b0c2655 100644 (file)
@@ -46,7 +46,7 @@ sub link {
   my ($self) = @_;
 
   my $html;
-  $html   = SL::Presenter->get->gl_transaction($self, display => 'inline');
+  $html   = $self->presenter->gl_transaction(display => 'inline');
 
   return $html;
 }
index 44b81df..ad590c7 100644 (file)
@@ -578,8 +578,8 @@ sub link {
   my ($self) = @_;
 
   my $html;
-  $html   = SL::Presenter->get->sales_invoice($self, display => 'inline') if $self->invoice;
-  $html   = SL::Presenter->get->ar_transaction($self, display => 'inline') if !$self->invoice;
+  $html   = $self->presenter->sales_invoice(display => 'inline') if $self->invoice;
+  $html   = $self->presenter->ar_transaction(display => 'inline') if !$self->invoice;
 
   return $html;
 }
index 6318165..93fc1fe 100644 (file)
@@ -99,8 +99,8 @@ sub link {
   my ($self) = @_;
 
   my $html;
-  $html   = SL::Presenter->get->purchase_invoice($self, display => 'inline') if $self->invoice;
-  $html   = SL::Presenter->get->ap_transaction($self, display => 'inline') if !$self->invoice;
+  $html   = $self->presenter->purchase_invoice(display => 'inline') if $self->invoice;
+  $html   = $self->presenter->ap_transaction(display => 'inline') if !$self->invoice;
 
   return $html;
 }
index 891f24a..45cd7de 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -50,6 +50,7 @@ use SL::MoreCommon;
 use SL::DB::Default;
 use SL::DB::TaxZone;
 use SL::DB;
+use SL::Presenter::Part qw(type_abbreviation classification_abbreviation);
 use List::Util qw(min);
 
 use strict;
@@ -1309,8 +1310,8 @@ sub retrieve_item {
     if (($::form->{"partnumber_$i"} ne '') && ($ref->{ean} eq $::form->{"partnumber_$i"})) {
       push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean};
     }
-    $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}).
-                                 $::request->presenter->classification_abbreviation($ref->{classification_id});
+    $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) .
+                                 classification_abbreviation($ref->{classification_id});
 
     if (! $ref->{used_for_purchase} ) {
        $has_wrong_pclass = PCLASS_NOTFORPURCHASE;
index 3b90cea..609d3c0 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -57,6 +57,7 @@ use SL::DB::Tax;
 use SL::DB::TaxZone;
 use SL::TransNumber;
 use SL::DB;
+use SL::Presenter::Part qw(type_abbreviation classification_abbreviation);
 use Data::Dumper;
 
 use strict;
@@ -2353,8 +2354,8 @@ sub retrieve_item {
       push @{ $ref->{matches} ||= [] }, $::locale->text('EAN') . ': ' . $ref->{ean};
     }
 
-    $ref->{type_and_classific} = $::request->presenter->type_abbreviation($ref->{part_type}).
-                                 $::request->presenter->classification_abbreviation($ref->{classification_id});
+    $ref->{type_and_classific} = type_abbreviation($ref->{part_type}) .
+                                 classification_abbreviation($ref->{classification_id});
     if (! $ref->{used_for_sale} ) {
       $has_wrong_pclass = PCLASS_NOTFORSALE ;
       next;
index dfd65c5..14c9582 100644 (file)
@@ -53,6 +53,7 @@ use SL::IC;
 use SL::IO;
 use SL::File;
 use SL::PriceSource;
+use SL::Presenter::Part;
 
 use SL::DB::Contact;
 use SL::DB::Customer;
@@ -308,8 +309,8 @@ sub display_row {
 
 
     $column_data{partnumber}    = $cgi->textfield(-name => "partnumber_$i",    -id => "partnumber_$i",    -size => 12, -value => $form->{"partnumber_$i"});
-    $column_data{type_and_classific} = $::request->presenter->type_abbreviation($form->{"part_type_$i"}).
-                                       $::request->presenter->classification_abbreviation($form->{"classification_id_$i"}) if $form->{"id_$i"};
+    $column_data{type_and_classific} = SL::Presenter::Part::type_abbreviation($form->{"part_type_$i"}).
+                                       SL::Presenter::Part::classification_abbreviation($form->{"classification_id_$i"}) if $form->{"id_$i"};
     $column_data{description} = (($rows > 1) # if description is too large, use a textbox instead
                                 ? $cgi->textarea( -name => "description_$i", -id => "description_$i", -default => $form->{"description_$i"}, -rows => $rows, -columns => 30)
                                 : $cgi->textfield(-name => "description_$i", -id => "description_$i",   -value => $form->{"description_$i"}, -size => 30))
index d749e58..45dcf33 100644 (file)
@@ -1,4 +1,5 @@
 [%- USE L %]
+[%- USE P %]
 [%- USE HTML %]
 [%- USE T8 %]
 [%- USE LxERP %][%- USE P -%]
@@ -82,7 +83,7 @@
               <tr>
                 <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
                 <td colspan="3">
-                 [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px", onchange="\$('#update_button').click()") %]
+                 [% P.customer_vendor.picker("vendor_id", vendor_id, type="vendor", style="width: 300px", onchange="\$('#update_button').click()") %]
                  [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
                  [% L.hidden_tag("previous_vendor_id", vendor_id) %]
                 </td>
           <tr>
             <td>
               [% SET selected_chart_id = "AP_amount_chart_id_"_ i %]
-              [% P.chart_picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %]
+              [% P.chart.picker("AP_amount_chart_id_" _ i, $selected_chart_id, style="width: 400px", type="AP_amount", class=(initial_focus == 'row_' _ i ? "initial_focus" : "")) %]
               [% L.hidden_tag("previous_AP_amount_chart_id_" _ i, $selected_chart_id) %]
               <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]">
             </td>
         </tr>
         <tr>
           <td>
-            [% P.chart_picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %]
+            [% P.chart.picker('AP_chart_id', AP_chart_id, style="width: 400px", type="AP") %]
           </td>
           <th align="left">[% invtotal | html %]</th>
           <td colspan="4"></td>
index ac1d70f..3ee796f 100644 (file)
@@ -37,7 +37,7 @@
      </tr>
      <tr>
       <th align="right">[% 'Project Number' | $T8 %]</th>
-      <td>[% P.project_picker("project_id", project_id, style=style) %]</td>
+      <td>[% P.project.picker("project_id", project_id, style=style) %]</td>
       <th align="right">[% 'Part Number' | $T8 %]</th>
       <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
      </tr>
index d1916ec..75bc22e 100644 (file)
@@ -47,7 +47,7 @@
               <tr>
                 <th align="right" nowrap>[% 'Customer' | $T8 %]</th>
                 <td colspan=3>
-                 [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : ""), onchange="\$('#update_button').click()") %]
+                 [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : ""), onchange="\$('#update_button').click()") %]
                  [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
                  [% L.hidden_tag("previous_customer_id", customer_id) %]
                  [% L.hidden_tag('terms', terms) %]
           </td>
         </tr>
         <tr>
-          <td>[% P.chart_picker("AR_chart_id", AR_chart_id, style="width: 400px", type="AR") %]</td>
+          <td>[% P.chart.picker("AR_chart_id", AR_chart_id, style="width: 400px", type="AR") %]</td>
           <th align=left>[% LxERP.format_amount(invtotal, 2) | html %]</th>
 
           <input type=hidden name=oldinvtotal value='[% oldinvtotal %]'>
index f3b7aa2..c328003 100644 (file)
@@ -56,7 +56,7 @@
      </tr>
      <tr>
       <th align="right">[% 'Project Number' | $T8 %]</th>
-      <td>[% P.project_picker("project_id", project_id, style=style) %]</td>
+      <td>[% P.project.picker("project_id", project_id, style=style) %]</td>
      </tr>
     [% IF ALL_BUSINESS_TYPES.as_list.size > 0 %]
      <tr>
index ef87d87..6e7c499 100644 (file)
           [% P.hidden_tag(vc_id, $vc_id) %]
           [% HTML.escape(VC_OBJ.name) %]
          [% ELSE %]
-          [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="fixed_width", onchange="\$('#update_button').click()") %]
+          [% P.customer_vendor.picker(vc_id, $vc_id, type=vc, class="fixed_width", onchange="\$('#update_button').click()") %]
          [% END %]
          [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
          [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
index de5e623..775a8b6 100644 (file)
@@ -51,7 +51,7 @@
         <tr>
           <th align="right">[% 'Vendor' | $T8 %]</th>
           <td>
-           [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
+           [% P.customer_vendor.picker("vendor_id", vendor_id, type="vendor", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
            [% P.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
            [% P.hidden_tag("previous_vendor_id", vendor_id) %]
           </td>
         </tr>
         <tr>
           <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
-          <td>[% P.project_picker('globalproject_id', globalproject_id) %]</td>
+          <td>[% P.project.picker('globalproject_id', globalproject_id) %]</td>
         </tr>
       </table>
     </td>
index 310508b..5990f49 100644 (file)
@@ -54,7 +54,7 @@
         <tr>
           <th align="right">[% 'Customer' | $T8 %]</th>
           <td>
-           [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
+           [% P.customer_vendor.picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
            [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
            [% L.hidden_tag("previous_customer_id", customer_id) %]
            [% L.hidden_tag("customer_pricegroup_id", customer_pricegroup_id) %]
index 70735ea..2932655 100644 (file)
@@ -60,7 +60,7 @@
                     <th align="right">[% IF vc == 'customer' %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
                     <td>
                      [%- SET vc_id = vc _ "_id" %]
-                     [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
+                     [% P.customer_vendor.picker(vc_id, $vc_id, type=vc, style="width: 250px", class="initial_focus", onchange="\$('#update_button').click()") %]
                      [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _  "')", LxERP.t8("Details (one letter abbreviation)")) %]
                      [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
                     </td>
index 53b1a47..e780d4b 100644 (file)
@@ -65,7 +65,7 @@
     </tr>
     <tr>
      <th align="right">[% 'Project' | $T8 %]</th>
-     <td>[% P.project_picker("project_id", '', style=style) %]</td>
+     <td>[% P.project.picker("project_id", '', style=style) %]</td>
 
      <th align="right">[% 'Part Number' | $T8 %]</th>
      <td>[% L.input_tag("parts_partnumber", "", style=style) %]</td>
index 1d86cf4..9c6b572 100644 (file)
@@ -1,4 +1,4 @@
-[%- USE T8 %][%- USE HTML %][%- USE LxERP %][%- USE L %]
+[%- USE T8 %][%- USE HTML %][%- USE LxERP %][%- USE L %][%- USE P %]
 
  <div>
   <table id="input_row_table_id">
@@ -14,7 +14,7 @@
     </thead>
     <tbody>
       <tr valign="top" class="listrow">
-        <td>[% L.part_picker('add_item.parts_id', '', fat_set_item=1, style='width: 300px', class="add_item_input") %]</td>
+        <td>[% P.part.picker('add_item.parts_id', '', fat_set_item=1, style='width: 300px', class="add_item_input") %]</td>
         <td>[% L.input_tag('add_item.description', '', class="add_item_input") %]</td>
         <td>
           [% L.input_tag('add_item.qty_as_number', '', size = 5, class="add_item_input numeric") %]
index 7b2e2e7..f000ba6 100644 (file)
@@ -35,7 +35,7 @@
       <div name="partnumber">[% HTML.escape(ITEM.part.partnumber) %]</div>
     </td>
     <td>
-      <div name="partclassification">[% P.typeclass_abbreviation(ITEM.part) %]</div>
+      <div name="partclassification">[% ITEM.part.presenter.typeclass_abbreviation %]</div>
     </td>
     <td>
       [% L.areainput_tag("order.orderitems[].description",
index 9e13708..1a09f0f 100644 (file)
@@ -2,13 +2,14 @@
 [%- USE HTML %]
 [%- USE LxERP %]
 [%- USE L %]
+[%- USE P %]
 
 <table>
   <tr><td colspan="100%">
     <b>[%- 'Serial No.' | $T8 %]</b>&nbsp;
     [%- L.input_tag("order.orderitems[].serialnumber", ITEM.serialnumber, size = 15) %]&nbsp;
     <b>[%- 'Project' | $T8 %]</b>&nbsp;
-    [% L.project_picker("order.orderitems[].project_id", ITEM.project_id, size = 15) %]&nbsp;
+    [% P.project.picker("order.orderitems[].project_id", ITEM.project_id, size = 15) %]&nbsp;
     <b>[%- 'Reqdate' | $T8 %]</b>&nbsp;
     [% L.date_tag("order.orderitems[].reqdate", ITEM.reqdate) %]&nbsp;
     <b>[%- 'Subtotal' | $T8 %]</b>&nbsp;
index 526e028..ad41537 100644 (file)
@@ -2,6 +2,7 @@
 [%- USE HTML %]
 [%- USE LxERP %]
 [%- USE L %]
+[%- USE P %]
 
 [%- INCLUDE 'generic/set_longdescription.html' %]
 
@@ -13,7 +14,7 @@
           <tr>
             <th align="right">[% SELF.cv | $T8 %]</th>
             [% SET cv_id = SELF.cv _ '_id' %]
-            <td>[% L.customer_vendor_picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]</td>
+            <td>[% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]</td>
           </tr>
 
           <tr id='cp_row' [%- IF !SELF.order.${SELF.cv}.contacts.size %]style='display:none'[%- END %]>
@@ -69,7 +70,7 @@
 
           <tr>
             <th align="right">[% 'Project Number' | $T8 %]</th>
-            <td>[% L.project_picker('order.globalproject_id', SELF.order.globalproject_id, style='width: 300px') %]</td>
+            <td>[% P.project.picker('order.globalproject_id', SELF.order.globalproject_id, style='width: 300px') %]</td>
           </tr>
 
         </table>
index 0ae5759..e79d0e4 100644 (file)
@@ -21,9 +21,9 @@
  </tr>
  [% FOREACH order_item = SELF.orderitems %]
  <tr id="tr_[% loop.count %]" class="listrow[% loop.count % 2 %]">
-  <td>                 [% P.part(order_item.part, no_link => 0)               %]</td>
-  <td>                 [% P.customer(order_item.order.customer, no_link => 0) %]</td>
-  <td class="numeric"> [% P.sales_order(order_item.order, no_link => 0)       %]</td>
+  <td>                 [% order_item.part.presenter.part(no_link => 0)               %]</td>
+  <td>                 [% order_item.order.customer.presenter.customer(no_link => 0) %]</td>
+  <td class="numeric"> [% order_item.order.presenter.sales_order(no_link => 0)       %]</td>
   <td>                 [% order_item.order.transdate.to_kivitendo             %]</td>
   <td class="numeric [% IF order_item.delivered_qty == order_item.qty %]shipped[% ELSE %]not_shipped[% END %]">
     [% LxERP.format_amount(order_item.qty, qty_round) %] [% order_item.unit | html %]
index 8bcfa92..495d2a5 100644 (file)
@@ -2,6 +2,7 @@
 [%- USE LxERP %]
 [%- USE T8 %]
 [%- USE L %]
+[%- USE P %]
 
 [% SET size=50 %]
 [% SET show_images=0 %]
@@ -13,7 +14,7 @@
  <table>
   </tr>
     <td>[% 'Customer' | $T8 %]</td>
-    <td>[% L.customer_vendor_picker('filter.order.customer.id', FORM.customer_id, type='customer', class="filter", size=size) %]</td>
+    <td>[% P.customer_vendor.picker('filter.order.customer.id', FORM.customer_id, type='customer', class="filter", size=size) %]</td>
   </tr>
   <tr>
     <td>[% 'Part' | $T8 %]</td>