use SL::DBUtils;
use SL::Helper::Flash;
use SL::Locale::String;
+use SL::Util qw(trim);
use SL::Controller::Helper::GetModels;
use SL::Controller::Helper::ReportGenerator;
use SL::Controller::Helper::ParseFilter;
use SL::DB::Vendor;
use SL::DB::Business;
use SL::DB::Employee;
+use SL::DB::Greeting;
use SL::DB::Language;
use SL::DB::TaxZone;
use SL::DB::Note;
$::dispatcher->end_request;
}
+ $self->{cv}->greeting(trim $self->{cv}->greeting);
+ my $save_greeting = $self->{cv}->greeting
+ && $::instance_conf->get_vc_greetings_use_textfield
+ && SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0;
+
my $db = $self->{cv}->db;
$db->with_transaction(sub {
$self->{cv}->save(cascade => 1);
+ SL::DB::Greeting->new(description => $self->{cv}->greeting)->save if $save_greeting;
+
$self->{contact}->cp_cv_id($self->{cv}->id);
if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) {
$self->{contact}->save(cascade => 1);
$self->{all_employees} = SL::DB::Manager::Employee->get_all(query => [ deleted => 0 ]);
- $query =
- 'SELECT DISTINCT(greeting)
- FROM customer
- WHERE greeting IS NOT NULL AND greeting != \'\'
- UNION
- SELECT DISTINCT(greeting)
- FROM vendor
- WHERE greeting IS NOT NULL AND greeting != \'\'
- ORDER BY greeting';
- $self->{all_greetings} = [
- map(
- { $_->{greeting}; }
- selectall_hashref_query($::form, $dbh, $query)
- )
- ];
+ $self->{all_greetings} = SL::DB::Manager::Greeting->get_all_sorted();
+ if ($self->{cv}->id && $self->{cv}->greeting && !grep {$self->{cv}->greeting eq $_->description} @{$self->{all_greetings}}) {
+ unshift @{$self->{all_greetings}}, (SL::DB::Greeting->new(description => $self->{cv}->greeting));
+ }
+
$query =
'SELECT DISTINCT(cp_title) AS title
use strict;
+use SL::Util qw(trim);
+
use SL::DB::MetaSetup::Greeting;
use SL::DB::Manager::Greeting;
__PACKAGE__->meta->initialize;
+__PACKAGE__->before_save('_before_save_trim_content');
+
+sub _before_save_trim_content {
+ $_[0]->description(trim($_[0]->description));
+ return 1;
+}
+
1;
transfer_default_use_master_default_bin => { type => 'boolean', default => 'false' },
transfer_default_warehouse_for_assembly => { type => 'boolean', default => 'false' },
transport_cost_reminder_article_number_id => { type => 'integer' },
+ vc_greetings_use_textfield => { type => 'boolean' },
vendornumber => { type => 'text' },
version => { type => 'varchar', length => 8 },
vertreter => { type => 'boolean', default => 'false' },
'Use UStVA' => 'UStVA verwenden',
'Use WebDAV Repository' => 'Verwende WebDAV',
'Use WebDAV Storage backend' => 'Verwende WebDAV-Backend',
+ '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.',
'Use as new' => 'Als neu verwenden',
'Use default booking group because setting is \'all\'' => 'Standardbuchungsgruppe wird verwendet',
'Use default booking group because wanted is missing' => 'Fehlende Buchungsgruppe, deshalb Standardbuchungsgruppe',
'Use linked items' => 'Verknüpfte Positionen verwenden',
'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',
'Use settings from client configuration' => 'Einstellungen aus Mandantenkonfiguration folgen',
+ 'Use text field for greetings' => 'Textfeld für Anreden verwenden',
'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien',
'Use this storage backend for all uploaded attachments' => 'Verwende dieses Backend für hochgeladene Dateien',
'Use this storage backend for uploaded images' => 'Verwende dieses Backend für hochgeladene Bilder',
'Use UStVA' => '',
'Use WebDAV Repository' => '',
'Use WebDAV Storage backend' => '',
+ 'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => '',
'Use as new' => '',
'Use default booking group because setting is \'all\'' => '',
'Use default booking group because wanted is missing' => '',
'Use linked items' => '',
'Use master default bin for Default Transfer, if no default bin for the part is configured' => '',
'Use settings from client configuration' => '',
+ 'Use text field for greetings' => '',
'Use this storage backend for all generated PDF-Files' => '',
'Use this storage backend for all uploaded attachments' => '',
'Use this storage backend for uploaded images' => '',
--- /dev/null
+-- @tag: defaults_vc_greetings_use_textfield
+-- @description: Auswahl, ob Freitext-Feld für Anrede im Kunden-/Lieferantenstamm angeboten wird
+-- @depends: release_3_5_5
+
+ALTER TABLE defaults ADD COLUMN vc_greetings_use_textfield BOOLEAN;
+UPDATE defaults SET vc_greetings_use_textfield = TRUE;
<td> [% L.yes_no_tag('defaults.normalize_vc_names', SELF.defaults.normalize_vc_names) %]</td>
<td>[% LxERP.t8('Automatic deletion of leading, trailing and excessive (repetitive) spaces in customer or vendor names') %]</td>
</tr>
+ <tr>
+ <td align="right">[% LxERP.t8('Use text field for greetings') %]</td>
+ <td> [% L.yes_no_tag('defaults.vc_greetings_use_textfield', SELF.defaults.vc_greetings_use_textfield) %]</td>
+ <td>[% LxERP.t8('Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.') %]</td>
+ </tr>
<tr>
<td align="right">[% LxERP.t8('Hourly Rate') %]</td>
<th align="right" nowrap>[% 'Greeting' | $T8 %]</th>
<td>
- [% L.input_tag('cv.greeting', SELF.cv.greeting) %]
- [% L.select_tag('cv_greeting_select', SELF.all_greetings, default = SELF.cv.greeting, with_empty = 1, onchange = '$("#cv_greeting").val(this.value);') %]
+ [%- IF INSTANCE_CONF.get_vc_greetings_use_textfield -%]
+ [% L.input_tag('cv.greeting', SELF.cv.greeting) %]
+ [% 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);') %]
+ [%- ELSE -%]
+ [% L.select_tag('cv.greeting', SELF.all_greetings, default = SELF.cv.greeting, value_key = 'description', title_key = 'description', with_empty = 1) %]
+ [%- END -%]
</td>
</tr>