my ($self) = @_;
$self->order->transdate(DateTime->now_local());
- my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval : 1;
+ my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval :
+ $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1;
$self->order->reqdate(DateTime->today_local->next_workday(extra_days => $extra_days)) if !$self->order->reqdate;
+
$self->pre_render();
$self->render(
'order/form',
# Set new reqdate unless changed
if ($order->reqdate == $saved_order->reqdate) {
- my $extra_days = $self->type eq sales_quotation_type() ? $::instance_conf->get_reqdate_interval : 1;
+ my $extra_days = $self->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval :
+ $self->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1;
$new_attrs{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days);
} else {
$new_attrs{reqdate} = $order->reqdate;
datev_check_on_purchase_invoice => { type => 'boolean', default => 'true' },
datev_check_on_sales_invoice => { type => 'boolean', default => 'true' },
datev_export_format => { type => 'enum', check_in => [ 'cp1252', 'cp1252-translit', 'utf-8' ], db_type => 'datev_export_format_enum', default => 'cp1252-translit' },
+ delivery_date_interval => { type => 'integer', default => '0' },
disabled_price_sources => { type => 'array' },
doc_delete_printfiles => { type => 'boolean', default => 'false' },
doc_files => { type => 'boolean', default => 'false' },
$form->{useasnew} = 1 if $is_collective_order == 1;
if (!$form->{id}) {
- my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1;
+ my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval :
+ $form->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1;
$form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo;
$form->{transdate} = DateTime->today_local->to_kivitendo;
}
if ( $form->{reqdate} && $form->{id} ) {
my $saved_order = OE->retrieve_simple(id => $form->{id});
if ( $saved_order && $saved_order->{reqdate} eq $form->{reqdate} && $saved_order->{transdate} eq $form->{transdate} ) {
- my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval : 1;
+ my $extra_days = $form->{type} eq 'sales_quotation' ? $::instance_conf->get_reqdate_interval :
+ $form->{type} eq 'sales_order' ? $::instance_conf->get_delivery_date_interval : 1;
$form->{reqdate} = DateTime->today_local->next_workday(extra_days => $extra_days)->to_kivitendo;
$form->{transdate} = DateTime->today_local->to_kivitendo;
}
'Sales Invoice' => 'Rechnung',
'Sales Invoices' => 'Kundenrechnungen',
'Sales Order' => 'Kundenauftrag',
+ 'Sales Order delivery date interval' => 'Lieferdatumintervall',
'Sales Orders' => 'Aufträge',
'Sales Orders Advance' => 'Auftragsvorlauf',
'Sales Orders deleteable' => 'Kundenaufträge löschbar',
'Users with access' => 'Benutzer mit Zugriff',
'Users with access to this client' => 'Benutzer mit Zugriff auf diesen Mandanten',
'Users, Clients and User Groups' => 'Benutzer, Mandanten und Benutzergruppen',
+ 'Usually the delivery date of an order is the next working day. If a value is set here this value will be added to the delivery date of the sales order. The resulting date will be adjusted to the next working day if it ends up on a weekend.' => 'Standardmäßig ist das vorausgewählte Lieferdatum der nächste Arbeitstag. Falls hier ein Wert gesetzt ist, wird dieser zum eigentlichen Lieferdatum hinzuaddiert. Fällt das daraus resultierende Datum auf ein Wochenende, so wird der nächste Werktag genommen.',
'Usually the sales quotation is valid until the next working day. If a value is set here then the quotation will be valid for at least that many days. The resulting date will be adjusted to the next working day if it ends up on a weekend.' => 'Standardmäßig ist ein Verkaufsangebot bis zum nächsten Werktag gültig. Ist hier ein Wert angegeben, so ist ein Angebot mindestens so viele Tage gültig. Sollte das dabei herauskommende Datum auf ein Wochenende fallen, so wird statt dessen der nachfolgende Arbeitstag genommen.',
'VAT ID' => 'USt-IdNr.',
'VN' => 'Kred.-Nr.',
--- /dev/null
+# @tag: defaults_delivery_date_interval
+# @description: Einstellen des Liefertermins für Aufträge per Intervall (z.B.: +28 Tage)
+# @depends: release_3_5_3
+package SL::DBUpgrade2::defaults_delivery_date_interval;
+
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+use strict;
+
+sub run {
+ my ($self) = @_;
+
+ # this query will fail if column already exist (new database)
+ $self->db_query(qq|ALTER TABLE defaults ADD COLUMN delivery_date_interval integer DEFAULT 0|);
+ return 1;
+}
+
+1;
<td>[% L.input_tag('defaults.reqdate_interval', LxERP.format_amount(SELF.defaults.reqdate_interval, 0), style=style) %]</td>
<td>[% LxERP.t8('Usually the sales quotation is valid until the next working day. If a value is set here then the quotation will be valid for at least that many days. The resulting date will be adjusted to the next working day if it ends up on a weekend.') %]</td>
</tr>
+ <tr>
+ <td align="right">[% LxERP.t8('Sales Order delivery date interval') %]</td>
+ <td>[% L.input_tag('defaults.delivery_date_interval', LxERP.format_amount(SELF.defaults.delivery_date_interval, 0), style=style) %]</td>
+ <td>[% LxERP.t8('Usually the delivery date of an order is the next working day. If a value is set here this value will be added to the delivery date of the sales order. The resulting date will be adjusted to the next working day if it ends up on a weekend.') %]</td>
+ </tr>
</table>
</div>