From: Moritz Bunkus Date: Fri, 16 Nov 2007 09:14:42 +0000 (+0000) Subject: Das Bearbeiten der Einstellungen, die in der Tabelle "defaults" gespeichert werden... X-Git-Tag: release-2.6.0beta1~405 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e549422fb649ca2299e684dc10ffe4a0f8c7efb1;p=kivitendo-erp.git Das Bearbeiten der Einstellungen, die in der Tabelle "defaults" gespeichert werden, wurde in eine eigene Maske ausgelagert, die unter "System -> Nummernkreise und Standardkonten" aufrufbar ist. Bei "Programm -> Benutzereinstellungen" hingegen befinden sich nur noch Einstellungen, die pro Benutzer einstellbar sind (also die Sachen aus %myconfig). --- diff --git a/SL/AM.pm b/SL/AM.pm index fa6e128ea..4eddb74bd 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -1474,68 +1474,83 @@ sub save_template { return $error; } -sub save_preferences { +sub save_defaults { $main::lxdebug->enter_sub(); - my ($self, $myconfig, $form, $memberfile, $userspath, $webdav) = @_; + my $self = shift; + my %params = @_; - map { ($form->{$_}) = split(/--/, $form->{$_}) } - qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno); + my $myconfig = \%main::myconfig; + my $form = $main::form; - my @a; - $form->{curr} =~ s/ //g; - map { push(@a, uc pack "A3", $_) if $_ } split(/:/, $form->{curr}); - $form->{curr} = join ':', @a; + my $dbh = $params{dbh} || $form->get_standard_dbh($myconfig); - # connect to database - my $dbh = $form->dbconnect_noauto($myconfig); + my %accnos; + map { ($accnos{$_}) = split(m/--/, $form->{$_}) } qw(inventory_accno income_accno expense_accno fxgain_accno fxloss_accno); + + $form->{curr} =~ s/ //g; + my @currencies = grep { $_ ne '' } split m/:/, $form->{curr}; + my $currency = join ':', @currencies; # these defaults are database wide - # user specific variables are in myconfig - # save defaults + my $query = - qq|UPDATE defaults SET | . - qq|inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | . - qq|income_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | . - qq|expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | . - qq|fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | . - qq|fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), | . - qq|invnumber = ?, | . - qq|cnnumber = ?, | . - qq|sonumber = ?, | . - qq|ponumber = ?, | . - qq|sqnumber = ?, | . - qq|rfqnumber = ?, | . - qq|customernumber = ?, | . - qq|vendornumber = ?, | . - qq|articlenumber = ?, | . - qq|servicenumber = ?, | . - qq|yearend = ?, | . - qq|curr = ?, | . - qq|businessnumber = ?|; - my @values = ($form->{inventory_accno}, $form->{income_accno}, - $form->{expense_accno}, - $form->{fxgain_accno}, $form->{fxloss_accno}, - $form->{invnumber}, $form->{cnnumber}, - $form->{sonumber}, $form->{ponumber}, - $form->{sqnumber}, $form->{rfqnumber}, - $form->{customernumber}, $form->{vendornumber}, - $form->{articlenumber}, $form->{servicenumber}, - $form->{yearend}, $form->{curr}, + qq|UPDATE defaults SET + inventory_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), + income_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), + expense_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), + fxgain_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), + fxloss_accno_id = (SELECT c.id FROM chart c WHERE c.accno = ?), + invnumber = ?, + cnnumber = ?, + sonumber = ?, + ponumber = ?, + sqnumber = ?, + rfqnumber = ?, + customernumber = ?, + vendornumber = ?, + articlenumber = ?, + servicenumber = ?, + yearend = ?, + curr = ?, + businessnumber = ?|; + my @values = ($accnos{inventory_accno}, $accnos{income_accno}, $accnos{expense_accno}, + $accnos{fxgain_accno}, $accnos{fxloss_accno}, + $form->{invnumber}, $form->{cnnumber}, + $form->{sonumber}, $form->{ponumber}, + $form->{sqnumber}, $form->{rfqnumber}, + $form->{customernumber}, $form->{vendornumber}, + $form->{articlenumber}, $form->{servicenumber}, + $form->{yearend}, $currency, $form->{businessnumber}); do_query($form, $dbh, $query, @values); + $dbh->commit(); + + $main::lxdebug->leave_sub(); +} + + +sub save_preferences { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $form, $memberfile, $userspath, $webdav) = @_; + + my $dbh = $form->get_standard_dbh($myconfig); + + my ($currency, $businessnumber) = selectrow_query($form, $dbh, qq|SELECT curr, businessnumber FROM defaults|); + # update name - $query = qq|UPDATE employee - SET name = ? - WHERE login = ?|; + my $query = qq|UPDATE employee SET name = ? WHERE login = ?|; do_query($form, $dbh, $query, $form->{name}, $form->{login}); - my $rc = $dbh->commit; - $dbh->disconnect; + my $rc = $dbh->commit(); # save first currency in myconfig - $form->{currency} = substr($form->{curr}, 0, 3); + $currency =~ s/:.*//; + $form->{currency} = $currency; + + $form->{businessnumber} = $businessnumber; $myconfig = new User "$memberfile", "$form->{login}"; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 89dd4f29f..fbb5cfd3e 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -2302,6 +2302,46 @@ sub swap_payment_terms { $lxdebug->leave_sub(); } +sub edit_defaults { + $lxdebug->enter_sub(); + + # get defaults for account numbers and last numbers + AM->defaultaccounts(\%myconfig, \%$form); + + map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; + + foreach $key (keys %{ $form->{IC} }) { + foreach $accno (sort keys %{ $form->{IC}->{$key} }) { + my $array = "ACCNOS_" . uc($key); + $form->{$array} ||= []; + + my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description}; + push @{ $form->{$array} }, { + 'name' => $value, + 'value' => $value, + 'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key}, + }; + } + } + + $form->{title} = $locale->text('Ranges of numbers and default accounts'); + + $form->header(); + print $form->parse_html_template('am/edit_defaults'); + + $lxdebug->leave_sub(); +} + +sub save_defaults { + $lxdebug->enter_sub(); + + AM->save_defaults(); + + $form->redirect($locale->text('Defaults saved.')); + + $lxdebug->leave_sub(); +} + sub _build_cfg_options { my $idx = shift; my $array = uc($idx) . 'S'; @@ -2319,11 +2359,6 @@ sub _build_cfg_options { sub config { $lxdebug->enter_sub(); - # get defaults for account numbers and last numbers - AM->defaultaccounts(\%myconfig, \%$form); - - map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; - _build_cfg_options('dateformat', qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)); _build_cfg_options('numberformat', qw(1,000.00 1000.00 1.000,00 1000,00)); @@ -2392,20 +2427,6 @@ sub config { }; } - foreach $key (keys %{ $form->{IC} }) { - foreach $accno (sort keys %{ $form->{IC}->{$key} }) { - my $array = "ACCNOS_" . uc($key); - $form->{$array} ||= []; - - my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description}; - push @{ $form->{$array} }, { - 'name' => $value, - 'value' => $value, - 'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key}, - }; - } - } - $form->{STYLESHEETS} = []; foreach $item (qw(lx-office-erp.css Win2000.css)) { push @{ $form->{STYLESHEETS} }, { diff --git a/locale/de/all b/locale/de/all index c030de56e..0ba69fe6b 100644 --- a/locale/de/all +++ b/locale/de/all @@ -309,6 +309,7 @@ aktualisieren wollen?', 'Credit Tax Account' => 'Umsatzsteuerkonto', 'Credit note (one letter abbreviation)' => 'G', 'Curr' => 'Währung', + 'Currencies' => 'Währungen', 'Currency' => 'Währung', 'Current' => 'Betrag', 'Current / Next Level' => 'Aktuelles / Nächstes Mahnlevel', @@ -361,9 +362,11 @@ aktualisieren wollen?', 'December' => 'Dezember', 'Decimalplaces' => 'Dezimalstellen', 'Decrease' => 'Verringern', + 'Default Accounts' => 'Standardkonten', 'Default output medium' => 'Standardausgabekanal', 'Default printer' => 'Standarddrucker', 'Default template format' => 'Standardvorlagenformat', + 'Defaults saved.' => 'Die Standardeinstellungen wurden gespeichert.', 'Delete' => 'Löschen', 'Delete Account' => 'Konto löschen', 'Delete Dataset' => 'Datenbank löschen', @@ -643,7 +646,6 @@ aktualisieren wollen?', 'Last Credit Note Number' => 'Letzte Gutschriftnummer', 'Last Customer Number' => 'Letzte Kundennummer', 'Last Invoice Number' => 'Letzte Rechnungsnummer', - 'Last Numbers & Default Accounts' => 'Laufende Zähler und Standardkonten', 'Last Purchase Order Number' => 'Letzte Lieferantenautragsnummer', 'Last RFQ Number' => 'Letzte Anfragenummer', 'Last Sales Order Number' => 'Letzte Auftragsnummer', @@ -710,6 +712,7 @@ aktualisieren wollen?', 'Method' => 'Verfahren', 'Microfiche' => 'Mikrofilm', 'Minimum Amount' => 'Mindestbetrag', + 'Miscellaneous' => 'Verschiedenes', 'Missing \'description\' field.' => 'Fehlendes Feld \'description\'.', 'Missing \'tag\' field.' => 'Fehlendes Feld \'tag\'.', 'Missing Method!' => 'Fehlender Voranmeldungszeitraum', @@ -949,6 +952,8 @@ aktualisieren wollen?', 'RFQ Number' => 'Anfragenummer', 'RFQs' => 'Preisanfragen', 'ROP' => 'Mindestlagerbestand', + 'Ranges of numbers' => 'Nummernkreise', + 'Ranges of numbers and default accounts' => 'Nummernkreise und Standardkonten', 'Receipt' => 'Zahlungseingang', 'Receipt posted!' => 'Beleg gebucht!', 'Receipts' => 'Zahlungseingänge', diff --git a/locale/de/am b/locale/de/am index 14faf014b..9fe7ed913 100644 --- a/locale/de/am +++ b/locale/de/am @@ -92,6 +92,7 @@ $self->{texts} = { 'Dataset upgrade' => 'Datenbankaktualisierung', 'Date' => 'Datum', 'Date Format' => 'Datumsformat', + 'Defaults saved.' => 'Die Standardeinstellungen wurden gespeichert.', 'Delete' => 'Löschen', 'Delete Account' => 'Konto löschen', 'Department deleted!' => 'Abteilung gelöscht.', @@ -199,6 +200,7 @@ $self->{texts} = { 'Queue' => 'Warteschlange', 'Quotation' => 'Angebot', 'RFQ' => 'Anfrage', + 'Ranges of numbers and default accounts' => 'Nummernkreise und Standardkonten', 'Revenue' => 'Erlöskonto', 'Revenues EU with UStId' => 'Erlöse EU m. UStId', 'Revenues EU without UStId' => 'Erlöse EU o. UStId', @@ -336,6 +338,7 @@ $self->{subs} = { 'edit_account' => 'edit_account', 'edit_buchungsgruppe' => 'edit_buchungsgruppe', 'edit_business' => 'edit_business', + 'edit_defaults' => 'edit_defaults', 'edit_department' => 'edit_department', 'edit_language' => 'edit_language', 'edit_lead' => 'edit_lead', @@ -371,6 +374,7 @@ $self->{subs} = { 'save_account' => 'save_account', 'save_buchungsgruppe' => 'save_buchungsgruppe', 'save_business' => 'save_business', + 'save_defaults' => 'save_defaults', 'save_department' => 'save_department', 'save_language' => 'save_language', 'save_lead' => 'save_lead', diff --git a/locale/de/menu b/locale/de/menu index 1ea504ff9..203f8c23f 100644 --- a/locale/de/menu +++ b/locale/de/menu @@ -91,6 +91,7 @@ $self->{texts} = { 'Purchase Orders' => 'Lieferantenaufträge', 'Quotations' => 'Angebote', 'RFQs' => 'Preisanfragen', + 'Ranges of numbers and default accounts' => 'Nummernkreise und Standardkonten', 'Receipt' => 'Zahlungseingang', 'Receipts' => 'Zahlungseingänge', 'Reconciliation' => 'Kontenabgleich', diff --git a/locale/de/menunew b/locale/de/menunew index 7a8d0fdbb..e10739839 100644 --- a/locale/de/menunew +++ b/locale/de/menunew @@ -90,6 +90,7 @@ $self->{texts} = { 'Purchase Orders' => 'Lieferantenaufträge', 'Quotations' => 'Angebote', 'RFQs' => 'Preisanfragen', + 'Ranges of numbers and default accounts' => 'Nummernkreise und Standardkonten', 'Receipt' => 'Zahlungseingang', 'Receipts' => 'Zahlungseingänge', 'Reconciliation' => 'Kontenabgleich', diff --git a/menu.ini b/menu.ini index f74685013..66f112623 100644 --- a/menu.ini +++ b/menu.ini @@ -342,6 +342,11 @@ type=receipt [System] + +[System--Ranges of numbers and default accounts] +module=am.pl +action=edit_defaults + [System--UStVa Einstellungen] module=ustva.pl action=config_step1 diff --git a/templates/webpages/am/config_de.html b/templates/webpages/am/config_de.html index 052204cda..3bf622af5 100644 --- a/templates/webpages/am/config_de.html +++ b/templates/webpages/am/config_de.html @@ -167,137 +167,6 @@ Anzahl Kopien - - - -   - - - - Firmennummer - - - - Jahresende (mm/dd) - - - - - Laufende Zähler und Standardkonten - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Warenbestand - -
Erlöskonto - -
Aufwandskonto - -
Wechselkurserträge - -
Wechselkursaufwendungen - -
- Geben Sie Ihre und weitere Währungen mit bis zu drei Buchstaben pro Währung und Währungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Letzte RechnungsnummerLetzte Kundennummer
Letzte GutschriftnummerLetzte Lieferantennummer
Letzte Auftragsnummer
Letzte LieferantenautragsnummerLetzte Artikelnummer
Letzte AngebotsnummerLetzte Dienstleistungsnr.
Letzte Anfragenummer
- -

diff --git a/templates/webpages/am/config_master.html b/templates/webpages/am/config_master.html index 547e53491..775bcaf30 100644 --- a/templates/webpages/am/config_master.html +++ b/templates/webpages/am/config_master.html @@ -167,137 +167,6 @@ Number of copies - - - -   - - - - Business Number - - - - Year End (mm/dd) - - - - - Last Numbers & Default Accounts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Inventory Account - -
Revenue Account - -
Expense Account - -
Foreign Exchange Gain - -
Foreign Exchange Loss - -
- Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Last Invoice NumberLast Customer Number
Last Credit Note NumberLast Vendor Number
Last Sales Order Number
Last Purchase Order NumberLast Article Number
Last Sales Quotation NumberLast Service Number
Last RFQ Number
- -

diff --git a/templates/webpages/am/edit_defaults_de.html b/templates/webpages/am/edit_defaults_de.html new file mode 100644 index 000000000..f6642303f --- /dev/null +++ b/templates/webpages/am/edit_defaults_de.html @@ -0,0 +1,148 @@ +[% USE HTML %] + +
[% title %]
+ +
+ + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Nummernkreise
Letzte RechnungsnummerLetzte Kundennummer
Letzte GutschriftnummerLetzte Lieferantennummer
Letzte Auftragsnummer
Letzte LieferantenautragsnummerLetzte Artikelnummer
Letzte AngebotsnummerLetzte Dienstleistungsnr.
Letzte Anfragenummer
Standardkonten
Warenbestand + +
Erlöskonto + +
Aufwandskonto + +
Wechselkurserträge + +
Wechselkursaufwendungen + +
Verschiedenes
Firmennummer
Jahresende (mm/dd)
Währungen (1)
+

+ +
+ +

+ +
+ +

+ (1) Geben Sie Ihre und weitere Währungen mit bis zu drei Buchstaben pro Währung und Währungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD) +

+
+ + + diff --git a/templates/webpages/am/edit_defaults_master.html b/templates/webpages/am/edit_defaults_master.html new file mode 100644 index 000000000..3d61244b4 --- /dev/null +++ b/templates/webpages/am/edit_defaults_master.html @@ -0,0 +1,148 @@ +[% USE HTML %] + +
[% title %]
+ +
+ + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ranges of numbers
Last Invoice NumberLast Customer Number
Last Credit Note NumberLast Vendor Number
Last Sales Order Number
Last Purchase Order NumberLast Article Number
Last Sales Quotation NumberLast Service Number
Last RFQ Number
Default Accounts
Inventory Account + +
Revenue Account + +
Expense Account + +
Foreign Exchange Gain + +
Foreign Exchange Loss + +
Miscellaneous
Business Number
Year End (mm/dd)
Currencies (1)
+

+ +
+ +

+ +
+ +

+ (1) Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies +

+
+ + +