DisplayableNamePrefs: Mandantenkonfiguration
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Sat, 19 Jan 2019 16:22:07 +0000 (17:22 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 25 Jan 2019 12:31:32 +0000 (13:31 +0100)
SL/Controller/ClientConfig.pm
templates/webpages/client_config/_features.html

index 237185d..59fe4f5 100644 (file)
@@ -12,6 +12,7 @@ use SL::DB::Default;
 use SL::DB::Language;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::DB::Customer;
 use SL::Helper::Flash;
 use SL::Locale::String qw(t8);
 use SL::PriceSource::ALL;
@@ -24,7 +25,8 @@ __PACKAGE__->run_before('check_auth');
 use Rose::Object::MakeMethods::Generic (
   'scalar --get_set_init' => [ qw(defaults all_warehouses all_weightunits all_languages all_currencies all_templates all_price_sources h_unit_name available_quick_search_modules available_shipped_qty_item_identity_fields
                                   all_project_statuses all_project_types
-                                  posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options) ],
+                                  posting_options payment_options accounting_options inventory_options profit_options balance_startdate_method_options
+                                  displayable_name_specs_by_module) ],
 );
 
 sub action_edit {
@@ -131,6 +133,11 @@ sub action_save {
     $self->defaults->templates('templates/' . $::form->{new_templates});
   }
 
+  # Displayable name preferences
+  foreach my $specs (@{ $::form->{displayable_name_specs} }) {
+    $self->displayable_name_specs_by_module->{$specs->{module}}->{prefs}->store_default($specs->{default});
+  }
+
   # Finally save defaults.
   $self->defaults->save;
 
@@ -202,6 +209,23 @@ sub init_available_shipped_qty_item_identity_fields {
   [ SL::Helper::ShippedQty->new->available_item_identity_fields ];
 }
 
+sub init_displayable_name_specs_by_module {
+  +{
+     'SL::DB::Customer' => {
+       specs => SL::DB::Customer->displayable_name_specs,
+       prefs => SL::DB::Customer->displayable_name_prefs,
+     },
+     'SL::DB::Vendor' => {
+       specs => SL::DB::Vendor->displayable_name_specs,
+       prefs => SL::DB::Vendor->displayable_name_prefs,
+     },
+     'SL::DB::Part' => {
+       specs => SL::DB::Part->displayable_name_specs,
+       prefs => SL::DB::Part->displayable_name_prefs,
+     },
+  };
+}
+
 #
 # filters
 #
index 4729d8c..7d4959f 100644 (file)
   <td>[% LxERP.t8('Only applies if the previous is set to true. When filling up unlinked positions, consider them matches if ALL of these fields match. For example, in a business with variants that are defined by a special description, description needs to be part of the identity. If delivering several similar order positions by delivery date is common, reqdate should be included in the identity. Serialnumber is useful when the serialnumber in the order and delivery order has to match.') %]</td>
  </tr>
 
+ <tr><td class="listheading" colspan="4">[% 'Displayable Name Preferences' | $T8 %]</td></tr>
+ [% FOREACH module=SELF.displayable_name_specs_by_module.keys.sort %]
+ [%- SET spec=SELF.displayable_name_specs_by_module.$module -%]
+  <tr>
+    <td align="right">[% spec.specs.title %]</td>
+    <td>
+      <table>
+        <tr>
+          <th align="left" class="listheading">[% 'Option' | $T8 %]</th>
+          <th align="left" class="listheading">[% 'Name'   | $T8 %]</th>
+        </tr>
+        [% FOREACH option=spec.specs.options %]
+        <tr>
+          <td>[% option.title %]</td>
+          <td>[% option.name  %]</td>
+        </tr>
+        [% END %]
+        <tr>
+          <th align="left">[% 'Display' | $T8 %]:</th>
+          <td>
+            [% L.hidden_tag("displayable_name_specs[+].module", module) %]
+            [% L.input_tag("displayable_name_specs[].default", spec.prefs.get_default, size=50) %]
+          </td>
+        </tr>
+      </table>
+    </td>
+    [% IF loop.first %]
+    <td>[% 'The display of (mainly) picker results can be configured. To insert the value of one option use <%Name%>.' | $T8 %]<br>
+        [% 'E.g. "<%customernumber%> <%name%>"' | $T8 %]
+    </td>
+    [% END %]
+  </tr>
+  [% END %]
+
 
 </table>
 </div>