Wiederkehrende Rechnungen: Lastschrifteinzugsflag in Konfiguration setzen können
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 21 Sep 2015 13:50:47 +0000 (15:50 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 21 Sep 2015 13:51:08 +0000 (15:51 +0200)
SL/BackgroundJob/CreatePeriodicInvoices.pm
SL/DB/MetaSetup/PeriodicInvoicesConfig.pm
SL/OE.pm
bin/mozilla/oe.pl
sql/Pg-upgrade2/periodic_invoices_direct_debit_flag.sql [new file with mode: 0644]
templates/webpages/oe/edit_periodic_invoices_config.html

index 9f116be..2df2a30 100644 (file)
@@ -200,6 +200,7 @@ sub _create_periodic_invoice {
     $invoice->assign_attributes(deliverydate => $period_start_date,
                                 intnotes     => $intnotes,
                                 employee     => $order->employee, # new_from sets employee to import user
+                                direct_debit => $config->direct_debit,
                                );
 
     _replace_vars(object => $invoice, vars => $time_period_vars, attribute => $_, attribute_format => ($_ eq 'notes' ? 'html' : 'text')) for qw(notes intnotes transaction_description);
index 1aeb42f..dfc43f4 100644 (file)
@@ -12,6 +12,7 @@ __PACKAGE__->meta->columns(
   active                  => { type => 'boolean', default => 'true' },
   ar_chart_id             => { type => 'integer', not_null => 1 },
   copies                  => { type => 'integer' },
+  direct_debit            => { type => 'boolean', default => 'false', not_null => 1 },
   end_date                => { type => 'date' },
   extend_automatically_by => { type => 'integer' },
   first_billing_date      => { type => 'date' },
index 0c6d6fc..9692e48 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -762,7 +762,7 @@ sub load_periodic_invoice_config {
 
     if ($config_obj) {
       my $config = { map { $_ => $config_obj->$_ } qw(active terminated periodicity order_value_periodicity start_date_as_date end_date_as_date first_billing_date_as_date extend_automatically_by ar_chart_id
-                                                      print printer_id copies) };
+                                                      print printer_id copies direct_debit) };
       $form->{periodic_invoices_config} = YAML::Dump($config);
     }
   }
index 1d3fe7f..97494cf 100644 (file)
@@ -2063,6 +2063,7 @@ sub save_periodic_invoices_config {
 
   my $config = { active                  => $::form->{active}     ? 1 : 0,
                  terminated              => $::form->{terminated} ? 1 : 0,
+                 direct_debit            => $::form->{direct_debit} ? 1 : 0,
                  periodicity             => (any { $_ eq $::form->{periodicity}             }       @SL::DB::PeriodicInvoicesConfig::PERIODICITIES)              ? $::form->{periodicity}             : 'm',
                  order_value_periodicity => (any { $_ eq $::form->{order_value_periodicity} } ('p', @SL::DB::PeriodicInvoicesConfig::ORDER_VALUE_PERIODICITIES)) ? $::form->{order_value_periodicity} : 'p',
                  start_date_as_date      => $::form->{start_date_as_date},
diff --git a/sql/Pg-upgrade2/periodic_invoices_direct_debit_flag.sql b/sql/Pg-upgrade2/periodic_invoices_direct_debit_flag.sql
new file mode 100644 (file)
index 0000000..a05ff0a
--- /dev/null
@@ -0,0 +1,6 @@
+-- @tag: periodic_invoices_direct_debit_flag
+-- @description: Flag Lastschrifteinzug bei wiederkehrenden Rechnungen
+-- @depends: release_3_3_0
+ALTER TABLE periodic_invoices_configs ADD COLUMN direct_debit BOOLEAN DEFAULT FALSE;
+UPDATE periodic_invoices_configs SET direct_debit = FALSE;
+ALTER TABLE periodic_invoices_configs ALTER COLUMN direct_debit SET NOT NULL;
index 656dc43..8ee4952 100644 (file)
      </td>
     </tr>
 
+    <tr>
+     <th align="right">[%- LxERP.t8('direct debit') %]</th>
+     <td valign="top">[% L.checkbox_tag("direct_debit", checked=direct_debit) %]</td>
+    </tr>
+
     <tr>
      <th align="right">[%- LxERP.t8('Print automatically') %]</th>
      <td valign="top">