Revision cc6d7fec
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
17 | 17 |
use SL::DB::Customer; |
18 | 18 |
use SL::DB::Vendor; |
19 | 19 |
use SL::DB::Business; |
20 |
use SL::DB::ContactDepartment; |
|
20 | 21 |
use SL::DB::ContactTitle; |
21 | 22 |
use SL::DB::Employee; |
22 | 23 |
use SL::DB::Greeting; |
... | ... | |
165 | 166 |
} |
166 | 167 |
|
167 | 168 |
$self->{cv}->greeting(trim $self->{cv}->greeting); |
168 |
my $save_greeting = $self->{cv}->greeting |
|
169 |
my $save_greeting = $self->{cv}->greeting
|
|
169 | 170 |
&& $::instance_conf->get_vc_greetings_use_textfield |
170 | 171 |
&& SL::DB::Manager::Greeting->get_all_count(where => [description => $self->{cv}->greeting]) == 0; |
171 | 172 |
|
172 | 173 |
$self->{contact}->cp_title(trim($self->{contact}->cp_title)); |
173 |
my $save_contact_title = $self->{contact}->cp_title |
|
174 |
my $save_contact_title = $self->{contact}->cp_title
|
|
174 | 175 |
&& $::instance_conf->get_contact_titles_use_textfield |
175 | 176 |
&& SL::DB::Manager::ContactTitle->get_all_count(where => [description => $self->{contact}->cp_title]) == 0; |
176 | 177 |
|
178 |
$self->{contact}->cp_abteilung(trim($self->{contact}->cp_abteilung)); |
|
179 |
my $save_contact_department = $self->{contact}->cp_abteilung |
|
180 |
&& $::instance_conf->get_contact_departments_use_textfield |
|
181 |
&& SL::DB::Manager::ContactDepartment->get_all_count(where => [description => $self->{contact}->cp_abteilung]) == 0; |
|
182 |
|
|
177 | 183 |
my $db = $self->{cv}->db; |
178 | 184 |
|
179 | 185 |
$db->with_transaction(sub { |
... | ... | |
203 | 209 |
|
204 | 210 |
$self->{contact}->cp_cv_id($self->{cv}->id); |
205 | 211 |
if( $self->{contact}->cp_name ne '' || $self->{contact}->cp_givenname ne '' ) { |
206 |
SL::DB::ContactTitle->new(description => $self->{contact}->cp_title)->save if $save_contact_title; |
|
212 |
SL::DB::ContactTitle ->new(description => $self->{contact}->cp_title) ->save if $save_contact_title; |
|
213 |
SL::DB::ContactDepartment->new(description => $self->{contact}->cp_abteilung)->save if $save_contact_department; |
|
207 | 214 |
|
208 | 215 |
$self->{contact}->save(cascade => 1); |
209 | 216 |
} |
... | ... | |
951 | 958 |
} |
952 | 959 |
} |
953 | 960 |
|
961 |
$self->{all_contact_departments} = SL::DB::Manager::ContactDepartment->get_all_sorted(); |
|
962 |
foreach my $contact (@{ $self->{cv}->contacts }) { |
|
963 |
if ($contact->cp_abteilung && !grep {$contact->cp_abteilung eq $_->description} @{$self->{all_contact_departments}}) { |
|
964 |
unshift @{$self->{all_contact_departments}}, (SL::DB::ContactDepartment->new(description => $contact->cp_abteilung)); |
|
965 |
} |
|
966 |
} |
|
967 |
|
|
954 | 968 |
$self->{all_currencies} = SL::DB::Manager::Currency->get_all(); |
955 | 969 |
|
956 | 970 |
$self->{all_languages} = SL::DB::Manager::Language->get_all(); |
... | ... | |
987 | 1001 |
$self->{all_pricegroups} = SL::DB::Manager::Pricegroup->get_all_sorted(query => [ or => [ id => $self->{cv}->pricegroup_id, obsolete => 0 ] ]); |
988 | 1002 |
} |
989 | 1003 |
|
990 |
$query = |
|
991 |
'SELECT DISTINCT(cp_abteilung) AS department |
|
992 |
FROM contacts |
|
993 |
WHERE cp_abteilung IS NOT NULL AND cp_abteilung != \'\' |
|
994 |
ORDER BY cp_abteilung'; |
|
995 |
$self->{all_departments} = [ |
|
996 |
map( |
|
997 |
{ $_->{department}; } |
|
998 |
selectall_hashref_query($::form, $dbh, $query) |
|
999 |
) |
|
1000 |
]; |
|
1001 |
|
|
1002 | 1004 |
$self->{contacts} = $self->{cv}->contacts; |
1003 | 1005 |
$self->{contacts} ||= []; |
1004 | 1006 |
|
SL/DB/MetaSetup/Default.pm | ||
---|---|---|
40 | 40 |
co_ustid => { type => 'text' }, |
41 | 41 |
coa => { type => 'text' }, |
42 | 42 |
company => { type => 'text' }, |
43 |
contact_departments_use_textfield => { type => 'boolean' }, |
|
43 | 44 |
contact_titles_use_textfield => { type => 'boolean' }, |
44 | 45 |
create_part_if_not_found => { type => 'boolean', default => 'false' }, |
45 | 46 |
create_zugferd_invoices => { type => 'integer' }, |
js/kivi.CustomerVendor.js | ||
---|---|---|
70 | 70 |
if ( contactId ) { |
71 | 71 |
$('#action_delete_contact').show(); |
72 | 72 |
$('#contact_cp_title_select').val(contact['cp_title']); |
73 |
$('#contact_cp_abteilung_select').val(contact['cp_abteilung']); |
|
73 | 74 |
} else { |
74 | 75 |
$('#action_delete_contact').hide(); |
75 | 76 |
$('#contact_cp_title_select, #contact_cp_abteilung_select').val(''); |
locale/de/all | ||
---|---|---|
3823 | 3823 |
'Use UStVA' => 'UStVA verwenden', |
3824 | 3824 |
'Use WebDAV Repository' => 'Verwende WebDAV', |
3825 | 3825 |
'Use WebDAV Storage backend' => 'Verwende WebDAV-Backend', |
3826 |
'Use a text field to enter (new) contact departments if enabled. Otherwise, only a drop down box is offered.' => 'Textfeld zusätzlich zur Eingabe (neuer) Abteilungen von Ansprechpersonen verwenden. Sonst wird nur eine Auswahlliste angezeigt.', |
|
3826 | 3827 |
'Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.' => 'Textfeld zusätzlich zur Eingabe (neuer) Titel von Ansprechpersonen verwenden. Sonst wird nur eine Auswahlliste angezeigt.', |
3827 | 3828 |
'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.', |
3828 | 3829 |
'Use as new' => 'Als neu verwenden', |
... | ... | |
3835 | 3836 |
'Use linked items' => 'Verknüpfte Positionen verwenden', |
3836 | 3837 |
'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', |
3837 | 3838 |
'Use settings from client configuration' => 'Einstellungen aus Mandantenkonfiguration folgen', |
3839 |
'Use text field for department of contacts' => 'Textfeld für Abteilungen von Ansprechpersonen verwenden', |
|
3838 | 3840 |
'Use text field for greetings' => 'Textfeld für Anreden verwenden', |
3839 | 3841 |
'Use text field for title of contacts' => 'Textfeld für Titel von Ansprechpersonen verwenden', |
3840 | 3842 |
'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien', |
locale/en/all | ||
---|---|---|
3822 | 3822 |
'Use UStVA' => '', |
3823 | 3823 |
'Use WebDAV Repository' => '', |
3824 | 3824 |
'Use WebDAV Storage backend' => '', |
3825 |
'Use a text field to enter (new) contact departments if enabled. Otherwise, only a drop down box is offered.' => '', |
|
3825 | 3826 |
'Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.' => '', |
3826 | 3827 |
'Use a text field to enter (new) greetings if enabled. Otherwise, only a drop down box is offered.' => '', |
3827 | 3828 |
'Use as new' => '', |
... | ... | |
3834 | 3835 |
'Use linked items' => '', |
3835 | 3836 |
'Use master default bin for Default Transfer, if no default bin for the part is configured' => '', |
3836 | 3837 |
'Use settings from client configuration' => '', |
3838 |
'Use text field for department of contacts' => '', |
|
3837 | 3839 |
'Use text field for greetings' => '', |
3838 | 3840 |
'Use text field for title of contacts' => '', |
3839 | 3841 |
'Use this storage backend for all generated PDF-Files' => '', |
sql/Pg-upgrade2/defaults_contact_departments_use_textfield.sql | ||
---|---|---|
1 |
-- @tag: defaults_contact_departments_use_textfield |
|
2 |
-- @description: Auswahl, ob Freitext-Feld für Abteilungen bei Ansprechpersonen im Kunden-/Lieferantenstamm angeboten wird |
|
3 |
-- @depends: release_3_5_5 |
|
4 |
|
|
5 |
ALTER TABLE defaults ADD COLUMN contact_departments_use_textfield BOOLEAN; |
|
6 |
UPDATE defaults SET contact_departments_use_textfield = TRUE; |
templates/webpages/client_config/_features.html | ||
---|---|---|
144 | 144 |
<td> [% L.yes_no_tag('defaults.contact_titles_use_textfield', SELF.defaults.contact_titles_use_textfield) %]</td> |
145 | 145 |
<td>[% LxERP.t8('Use a text field to enter (new) contact titles if enabled. Otherwise, only a drop down box is offered.') %]</td> |
146 | 146 |
</tr> |
147 |
<tr> |
|
148 |
<td align="right">[% LxERP.t8('Use text field for department of contacts') %]</td> |
|
149 |
<td> [% L.yes_no_tag('defaults.contact_departments_use_textfield', SELF.defaults.contact_departments_use_textfield) %]</td> |
|
150 |
<td>[% LxERP.t8('Use a text field to enter (new) contact departments if enabled. Otherwise, only a drop down box is offered.') %]</td> |
|
151 |
</tr> |
|
147 | 152 |
|
148 | 153 |
<tr> |
149 | 154 |
<td align="right">[% LxERP.t8('Hourly Rate') %]</td> |
templates/webpages/customer_vendor/tabs/contacts.html | ||
---|---|---|
58 | 58 |
<th align="right" nowrap>[% 'Department' | $T8 %]</th> |
59 | 59 |
|
60 | 60 |
<td> |
61 |
[% L.input_tag('contact.cp_abteilung', SELF.contact.cp_abteilung, size = 40) %] |
|
62 |
[% L.select_tag('contact_cp_abteilung_select', SELF.all_departments, default = SELF.contact.cp_abteilung, with_empty = 1, onchange = '$("#contact_cp_abteilung").val(this.value);') %] |
|
61 |
[%- IF INSTANCE_CONF.get_contact_departments_use_textfield -%] |
|
62 |
[% L.input_tag('contact.cp_abteilung', SELF.contact.cp_abteilung, size = 40) %] |
|
63 |
[% L.select_tag('contact_cp_abteilung_select', SELF.all_contact_departments, default = SELF.contact.cp_abteilung, value_key = 'description', title_key = 'description', with_empty = 1, onchange = '$("#contact_cp_abteilung").val(this.value);') %] |
|
64 |
[%- ELSE -%] |
|
65 |
[% L.select_tag('contact.cp_abteilung', SELF.all_contact_departments, default = SELF.contact.cp_abteilung, value_key = 'description', title_key = 'description', with_empty = 1) %] |
|
66 |
[%- END -%] |
|
63 | 67 |
</td> |
64 | 68 |
</tr> |
65 | 69 |
|
Auch abrufbar als: Unified diff
Abteilungen bei Ansprechpersonen: Freitext-Feld und/oder Auswahlliste
Die Abteilung 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 contact_departments gespeichert.
In der Mandantenkonfiguration ist das Freitext-Feld (altes Verhalten)
abschaltbar.
Todo: Fremdschlüsselbeziehung zwischen contacts und contact_departments