flash_later('error', $::locale->text('There was an error executing the background job.'));
}
- $self->redirect_to(controller => 'BackgroundJobHistory', action => 'show', id => $history->id);
+ $self->redirect_to(controller => 'BackgroundJobHistory',
+ action => 'show',
+ id => $history->id,
+ back_to => $self->url_for(action => 'edit', id => $self->background_job->id));
}
#
--- /dev/null
+package SL::Controller::BackgroundJobHistory;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::DB::BackgroundJobHistory;
+use SL::Helper::Flash;
+use SL::System::TaskServer;
+
+use Rose::Object::MakeMethods::Generic
+(
+ scalar => [ qw(history) ],
+ 'scalar --get_set_init' => [ qw(task_server) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+__PACKAGE__->run_before('add_stylesheet');
+__PACKAGE__->run_before('check_task_server');
+
+#
+# actions
+#
+
+sub action_list {
+ my ($self) = @_;
+
+ $self->render('background_job_history/list',
+ title => $::locale->text('Background job history'),
+ ENTRIES => SL::DB::Manager::BackgroundJobHistory->get_all_sorted);
+}
+
+sub action_show {
+ my ($self) = @_;
+
+ my $back_to = $::form->{back_to} || $self->url_for(action => 'list');
+
+ $self->history(SL::DB::BackgroundJobHistory->new(id => $::form->{id})->load);
+ $self->render('background_job_history/show',
+ title => $::locale->text('View background job execution result'),
+ back_to => $back_to);
+}
+
+#
+# filters
+#
+
+sub check_auth {
+ $::auth->assert('admin');
+}
+
+#
+# helpers
+#
+
+sub init_task_server {
+ return SL::System::TaskServer->new;
+}
+
+sub check_task_server {
+ my ($self) = @_;
+ flash('warning', $::locale->text('The task server does not appear to be running.')) if !$self->task_server->is_running;
+}
+
+sub add_stylesheet {
+ $::form->use_stylesheet('lx-office-erp/background_jobs.css');
+}
+
+1;
use strict;
use SL::DB::MetaSetup::BackgroundJobHistory;
-
-# Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
-__PACKAGE__->meta->make_manager_class;
+use SL::DB::Manager::BackgroundJobHistory;
1;
--- /dev/null
+package SL::DB::Manager::BackgroundJobHistory;
+
+use strict;
+
+use SL::DB::Helper::Manager;
+use base qw(SL::DB::Helper::Manager);
+
+use SL::DB::Helper::Sorted;
+
+sub object_class { 'SL::DB::BackgroundJobHistory' }
+
+__PACKAGE__->make_manager_methods;
+
+sub _sort_spec {
+ return ( default => [ 'run_at', 1 ],
+ columns => { SIMPLE => 'ALL' } );
+}
+
+1;
--- /dev/null
+../lx-office-erp/background_jobs.css
\ No newline at end of file
--- /dev/null
+../lx-office-erp/background_jobs.css
\ No newline at end of file
--- /dev/null
+../lx-office-erp/background_jobs.css
\ No newline at end of file
--- /dev/null
+/* Jobverwaltung */
+.background_job_history_list tbody pre,
+.background_job_history_details tbody pre {
+ margin: 0px;
+}
+
+.background_job_history_details tbody th {
+ text-align: right;
+ vertical-align: top;
+}
+
+.background_job_history_details tbody td {
+ vertical-align: top;
+}
'Execution date from' => 'Ausführungsdatum von',
'Execution date to' => 'Ausführungsdatum bis',
'Execution schedule' => 'Ausführungszeitplan',
+ 'Execution status' => 'Ausführungsstatus',
'Execution type' => 'Ausführungsart',
'Existing Buchungsgruppen' => 'Existierende Buchungsgruppen',
'Existing Datasets' => 'Existierende Datenbanken',
'Required by' => 'Lieferdatum',
'Reset' => 'Zurücksetzen',
'Restore Dataset' => 'Datenbank wiederherstellen',
+ 'Result' => 'Ergebnis',
'Revenue' => 'Erlöskonto',
'Revenue Account' => 'Erlöskonto',
'Revenues EU with UStId' => 'Erlöse EU m. UStId',
'Revenues EU without UStId' => 'Erlöse EU o. UStId',
'Review of Aging list' => 'Altersstrukturliste',
'Right' => 'Rechts',
+ 'Run at' => 'Ausgeführt um',
'SAVED' => 'Gespeichert',
'SAVED FOR DUNNING' => 'Gespeichert',
'SCREENED' => 'Angezeigt',
'The background job has been created.' => 'Der Hintergrund-Job wurden angelegt.',
'The background job has been deleted.' => 'Der Hintergrund-Job wurde gelöscht.',
'The background job has been saved.' => 'Der Hintergrund-Job wurde gespeichert.',
+ 'The background job was executed successfully.' => 'Der Hintergrund-Job wurde erfolgreich ausgeführt.',
'The backup you upload here has to be a file created with "pg_dump -o -Ft".' => 'Die von Ihnen hochzuladende Sicherungsdatei muss mit dem Programm und den Parametern "pg_dump -o -Ft" erstellt worden sein.',
'The bank information must not be empty.' => 'Die Bankinformationen müssen vollständig ausgefüllt werden.',
'The base unit does not exist or it is about to be deleted in row %d.' => 'Die Basiseinheit in Zeile %d existiert nicht oder soll gelöscht werden.',
'There are #1 unfinished follow-ups of which #2 are due.' => 'Es gibt #1 Wiedervorlage(n), von denen #2 fällig ist/sind.',
'There are bookings to the account 3803 after 01.01.2007. If you didn\'t change this account manually to 19% the bookings are probably incorrect.' => 'Das Konto 3803 wurde nach dem 01.01.2007 bebucht. Falls Sie dieses Konto nicht manuell auf 19% gestellt haben sind die Buchungen wahrscheinlich mit falscher Umsatzsteuer gebucht worden.',
'There are four tax zones.' => 'Es gibt vier Steuerzonen.',
+ 'There are no entries in the background job history.' => 'Es gibt keine Einträge im Hintergrund-Job-Verlauf.',
'There are no items in stock.' => 'Dieser Artikel ist nicht eingelagert.',
'There are no items on your TODO list at the moment.' => 'Ihre Aufgabenliste enthält momentan keine Einträge.',
'There are still entries in the database for which no unit has been assigned.' => 'Es gibt noch Einträge in der Datenbank, für die keine Einheit zugeordnet ist.',
'There is not enough available of \'#1\' at warehouse \'#2\', bin \'#3\', #4, for the transfer of #5.' => 'Von \'#1\' ist in Lager \'#2\', Lagerplatz \'#3\', #4 nicht genügend eingelagert, um insgesamt #5 auszulagern.',
'There is not enough left of \'#1\' in bin \'#2\' for the removal of #3.' => 'In Lagerplatz \'#2\' ist nicht genug von \'#1\' vorhanden, um #3 zu entnehmen.',
'There is nothing to do in this step.' => 'In diesem Schritt gibt es nichts mehr zu tun.',
+ 'There was an error executing the background job.' => 'Bei der Ausführung des Hintergrund-Jobs trat ein Fehler auf.',
'Therefore the definition of "kg" with the base unit "g" and a factor of 1000 is valid while defining "g" with a base unit of "kg" and a factor of "0.001" is not.' => 'So ist die Definition von "kg" mit der Basiseinheit "g" und dem Faktor 1000 zulässig, die Definition von "g" mit der Basiseinheit "kg" und dem Faktor "0,001" hingegen nicht.',
'Therefore there\'s no need to create the same article more than once if it is sold or bought in/from another tax zone.' => 'Deswegen muss man den gleichen Artikel nicht mehr mehrmals anlegen, wenn er in verschiedenen Steuerzonen gehandelt werden soll.',
'These units can be based on other units so that kivitendo can convert prices when the user switches from one unit to another.' => 'Einheiten können auf anderen Einheiten basieren, sodass kivitendo Preise automatisch umrechnen kann, wenn die Benutzer zwischen solchen Einheiten umschalten.',
'Version' => 'Version',
'Version 2.4.0 introduces two new concepts: tax zones and Buchungsgruppen.' => 'Version 2.4.0 hat zwei neue Konzepte eingeführt: Steuerzonen und Buchungsgruppen.',
'View SEPA export' => 'SEPA-Export-Details ansehen',
+ 'View background job execution result' => 'Verlauf der Hintergrund-Job-Ausführungen anzeigen',
+ 'View background job history' => 'Hintergrund-Job-Verlauf anzeigen',
+ 'View background jobs' => '',
'View warehouse content' => 'Lagerbestand ansehen',
'View/edit all employees sales documents' => 'Bearbeiten/ansehen der Verkaufsdokumente aller Mitarbeiter',
'Von Konto: ' => 'von Konto: ',
'emailed to' => 'gemailt an',
'empty' => 'leer',
'executed' => 'ausgeführt',
+ 'failed' => 'fehlgeschlagen',
'female' => 'weiblich',
'follow_up_list' => 'wiedervorlageliste',
'for' => 'für',
'soldtotal' => 'Verkaufte Anzahl',
'stock' => 'Einlagerung',
'submit' => 'abschicken',
+ 'succeeded' => 'erfolgreich',
'tax_chartaccno' => 'Automatikkonto',
'tax_percent' => 'Prozentsatz',
'tax_rate' => 'Prozent',
<table>
<tr>
- <td>[%- LxERP.t8('Active') %]</td>
+ <th align="right">[%- LxERP.t8('Active') %]</th>
<td>[% L.yes_no_tag("background_job.active", SELF.background_job.active) %]</td>
</tr>
<tr>
- <td>[%- LxERP.t8('Execution type') %]</td>
+ <th align="right">[%- LxERP.t8('Execution type') %]</th>
<td>[% L.select_tag("background_job.type", L.options_for_select([ [ 'once', LxERP.t8('one-time execution') ], [ 'interval', LxERP.t8('repeated execution') ] ],
'default' => SELF.background_job.type)) %]</td>
</tr>
<tr>
- <td>[%- LxERP.t8('Package name') %]</td>
+ <th align="right">[%- LxERP.t8('Package name') %]</th>
<td>[% L.input_tag("background_job.package_name", SELF.background_job.package_name, 'size' => 40) %]</td>
</tr>
<tr>
- <td>[%- LxERP.t8('Execution schedule') %]</td>
+ <th align="right">[%- LxERP.t8('Execution schedule') %]</th>
<td>[% L.input_tag("background_job.cron_spec", SELF.background_job.cron_spec, 'size' => 40) %]</td>
</tr>
<tr>
- <td>[%- LxERP.t8('Data') %]</td>
- <td>[% L.textarea_tag("background_job.data", SELF.background_job.data, 'cols' => 80, 'rows' => 10) %]</td>
+ <th align="right" valign="top">[%- LxERP.t8('Data') %]</th>
+ <td valign="top">[% L.textarea_tag("background_job.data", SELF.background_job.data, 'cols' => 80, 'rows' => 10) %]</td>
</tr>
</table>
[%- ELSE %]
<table id="background_job_list" width="100%">
<thead>
- <tr class="listheading">
- <th>[%- LxERP.t8('Execution type') %]</th>
- <th>[%- LxERP.t8('Package name') %]</th>
- <th>[%- LxERP.t8('Active') %]</th>
- <th>[%- LxERP.t8('Execution schedule') %]</th>
- <th>[%- LxERP.t8('Last run at') %]</th>
- <th>[%- LxERP.t8('Next run at') %]</th>
- </tr>
+ <tr class="listheading">
+ <th>[%- LxERP.t8('Execution type') %]</th>
+ <th>[%- LxERP.t8('Package name') %]</th>
+ <th>[%- LxERP.t8('Active') %]</th>
+ <th>[%- LxERP.t8('Execution schedule') %]</th>
+ <th>[%- LxERP.t8('Last run at') %]</th>
+ <th>[%- LxERP.t8('Next run at') %]</th>
+ </tr>
</thead>
<tbody>
[% ELSE %]
[%- HTML.escape(background_job.type) %]
[%- END %]
+ </td>
<td>
<a href="[% SELF.url_for(action => 'edit', id => background_job.id) %]">
[%- HTML.escape(background_job.package_name) %]
<p>
<a href="[% SELF.url_for(action => 'new') %]">[%- LxERP.t8('Create new background job') %]</a>
|
+ <a href="[% SELF.url_for(controller => 'BackgroundJobHistory', action => 'list') %]">[%- LxERP.t8('View background job history') %]</a>
+ |
<a href="[% SELF.url_for(controller => 'TaskServer', action => 'show') %]">[%- LxERP.t8('Task server control') %]</a>
</p>
</form>
--- /dev/null
+[% USE HTML %][% USE L %][% USE LxERP %]
+
+<body>
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <form method="post" action="controller.pl">
+ [% IF !ENTRIES.size %]
+ <p>
+ [%- LxERP.t8('There are no entries in the background job history.') %]
+ </p>
+
+ [%- ELSE %]
+ <table id="background_job_history_list" class="background_job_history_list" width="100%">
+ <thead>
+ <tr class="listheading">
+ <th>[%- LxERP.t8('Package name') %]</th>
+ <th>[%- LxERP.t8('Run at') %]</th>
+ <th>[%- LxERP.t8('Execution status') %]</th>
+ <th>[%- LxERP.t8('Result') %]</th>
+ <th>[%- LxERP.t8('Error') %]</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ [%- FOREACH entry = ENTRIES %]
+ <tr class="listrow[% loop.count % 2 %]" id="background_job_history_id_[% entry.id %]">
+ <td>
+ <a href="[% SELF.url_for(action => 'show', id => entry.id) %]">
+ [%- HTML.escape(entry.package_name) %]
+ </a>
+ </td>
+ <td>[%- HTML.escape(entry.run_at.to_lxoffice('precision' => 'second')) %]</td>
+ <td>
+ [%- IF entry.status == 'success' %]
+ [%- LxERP.t8('succeeded') %]
+ [%- ELSIF entry.status == 'failure' %]
+ [%- LxERP.t8('failed') %]
+ [%- ELSE %]
+ [%- HTML.escape(entry.status) %]
+ [%- END %]
+ </td>
+ <td>[%- HTML.escape(entry.result) %]</td>
+ <td>[% IF entry.error_col %]<pre>[%- HTML.escape(L.truncate(entry.error_col)) %]</pre>[%- END %]</td>
+ </tr>
+ [%- END %]
+ </tbody>
+ </table>
+ [%- END %]
+
+ <hr size="3" noshade>
+
+ <p>
+ <a href="[% SELF.url_for(controller => 'BackgroundJob', action => 'list') %]">[%- LxERP.t8('View background jobs') %]</a>
+ |
+ <a href="[% SELF.url_for(controller => 'TaskServer', action => 'show') %]">[%- LxERP.t8('Task server control') %]</a>
+ </p>
+ </form>
+</body>
+</html>
--- /dev/null
+[% USE HTML %][% USE L %][% USE LxERP %]
+<body>
+
+ <div class="listtop">[% FORM.title %]</div>
+
+[%- INCLUDE 'common/flash.html' %]
+
+ <table id="background_job_history_details" class="background_job_history_details">
+ <tbody>
+ <tr class="listrow0">
+ <th>[%- LxERP.t8('Package name') %]</th>
+ <td>[%- HTML.escape(SELF.history.package_name) %]</td>
+ </tr>
+
+ <tr class="listrow1">
+ <th>[%- LxERP.t8('Run at') %]</th>
+ <td>[%- HTML.escape(SELF.history.run_at.to_lxoffice('precision' => 'second')) %]</td>
+ </tr>
+
+ <tr class="listrow0">
+ <th>[%- LxERP.t8('Execution status') %]</th>
+ <td>
+ [%- IF SELF.history.status == 'success' %]
+ [%- LxERP.t8('succeeded') %]
+ [%- ELSIF SELF.history.status == 'failed' %]
+ [%- LxERP.t8('failed') %]
+ [%- ELSE %]
+ [%- HTML.escape(SELF.history.status) %]
+ [%- END %]
+ </td>
+ </tr>
+
+ <tr class="listrow1">
+ <th>[%- LxERP.t8('Result') %]</th>
+ <td>[%- HTML.escape(SELF.history.result) %]</td>
+ </tr>
+
+ <tr class="listrow0">
+ <th>[%- LxERP.t8('Error') %]</th>
+ <td>[% IF SELF.history.error_col %]<pre>[%- HTML.escape(SELF.history.error_col) %]</pre>[%- END %]</td>
+ </tr>
+
+ <tr class="listrow1">
+ <th>[%- LxERP.t8('Data') %]</th>
+ <td>[% IF SELF.history.data %]<pre>[%- HTML.escape(SELF.history.data) %]</pre>[%- END %]</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>
+ <a href="[% back_to %]">[%- LxERP.t8('Back') %]</a>
+ </p>
+</body>
+</html>