Auftrags-Controller: self an _row-Template übergeben …
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 2 Oct 2019 10:08:34 +0000 (12:08 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 2 Oct 2019 11:46:04 +0000 (13:46 +0200)
… und nicht einzelne Variablen aus self, die dort abgefragt werden.

SL/Controller/Order.pm
templates/webpages/order/tabs/_row.html
templates/webpages/order/tabs/basic_data.html

index 00efeca..771b160 100644 (file)
@@ -791,12 +791,9 @@ sub action_add_item {
 
   my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
   my $row_as_html = $self->p->render('order/tabs/_row',
-                                     ITEM                => $item,
-                                     ID                  => $item_id,
-                                     TYPE                => $self->type,
-                                     ALL_PRICE_FACTORS   => $self->all_price_factors,
-                                     SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
-                                     SHOW_UPDATE_BUTTON  => $self->show_update_button,
+                                     ITEM => $item,
+                                     ID   => $item_id,
+                                     SELF => $self,
   );
 
   $self->js
@@ -820,12 +817,9 @@ sub action_add_item {
       $self->get_item_cvpartnumber($item);
       my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
       my $row_as_html = $self->p->render('order/tabs/_row',
-                                         ITEM                => $item,
-                                         ID                  => $item_id,
-                                         TYPE                => $self->type,
-                                         ALL_PRICE_FACTORS   => $self->all_price_factors,
-                                         SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
-                                         SHOW_UPDATE_BUTTON  => $self->show_update_button,
+                                         ITEM => $item,
+                                         ID   => $item_id,
+                                         SELF => $self,
       );
       $self->js
         ->append('#row_table_id', $row_as_html);
@@ -904,12 +898,9 @@ sub action_add_multi_items {
     $self->get_item_cvpartnumber($item);
     my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
     my $row_as_html = $self->p->render('order/tabs/_row',
-                                       ITEM                => $item,
-                                       ID                  => $item_id,
-                                       TYPE                => $self->type,
-                                       ALL_PRICE_FACTORS   => $self->all_price_factors,
-                                       SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
-                                       SHOW_UPDATE_BUTTON  => $self->show_update_button,
+                                       ITEM => $item,
+                                       ID   => $item_id,
+                                       SELF => $self,
     );
 
     $self->js->append('#row_table_id', $row_as_html);
index 42a7a77..cff019a 100644 (file)
@@ -32,7 +32,7 @@
                        LxERP.t8("X"),
                        confirm=LxERP.t8("Are you sure?")) %]
     </td>
-    [%- IF SHOW_UPDATE_BUTTON -%]
+    [%- IF SELF.show_update_button -%]
     <td align="center">
       [%- L.img_tag(src="image/rotate_cw.svg",
                     alt=LxERP.t8('Update from master data'),
@@ -44,7 +44,7 @@
     <td>
       <div name="partnumber">[% HTML.escape(ITEM.part.partnumber) %]</div>
     </td>
-    [%- IF SEARCH_CVPARTNUMBER -%]
+    [%- IF SELF.search_cvpartnumber -%]
     <td>
       <div name="cvpartnumber">[% HTML.escape(ITEM.cvpartnumber) %]</div>
     </td>
@@ -62,7 +62,7 @@
       [%- END -%]
       [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %]
     </td>
-    [%- IF (TYPE == "sales_order" || TYPE == "purchase_order") -%]
+    [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
     <td nowrap>
       [%- L.div_tag(LxERP.format_amount(ITEM.shipped_qty, 2, 0) _ ' ' _ ITEM.unit, name="shipped_qty", class="numeric") %]
     </td>
@@ -79,7 +79,7 @@
     </td>
     <td>
       [%- L.select_tag("order.orderitems[].price_factor_id",
-                       ALL_PRICE_FACTORS,
+                       SELF.all_price_factors,
                        default = ITEM.price_factor_id,
                        title_key = 'description',
                        with_empty = 1,
     <td colspan="100%">
       [%- IF MYCONFIG.show_form_details || ITEM.render_second_row %]
         <div name="second_row" data-loaded="1">
-          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM TYPE=TYPE %]
+          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM TYPE=SELF.type %]
         </div>
       [%- ELSE %]
         <div name="second_row" id="second_row_[% ID %]">
index c040f11..698ef63 100644 (file)
             </thead>
 
             [%- FOREACH item = SELF.order.items_sorted %]
-              [%- PROCESS order/tabs/_row.html
-                  ITEM=item
-                  ID=(item.id||item.new_fake_id)
-                  TYPE=SELF.type
-                  ALL_PRICE_FACTORS=SELF.all_price_factors
-                  SEARCH_CVPARTNUMBER=SELF.search_cvpartnumber
-                  SHOW_UPDATE_BUTTON=SELF.show_update_button
-              -%]
+              [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id)  -%]
             [%- END %]
 
           </table>