From 5b64d6fcbd6a3b97fe0d7689bae9d72f04ad7307 Mon Sep 17 00:00:00 2001
From: Moritz Bunkus
Date: Fri, 3 Jul 2009 18:05:05 +0200
Subject: [PATCH] =?utf8?q?Umstellung=20der=20Verwaltung=20der=20benutzerde?=
=?utf8?q?finierten=20Variablen=20zum=20Sparen=20von=20Men=C3=BCeintr?=
=?utf8?q?=C3=A4gen.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
bin/mozilla/amcvar.pl | 38 ++++-
locale/de/all | 8 +-
locale/de/amcvar | 7 +
locale/de/menu | 8 +-
locale/de/menunew | 8 +-
menu.ini | 26 +--
.../amcvar/display_cvar_config_form_de.html | 15 +-
.../display_cvar_config_form_master.html | 15 +-
.../webpages/amcvar/list_cvar_configs_de.html | 151 ++++++++++--------
.../amcvar/list_cvar_configs_master.html | 151 ++++++++++--------
10 files changed, 220 insertions(+), 207 deletions(-)
diff --git a/bin/mozilla/amcvar.pl b/bin/mozilla/amcvar.pl
index 795dd44b7..a3e281ff6 100644
--- a/bin/mozilla/amcvar.pl
+++ b/bin/mozilla/amcvar.pl
@@ -36,6 +36,7 @@ use SL::CVar;
use SL::Form;
use Data::Dumper;
+use List::MoreUtils qw(any);
1;
@@ -54,6 +55,11 @@ our %translations = ('text' => $locale->text('Free-form text'),
our @types = qw(text textfield number date bool select); # timestamp
+our @modules = ({ module => 'CT', description => $locale->text('Customers and vendors') },
+ { module => 'IC', description => $locale->text('Parts, services and assemblies') },
+ { module => 'Projects', description => $locale->text('Projects') },
+ );
+
sub add {
add_cvar_config();
}
@@ -62,14 +68,21 @@ sub edit {
edit_cvar_config();
}
+sub _is_valid_module {
+ my $module = shift;
+
+ return any { $_->{module} eq $module } @modules;
+}
+
sub list_cvar_configs {
$lxdebug->enter_sub();
$auth->assert('config');
- $form->{module} ||= $form->{cvar_module};
+ $form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
+ $form->{module} = 'CT' unless _is_valid_module($form->{module});
- my @configs = grep { $_->{module} eq $form->{module} } @{ CVar->get_configs() };
+ my @configs = @{ CVar->get_configs(module => $form->{module}) };
my $previous_config;
@@ -86,7 +99,10 @@ sub list_cvar_configs {
$form->{title} = $locale->text('List of custom variables');
$form->header();
- print $form->parse_html_template('amcvar/list_cvar_configs', { 'CONFIGS' => \@configs });
+ print $form->parse_html_template('amcvar/list_cvar_configs', { CONFIGS => \@configs,
+ MODULES => \@modules });
+
+ $main::lxdebug->dump(0, "modules", \@modules);
$lxdebug->leave_sub();
}
@@ -96,7 +112,7 @@ sub add_cvar_config {
$auth->assert('config');
- $form->{module} ||= $form->{cvar_module};
+ $form->{module} = $form->{module} || $form->{cvar_module} || 'CT';
$form->{edit} = 0;
display_cvar_config_form();
@@ -176,7 +192,8 @@ sub display_cvar_config_form {
$form->{title} = $form->{edit} ? $locale->text("Edit custom variable") : $locale->text("Add custom variable");
$form->header();
- print $form->parse_html_template("amcvar/display_cvar_config_form", { 'TYPES' => \@types });
+ print $form->parse_html_template("amcvar/display_cvar_config_form", { TYPES => \@types,
+ MODULES => \@modules });
$lxdebug->leave_sub();
}
@@ -191,4 +208,15 @@ sub swap_cvar_configs {
$lxdebug->leave_sub();
}
+sub dispatcher {
+ foreach my $action (qw(list_cvar_configs add_cvar_config)) {
+ if ($form->{"action_${action}"}) {
+ call_sub($action);
+ return;
+ }
+ }
+
+ $form->error($locale->text('No action defined.'));
+}
+
1;
diff --git a/locale/de/all b/locale/de/all
index b7dceda75..ee987ca9c 100644
--- a/locale/de/all
+++ b/locale/de/all
@@ -102,9 +102,6 @@ $self->{texts} = {
'Active?' => 'Aktiviert?',
'Add' => 'Erfassen',
'Add ' => 'Hinzufügen',
- 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
- 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
- 'Add (Projects)' => 'Erfassen (Projekte)',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
@@ -427,6 +424,7 @@ $self->{texts} = {
'Current unit' => 'Aktuelle Einheit',
'Current value:' => 'Aktueller Wert:',
'Custom Variables' => 'Benutzerdefinierte Variablen',
+ 'Custom variables for module' => 'Benutzerdefinierte Variablen für Modul',
'Customer' => 'Kunde',
'Customer Number' => 'Kundennummer',
'Customer Order Number' => 'Bestellnummer des Kunden',
@@ -890,9 +888,7 @@ $self->{texts} = {
'Limit part selection' => 'Artikelauswahl eingrenzen',
'Line Total' => 'Zeilensumme',
'Line endings' => 'Zeilenumbrüche',
- 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
- 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
- 'List (Projects)' => 'Auflisten (Projekte)',
+ 'List' => 'Anzeigen',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
diff --git a/locale/de/amcvar b/locale/de/amcvar
index dc92a0c8c..39c6c6301 100644
--- a/locale/de/amcvar
+++ b/locale/de/amcvar
@@ -48,6 +48,7 @@ $self->{texts} = {
'Credit Note' => 'Gutschrift',
'Customer Number' => 'Kundennummer',
'Customer details' => 'Kundendetails',
+ 'Customers and vendors' => 'Kunden und Lieferanten',
'DATEV Export' => 'DATEV-Export',
'DELETED' => 'Gelöscht',
'DR' => 'S',
@@ -85,6 +86,7 @@ $self->{texts} = {
'No %s was found matching the search parameters.' => 'Es wurde kein %s gefunden, auf den die Suchparameter zutreffen.',
'No Customer was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Endkunde gefunden',
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden',
+ 'No action defined.' => 'Keine Aktion definiert.',
'No customer has been selected yet.' => 'Es wurde noch kein Kunde ausgewählt.',
'No or an unknown authenticantion module specified in "config/authentication.pl".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/authentication.pl" angegeben.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
@@ -98,10 +100,12 @@ $self->{texts} = {
'Packing List' => 'Lieferschein',
'Part Number' => 'Artikelnummer',
'Part description' => 'Artikelbeschreibung',
+ 'Parts, services and assemblies' => 'Waren, Dienstleistungen und Erzeugnisse',
'Pick List' => 'Sammelliste',
'Please enter values' => 'Bitte Werte eingeben',
'Preview' => 'Druckvorschau',
'Proforma Invoice' => 'Proformarechnung',
+ 'Projects' => 'Projekte',
'Purchase Order' => 'Lieferantenauftrag',
'Quotation' => 'Angebot',
'RFQ' => 'Anfrage',
@@ -173,6 +177,7 @@ $self->{subs} = {
'H' => 'H',
'NTI' => 'NTI',
'Q' => 'Q',
+ '_is_valid_module' => '_is_valid_module',
'add' => 'add',
'add_cvar_config' => 'add_cvar_config',
'ap_transaction' => 'ap_transaction',
@@ -183,6 +188,7 @@ $self->{subs} = {
'cov_selection_internal' => 'cov_selection_internal',
'delete' => 'delete',
'delivery_customer_selection' => 'delivery_customer_selection',
+ 'dispatcher' => 'dispatcher',
'display_cvar_config_form' => 'display_cvar_config_form',
'edit' => 'edit',
'edit_cvar_config' => 'edit_cvar_config',
@@ -209,6 +215,7 @@ $self->{subs} = {
'löschen' => 'delete',
'neue_ware' => 'new_part',
'speichern' => 'save',
+ 'zeigen' => 'show',
};
1;
diff --git a/locale/de/menu b/locale/de/menu
index d5beaf60d..d5becc2a9 100644
--- a/locale/de/menu
+++ b/locale/de/menu
@@ -7,9 +7,7 @@ $self->{texts} = {
'AR' => 'Verkauf',
'AR Aging' => 'Offene Forderungen',
'Accounting Menu' => 'Kontoverwaltung',
- 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
- 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
- 'Add (Projects)' => 'Erfassen (Projekte)',
+ 'Add' => 'Erfassen',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
@@ -119,9 +117,7 @@ $self->{texts} = {
'Languages' => 'Sprachen',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
- 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
- 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
- 'List (Projects)' => 'Auflisten (Projekte)',
+ 'List' => 'Anzeigen',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
diff --git a/locale/de/menunew b/locale/de/menunew
index cb853f166..3287d82e9 100644
--- a/locale/de/menunew
+++ b/locale/de/menunew
@@ -6,9 +6,7 @@ $self->{texts} = {
'AP Aging' => 'Offene Verbindlichkeiten',
'AR' => 'Verkauf',
'AR Aging' => 'Offene Forderungen',
- 'Add (Customers and Vendors)' => 'Erfassen (Kunden und Lieferanten)',
- 'Add (Parts, services, assemblies)' => 'Erfassen (Waren, Dienstleistungen, Erzeugnisse)',
- 'Add (Projects)' => 'Erfassen (Projekte)',
+ 'Add' => 'Erfassen',
'Add AP Transaction' => 'Kreditorenbuchung',
'Add AR Transaction' => 'Debitorenbuchung',
'Add Account' => 'Konto erfassen',
@@ -118,9 +116,7 @@ $self->{texts} = {
'Languages' => 'Sprachen',
'Lead' => 'Kundenquelle',
'Licenses' => 'Lizenzen',
- 'List (Customers and Vendors)' => 'Auflisten (Kunden und Lieferanten)',
- 'List (Parts, services, assemblies)' => 'Auflisten (Waren, Dienstleistungen, Erzeugnisse)',
- 'List (Projects)' => 'Auflisten (Projekte)',
+ 'List' => 'Anzeigen',
'List Accounting Groups' => 'Buchungsgruppen anzeigen',
'List Accounts' => 'Konten anzeigen',
'List Businesses' => 'Kunden-/Lieferantentypen anzeigen',
diff --git a/menu.ini b/menu.ini
index 318759065..7835f30b0 100644
--- a/menu.ini
+++ b/menu.ini
@@ -681,35 +681,13 @@ action=acc_menu
target=acc_menu
submenu=1
-[System--Custom Variables--Add (Customers and Vendors)]
+[System--Custom Variables--Add]
module=amcvar.pl
action=add_cvar_config
-cvar_module=CT
-[System--Custom Variables--List (Customers and Vendors)]
+[System--Custom Variables--List]
module=amcvar.pl
action=list_cvar_configs
-cvar_module=CT
-
-[System--Custom Variables--Add (Parts, services, assemblies)]
-module=amcvar.pl
-action=add_cvar_config
-cvar_module=IC
-
-[System--Custom Variables--List (Parts, services, assemblies)]
-module=amcvar.pl
-action=list_cvar_configs
-cvar_module=IC
-
-[System--Custom Variables--Add (Projects)]
-module=amcvar.pl
-action=add_cvar_config
-cvar_module=Projects
-
-[System--Custom Variables--List (Projects)]
-module=amcvar.pl
-action=list_cvar_configs
-cvar_module=Projects
[System--Warehouses]
module=menu.pl
diff --git a/templates/webpages/amcvar/display_cvar_config_form_de.html b/templates/webpages/amcvar/display_cvar_config_form_de.html
index 3e912112a..20ee21d9a 100644
--- a/templates/webpages/amcvar/display_cvar_config_form_de.html
+++ b/templates/webpages/amcvar/display_cvar_config_form_de.html
@@ -15,13 +15,11 @@
Modul |
- [%- IF module == 'CT' %]
- Kunden und Lieferanten
- [%- ELSIF module == 'Projects' %]
- Projekte
- [%- ELSIF module == 'IC' %]
- Waren, Dienstleistungen und Erzeugnisse
- [%- END %]
+ [%- INCLUDE generic/multibox.html
+ name = 'module',
+ id_key = 'module',
+ label_key = 'description',
+ DATA = MODULES %]
|
@@ -91,8 +89,7 @@
-
-
+
diff --git a/templates/webpages/amcvar/display_cvar_config_form_master.html b/templates/webpages/amcvar/display_cvar_config_form_master.html
index 94622ca5f..3f6fa83dd 100644
--- a/templates/webpages/amcvar/display_cvar_config_form_master.html
+++ b/templates/webpages/amcvar/display_cvar_config_form_master.html
@@ -15,13 +15,11 @@
Module |
- [%- IF module == 'CT' %]
- Customers and vendors
- [%- ELSIF module == 'Projects' %]
- Projects
- [%- ELSIF module == 'IC' %]
- Parts, services and assemblies
- [%- END %]
+ [%- INCLUDE generic/multibox.html
+ name = 'module',
+ id_key = 'module',
+ label_key = 'description',
+ DATA = MODULES %]
|
@@ -91,8 +89,7 @@
-
-
+
diff --git a/templates/webpages/amcvar/list_cvar_configs_de.html b/templates/webpages/amcvar/list_cvar_configs_de.html
index 827c56e89..817483095 100644
--- a/templates/webpages/amcvar/list_cvar_configs_de.html
+++ b/templates/webpages/amcvar/list_cvar_configs_de.html
@@ -4,89 +4,98 @@
[% title %]
-
-
-
- |
- |
- Name |
- Beschreibung |
- Typ |
- Durchsuchbar |
- In Berichten anzeigbar |
- [%- IF module == 'IC' %]
- Bearbeitbar |
- [%- END %]
-
+
+
-
-
-
+
+
+
+