Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 761f4a3f

Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt

  • ID 761f4a3f4efbe238058efe99939698c0624d3181
  • Vorgänger c2e49890
  • Nachfolger 3a83d463

Anreden: Kunden-/Lieferantenstamm: Freitext-Feld und/oder Auswahlliste

Die Anrede wird entweder nur mit einer Auswahlliste angezeigt oder mit
Freitext-Feld und Auswahlliste. Das ist annähernd das alte Verhalten - im
Freitext-Feld eingegebener Text wird auch in greetings gespeichert.

In der Mandantenkonfiguration ist das Freitext-Feld (altes Verhalten)
abschaltbar.

Todo: Fremdschlüsselbeziehung zwischen customer/vendor und greetings

Unterschiede anzeigen:

SL/Controller/CustomerVendor.pm
9 9
use SL::DBUtils;
10 10
use SL::Helper::Flash;
11 11
use SL::Locale::String;
12
use SL::Util qw(trim);
12 13
use SL::Controller::Helper::GetModels;
13 14
use SL::Controller::Helper::ReportGenerator;
14 15
use SL::Controller::Helper::ParseFilter;
......
17 18
use SL::DB::Vendor;
18 19
use SL::DB::Business;
19 20
use SL::DB::Employee;
21
use SL::DB::Greeting;
20 22
use SL::DB::Language;
21 23
use SL::DB::TaxZone;
22 24
use SL::DB::Note;
......
161 163
    $::dispatcher->end_request;
162 164
  }
163 165

  
166
  $self->{cv}->greeting(trim $self->{cv}->greeting);
167
  my $save_greeting  = $self->{cv}->greeting
168
                    && $::instance_conf->get_vc_greetings_use_textfield
169
                    && SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0;
170

  
164 171
  my $db = $self->{cv}->db;
165 172

  
166 173
  $db->with_transaction(sub {
......
186 193

  
187 194
    $self->{cv}->save(cascade => 1);
188 195

  
196
    SL::DB::Greeting->new(description => $self->{cv}->greeting)->save if $save_greeting;
197

  
189 198
    $self->{contact}->cp_cv_id($self->{cv}->id);
190 199
    if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) {
191 200
      $self->{contact}->save(cascade => 1);
......
922 931

  
923 932
  $self->{all_employees} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
924 933

  
925
  $query =
926
    'SELECT DISTINCT(greeting)
927
     FROM customer
928
     WHERE greeting IS NOT NULL AND greeting != \'\'
929
     UNION
930
       SELECT DISTINCT(greeting)
931
       FROM vendor
932
       WHERE greeting IS NOT NULL AND greeting != \'\'
933
     ORDER BY greeting';
934
  $self->{all_greetings} = [
935
    map(
936
      { $_->{greeting}; }
937
      selectall_hashref_query($::form, $dbh, $query)
938
    )
939
  ];
934
  $self->{all_greetings} = SL::DB::Manager::Greeting->get_all_sorted();
935
  if ($self->{cv}->id && $self->{cv}->greeting && !grep {$self->{cv}->greeting eq $_->description} @{$self->{all_greetings}}) {
936
    unshift @{$self->{all_greetings}}, (SL::DB::Greeting->new(description => $self->{cv}->greeting));
937
  }
938

  
940 939

  
941 940
  $query =
942 941
    'SELECT DISTINCT(cp_title) AS title
SL/DB/Greeting.pm
5 5

  
6 6
use strict;
7 7

  
8
use SL::Util qw(trim);
9

  
8 10
use SL::DB::MetaSetup::Greeting;
9 11
use SL::DB::Manager::Greeting;
10 12

  
11 13
__PACKAGE__->meta->initialize;
12 14

  
15
__PACKAGE__->before_save('_before_save_trim_content');
16

  
17
sub _before_save_trim_content {
18
  $_[0]->description(trim($_[0]->description));
19
  return 1;
20
}
21

  
13 22
1;
SL/DB/MetaSetup/Default.pm
167 167
  transfer_default_use_master_default_bin   => { type => 'boolean', default => 'false' },
168 168
  transfer_default_warehouse_for_assembly   => { type => 'boolean', default => 'false' },
169 169
  transport_cost_reminder_article_number_id => { type => 'integer' },
170
  vc_greetings_use_textfield                => { type => 'boolean' },
170 171
  vendornumber                              => { type => 'text' },
171 172
  version                                   => { type => 'varchar', length => 8 },
172 173
  vertreter                                 => { type => 'boolean', default => 'false' },
locale/de/all
3819 3819
  'Use UStVA'                   => 'UStVA verwenden',
3820 3820
  'Use WebDAV Repository'       => 'Verwende WebDAV',
3821 3821
  'Use WebDAV Storage backend'  => 'Verwende WebDAV-Backend',
3822
  'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => 'Textfeld zusätzlich zur Eingabe (neuer) Anreden verwenden. Sonst wird nur eine Auswahlliste angezeigt.',
3822 3823
  'Use as new'                  => 'Als neu verwenden',
3823 3824
  'Use default booking group because setting is \'all\'' => 'Standardbuchungsgruppe wird verwendet',
3824 3825
  'Use default booking group because wanted is missing' => 'Fehlende Buchungsgruppe, deshalb Standardbuchungsgruppe',
......
3829 3830
  'Use linked items'            => 'Verknüpfte Positionen verwenden',
3830 3831
  'Use master default bin for Default Transfer, if no default bin for the part is configured' => 'Standardlagerplatz für Ein- / Auslagern über Standard-Lagerplatz, falls für die Ware kein expliziter Lagerplatz konfiguriert ist',
3831 3832
  'Use settings from client configuration' => 'Einstellungen aus Mandantenkonfiguration folgen',
3833
  'Use text field for greetings' => 'Textfeld für Anreden verwenden',
3832 3834
  'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien',
3833 3835
  'Use this storage backend for all uploaded attachments' => 'Verwende dieses Backend für hochgeladene Dateien',
3834 3836
  'Use this storage backend for uploaded images' => 'Verwende dieses Backend für hochgeladene Bilder',
locale/en/all
3818 3818
  'Use UStVA'                   => '',
3819 3819
  'Use WebDAV Repository'       => '',
3820 3820
  'Use WebDAV Storage backend'  => '',
3821
  'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => '',
3821 3822
  'Use as new'                  => '',
3822 3823
  'Use default booking group because setting is \'all\'' => '',
3823 3824
  'Use default booking group because wanted is missing' => '',
......
3828 3829
  'Use linked items'            => '',
3829 3830
  'Use master default bin for Default Transfer, if no default bin for the part is configured' => '',
3830 3831
  'Use settings from client configuration' => '',
3832
  'Use text field for greetings' => '',
3831 3833
  'Use this storage backend for all generated PDF-Files' => '',
3832 3834
  'Use this storage backend for all uploaded attachments' => '',
3833 3835
  'Use this storage backend for uploaded images' => '',
sql/Pg-upgrade2/defaults_vc_greetings_use_textfield.sql
1
-- @tag: defaults_vc_greetings_use_textfield
2
-- @description: Auswahl, ob Freitext-Feld für Anrede im Kunden-/Lieferantenstamm angeboten wird
3
-- @depends: release_3_5_5
4

  
5
ALTER TABLE defaults ADD COLUMN vc_greetings_use_textfield BOOLEAN;
6
UPDATE defaults SET vc_greetings_use_textfield = TRUE;
templates/webpages/client_config/_features.html
134 134
   <td>   [% L.yes_no_tag('defaults.normalize_vc_names', SELF.defaults.normalize_vc_names) %]</td>
135 135
   <td>[% LxERP.t8('Automatic deletion of leading, trailing and excessive (repetitive) spaces in customer or vendor names') %]</td>
136 136
  </tr>
137
  <tr>
138
   <td align="right">[% LxERP.t8('Use text field for greetings') %]</td>
139
   <td>   [% L.yes_no_tag('defaults.vc_greetings_use_textfield', SELF.defaults.vc_greetings_use_textfield) %]</td>
140
   <td>[% LxERP.t8('Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.') %]</td>
141
  </tr>
137 142

  
138 143
  <tr>
139 144
   <td align="right">[% LxERP.t8('Hourly Rate') %]</td>
templates/webpages/customer_vendor/tabs/billing.html
54 54
      <th align="right" nowrap>[% 'Greeting' | $T8 %]</th>
55 55

  
56 56
      <td>
57
        [% L.input_tag('cv.greeting', SELF.cv.greeting) %]
58
        [% L.select_tag('cv_greeting_select', SELF.all_greetings, default = SELF.cv.greeting, with_empty = 1, onchange = '$("#cv_greeting").val(this.value);') %]
57
        [%- IF INSTANCE_CONF.get_vc_greetings_use_textfield -%]
58
          [% L.input_tag('cv.greeting', SELF.cv.greeting) %]
59
          [% L.select_tag('cv_greeting_select', SELF.all_greetings, default = SELF.cv.greeting, value_key = 'description', title_key = 'description', with_empty = 1, onchange = '$("#cv_greeting").val(this.value);') %]
60
        [%- ELSE -%]
61
          [% L.select_tag('cv.greeting', SELF.all_greetings, default = SELF.cv.greeting, value_key = 'description', title_key = 'description', with_empty = 1) %]
62
        [%- END -%]
59 63
      </td>
60 64
    </tr>
61 65

  

Auch abrufbar als: Unified diff