Auftrags-Controller: Artikel nicht hinzufügen, wenn keine part-id da ist.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 19 Aug 2015 12:38:00 +0000 (14:38 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Mon, 16 Nov 2015 15:15:56 +0000 (16:15 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/basic_data.html

index 1669269..c462407 100644 (file)
@@ -127,6 +127,9 @@ sub action_add_item {
   my ($self) = @_;
 
   my $form_attr = $::form->{add_item};
+
+  return unless $form_attr->{parts_id};
+
   my $item      = SL::DB::OrderItem->new;
   $item->assign_attributes(%$form_attr);
 
index b5d3c3b..ea9710b 100644 (file)
               title_key='safe_name') %]</td>
           </tr>
 
+          [% IF SELF.cv == 'customer' %]
+          <tr>
+            <th align="right">[% 'Salesman' | $T8 %]</th>
+            <td>[% L.select_tag('order.employee_id',
+              SELF.all_employees,
+              default=(SELF.order.salesman_id ? SELF.order.salesman_id : SELF.current_employee_id),
+              title_key='safe_name') %]</td>
+          </tr>
+          [% END %]
+
           <tr>
             <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
             <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11) %]</td>
@@ -184,6 +194,8 @@ function reload_cv_dependend_selections() {
 }
 
 function add_item() {
+  if ($('#add_item_parts_id').val() == '') return;
+
   var data = $('#order_form').serialize();
   data += '&action=Order/add_item';
   data += '&type=' + $('#type').val();