From: Moritz Bunkus Date: Wed, 12 Jan 2011 14:27:41 +0000 (+0100) Subject: Felder end_date, terminated, extend_automatically_by ergänzt X-Git-Tag: release-2.6.3~61^2~7^2~1^2~2^2~98 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f49ad7f1f479daf79dd78d3ff0e0894c1e6c311c;p=kivitendo-erp.git Felder end_date, terminated, extend_automatically_by ergänzt --- diff --git a/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm b/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm index ab3a619ef..aeaf1c2ed 100644 --- a/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm +++ b/SL/DB/MetaSetup/PeriodicInvoicesConfig.pm @@ -10,15 +10,18 @@ __PACKAGE__->meta->setup( table => 'periodic_invoices_configs', columns => [ - id => { type => 'integer', not_null => 1, sequence => 'id' }, - oe_id => { type => 'integer', not_null => 1 }, - periodicity => { type => 'varchar', length => 10, not_null => 1 }, - print => { type => 'boolean', default => 'false' }, - printer_id => { type => 'integer' }, - copies => { type => 'integer' }, - active => { type => 'boolean', default => 'true' }, - start_date => { type => 'date' }, - ar_chart_id => { type => 'integer', not_null => 1 }, + id => { type => 'integer', not_null => 1, sequence => 'id' }, + oe_id => { type => 'integer', not_null => 1 }, + periodicity => { type => 'varchar', length => 10, not_null => 1 }, + print => { type => 'boolean', default => 'false' }, + printer_id => { type => 'integer' }, + copies => { type => 'integer' }, + active => { type => 'boolean', default => 'true' }, + start_date => { type => 'date' }, + ar_chart_id => { type => 'integer', not_null => 1 }, + terminated => { type => 'boolean', default => 'false' }, + end_date => { type => 'date' }, + extend_automatically_by => { type => 'integer' }, ], primary_key_columns => [ 'id' ], diff --git a/SL/OE.pm b/SL/OE.pm index 996262005..7f0c8e363 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -589,6 +589,23 @@ sub save_periodic_invoices_config { $obj->update_attributes(%{ $config }); } +sub load_periodic_invoice_config { + my $self = shift; + my $form = shift; + + delete $form->{periodic_invoices_config}; + + if ($form->{id}) { + my $config_obj = SL::DB::Manager::PeriodicInvoicesConfig->find_by(oe_id => $form->{id}); + + if ($config_obj) { + my $config = { map { $_ => $config_obj->$_ } qw(active terminated periodicity start_date_as_date end_date_as_date extend_automatically_by ar_chart_id + print printer_id copies) }; + $form->{periodic_invoices_config} = YAML::Dump($config); + } + } +} + sub _close_quotations_rfqs { $main::lxdebug->enter_sub(); @@ -965,14 +982,6 @@ sub retrieve { } $sth->finish; - delete $form->{periodic_invoices_config}; - if ($form->{id} && ($form->{type} eq 'sales_order')) { - $query = qq|SELECT periodicity, start_date, print, printer_id, copies, active, ar_chart_id FROM periodic_invoices_configs WHERE oe_id = ? LIMIT 1|; - $ref = selectfirst_hashref_query($form, $dbh, $query, conv_i($form->{id})); - - $form->{periodic_invoices_config} = YAML::Dump($ref) if ($ref); - } - } else { # get last name used @@ -985,6 +994,8 @@ sub retrieve { Common::webdav_folder($form) if ($main::webdav); + $self->load_periodic_invoice_config($form); + my $rc = $dbh->commit; $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 20206d6b3..2f63157c9 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1963,11 +1963,11 @@ sub edit_periodic_invoices_config { $config = YAML::Load($::form->{periodic_invoices_config}) if $::form->{periodic_invoices_config}; if ('HASH' ne ref $config) { - $config = { - periodicity => 'm', - start_date => $::form->{transdate}, - active => 1, - }; + $config = { periodicity => 'y', + start_date_as_date => $::form->{transdate}, + extend_automatically_by => 12, + active => 1, + }; } $config->{periodicity} = 'm' if none { $_ eq $config->{periodicity} } qw(m q y); @@ -1992,15 +1992,18 @@ sub save_periodic_invoices_config { check_oe_access(); - $::form->isblank('start_date', $::locale->text('The start date is missing.')); - - my $config = { active => $::form->{active} ? 1 : 0, - periodicity => (any { $_ eq $::form->{periodicity} } qw(m q y)) ? $::form->{periodicity} : 'm', - start_date => $::form->{start_date}, - print => $::form->{print} ? 1 : 0, - printer_id => $::form->{print} ? $::form->{printer_id} * 1 : undef, - copies => $::form->{copies} * 1 ? $::form->{copies} : 1, - ar_chart_id => $::form->{ar_chart_id} * 1, + $::form->isblank('start_date_as_date', $::locale->text('The start date is missing.')); + + my $config = { active => $::form->{active} ? 1 : 0, + terminated => $::form->{terminated} ? 1 : 0, + periodicity => (any { $_ eq $::form->{periodicity} } qw(m q y)) ? $::form->{periodicity} : 'm', + start_date_as_date => $::form->{start_date_as_date}, + end_date_as_date => $::form->{end_date_as_date}, + print => $::form->{print} ? 1 : 0, + printer_id => $::form->{print} ? $::form->{printer_id} * 1 : undef, + copies => $::form->{copies} * 1 ? $::form->{copies} : 1, + extend_automatically_by => $::form->{extend_automatically_by} * 1 || undef, + ar_chart_id => $::form->{ar_chart_id} * 1, }; $::form->{periodic_invoices_config} = YAML::Dump($config); diff --git a/locale/de/all b/locale/de/all index d6e500628..115222d37 100644 --- a/locale/de/all +++ b/locale/de/all @@ -689,6 +689,7 @@ $self->{texts} = { 'Element disabled' => 'Element deaktiviert', 'Employee' => 'Bearbeiter', 'Empty transaction!' => 'Buchung ist leer!', + 'End date' => 'Enddatum', 'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.', 'Enter longdescription' => 'Langtext eingeben', 'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:', @@ -735,6 +736,7 @@ $self->{texts} = { 'Export date' => 'Exportdatum', 'Export date from' => 'Exportdatum von', 'Export date to' => 'Exportdatum bis', + 'Extend automatically by n months' => 'Automatische Verlängerung um x Monate', 'Extended' => 'Gesamt', 'Extension Of Time' => 'Dauerfristverlängerung', 'Factor' => 'Faktor', @@ -1516,6 +1518,7 @@ $self->{texts} = { 'Statement Balance' => 'Sammelrechnungsbilanz', 'Statement sent to' => 'Sammelrechnung verschickt an', 'Statements sent to printer!' => 'Sammelrechnungen an Drucker geschickt!', + 'Status' => 'Status', 'Step 1 of 3: Parts' => 'Schritt 1 von 3: Waren', 'Step 2' => 'Schritt 2', 'Step 2 of 3: Services' => 'Schritt 2 von 3: Dienstleistungen', @@ -1641,6 +1644,7 @@ $self->{texts} = { 'The dunning process started' => 'Der Mahnprozess ist gestartet.', 'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', 'The email address is missing.' => 'Die Emailadresse fehlt.', + 'The end date is the last day for which invoices will possibly be created.' => 'Das Enddatum ist das letztmögliche Datum, an dem eine Rechnung erzeugt wird.', 'The factor is missing in row %d.' => 'Der Faktor fehlt in Zeile %d.', 'The factor is missing.' => 'Der Faktor fehlt.', 'The first reason is that Lx-Office contained a bug which resulted in the wrong taxkeys being recorded for transactions in which two entries are posted for the same chart with different taxkeys.' => 'Zum Einen gab es einen Bug in Lx-Office, der dazu führte, dass bei Buchungen mit verschiedenen Steuerschlüssel auf ein Konto teilweise falsche Steuerschlüssel gespeichert wurden.', @@ -2085,6 +2089,7 @@ $self->{texts} = { 'tax_taxdescription' => 'Steuername', 'tax_taxkey' => 'Steuerschlüssel', 'taxnumber' => 'Automatikkonto', + 'terminated' => 'gekündigt', 'to (date)' => 'bis', 'to (time)' => 'bis', 'transfer' => 'Umlagerung', diff --git a/sql/Pg-upgrade2/periodic_invoices.sql b/sql/Pg-upgrade2/periodic_invoices.sql index 43c3b27cd..e40cddc71 100644 --- a/sql/Pg-upgrade2/periodic_invoices.sql +++ b/sql/Pg-upgrade2/periodic_invoices.sql @@ -2,15 +2,18 @@ -- @description: Neue Tabellen und Spalten für Wiederkehrende Rechnungen -- @depends: release_2_6_1 CREATE TABLE periodic_invoices_configs ( - id integer NOT NULL DEFAULT nextval('id'), - oe_id integer NOT NULL, - periodicity varchar(10) NOT NULL, - print boolean DEFAULT 'f', - printer_id integer, - copies integer, - active boolean DEFAULT 't', - start_date date, - ar_chart_id integer NOT NULL, + id integer NOT NULL DEFAULT nextval('id'), + oe_id integer NOT NULL, + periodicity varchar(10) NOT NULL, + print boolean DEFAULT 'f', + printer_id integer, + copies integer, + active boolean DEFAULT 't', + terminated boolean DEFAULT 'f', + start_date date, + end_date date, + ar_chart_id integer NOT NULL, + extend_automatically_by integer, PRIMARY KEY (id), FOREIGN KEY (oe_id) REFERENCES oe (id), @@ -19,11 +22,11 @@ CREATE TABLE periodic_invoices_configs ( ); CREATE TABLE periodic_invoices ( - id integer NOT NULL DEFAULT nextval('id'), - config_id integer NOT NULL, - ar_id integer NOT NULL, - period_start_date date NOT NULL, - itime timestamp DEFAULT now(), + id integer NOT NULL DEFAULT nextval('id'), + config_id integer NOT NULL, + ar_id integer NOT NULL, + period_start_date date NOT NULL, + itime timestamp DEFAULT now(), PRIMARY KEY (id), FOREIGN KEY (config_id) REFERENCES periodic_invoices_configs (id), diff --git a/templates/webpages/oe/edit_periodic_invoices_config.html b/templates/webpages/oe/edit_periodic_invoices_config.html index dda18f169..c469a02ce 100644 --- a/templates/webpages/oe/edit_periodic_invoices_config.html +++ b/templates/webpages/oe/edit_periodic_invoices_config.html @@ -10,8 +10,15 @@

- - + + + + + + + @@ -28,7 +35,21 @@ + + + + + + + + + + @@ -60,6 +81,10 @@
[%- LxERP.t8('Active') %][% L.checkbox_tag("active", checked => active) %][% LxERP.t8('Status') %][% L.checkbox_tag("active", checked => active, label => LxERP.t8('Active')) %]
  + [% L.checkbox_tag('terminated', label => LxERP.t8('terminated'), checked => terminated) %] +
[%- LxERP.t8('Start date') %] - [% L.date_tag("start_date", start_date) %] + [% L.date_tag("start_date_as_date", start_date_as_date) %] +
[%- LxERP.t8('End date') %](1) + [% L.date_tag("end_date_as_date", end_date_as_date) %] +
[% LxERP.t8('Extend automatically by n months') %] + [% L.input_tag("extend_automatically_by", extend_automatically_by, size => 10) %]

+
+ +

(1): [%- LxERP.t8('The end date is the last day for which invoices will possibly be created.') %]

+ [% L.hidden_tag('action', 'save_periodic_invoices_config') %]