UserPreferences-Helper f. Part-Picker-Such-Einstellungen in Belegen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 19 Jul 2019 13:45:46 +0000 (15:45 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Wed, 7 Aug 2019 13:38:01 +0000 (15:38 +0200)
Hier kann der Benutzer einstellen, ob in Verkauf auch nach Kunden-Artikle-Nr.
und im Einkauf nach Lieferanten-Artikel-Nr. gesucht werden soll.

SL/AM.pm
SL/Helper/UserPreferences/PartPickerSearch.pm [new file with mode: 0644]
bin/mozilla/am.pl
locale/de/all
locale/en/all
templates/webpages/am/config.html

index a981017..a2ae7d5 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -53,6 +53,7 @@ use SL::DB::Vendor;
 use SL::DB;
 use SL::GenericTranslations;
 use SL::Helper::UserPreferences::PositionsScrollbar;
+use SL::Helper::UserPreferences::PartPickerSearch;
 
 use strict;
 
@@ -532,6 +533,14 @@ sub positions_scrollbar_height {
   SL::Helper::UserPreferences::PositionsScrollbar->new()->get_height();
 }
 
+sub purchase_search_makemodel {
+  SL::Helper::UserPreferences::PartPickerSearch->new()->get_purchase_search_makemodel();
+}
+
+sub sales_search_customer_partnumber {
+  SL::Helper::UserPreferences::PartPickerSearch->new()->get_sales_search_customer_partnumber();
+}
+
 sub save_preferences {
   $main::lxdebug->enter_sub();
 
@@ -560,6 +569,12 @@ sub save_preferences {
   if (exists $form->{positions_scrollbar_height}) {
     SL::Helper::UserPreferences::PositionsScrollbar->new()->store_height($form->{positions_scrollbar_height})
   }
+  if (exists $form->{purchase_search_makemodel}) {
+    SL::Helper::UserPreferences::PartPickerSearch->new()->store_purchase_search_makemodel($form->{purchase_search_makemodel})
+  }
+  if (exists $form->{sales_search_customer_partnumber}) {
+    SL::Helper::UserPreferences::PartPickerSearch->new()->store_sales_search_customer_partnumber($form->{sales_search_customer_partnumber})
+  }
 
   $main::lxdebug->leave_sub();
 
diff --git a/SL/Helper/UserPreferences/PartPickerSearch.pm b/SL/Helper/UserPreferences/PartPickerSearch.pm
new file mode 100644 (file)
index 0000000..7d4821d
--- /dev/null
@@ -0,0 +1,75 @@
+package SL::Helper::UserPreferences::PartPickerSearch;
+
+use strict;
+use parent qw(Rose::Object);
+
+use Carp;
+use List::MoreUtils qw(none);
+
+use SL::Helper::UserPreferences;
+
+use Rose::Object::MakeMethods::Generic (
+  'scalar --get_set_init' => [ qw(user_prefs) ],
+);
+
+sub get_sales_search_customer_partnumber {
+  !!$_[0]->user_prefs->get('sales_search_customer_partnumber');
+}
+
+sub get_purchase_search_makemodel {
+  !!$_[0]->user_prefs->get('purchase_search_makemodel');
+}
+
+sub store_sales_search_customer_partnumber {
+  $_[0]->user_prefs->store('sales_search_customer_partnumber', $_[1]);
+}
+
+sub store_purchase_search_makemodel {
+  $_[0]->user_prefs->store('purchase_search_makemodel', $_[1]);
+}
+
+sub init_user_prefs {
+  SL::Helper::UserPreferences->new(
+    namespace => $_[0]->namespace,
+  )
+}
+
+# read only stuff
+sub namespace     { 'PartPickerSearch' }
+sub version       { 1 }
+
+1;
+
+__END__
+
+=pod
+
+=encoding utf-8
+
+=head1 NAME
+
+SL::Helper::UserPreferences::PartPickerSearch - preferences intended
+to store user settings for the behavior of a partpicker search.
+
+=head1 SYNOPSIS
+
+  use SL::Helper::UserPreferences::PartPickerSearch;
+  my $prefs = SL::Helper::UserPreferences::PartPickerSearch->new();
+
+  $prefs->store_purchase_search_makemodel(1);
+  my $value = $prefs->get_purchase_search_makemodel;
+
+=head1 DESCRIPTION
+
+This module manages storing the settings for the part picker to search for
+customer/vendor partnumber in sales/purchase forms (new order controller).
+
+=head1 BUGS
+
+None yet :)
+
+=head1 AUTHOR
+
+Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
+
+=cut
index fa7f092..f2987b6 100644 (file)
@@ -661,6 +661,8 @@ sub config {
 
   $form->{displayable_name_specs_by_module} = AM->displayable_name_specs_by_module();
   $form->{positions_scrollbar_height}       = AM->positions_scrollbar_height();
+  $form->{purchase_search_makemodel}        = AM->purchase_search_makemodel();
+  $form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber();
 
   $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
   $form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
index 771d5c8..59e6c76 100755 (executable)
@@ -2774,6 +2774,8 @@ $self->{texts} = {
   'Search AR Aging'             => 'Offene Forderungen',
   'Search bank transactions'    => 'Filter für Bankbuchungen',
   'Search contacts'             => 'Personensuche',
+  'Search parts by customer partnumber in sales order forms' => 'Artikel nach Kunden-Art.-Nr. in Verkaufsbelegen suchen',
+  'Search parts by vendor partnumber (model) in purchase order forms' => 'Artikel nach Lieferanten-Art.-Nr. in Einkaufsbelegen suchen',
   'Search term'                 => 'Suchbegriff',
   'Searchable'                  => 'Durchsuchbar',
   'Secondary sorting'           => 'Untersortierung',
index acabd24..303ce94 100644 (file)
@@ -2774,6 +2774,8 @@ $self->{texts} = {
   'Search AR Aging'             => '',
   'Search bank transactions'    => '',
   'Search contacts'             => '',
+  'Search parts by customer partnumber in sales order forms' => '',
+  'Search parts by vendor partnumber (model) in purchase order forms' => '',
   'Search term'                 => '',
   'Searchable'                  => '',
   'Secondary sorting'           => '',
index 6f5dea7..06c58f1 100644 (file)
         [% L.input_tag('positions_scrollbar_height',  positions_scrollbar_height, size = 5) %]
       </td>
      </tr>
+     <tr>
+      <th align="right">[% 'Search parts by vendor partnumber (model) in purchase order forms' | $T8 %]</th>
+      <td>
+        [% L.yes_no_tag('purchase_search_makemodel', purchase_search_makemodel) %]
+      </td>
+     </tr>
+     <tr>
+      <th align="right">[% 'Search parts by customer partnumber in sales order forms' | $T8 %]</th>
+      <td>
+        [% L.yes_no_tag('sales_search_customer_partnumber', sales_search_customer_partnumber) %]
+      </td>
+     </tr>
      [%- END -%]
 
      <tr>