Bug 22417: Fix the batch authority tool
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / background_jobs.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; [% IF op =='add_form' %]Background jobs&rsaquo; [% IF job %] View background job[% ELSE %] Background jobs[% END %][% END %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="admin_background_jobs" class="admin">
10 [% INCLUDE 'header.inc' %]
11
12 <div id="breadcrumbs">
13     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
14     &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
15     &rsaquo; <a href="/cgi-bin/koha/admin/background_jobs.pl">Background jobs</a>
16 </div>
17
18 <div class="main container-fluid">
19     <div class="row">
20         <div class="col-sm-10 col-sm-push-2">
21             <main>
22
23 [% FOR m IN messages %]
24     <div class="dialog message">
25         [% SWITCH m.code %]
26         [% CASE 'cannot_retrieve_jobs' %]
27             <div><i class="fa fa-exclamation error"></i>Cannot retrieve pending jobs ([% m.error %])</div>
28         [% CASE %]
29             [% m.code | html %]
30         [% END %]
31     </div>
32 [% END %]
33
34 [% IF op == 'view' %]
35     <h1>Detail of job #[% job.id | html %]</h1>
36
37     <fieldset class="rows">
38         <ol>
39             <li><span class="label">Job ID: </span>[% job.id | html %]</li>
40             <li><label for="job_status">Status: </label>[% job.status | html %]</li>
41             <li><label for="job_progress">Progress: </label>[% job.progress || 0 | html %] / [% job.size | html %]</li>
42             <li><label for="job_type">Type: </label>[% job.type | html %]</li>
43             <li><label for="job_enqueued_on">enqueued_on: </label>[% job.enqueued_on | html %]</li>
44             <li><label for="job_started_on">started_on: </label>[% job.started_on | html %]</li>
45             <li><label for="job_ended_on">ended_on: </label>[% job.ended_on | html %]</li>
46             <li><label for="job_data">Report: </label>
47                 [% SWITCH job.type %]
48                 [% CASE 'batch_biblio_record_modification' %]
49                     [% SET report = job.report %]
50                     [% IF report %]
51                         [% IF report.total_records == report.total_success %]
52                             <div class="dialog message">
53                                 All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
54                             </div>
55                         [% ELSE %]
56                             <div class="dialog message">
57                                 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred.
58                                 [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
59                                 <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
60                             </div>
61                         [% END %]
62                     [% END %]
63                 [% CASE 'batch_authority_record_modification' %]
64                     [% SET report = job.report %]
65                     [% IF report %]
66                         [% IF report.total_records == report.total_success %]
67                             <div class="dialog message">
68                                 All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
69                             </div>
70                         [% ELSE %]
71                             <div class="dialog message">
72                                 [% report.total_success | html %] / [% report.total_records | html %] records have successfully been modified. Some errors occurred.
73                                 [% IF job.status == 'cancelled' %]The job has been cancelled before it finished.[% END %]
74                                 <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
75                             </div>
76                         [% END %]
77                     [% END %]
78                 [% CASE %]Job type "[% job.type | html %]" not handled in the template
79                 [% END %]
80             </li>
81             <li><label for="job_data">Detailed messages: </label>
82                 [% SWITCH job.type %]
83                 [% CASE 'batch_biblio_record_modification' %]
84                     [% FOR m IN job.messages %]
85                         <div class="dialog message">
86                             [% IF m.type == 'success' %]
87                                 <i class="fa fa-check success"></i>
88                             [% ELSIF m.type == 'warning' %]
89                                 <i class="fa fa-warning warn"></i>
90                             [% ELSIF m.type == 'error' %]
91                                 <i class="fa fa-exclamation error"></i>
92                             [% END %]
93                             [% SWITCH m.code %]
94                             [% CASE 'biblio_not_modified' %]
95                                 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error %])[% END %].
96                             [% CASE 'biblio_modified' %]
97                                 Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified.
98                                 <h3>Next steps</h3>
99                                 <ul>
100                                     <li><a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
101                                     [% IF lists.count %]
102                                     <li>
103                                         <label for="add_bibs_to_list">Add modified records to the following list: </label>
104                                         <select name="add_bibs_to_list" id="add_bibs_to_list">
105                                             <option value="">Select a list</option>
106                                             [% FOREACH list IN lists %]
107                                                 <option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
108                                             [% END %]
109                                         </select>
110                                     </li>
111                                     [% END %]
112                                 </ul>
113                             [% END %]
114                         </div>
115                     [% END %]
116                 [% CASE 'batch_authority_record_modification' %]
117                     [% FOR m IN job.messages %]
118                         <div class="dialog message">
119                             [% IF m.type == 'success' %]
120                                 <i class="fa fa-check success"></i>
121                             [% ELSIF m.type == 'warning' %]
122                                 <i class="fa fa-warning warn"></i>
123                             [% ELSIF m.type == 'error' %]
124                                 <i class="fa fa-exclamation error"></i>
125                             [% END %]
126                             [% SWITCH m.code %]
127                             [% CASE 'authority_not_modified' %]
128                                 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has not been modified. An error occurred on modifying it[% IF m.error %] ([% m.error %])[% END %].
129                             [% CASE 'authority_modified' %]
130                                 Authority record <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% m.authid | uri %]">[% m.authid | html %]</a> has successfully been modified..
131                             [% END %]
132                         </div>
133                     [% END %]
134                 [% CASE %]Job type "[% job.type | html %]" not handled in the template
135                 [% END %]
136             </li>
137         </ol>
138     </fieldset>
139
140     <a href="/cgi-bin/koha/admin/background_jobs.pl">Return to the job list</a>
141 [% END %]
142
143 [% IF op == 'list' %]
144
145     <h2>Background jobs</h2>
146
147     <div class="dialog message">
148         <i class="fa fa-info"></i>
149         [% IF pending_jobs.size > 0 %]
150             There is [% pending_jobs.size %] pending jobs on the server: [% pending_jobs.join(', ') %].
151         [% ELSE %]
152             There is no pending jobs on the server.
153         [% END %]
154     </div>
155
156     [% IF jobs.count %]
157         <table id="table_background_jobs">
158             <thead>
159                 <tr>
160                     <th>Job ID</th>
161                     <th>Status</th>
162                     <th>Progress</th>
163                     <th>Type</th>
164                     <th>Enqueued on</th>
165                     <th>Started on</th>
166                     <th>Ended on</th>
167                     <th>Actions (NIY)</th>
168                 </tr>
169             </thead>
170             <tbody>
171                 [% FOREACH job IN jobs %]
172                 <tr>
173                     <td>[% job.id | html %]</td>
174                     <td>[% job.status | html %]</td>
175                     <td>[% job.progress || 0 | html %] / [% job.size | html %]</td>
176                     <td>
177                         [% SWITCH job.type %]
178                         [% CASE 'batch_biblio_record_modification' %]Batch bibliographic record modification
179                         [% CASE 'batch_authority_record_modification' %]Batch authority record modification
180                         [% CASE %][% job.type | html %]
181                         [% END %]
182                     </td>
183                     <td>[% job.enqueued_on | html %]</td>
184                     <td>[% job.started_on| html %]</td>
185                     <td>[% job.ended_on| html %]</td>
186                     <td class="actions">
187                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=view&amp;id=[% job.id | html %]"><i class="fa fa-eye"></i> View</a>
188                         [% IF job.status == 'new' || job.status == 'started' %]
189                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/background_jobs.pl?op=cancel&amp;id=[% job.id | html %]"><i class="fa fa-trash"></i> Cancel</a>
190                         [% END %]
191                         <a class="btn btn-default btn-xs disabled" href="/cgi-bin/koha/admin/background_jobs.pl?op=replay&amp;id=[% job.id | html %]"><i class="fa fa-refresh"></i> Replay</a>
192                     </td>
193                 </tr>
194                 [% END %]
195             </tbody>
196         </table>
197     [% ELSE %]
198         <div class="dialog message">
199             There are no background jobs yet.
200         </div>
201     [% END %]
202 [% END %]
203
204             </main>
205         </div> <!-- /.col-sm-10.col-sm-push-2 -->
206
207         <div class="col-sm-2 col-sm-pull-10">
208             <aside>
209                 [% INCLUDE 'admin-menu.inc' %]
210             </aside>
211         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
212      </div> <!-- /.row -->
213
214 [% MACRO jsinclude BLOCK %]
215     [% Asset.js("js/admin-menu.js") | $raw %]
216     [% INCLUDE 'datatables.inc' %]
217     <script>
218         $(document).ready(function() {
219             $("#table_background_jobs").dataTable($.extend(true, {}, dataTablesDefaults, {
220                 "aoColumnDefs": [
221                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
222                 ],
223                 "aaSorting": [[ 0, "desc" ]],
224                 "iDisplayLength": 10,
225                 "sPaginationType": "full_numbers"
226             }));
227         });
228     </script>
229 [% END %]
230 [% INCLUDE 'intranet-bottom.inc' %]