return 1;
}
-sub language {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form, $return_list) = @_;
-
- my $dbh = SL::DB->client->dbh;
-
- my $query =
- "SELECT id, description, template_code, article_code, " .
- " output_numberformat, output_dateformat, output_longdates " .
- "FROM language ORDER BY description";
-
- my $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- my $ary = [];
-
- while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
- push(@{ $ary }, $ref);
- }
-
- $sth->finish;
-
- $main::lxdebug->leave_sub();
-
- if ($return_list) {
- return @{$ary};
- } else {
- $form->{ALL} = $ary;
- }
-}
-
-sub get_language {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- my $dbh = SL::DB->client->dbh;
-
- my $query =
- "SELECT description, template_code, article_code, " .
- " output_numberformat, output_dateformat, output_longdates " .
- "FROM language WHERE id = ?";
- my $sth = $dbh->prepare($query);
- $sth->execute($form->{"id"}) || $form->dberror($query . " ($form->{id})");
-
- my $ref = $sth->fetchrow_hashref("NAME_lc");
-
- map { $form->{$_} = $ref->{$_} } keys %$ref;
-
- $sth->finish;
-
- $main::lxdebug->leave_sub();
-}
-
sub get_language_details {
$main::lxdebug->enter_sub();
return @res;
}
-sub save_language {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
-
- SL::DB->client->with_transaction(sub {
- my $dbh = SL::DB->client->dbh;
- my (@values, $query);
-
- map({ push(@values, $form->{$_}); }
- qw(description template_code article_code
- output_numberformat output_dateformat output_longdates));
-
- # id is the old record
- if ($form->{id}) {
- $query =
- "UPDATE language SET " .
- " description = ?, template_code = ?, article_code = ?, " .
- " output_numberformat = ?, output_dateformat = ?, " .
- " output_longdates = ? " .
- "WHERE id = ?";
- push(@values, $form->{id});
- } else {
- $query =
- "INSERT INTO language (" .
- " description, template_code, article_code, " .
- " output_numberformat, output_dateformat, output_longdates" .
- ") VALUES (?, ?, ?, ?, ?, ?)";
- }
- do_query($form, $dbh, $query, @values);
- 1;
- }) or do { die SL::DB->client->error };
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_language {
- $main::lxdebug->enter_sub();
-
- my ($self, $myconfig, $form) = @_;
- my $query;
-
- SL::DB->client->with_transaction(sub {
- my $dbh = SL::DB->client->dbh;
-
- foreach my $table (qw(generic_translations units_language)) {
- $query = qq|DELETE FROM $table WHERE language_id = ?|;
- do_query($form, $dbh, $query, $form->{"id"});
- }
-
- $query = "DELETE FROM language WHERE id = ?";
- do_query($form, $dbh, $query, $form->{"id"});
- 1;
- }) or do { die SL::DB->client->error };
-
- $main::lxdebug->leave_sub();
-}
-
sub prepare_template_filename {
$main::lxdebug->enter_sub();
},
},
+ language => {
+ # Make locales.pl happy: $self->render("simple_system_setting/_language_form")
+ class => 'Language',
+ titles => {
+ list => t8('Languages'),
+ add => t8('Add language'),
+ edit => t8('Edit language'),
+ },
+ list_attributes => [
+ { method => 'description', title => t8('Description'), },
+ { method => 'template_code', title => t8('Template Code'), },
+ { method => 'article_code', title => t8('Article Code'), },
+ { title => t8('Number Format'), formatter => sub { $_[0]->output_numberformat || t8('use program settings') } },
+ { title => t8('Date Format'), formatter => sub { $_[0]->output_dateformat || t8('use program settings') } },
+ { title => t8('Long Dates'), formatter => sub { $_[0]->output_longdates ? t8('yes') : t8('no') } },
+ ],
+ },
+
part_classification => {
# Make locales.pl happy: $self->render("simple_system_setting/_part_classification_form")
class => 'PartClassification',
$self->{valid_names} = \@SL::DB::RequirementSpecStatus::valid_names;
}
+sub setup_language {
+ my ($self) = @_;
+
+ $self->{numberformats} = [ '1,000.00', '1000.00', '1.000,00', '1000,00', "1'000.00" ];
+ $self->{dateformats} = [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ];
+}
+
1;
__END__
$main::lxdebug->leave_sub();
}
-sub add_language {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
-
- $main::auth->assert('config');
-
- $form->{title} = "Add";
-
- $form->{callback} = "am.pl?action=add_language" unless $form->{callback};
-
- &language_header;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub edit_language {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- $main::auth->assert('config');
-
- $form->{title} = "Edit";
-
- AM->get_language(\%myconfig, \%$form);
-
- &language_header;
-
- $form->{orphaned} = 1;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub list_language {
- $::lxdebug->enter_sub;
- $::auth->assert('config');
-
- AM->language(\%::myconfig, $::form);
-
- $::form->{callback} = "am.pl?action=list_language";
- $::form->{title} = $::locale->text('Languages');
-
- $::form->header;
-
- print $::form->parse_html_template('am/language_list');
-
- $::lxdebug->leave_sub;
-}
-
-sub language_header {
- $::lxdebug->enter_sub;
- $::auth->assert('config');
-
- # $locale->text('Add Language')
- # $locale->text('Edit Language')
- $::form->{title} = $::locale->text("$::form->{title} Language");
-
- $::form->header;
-
- print $::form->parse_html_template('am/language_header', {
- numberformats => [ '1,000.00', '1000.00', '1.000,00', '1000,00', "1'000.00" ],
- dateformats => [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ],
- });
-
- $::lxdebug->leave_sub;
-}
-
-sub save_language {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- $form->isblank("description", $locale->text('Language missing!'));
- $form->isblank("template_code", $locale->text('Template Code missing!'));
- $form->isblank("article_code", $locale->text('Article Code missing!'));
- AM->save_language(\%myconfig, \%$form);
- $form->redirect($locale->text('Language saved!'));
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_language {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->delete_language(\%myconfig, \%$form);
- $form->redirect($locale->text('Language deleted!'));
-
- $main::lxdebug->leave_sub();
-}
-
sub _build_cfg_options {
my $form = $main::form;
my %myconfig = %main::myconfig;
'Add Follow-Up' => 'Wiedervorlage erstellen',
'Add Follow-Up for #1' => 'Wiedervorlage für #1 erstellen',
'Add General Ledger Transaction' => 'Dialogbuchen',
- 'Add Language' => 'Sprache hinzufügen',
'Add Letter' => 'Brief hinzufügen',
'Add Part' => 'Ware erfassen',
'Add Price Factor' => 'Preisfaktor erfassen',
'Add function block' => 'Funktionsblock hinzufügen',
'Add headers from last uploaded file (csv_import)' => 'Spalten aus der hochgeladenen Datei einfügen',
'Add invoices' => 'Rechnungen hinzufügen',
+ 'Add language' => 'Sprache hinzufügen',
'Add link: select records to link with' => 'Verknüpfungen hinzufügen: zu verknüpfende Belege auswählen',
'Add linked record' => 'Verknüpften Beleg hinzufügen',
'Add links' => 'Verknüpfungen hinzufügen',
'Are you sure?' => 'Sind Sie sicher?',
'Article' => 'Artikel',
'Article Code' => 'Artikelkürzel',
- 'Article Code missing!' => 'Artikelkürzel fehlt',
'Article classification' => 'Artikel-Klassifizierung',
'Article type' => 'Artikeltyp',
'Articles' => 'Artikel',
'Edit Follow-Up' => 'Wiedervorlage bearbeiten',
'Edit Follow-Up for #1' => 'Wiedervorlage für #1 bearbeiten',
'Edit General Ledger Transaction' => 'Buchung im Hauptbuch bearbeiten',
- 'Edit Language' => 'Sprache bearbeiten',
'Edit Letter' => 'Brief bearbeiten',
'Edit Part' => 'Ware bearbeiten',
'Edit Preferences for #1' => 'Einstellungen von #1 bearbeiten',
'Edit file' => 'Datei bearbeiten',
'Edit general settings' => 'Grundeinstellungen bearbeiten',
'Edit greetings' => 'Anreden bearbeiten',
+ 'Edit language' => 'Sprache bearbeiten',
'Edit note' => 'Notiz bearbeiten',
'Edit part classification' => 'Artikel-Klassifizierung bearbeiten',
'Edit partsgroup' => 'Warengruppe bearbeiten',
'Language' => 'Sprache',
'Language (database ID)' => 'Sprache (Datenbank-ID)',
'Language (name)' => 'Sprache (Name)',
- 'Language deleted!' => 'Sprache gelöscht!',
- 'Language missing!' => 'Sprache fehlt!',
- 'Language saved!' => 'Sprache gespeichert!',
'Language settings' => 'Spracheinstellungen',
'Languages' => 'Sprachen',
'Languages and translations' => 'Sprachen und Übersetzungen',
'Linked invoices' => 'Verknüpfte Rechnungen',
'Liquidity projection' => 'Liquiditätsübersicht',
'List Accounts' => 'Konten anzeigen',
- 'List Languages' => 'Sprachen anzeigen',
'List Price' => 'Listenpreis',
'List Printers' => 'Drucker anzeigen',
'List Transactions' => 'Buchungsliste',
'Telephone' => 'Telefon',
'Template' => 'Druckvorlage',
'Template Code' => 'Vorlagenkürzel',
- 'Template Code missing!' => 'Vorlagenkürzel fehlt!',
'Template database' => 'Datenbankvorlage',
'Templates' => 'Vorlagen',
'Terms missing in row ' => '+Tage fehlen in Zeile ',
order: 1900
- parent: system_languages_and_translations
id: system_languages_and_translations_add_language
- name: Add Language
+ name: Languages
order: 100
- module: am.pl
- params:
- action: add_language
-- parent: system_languages_and_translations
- id: system_languages_and_translations_list_languages
- name: List Languages
- order: 200
- module: am.pl
params:
- action: list_language
+ action: SimpleSystemSetting/list
+ type: language
- parent: system_languages_and_translations
id: system_languages_and_translations_greetings
name: Greetings
+++ /dev/null
-[%- USE L %]
-[%- USE HTML %]
-[%- USE LxERP %]
-[%- USE T8 %]
-<h1>[% title | html %]</h1>
-
-<form method=post action=am.pl>
-
-<input type=hidden name=id value='[% id %]'>
-<input type=hidden name=type value=language>
-
-<table width=100%>
- <tr>
- <th align=right>[% 'Language' | $T8 %]</th>
- <td><input name=description size=30 value="[% description | html %]"></td>
- <tr>
- <tr>
- <th align=right>[% 'Template Code' | $T8 %]</th>
- <td><input name=template_code size=5 value="[% template_code | html %]"></td>
- </tr>
- <tr>
- <th align=right>[% 'Article Code' | $T8 %]</th>
- <td><input name=article_code size=10 value="[% article_code | html %]"></td>
- </tr>
- <tr>
- <th align=right>[% 'Number Format' | $T8 %]</th>
- <td>[% L.select_tag('output_numberformat', numberformats, default = output_numberformat, with_empty = 1, empty_title = LxERP.t8('use program settings')) %]</td>
- </tr>
- <tr>
- <th align=right>[% 'Date Format' | $T8 %]</th>
- <td>[% L.select_tag('output_dateformat', dateformats, default = output_dateformat, with_empty = 1, empty_title=LxERP.t8('use program settings')) %]</td>
- </tr>
- <tr>
- <th align=right>[% 'Long Dates' | $T8 %]</th>
- <td>[% L.radio_button_tag('output_longdates', checked=output_longdates, label=LxERP.t8('Yes')) %]
- [% L.radio_button_tag('output_longdates', checked=!output_longdates, label=LxERP.t8('No')) %]</td>
- </tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
+++ /dev/null
-[%- USE HTML %]
-[%- USE L %]
-[%- USE LxERP %]
-[%- USE T8 %]
-<h1>[% title | html %]</h1>
-
-<table width=100%>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
- <th class=listheading>[% 'Description' | $T8 %]</th>
- <th class=listheading>[% 'Template Code' | $T8 %]</th>
- <th class=listheading>[% 'Article Code' | $T8 %]</th>
- <th class=listheading>[% 'Number Format' | $T8 %]</th>
- <th class=listheading>[% 'Date Format' | $T8 %]</th>
- <th class=listheading>[% 'Long Dates' | $T8 %]</th>
- </tr>
-[%- FOREACH row = ALL %]
- <tr valign=top class=listrow[% loop.count % 2 %]>
- <td><a href="am.pl?action=edit_language&id=[% row.id | html %]&callback=[% callback | html %]">[% row.description %]</a></td>
- <td align=right>[% row.template_code | html %]</td>
- <td align=right>[% row.article_code | html %]</td>
- <td nowrap>[% row.output_numberformat ? row.output_numberformat : LxERP.t8('use program settings') | html %]</td>
- <td nowrap>[% row.output_dateformat ? row.output_dateformat : LxERP.t8('use program settings') | html %]</td>
- <td nowrap>[% row.output_longdates ? LxERP.t8('Yes') : LxERP.t8('No') %]</td>
-[%- END %]
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=am.pl>
-
-<input name=callback type=hidden value="[% callback | html %]">
-<input type=hidden name=type value=language>
-<input class=submit type=submit name=action value="[% 'Add' | $T8 %]">
-
- </form>
-
--- /dev/null
+[%- USE LxERP -%][%- USE L -%][%- USE HTML -%]
+[% SET style="width: 250px" %]
+<table>
+ <tr>
+ <th align="right">[% LxERP.t8("Language") %]</th>
+ <td>[% L.input_tag("object.description", SELF.object.description, style=style, "data-validate"="required", "data-title"=LxERP.t8("Language")) %]</td>
+ <tr>
+ <tr>
+ <th align="right">[% LxERP.t8("Template Code") %]</th>
+ <td>[% L.input_tag("object.template_code", SELF.object.template_code, style=style) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% LxERP.t8("Article Code") %]</th>
+ <td>[% L.input_tag("object.article_code", SELF.object.article_code, style=style) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% LxERP.t8("Number Format") %]</th>
+ <td>[% L.select_tag("object.output_numberformat", SELF.numberformats, default=SELF.object.output_numberformat, with_empty=1, empty_title=LxERP.t8("use program settings"), style=style) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% LxERP.t8("Date Format") %]</th>
+ <td>[% L.select_tag("object.output_dateformat", SELF.dateformats, default=SELF.object.output_dateformat, with_empty=1, empty_title=LxERP.t8("use program settings"), style=style) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% LxERP.t8("Long Dates") %]</th>
+ <td>[% L.yes_no_tag("object.output_longdates", SELF.object.output_longdates, style=style) %]</td>
+ </tr>
+</table>