Auftrags-Controller: Fehler bei Anzeige von EK und Marge in 2. Zeile behoben
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 11 Dec 2017 15:05:11 +0000 (16:05 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 29 Jan 2018 09:03:58 +0000 (10:03 +0100)
Wenn das Order-Objekt noch nicht gespeichert ist, kann darauf nicht über
$item->order zugegriffen werden. Darum muss an die 2. Zeile eine weitere
Variable durchgereicht werden, um zu bestimmen, ob wir im Verkauf sind und
EK und Margen angezeigt werden sollen.

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

index 04319e0..0421e08 100644 (file)
@@ -447,6 +447,7 @@ sub action_add_item {
   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
   );
 
@@ -472,6 +473,7 @@ sub action_add_item {
       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
       );
       $self->js
@@ -553,6 +555,7 @@ sub action_add_multi_items {
     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
     );
 
@@ -665,7 +668,7 @@ sub _js_load_second_row {
     $item->parse_custom_variable_values;
   }
 
-  my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item);
+  my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item, TYPE => $self->type);
 
   $self->js
     ->html('.row_entry:has(#item_' . $item_id . ') [name = "second_row"]', $row_as_html)
index f000ba6..c057747 100644 (file)
     <td colspan="100%">
       [%- IF MYCONFIG.show_form_details %]
         <div name="second_row" data-loaded="1">
-          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM %]
+          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM TYPE=TYPE %]
         </div>
       [%- ELSE %]
         <div name="second_row">
index 1a09f0f..d8d8a86 100644 (file)
@@ -14,7 +14,7 @@
     [% L.date_tag("order.orderitems[].reqdate", ITEM.reqdate) %]&nbsp;
     <b>[%- 'Subtotal' | $T8 %]</b>&nbsp;
     [% L.yes_no_tag("order.orderitems[].subtotal", ITEM.subtotal) %]&nbsp;
-    [%- IF ITEM.order.is_sales %]
+    [%- IF TYPE == "sales_order" %]
       <b>[%- 'Ertrag' | $T8 %]</b>&nbsp;
         <span name="linemargin">
           <span[%- IF ITEM.marge_total < 0 -%] class="plus0"[%- END -%]>
index ad41537..39b9531 100644 (file)
             </thead>
 
             [%- FOREACH item = SELF.order.items_sorted %]
-              [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id ALL_PRICE_FACTORS=SELF.all_price_factors %]
+              [%- PROCESS order/tabs/_row.html ITEM=item ID=item.id TYPE=SELF.type ALL_PRICE_FACTORS=SELF.all_price_factors %]
             [%- END %]
 
           </table>