Bugfix (böse klammer zuviel).
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 22 Feb 2008 15:01:16 +0000 (15:01 +0000)
committerSven Schöling <s.schoeling@linet-services.de>
Fri, 22 Feb 2008 15:01:16 +0000 (15:01 +0000)
Ausserdem Department Dropdownbox ausgelagert ins template.

SL/OE.pm
bin/mozilla/oe.pl
templates/webpages/oe/form_header_de.html
templates/webpages/oe/form_header_master.html

index f9d5dab..18daae1 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -419,7 +419,7 @@ sub save {
 
   my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't';
 
-  ($null, $form->{department_id}) = split(/--/, $form->{department});
+  ($null, $form->{department_id}) = split(/--/, $form->{department}) if $form->{department};
 
   # save OE record
   $query =
index 993c29f..fbd6a9c 100644 (file)
@@ -202,7 +202,7 @@ sub order_links {
   # the content from the field)
   $form->error($locale->text('Collective Orders only work for orders from one customer!'))
     if          $form->{rowcount}  && $form->{type}     eq 'sales_order'
-     && defined $form->{customer}  && $form->{customer} eq '');
+     && defined $form->{customer}  && $form->{customer} eq '';
 
   $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"};
 
@@ -220,13 +220,8 @@ sub order_links {
   $form->{employee}    = "$form->{employee}--$form->{employee_id}";
 
   # build vendor/customer drop down comatibility... don't ask
-  $form->{"old$form->{vc}"} = $form->{"select$form->{vc}"} = 1;
-
-  # departments
-  if (@{ $form->{all_departments} }) {
-    $form->{department}       = "$form->{department}--$form->{department_id}";
-    $form->{selectdepartment} = join "\n", "<option>", map "<option>$_->{description}--$_->{id}</option>", @{ $form->{all_departments} };
-  }
+  $form->{"old$form->{vc}"} = $form->{vc};
+  $form->{"select$form->{vc}"} = 1;
 
   $lxdebug->leave_sub();
 }
@@ -321,14 +316,16 @@ sub form_header {
                    "taxzones"      => "ALL_TAXZONES",
                    "payments"      => "ALL_PAYMENTS",
                    "currencies"    => "ALL_CURRENCIES",
+                   "departments"   => "ALL_DEPARTMENTS",
                    $vc             => { key   => "ALL_" . uc($vc),
                                         limit => $myconfig{vclimit} + 1 },
                    "price_factors" => "ALL_PRICE_FACTORS");
 
   # label subs
   $TMPL_VAR{sales_employee_labels} = sub { $_[0]->{name} || $_[0]->{login} };
-  $TMPL_VAR{shipto_labels} = sub { join "; ", grep { $_ } map { $_[0]->{"shipto${_}" } } qw(name department_1 street city) };
-  $TMPL_VAR{contact_labels} = sub { $_[0]->{"cp_name"} . ($_[0]->{cp_abteilung} ? " ($_[0]->{cp_abteilung})" : "") };
+  $TMPL_VAR{shipto_labels}         = sub { join "; ", grep { $_ } map { $_[0]->{"shipto${_}" } } qw(name department_1 street city) };
+  $TMPL_VAR{contact_labels}        = sub { $_[0]->{"cp_name"} . ($_[0]->{cp_abteilung} ? " ($_[0]->{cp_abteilung})" : "") };
+  $TMPL_VAR{department_labels}     = sub { "$_[0]->{description}--$_[0]->{id}" }; 
 
   # vendor/customer
   $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
index 209d4fa..8d92710 100644 (file)
                            label_key  = 'description' -%]
                     </td>
                   </tr>
-[%- IF selectdepartment %]
+[%- IF ALL_DEPARTMENTS %]
                   <tr>
                     <th align="right" nowrap>Abteilung</th>
-                    <td colspan="3"><select name="department" style="width: 250px">[% selectdepartment %]</select>
-                    <input type="hidden" name="selectdepartment" value="[% HTML.escape(selectdepartment) %]">
+                    <td colspan="3">
+                      [%- INCLUDE 'generic/multibox.html'
+                           name       = 'department_id',
+                           style      = 'width: 250px',
+                           DATA       = ALL_DEPARTMENTS,
+                           id_key     = 'id',
+                           label_sub  = 'department_labels',
+                           show_empty = 1 -%]
                     </td>
                   </tr>
 [%- END %]
index f5df7d6..64636b2 100644 (file)
                            label_key  = 'description' -%]
                     </td>
                   </tr>
-[%- IF selectdepartment %]
+[%- IF ALL_DEPARTMENTS %]
                   <tr>
                     <th align="right" nowrap><translate>Department</translate></th>
-                    <td colspan="3"><select name="department" style="width: 250px">[% selectdepartment %]</select>
-                    <input type="hidden" name="selectdepartment" value="[% HTML.escape(selectdepartment) %]">
+                    <td colspan="3">
+                      [%- INCLUDE 'generic/multibox.html'
+                           name       = 'department_id',
+                           style      = 'width: 250px',
+                           DATA       = ALL_DEPARTMENTS,
+                           id_key     = 'id',
+                           label_sub  = 'department_labels',
+                           show_empty = 1 -%]
                     </td>
                   </tr>
 [%- END %]