Wiederkehrende Rechnungen: Job täglich ausführen lassen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 26 Apr 2013 12:11:51 +0000 (14:11 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 26 Apr 2013 12:12:09 +0000 (14:12 +0200)
Damit ist es problemlos möglich, Rechnungen immer am x. eines Monats
zu erzeugen (z.B. immer am 15., indem das Startdatum auf den 15. eines
Monats gesetzt wird).

sql/Pg-upgrade2/background_job_change_create_periodic_invoices_to_daily.pl [new file with mode: 0644]

diff --git a/sql/Pg-upgrade2/background_job_change_create_periodic_invoices_to_daily.pl b/sql/Pg-upgrade2/background_job_change_create_periodic_invoices_to_daily.pl
new file mode 100644 (file)
index 0000000..ace35be
--- /dev/null
@@ -0,0 +1,23 @@
+# @tag: background_job_change_create_periodic_invoices_to_daily
+# @description: Hintergrundjob zum Erzeugen periodischer Rechnungen täglich ausführen
+# @depends: release_3_0_0
+package SL::DBUpgrade2::background_job_change_create_periodic_invoices_to_daily;
+
+use strict;
+use utf8;
+
+use parent qw(SL::DBUpgrade2::Base);
+
+use SL::DB::BackgroundJob;
+
+sub run {
+  my ($self) = @_;
+
+  foreach my $job (@{ SL::DB::Manager::BackgroundJob->get_all(where => [ package_name => 'CreatePeriodicInvoices' ]) }) {
+    $job->update_attributes(cron_spec => '0 3 * * *', next_run_at => undef);
+  }
+
+  return 1;
+}
+
+1;