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' ],
$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();
}
$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
Common::webdav_folder($form) if ($main::webdav);
+ $self->load_periodic_invoice_config($form);
+
my $rc = $dbh->commit;
$main::lxdebug->leave_sub();
$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);
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);
'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:',
'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',
'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',
'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.',
'tax_taxdescription' => 'Steuername',
'tax_taxkey' => 'Steuerschlüssel',
'taxnumber' => 'Automatikkonto',
+ 'terminated' => 'gekündigt',
'to (date)' => 'bis',
'to (time)' => 'bis',
'transfer' => 'Umlagerung',
-- @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),
);
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),
<p>
<table border="0">
<tr>
- <th align="right">[%- LxERP.t8('Active') %]</th>
- <td>[% L.checkbox_tag("active", checked => active) %]</td>
+ <th align="right">[% LxERP.t8('Status') %]</th>
+ <td>[% L.checkbox_tag("active", checked => active, label => LxERP.t8('Active')) %]</td>
+ </tr>
+
+ <tr>
+ <td> </td>
+ <td>
+ [% L.checkbox_tag('terminated', label => LxERP.t8('terminated'), checked => terminated) %]
+ </td>
</tr>
<tr>
<tr>
<th align="right">[%- LxERP.t8('Start date') %]</th>
<td valign="top">
- [% L.date_tag("start_date", start_date) %]
+ [% L.date_tag("start_date_as_date", start_date_as_date) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[%- LxERP.t8('End date') %]<sup>(1)</sup></th>
+ <td valign="top">
+ [% L.date_tag("end_date_as_date", end_date_as_date) %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[% LxERP.t8('Extend automatically by n months') %]</th>
+ <td valign="top">
+ [% L.input_tag("extend_automatically_by", extend_automatically_by, size => 10) %]
</td>
</tr>
</table>
</p>
+ <hr>
+
+ <p>(1): [%- LxERP.t8('The end date is the last day for which invoices will possibly be created.') %]</p>
+
[% L.hidden_tag('action', 'save_periodic_invoices_config') %]
<p>