Auftrags-Controller: zweite Zeile zeigen CVars.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Thu, 10 Sep 2015 21:35:17 +0000 (23:35 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Mon, 16 Nov 2015 15:15:57 +0000 (16:15 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/_row.html

index fb3078c..4cd7864 100644 (file)
@@ -152,13 +152,13 @@ sub action_add_item {
   $new_attr{discount}    = $cv_discount       if ! $item->discount;
 
   $item->assign_attributes(%new_attr);
-  $item->id(join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000)) if !$item->id;
 
   $self->order->add_items($item);
 
   $self->_recalc();
 
-  my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $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);
 
   $self->js
     ->append('#row_table_id', $row_as_html)
@@ -169,7 +169,7 @@ sub action_add_item {
     ->val('#add_item_sellprice_as_number', '')
     ->val('#add_item_discount_as_percent', '')
     ->run('row_table_scroll_down')
-    ->run('row_set_keyboard_events_by_id', $item->id)
+    ->run('row_set_keyboard_events_by_id', $item_id)
     ->focus('#add_item_parts_id_name');
 
   $self->_js_redisplay_amounts_and_taxes;
index 4d5656f..ca340eb 100644 (file)
@@ -7,7 +7,7 @@
 
   <tr class="listrow0">
     <td style='display:none'>
-      [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ITEM.id) %]
+      [% L.hidden_tag("order.orderitems[+].id", ITEM.id, id='item_' _ ID) %]
       [% L.hidden_tag("order.orderitems[].parts_id", ITEM.parts_id) %]
     </td>
     <td align="center">
     <td colspan="100%">
       <table>
         <tr class="listrow1">
-          <td>hi1</td>
-          <td>hi2</td>
-          <td>hi3</td>
-          <td>[%- ITEM.description %]</td>
-        </tr>
-        <tr class="listrow1">
-          <td>ho1</td>
-          <td>ho2</td>
-          <td>ho3</td>
-          <td>[%- ITEM.longdescription %]</td>
+          [%- SET n = 0 %]
+          [%- FOREACH var = ITEM.cvars_by_config %]
+            [%- NEXT UNLESS (var.config.processed_flags.editable && ITEM.part.cvar_by_name(var.config.name).is_valid) %]
+            [%- SET n = n + 1 %]
+            <th>
+              [% var.config.description %]
+            </th>
+            <td>
+              [% L.hidden_tag('order.orderitems[].custom_variables[+].config_id', var.config.id) %]
+              [% INCLUDE 'common/render_cvar_input.html' var_name='order.orderitems[].custom_variables[].unparsed_value' %]
+            </td>
+            [%- IF (n % (MYCONFIG.form_cvars_nr_cols || 3)) == 0 %]
+              </tr><tr class="listrow1">
+            [%- END %]
+          [%- END %]
         </tr>
       </table>
     </td>