my $dbh = $form->dbconnect($myconfig);
- $query =
- qq|SELECT DISTINCT(cp_greeting) | .
- qq|FROM contacts | .
- qq|WHERE cp_greeting ~ '[a-zA-Z]' | .
- qq|ORDER BY cp_greeting|;
- $form->{GREETINGS} = [ selectall_array_query($form, $dbh, $query) ];
-
- $query =
- qq|SELECT DISTINCT(greeting) | .
- qq|FROM customer | .
- qq|WHERE greeting ~ '[a-zA-Z]' | .
- qq|UNION | .
- qq|SELECT DISTINCT(greeting) | .
- qq|FROM vendor | .
- qq|WHERE greeting ~ '[a-zA-Z]' | .
- qq|ORDER BY greeting|;
- my %tmp;
- map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query));
- $form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ];
+# edit: cp_greeting wurde entfernt, wird durch cp_gender ersetzt
+# $query =
+# qq|SELECT DISTINCT(cp_greeting) | .
+# qq|FROM contacts | .
+# qq|WHERE cp_greeting ~ '[a-zA-Z]' | .
+# qq|ORDER BY cp_greeting|;
+# $form->{GREETINGS} = [ selectall_array_query($form, $dbh, $query) ];
+#
+# $query =
+# qq|SELECT DISTINCT(greeting) | .
+# qq|FROM customer | .
+# qq|WHERE greeting ~ '[a-zA-Z]' | .
+# qq|UNION | .
+# qq|SELECT DISTINCT(greeting) | .
+# qq|FROM vendor | .
+# qq|WHERE greeting ~ '[a-zA-Z]' | .
+# qq|ORDER BY greeting|;
+# my %tmp;
+# map({ $tmp{$_} = 1; } selectall_array_query($form, $dbh, $query));
+# $form->{COMPANY_GREETINGS} = [ sort(keys(%tmp)) ];
$query =
qq|SELECT DISTINCT(cp_title) | .
qq|cp_project = ?, | .
qq|cp_privatphone = ?, | .
qq|cp_privatemail = ?, | .
- qq|cp_birthday = ? | .
+ qq|cp_birthday = ?, | .
+ qq|cp_gender = ? | .
qq|WHERE cp_id = ?|;
@values = (
$form->{cp_greeting},
$form->{cp_privatphone},
$form->{cp_privatemail},
$form->{cp_birthday},
+ $form->{cp_gender} eq 'f' ? 'f' : 'm',
$form->{cp_id}
);
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | .
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | .
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | .
- qq| cp_birthday) | .
- qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ qq| cp_birthday, cp_gender) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
@values = (
$form->{id},
$form->{cp_greeting},
$form->{cp_project},
$form->{cp_privatphone},
$form->{cp_privatemail},
- $form->{cp_birthday}
+ $form->{cp_birthday},
+ $form->{cp_gender} eq 'f' ? 'f' : 'm',
);
}
do_query( $form, $dbh, $query, @values ) if ($query);
qq|cp_privatphone = ?, | .
qq|cp_privatemail = ?, | .
qq|cp_birthday = ? | .
+ qq|cp_gender = ? | .
qq|WHERE cp_id = ?|;
@values = (
$form->{cp_greeting},
$form->{cp_privatphone},
$form->{cp_privatemail},
$form->{cp_birthday},
+ $form->{cp_gender} eq 'f' ? 'f' : 'm',
$form->{cp_id}
);
} elsif ( $form->{cp_name} || $form->{cp_givenname} ) {
qq|INSERT INTO contacts ( cp_cv_id, cp_greeting, cp_title, cp_givenname, | .
qq| cp_name, cp_email, cp_phone1, cp_phone2, cp_abteilung, cp_fax, cp_mobile1, | .
qq| cp_mobile2, cp_satphone, cp_satfax, cp_project, cp_privatphone, cp_privatemail, | .
- qq| cp_birthday) | .
- qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
+ qq| cp_birthday, cp_gender) | .
+ qq|VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)|;
@values = (
$form->{id},
$form->{cp_greeting},
push(@queries, qq|SELECT
c.id, c.name, 0 AS customer_is_vendor,
c.street, c.zipcode, c.city,
- ct.cp_greeting, ct.cp_title, ct.cp_givenname, ct.cp_name
+ ct.cp_gender, ct.cp_title, ct.cp_givenname, ct.cp_name
FROM customer c
LEFT JOIN contacts ct ON (c.id = ct.cp_cv_id)
$c_filter|);
push(@queries, qq|SELECT
v.id, v.name, 1 AS customer_is_vendor,
v.street, v.zipcode, v.city,
- ct.cp_greeting, ct.cp_title, ct.cp_givenname, ct.cp_name
+ ct.cp_gender, ct.cp_title, ct.cp_givenname, ct.cp_name
FROM vendor v
LEFT JOIN contacts ct ON (v.id = ct.cp_cv_id)
$v_filter|);
while (<IN>) {
print OUT $_;
+ open(DUMP_OUT, "> /tmp/lx2.dump" );
+ print(DUMP_OUT Dumper($self));
+ close(DUMP_OUT);
+
}
close(OUT);
use SL::Common;
use SL::DBUtils;
use SL::DO;
+use SL::GenericTranslations;
use SL::MoreCommon;
use List::Util qw(min);
'trans_id' => $form->{vendor_id});
map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables };
+ $form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh,
+ 'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'),
+ 'allow_fallback' => 1);
+
$dbh->disconnect();
$main::lxdebug->leave_sub();
use SL::Common;
use SL::DBUtils;
use SL::DO;
+use SL::GenericTranslations;
use SL::MoreCommon;
use SL::IC;
use Data::Dumper;
# connect to database
my $dbh = $form->dbconnect($myconfig);
+ my $language_id = $form->{language_id};
+
# get contact id, set it if nessessary
$form->{cp_id} *= 1;
'trans_id' => $form->{customer_id});
map { $form->{"vc_cvar_$_->{name}"} = $_->{value} } @{ $custom_variables };
+ $form->{cp_greeting} = GenericTranslations->get('dbh' => $dbh,
+ 'translation_type' => 'greetings::' . ($form->{cp_gender} eq 'f' ? 'female' : 'male'),
+ 'language_id' => $language_id,
+ 'allow_fallback' => 1);
+
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
$cov->{address} =~ s{^,}{}x;
$cov->{address} =~ s{\ +}{\ }gx;
- $cov->{contact} = join " ", map { $cov->{$_} } qw(cp_greeting cp_title cp_givenname cp_name);
+ $cov->{contact} = join " ", map { $cov->{$_} } qw(cp_gender cp_title cp_givenname cp_name);
$cov->{contact} =~ s{\ +}{\ }gx;
}
CT->get_contact(\%myconfig, \%$form);
print $form->ajax_response_header(), join '__pjx__', map $form->{"cp_$_"},
- qw(name greeting title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used);
+ qw(name greeting title givenname phone1 phone2 email abteilung fax mobile1 mobile2 satphone satfax project privatphone privatemail birthday used gender);
$lxdebug->leave_sub();
}
'December' => 'Dezember',
'Decimalplaces' => 'Dezimalstellen',
'Decrease' => 'Verringern',
+ 'Default (no language selected)' => 'Standard (keine Sprache ausgewählt)',
'Default Accounts' => 'Standardkonten',
'Default output medium' => 'Standardausgabekanal',
'Default printer' => 'Standarddrucker',
'Edit and delete a group' => 'Gruppen bearbeiten und löschen',
'Edit custom variable' => 'Benutzerdefinierte Variable bearbeiten',
'Edit file' => 'Datei bearbeiten',
+ 'Edit greetings' => 'Anreden bearbeiten',
'Edit group ' => 'Gruppe bearbeiten',
'Edit group membership' => 'Gruppenmitgliedschaften bearbeiten',
'Edit groups' => 'Gruppen bearbeiten',
'Full access to all functions' => 'Vollzugriff auf alle Funktionen',
'GL Transaction' => 'Dialogbuchung',
'Gegenkonto' => 'Gegenkonto',
+ 'Gender' => 'Geschlecht',
'General Ledger' => 'Finanzbuchhaltung',
'General Ledger Corrections' => 'Korrekturen im Hauptbuch',
'General Ledger Transaction' => 'Dialogbuchung',
'German' => 'Deutsch',
'Given Name' => 'Vorname',
'Greeting' => 'Anrede',
+ 'Greetings' => 'Anreden',
'Group' => 'Warengruppe',
'Group Invoices' => 'Rechnungen zusammenfassen',
'Group Items' => 'Waren gruppieren',
'The following users have been migrated into the authentication database:' => 'Die folgenden Benutzer wurden in die Authentifizierungsdatenbank migriert:',
'The following warnings occured during an upgrade to the document templates:' => 'Die folgenden Warnungen traten während einer Aktualisierung der Dokumentenvorlagen auf:',
'The formula needs the following syntax:<br>For regular article:<br>Variablename= Variable Unit;<br>Variablename2= Variable2 Unit2;<br>...<br>###<br>Variable + ( Variable2 / Variable )<br><b>Please be beware of the spaces in the formula</b><br>' => 'Die Formeln müssen in der folgenden Syntax eingegeben werden:<br>Bei normalen Artikeln:<br>Variablenname = Variable Einheit;<br>Variablenname2 = Variable2 Einheit2;<br>...<br>###<br>Variable + Variable2 * ( Variable - Variable2 )<br>Variablennamen und Einheiten dürfen nur aus alphanumerischen Zeichen bestehen.<br>Es muss jeweils die Gesamte Zeile eingegeben werden',
+ 'The greetings have been saved.' => 'Die Anreden wurden gespeichert',
'The group has been added.' => 'Die Gruppe wurde erfasst.',
'The group has been deleted.' => 'Die Gruppe wurde gelöscht.',
'The group has been saved.' => 'Die Gruppe wurde gespeichert.',
'eMail?' => 'eMail?',
'ea' => 'St.',
'emailed to' => 'gemailt an',
+ 'female' => 'weiblich',
'follow_up_list' => 'wiedervorlageliste',
'for' => 'für',
'for Period' => 'für den Zeitraum',
'list_of_receipts' => 'zahlungseingaenge',
'list_of_transactions' => 'buchungsliste',
'logout' => 'abmelden',
+ 'male' => 'männlich',
'mark as paid' => 'als bezahlt markieren',
'master' => 'de',
'missing' => 'Fehlbestand',
'General Ledger' => 'Finanzbuchhaltung',
'General Ledger Corrections' => 'Korrekturen im Hauptbuch',
'General ledger and cash' => 'Finanzbuchhaltung und Zahlungsverkehr',
+ 'Greetings' => 'Anreden',
'Groups' => 'Warengruppen',
'HTML Templates' => 'HTML-Vorlagen',
'History Search Engine' => 'Historien Suchmaschine',
'General Ledger' => 'Finanzbuchhaltung',
'General Ledger Corrections' => 'Korrekturen im Hauptbuch',
'General ledger and cash' => 'Finanzbuchhaltung und Zahlungsverkehr',
+ 'Greetings' => 'Anreden',
'Groups' => 'Warengruppen',
'HTML Templates' => 'HTML-Vorlagen',
'History Search Engine' => 'Historien Suchmaschine',
module=am.pl
action=list_language
+[System--Languages--Greetings]
+module=generictranslations.pl
+action=edit_greetings
+
+
[System--Printer]
module=menu.pl
action=acc_menu
--- /dev/null
+-- @tag: gender
+-- @description: Feld "Geschlecht" zu Kontaktdaten hinzufuegen, cp_greeting entferne
+-- @depends: release_2_6_0
+
+ALTER TABLE contacts ADD COLUMN cp_gender char(1);
+UPDATE contacts SET cp_gender = 'm';
+UPDATE contacts SET cp_gender = 'f'
+ WHERE (cp_greeting ILIKE '%frau%')
+ OR (cp_greeting ILIKE '%mrs.%')
+ OR (cp_greeting ILIKE '%miss%');
+
+UPDATE contacts SET cp_title = cp_greeting WHERE NOT (cp_greeting ILIKE '%frau%' OR cp_greeting ILIKE '%herr%' or cp_greeting ILIKE '%mrs.%' or cp_greeting ILIKE '%miss%');
+
+ALtER TABLE contacts DROP COLUMN cp_greeting;
--- /dev/null
+-- @tag: generic_translations
+-- @description: Allgemeine Tabelle fuer Uebersetzungen
+-- @depends: release_2_6_0
+CREATE TABLE generic_translations (
+ id SERIAL,
+ language_id integer,
+ translation_type varchar(100) NOT NULL,
+ translation_id integer,
+ translation text,
+
+ PRIMARY KEY (id),
+ FOREIGN KEY (language_id) REFERENCES language (id)
+);
+CREATE INDEX generic_translations_type_id_idx ON generic_translations (language_id, translation_type, translation_id);
+
name = 'shipto_id',
id = 'shipto_id',
DATA = SHIPTO,
- onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto])",
+ onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto,set_gender])",
id_key = 'shipto_id',
label_sub = 'shipto_label',
label_key = 'shipto_label',
name = 'cp_id',
id = 'cp_id',
DATA = CONTACTS,
- onChange = "get_contact(['cp_id__'+this.value],['cp_name','cp_greeting','cp_title','cp_givenname','cp_phone1','cp_phone2','cp_email','cp_abteilung','cp_fax','cp_mobile1','cp_mobile2','cp_satphone','cp_satfax','cp_project','cp_privatphone','cp_privatemail','cp_birthday',enable_delete_contact])",
+ onChange = "get_contact(['cp_id__'+this.value],['cp_name','cp_title','cp_givenname','cp_phone1','cp_phone2','cp_email','cp_abteilung','cp_fax','cp_mobile1','cp_mobile2','cp_satphone','cp_satfax','cp_project','cp_privatphone','cp_privatemail','cp_birthday',enable_delete_contact,set_gender])",
id_key = 'cp_id',
label_sub = 'contacts_label',
-%]
</td>
</tr>
- <tr>
- <th align="left" nowrap>Anrede</th>
- <td>
- <input id="cp_greeting" name="cp_greeting" size="40" maxlength="75" value="[% HTML.escape(cp_greeting) %]">
- [%- INCLUDE generic/multibox.html
- name = 'selected_cp_greeting',
- DATA = MB_GREETINGS,
- show_empty = 1,
- id_key = 'id',
- label_key = 'description',
- -%]
- </td>
- </tr>
+ <tr>
+ <th align="left" nowrap>Geschlecht</th>
+ <td>
+ <select id="cp_gender" name="cp_gender">
+ <option value="m"[% IF cp_gender == 'm' %] selected[% END %]>männlich</option>
+ <option value="f"[% IF cp_gender == 'f' %] selected[% END %]>weiblich</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
<tr>
<th align="left" nowrap>Titel</th>
[%- END %]
</div>
+
+ <script type="text/javascript">
+ <!--
+ function set_gender(gender) {
+ var s = document.getElementById('cp_gender');
+ if (s) {
+ s.selectedIndex = (gender == 'f') ? 1 : 0;
+ }
+ }
+ -->
+
+ </script>
+
+
+
name = 'shipto_id',
id = 'shipto_id',
DATA = SHIPTO,
- onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto])",
+ onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto,set_gender])",
id_key = 'shipto_id',
label_sub = 'shipto_label',
label_key = 'shipto_label',
name = 'cp_id',
id = 'cp_id',
DATA = CONTACTS,
- onChange = "get_contact(['cp_id__'+this.value],['cp_name','cp_greeting','cp_title','cp_givenname','cp_phone1','cp_phone2','cp_email','cp_abteilung','cp_fax','cp_mobile1','cp_mobile2','cp_satphone','cp_satfax','cp_project','cp_privatphone','cp_privatemail','cp_birthday',enable_delete_contact])",
+ onChange = "get_contact(['cp_id__'+this.value],['cp_name','cp_title','cp_givenname','cp_phone1','cp_phone2','cp_email','cp_abteilung','cp_fax','cp_mobile1','cp_mobile2','cp_satphone','cp_satfax','cp_project','cp_privatphone','cp_privatemail','cp_birthday',enable_delete_contact,set_gender])",
id_key = 'cp_id',
label_sub = 'contacts_label',
-%]
</td>
</tr>
- <tr>
- <th align="left" nowrap><translate>Greeting</translate></th>
- <td>
- <input id="cp_greeting" name="cp_greeting" size="40" maxlength="75" value="[% HTML.escape(cp_greeting) %]">
- [%- INCLUDE generic/multibox.html
- name = 'selected_cp_greeting',
- DATA = MB_GREETINGS,
- show_empty = 1,
- id_key = 'id',
- label_key = 'description',
- -%]
- </td>
- </tr>
+ <tr>
+ <th align="left" nowrap><translate>Gender</translate></th>
+ <td>
+ <select id="cp_gender" name="cp_gender">
+ <option value="m"[% IF cp_gender == 'm' %] selected[% END %]><translate>male</translate></option>
+ <option value="f"[% IF cp_gender == 'f' %] selected[% END %]><translate>female</translate></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
<tr>
<th align="left" nowrap><translate>Title</translate></th>
[%- END %]
</div>
+
+ <script type="text/javascript">
+ <!--
+ function set_gender(gender) {
+ var s = document.getElementById('cp_gender');
+ if (s) {
+ s.selectedIndex = (gender == 'f') ? 1 : 0;
+ }
+ }
+ -->
+
+ </script>
+
+
+