View | Details | Raw Unified | Return to bug 24886
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-969 / +1164 lines)
Lines 19-45 Link Here
19
19
20
[% INCLUDE 'doc-head-open.inc' %]
20
[% INCLUDE 'doc-head-open.inc' %]
21
21
22
<title>Koha &rsaquo; Reports &rsaquo; Guided reports wizard [%- IF ( saved1 ) -%]&rsaquo; Saved reports
22
<title>
23
[%- ELSIF ( create ) -%]&rsaquo; Create from SQL
23
    Koha &rsaquo; Reports &rsaquo; Guided reports wizard
24
[%- ELSIF ( showsql ) -%]&rsaquo; Saved reports &rsaquo; SQL view
24
    [%- IF ( saved1 ) -%]
25
[%- ELSIF ( execute ) -%]&rsaquo; Saved reports &rsaquo; [% name | html %] Report
25
        &rsaquo; Saved reports
26
[%- ELSIF ( editsql ) -%]&rsaquo; Saved reports &rsaquo; Edit SQL report
26
    [%- ELSIF ( create ) -%]
27
[%- END -%]
27
        &rsaquo; Create from SQL
28
[%- IF ( build1 ) -%]&rsaquo; Build a report, step 1 of 6: Choose a module
28
    [%- ELSIF ( showsql ) -%]
29
[%- ELSIF ( build2 ) -%]&rsaquo; Build a report, step 2 of 6: Pick a report type
29
        &rsaquo; Saved reports &rsaquo; SQL view
30
[%- ELSIF ( build3 ) -%]&rsaquo; Build a report, step 3 of 6: Select columns for display
30
    [%- ELSIF ( execute ) -%]
31
[%- ELSIF ( build4 ) -%]&rsaquo; Build a report, step 4 of 6: Select criteria to limit on
31
        &rsaquo; Saved reports &rsaquo; [% name | html %] Report
32
[%- ELSIF ( build5 ) -%]&rsaquo; Build a report, step 5 of 6: Pick which columns to total
32
    [%- ELSIF ( editsql ) -%]
33
[%- ELSIF ( build6 ) -%]&rsaquo; Build a report, step 6 of 6: Select how you want the report ordered
33
        &rsaquo; Saved reports &rsaquo; Edit SQL report
34
[%- END -%]</title>
34
    [%- END -%]
35
    [%- IF ( build1 ) -%]
36
        &rsaquo; Build a report, step 1 of 6: Choose a module
37
    [%- ELSIF ( build2 ) -%]
38
        &rsaquo; Build a report, step 2 of 6: Pick a report type
39
    [%- ELSIF ( build3 ) -%]
40
        &rsaquo; Build a report, step 3 of 6: Select columns for display
41
    [%- ELSIF ( build4 ) -%]
42
        &rsaquo; Build a report, step 4 of 6: Select criteria to limit on
43
    [%- ELSIF ( build5 ) -%]
44
        &rsaquo; Build a report, step 5 of 6: Pick which columns to total
45
    [%- ELSIF ( build6 ) -%]
46
        &rsaquo; Build a report, step 6 of 6: Select how you want the report ordered
47
    [%- END -%]
48
</title>
35
49
36
[% INCLUDE 'doc-head-close.inc' %]
50
[% INCLUDE 'doc-head-close.inc' %]
37
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
51
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
38
<style>
52
<style>
39
.CodeMirror {
53
    .CodeMirror {
40
    resize:  vertical;
54
        resize:  vertical;
41
}
55
    }
42
#mana_search_errortext { font-family: monospace; font-weight: bold; }
56
    #mana_search_errortext { font-family: monospace; font-weight: bold; }
43
</style>
57
</style>
44
[% Asset.css("css/reports.css") | $raw %]
58
[% Asset.css("css/reports.css") | $raw %]
45
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
59
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
Lines 49-89 Link Here
49
[% INCLUDE 'header.inc' %]
63
[% INCLUDE 'header.inc' %]
50
[% INCLUDE 'circ-search.inc' %]
64
[% INCLUDE 'circ-search.inc' %]
51
65
52
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
66
<div id="breadcrumbs">
53
&rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
67
    <a href="/cgi-bin/koha/mainpage.pl">Home</a>
54
&rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
68
    &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
55
69
    &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
56
[% IF ( saved1 ) %]&rsaquo; Saved reports
70
57
[% ELSIF ( create ) %]&rsaquo; Create from SQL
71
    [% IF ( saved1 ) %]
58
[% ELSIF ( showsql ) %]&rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; SQL view
72
        &rsaquo; Saved reports
59
[% ELSIF ( editsql ) %]&rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; Edit SQL report
73
    [% ELSIF ( create ) %]
60
[% ELSIF ( execute ) %]&rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; <em>[% name | html %]</em> Report
74
        &rsaquo; Create from SQL
61
[% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]&rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
75
    [% ELSIF ( showsql ) %]
62
    [% IF ( build1 ) %]&rsaquo; Step 1 of 6: Choose a module
76
        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; SQL view
63
    [% ELSIF ( build2 ) %]&rsaquo; Step 2 of 6: Pick a report type
77
    [% ELSIF ( editsql ) %]
64
    [% ELSIF ( build3 ) %]&rsaquo; Step 3 of 6: Select columns for display
78
        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; Edit SQL report
65
    [% ELSIF ( build4 ) %]&rsaquo; Step 4 of 6: Select criteria to limit on
79
    [% ELSIF ( execute ) %]
66
    [% ELSIF ( build5 ) %]&rsaquo; Step 5 of 6: Pick which columns to total
80
        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> &rsaquo; <em>[% name | html %]</em> Report
67
    [% ELSIF ( build6 ) %]&rsaquo; Step 6 of 6: Select how you want the report ordered
81
    [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
82
        &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
83
        [% IF ( build1 ) %]
84
            &rsaquo; Step 1 of 6: Choose a module
85
        [% ELSIF ( build2 ) %]
86
            &rsaquo; Step 2 of 6: Pick a report type
87
        [% ELSIF ( build3 ) %]
88
            &rsaquo; Step 3 of 6: Select columns for display
89
        [% ELSIF ( build4 ) %]
90
            &rsaquo; Step 4 of 6: Select criteria to limit on
91
        [% ELSIF ( build5 ) %]
92
            &rsaquo; Step 5 of 6: Pick which columns to total
93
        [% ELSIF ( build6 ) %]
94
            &rsaquo; Step 6 of 6: Select how you want the report ordered
95
        [% END %]
68
    [% END %]
96
    [% END %]
69
[% END %]
70
</div>
97
</div>
71
98
72
<div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
99
<div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
73
    <div class="modal-dialog">
100
    <div class="modal-dialog">
74
    <div class="modal-content">
101
        <div class="modal-content">
75
    <div class="modal-header">
102
            <div class="modal-header">
76
        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
103
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
77
        <h3 id="update_sql_label">Update SQL</h3>
104
                <h3 id="update_sql_label">Update SQL</h3>
78
    </div>
105
            </div>
79
    <div class="modal-body">
106
            <div class="modal-body">
80
        <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
107
                <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
81
    </div>
108
            </div>
82
    <div class="modal-footer">
109
            <div class="modal-footer">
83
        <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
110
                <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
84
        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
111
                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
85
    </div>
112
            </div>
86
    </div>
113
        </div>
87
    </div>
114
    </div>
88
</div>
115
</div>
89
116
Lines 92-1082 Link Here
92
        <div class="col-sm-10 col-sm-push-2">
119
        <div class="col-sm-10 col-sm-push-2">
93
            <main>
120
            <main>
94
121
95
    [% INCLUDE "reports-toolbar.inc" %]
122
                [% INCLUDE "reports-toolbar.inc" %]
96
123
97
[% IF ( start ) %]
124
                [% IF ( start ) %]
98
    <h2>Guided reports</h2>
125
                    <h2>Guided reports</h2>
99
    <p>Use the guided reports engine to create non standard reports.
126
                    <p>Use the guided reports engine to create non standard reports. This feature aims to provide some middle ground between the built in canned reports and writing custom SQL reports.</p>
100
This feature aims to provide some middle ground between the built in
101
canned reports and writing custom SQL reports.</p>
102
127
103
    <h3>Build and run reports</h3>
128
                    <h3>Build and run reports</h3>
104
        [% IF ( CAN_user_reports_create_reports ) %]
105
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
106
            <input type="hidden" name="phase" value="Build new" />
107
            <input type="submit" name="submit" value="Build new"/>
108
        </form>
109
        [% END %]
110
        [% IF ( CAN_user_reports_execute_reports ) %]
111
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
112
            <input type="hidden" name="phase" value="Use saved"/>
113
            <input type="submit" name="submit" value="Use saved"/>
114
        </form>
115
        [% END %]
116
        [% IF ( CAN_user_reports_create_reports ) %]
117
        <form action="/cgi-bin/koha/reports/guided_reports.pl">
118
            <input type="hidden" name="phase" value="Create report from SQL"/>
119
            <input type="submit" name="submit" value="Create report from SQL"/>
120
        </form>
121
        [% END %]
122
<h3>Reports Dictionary</h3>
123
<p>Use the reports dictionary to define custom criteria to use in your reports</p>
124
<form action="/cgi-bin/koha/reports/dictionary.pl">
125
<input type="hidden" name="phase" value="View Dictionary"/>
126
<input type="submit" name="submit" value="View dictionary"/>
127
</form>
128
[% END %]
129
129
130
[% IF report_converted %]
130
                    [% IF ( CAN_user_reports_create_reports ) %]
131
    <div class="dialog message">
131
                        <form action="/cgi-bin/koha/reports/guided_reports.pl">
132
        The report "[% report_converted | html %]" has been converted.
132
                            <input type="hidden" name="phase" value="Build new" />
133
    </div>
133
                            <input type="submit" name="submit" value="Build new"/>
134
[% END %]
134
                        </form>
135
                    [% END %]
135
136
136
[% IF report_converted %]
137
                    [% IF ( CAN_user_reports_execute_reports ) %]
137
    <div class="dialog message">
138
                        <form action="/cgi-bin/koha/reports/guided_reports.pl">
138
        The report "[% report_converted | html %]" has been converted.
139
                            <input type="hidden" name="phase" value="Use saved"/>
139
    </div>
140
                            <input type="submit" name="submit" value="Use saved"/>
140
[% END %]
141
                        </form>
142
                    [% END %]
141
143
144
                    [% IF ( CAN_user_reports_create_reports ) %]
145
                        <form action="/cgi-bin/koha/reports/guided_reports.pl">
146
                            <input type="hidden" name="phase" value="Create report from SQL"/>
147
                            <input type="submit" name="submit" value="Create report from SQL"/>
148
                        </form>
149
                    [% END %]
142
150
143
[% IF ( saved1 ) %]
151
                    <h3>Reports Dictionary</h3>
144
[% IF ( savedreports ) %]<h1>Saved reports</h1>
152
                    <p>Use the reports dictionary to define custom criteria to use in your reports</p>
153
                    <form action="/cgi-bin/koha/reports/dictionary.pl">
154
                        <input type="hidden" name="phase" value="View Dictionary"/>
155
                        <input type="submit" name="submit" value="View dictionary"/>
156
                    </form>
157
                [% END %]
145
158
146
[% IF ( filters.date || filters.author || filters.keyword ) %]
159
                [% IF report_converted %]
147
    <p>Filtered by:
160
                    <div class="dialog message">
148
        <span class="filter">
161
                        The report "[% report_converted | html %]" has been converted.
149
            [% IF ( filters.date ) %]
162
                    </div>
150
                <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
163
                [% END %]
151
            [% END %]
152
            [% IF ( filters.author ) %]
153
                <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
154
            [% END %]
155
            [% IF ( filters.keyword ) %]
156
                <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
157
            [% END %]
158
            <a class="clear_filter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1"><i class="fa fa-remove"></i> Clear</a>
159
        </span>
160
    </p>
161
[% END %]
162
164
163
<div id="tabs" class="toptabs">
165
                [% IF report_converted %]
164
    <ul>
166
                    <div class="dialog message">
165
        <li><a href="#reports">All</a></li>
167
                        The report "[% report_converted | html %]" has been converted.
166
        [% FOREACH group IN groups_with_subgroups %]
168
                    </div>
167
            <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
169
                [% END %]
168
        [% END %]
169
    </ul>
170
    <div id="reports">
171
        <div id="subgroup_filter_block">
172
            <label for="subgroup_filter">Subgroup:</label>
173
            <select id="subgroup_filter">
174
                <option value="">All</option>
175
            </select>
176
        </div>
177
170
178
        [% IF (Koha.Preference('Mana') == 1) %]
171
                [% IF ( saved1 ) %]
179
            [% IF manamsg %]
172
                    [% IF ( savedreports ) %]
180
                <div id="mana_search_message" class="dialog message">
173
                        <h1>Saved reports</h1>
181
                    <p> [% manamsg | html %] </p>
174
182
                </div>
175
                        [% IF ( filters.date || filters.author || filters.keyword ) %]
183
            [% END %]
176
                            <p>Filtered by:
184
        [% END %]
177
                                <span class="filter">
178
                                    [% IF ( filters.date ) %]
179
                                        <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
180
                                    [% END %]
181
                                    [% IF ( filters.author ) %]
182
                                        <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
183
                                    [% END %]
184
                                    [% IF ( filters.keyword ) %]
185
                                        <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
186
                                    [% END %]
187
                                    <a class="clear_filter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1"><i class="fa fa-remove"></i> Clear</a>
188
                                </span>
189
                            </p>
190
                        [% END %]
185
191
186
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
192
                        <div id="tabs" class="toptabs">
187
<input type="hidden" name="phase" value="Delete Multiple" />
193
                            <ul>
188
        <table id="table_reports">
194
                                <li><a href="#reports">All</a></li>
189
            <thead>
195
                                [% FOREACH group IN groups_with_subgroups %]
190
                <tr>
196
                                    <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
191
                    <th>&nbsp;</th>
197
                                [% END %]
192
                    <th>ID</th>
198
                            </ul>
193
                    <th>Report name</th>
199
                            <div id="reports">
194
                    <th>Type</th>
200
                                <div id="subgroup_filter_block">
195
                    <th>Group</th>
201
                                    <label for="subgroup_filter">Subgroup:</label>
196
                    <th>Subgroup</th>
202
                                    <select id="subgroup_filter">
197
                    <th>Notes</th>
203
                                        <option value="">All</option>
198
                    <th>Author</th>
204
                                    </select>
199
                    <th class="title-string">Creation date</th>
205
                                </div>
200
                    <th class="title-string">Last edit</th>
206
201
                    <th class="title-string">Last run</th>
207
                                [% IF (Koha.Preference('Mana') == 1) %]
202
                    <th class="report_public">Public</th>
208
                                    [% IF manamsg %]
203
                    <th class="report_json_url">JSON URL</th>
209
                                        <div id="mana_search_message" class="dialog message">
204
                    [% IF (usecache) %]
210
                                            <p> [% manamsg | html %] </p>
205
                        <th>Cache expiry (seconds)</th>
211
                                        </div>
206
                    [% ELSE %]
212
                                    [% END %]
207
                        <th class="hidden">&nbsp;</th>
213
                                [% END %]
208
                    [% END %]
214
209
                    <th>Saved results</th>
215
                                <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
210
                    [% IF has_obsolete_reports %]
216
                                    <input type="hidden" name="phase" value="Delete Multiple" />
211
                        <th>Update</th>
217
                                    <table id="table_reports">
218
                                        <thead>
219
                                            <tr>
220
                                                <th>&nbsp;</th>
221
                                                <th>ID</th>
222
                                                <th>Report name</th>
223
                                                <th>Type</th>
224
                                                <th>Group</th>
225
                                                <th>Subgroup</th>
226
                                                <th>Notes</th>
227
                                                <th>Author</th>
228
                                                <th class="title-string">Creation date</th>
229
                                                <th class="title-string">Last edit</th>
230
                                                <th class="title-string">Last run</th>
231
                                                <th class="report_public">Public</th>
232
                                                <th class="report_json_url">JSON URL</th>
233
                                                [% IF (usecache) %]
234
                                                    <th>Cache expiry (seconds)</th>
235
                                                [% ELSE %]
236
                                                    <th class="hidden">&nbsp;</th>
237
                                                [% END %]
238
                                                <th>Saved results</th>
239
                                                [% IF has_obsolete_reports %]
240
                                                    <th>Update</th>
241
                                                [% ELSE %]
242
                                                    <th class="hidden">&nbsp;</th>
243
                                                [% END %]
244
                                                <th>Actions</th>
245
                                            </tr>
246
                                        </thead>
247
                                        <tbody>
248
                                            [% FOREACH savedreport IN savedreports %]
249
                                                [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
250
                                                    <td class="report_checkbox">
251
                                                        [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
252
                                                            <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
253
                                                        [% END %]
254
                                                        <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
255
                                                    </td>
256
                                                    <td class="report_id">
257
                                                        <label for="ids">[% savedreport.id | html %]</label>
258
                                                    </td>
259
                                                    <td class="report_name">
260
                                                        [% IF ( savedreport.report_name ) %]
261
                                                            [% savedreport.report_name | html %]
262
                                                        [% ELSE %]
263
                                                            [ no name ]
264
                                                        [% END %]
265
                                                    </td>
266
                                                    <td class="report_type">
267
                                                        [% savedreport.type | html %]
268
                                                    </td>
269
                                                    <td class="report_group">
270
                                                        [% savedreport.groupname | html %]
271
                                                    </td>
272
                                                    <td>
273
                                                        [% savedreport.subgroupname | html %]
274
                                                    </td>
275
                                                    <td class="report_notes">
276
                                                        [% savedreport.notes | html %]
277
                                                    </td>
278
                                                    <td>
279
                                                        [% savedreport.borrowersurname | html %]
280
                                                        [% IF ( savedreport.borrowerfirstname ) %]
281
                                                            , [% savedreport.borrowerfirstname | html %]
282
                                                        [% END %]
283
                                                        ([% savedreport.borrowernumber | html %])
284
                                                    </td>
285
                                                    <td>
286
                                                        <span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span>
287
                                                    </td>
288
                                                    <td>
289
                                                        <span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates  with_hours => 1 %]</span>
290
                                                    </td>
291
                                                    <td>
292
                                                        <span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates  with_hours => 1 %]</span>
293
                                                    </td>
294
                                                    <td class="report_public">
295
                                                        [% IF (savedreport.public) %]
296
                                                            Yes
297
                                                        [% ELSE %]
298
                                                            No
299
                                                        [% END %]
300
                                                    </td>
301
                                                    <td class="report_json_url">
302
                                                        [% IF (savedreport.public) %]
303
                                                            <a href="[% OPACBaseURL | url %]/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% OPACBaseURL | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
304
                                                        [% ELSE %]
305
                                                            <a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% Koha.Preference('staffClientBaseURL') | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
306
                                                        [% END %]
307
                                                    </td>
308
                                                    <td>
309
                                                        [% savedreport.cache_expiry | html %]
310
                                                    </td>
311
                                                    <td>
312
                                                        [% FOR result IN savedreport.results %]
313
                                                            <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&amp;id=[% result.id | uri %]">[% result.date_run | html %]</a>
314
                                                            <br/>
315
                                                        [% END %]
316
                                                    </td>
317
                                                    <td>
318
                                                        [% IF savedreport.seems_obsolete %]
319
                                                            This report seems obsolete, it uses biblioitems.marcxml field.
320
                                                            <a href="/cgi-bin/koha/svc/convert_report?report_id=[% savedreport.id | uri %]" data-report_id="[% savedreport.id | html %]" class="update_sql btn btn-default btn-xs" title="Update SQL"><i class="fa fa-eye"></i> Update SQL</a>
321
                                                        [% END %]
322
                                                    </td>
323
                                                    <td>
324
                                                        <div class="dropup">
325
                                                            <div class="btn-group">
326
                                                                [%# There should be no space between these two buttons, it would render badly %]
327
                                                                <a class="btn btn-default btn-xs" role="button"
328
                                                                   href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Run%20this%20report"><i
329
                                                                   class="fa fa-play"></i> Run</a><a
330
                                                                   class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
331
                                                                   href="#"><b class="caret"></b></a>
332
                                                                <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
333
                                                                    <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
334
                                                                    [% IF ( CAN_user_reports_create_reports ) %]
335
                                                                        <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
336
                                                                        <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
337
                                                                    [% END %]
338
                                                                    [% IF (Koha.Preference('Mana') == 1) %]
339
                                                                        <li><a class="ShareButton" data-toggle="modal" href="#mana_share_report" title="Share your report with Mana Knowledge Base"><i class="fa fa-share-alt"></i> Share</a></li>
340
                                                                    [% END %]
341
                                                                    <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
342
                                                                    [% IF ( CAN_user_reports_delete_reports ) %]
343
                                                                        <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
344
                                                                    [% END %]
345
                                                                </ul>
346
                                                            </div>
347
                                                        </div>
348
                                                    </td>
349
                                                </tr>
350
                                            [% END %]
351
                                        </tbody>
352
                                    </table>
353
354
                                    [% IF ( CAN_user_reports_delete_reports ) %]
355
                                        <fieldset class="action">
356
                                            <input type="submit" value="Delete selected" />
357
                                        </fieldset>
358
                                    [% END %]
359
                                </form>
360
                            </div>
361
                        </div>
212
                    [% ELSE %]
362
                    [% ELSE %]
213
                        <th class="hidden">&nbsp;</th>
363
                        <div class="dialog message">
214
                    [% END %]
364
                            [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
215
                    <th>Actions</th>
365
                                <h4>No saved reports match your criteria. </h4>
216
                </tr>
366
                                [% IF ( CAN_user_reports_create_reports ) %]
217
            </thead>
367
                                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
218
            <tbody>
368
                                        <input type="hidden" name="phase" value="Build new" />
219
                [% FOREACH savedreport IN savedreports %]
369
                                        <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
220
                    [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
370
                                    </form>
221
                        <td class="report_checkbox">
371
222
                            [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
372
                                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
223
                                <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
373
                                        <input type="hidden" name="phase" value="Create report from SQL" />
224
                            [% END %]
374
                                        <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
225
                            <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
375
                                    </form>
226
                        </td>
376
227
                        <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
377
                                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
228
                        <td class="report_name">
378
                                        <input type="hidden" name="phase" value="Use saved" />
229
                            [% IF ( savedreport.report_name ) %]
379
                                        <input type="hidden" name="filter_set" value="1" />
230
                                [% savedreport.report_name | html %]
380
                                        <input type="hidden" name="filter_keyword" value="" />
381
                                        <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
382
                                    </form>
383
                                [% END %]
231
                            [% ELSE %]
384
                            [% ELSE %]
232
                                [ no name ]
385
                                <h4>There are no saved reports. </h4>
233
                            [% END %]
386
                                [% IF ( CAN_user_reports_create_reports ) %]
234
                        </td>
387
                                    <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
235
                        <td class="report_type">[% savedreport.type | html %]</td>
388
                                [% END %]
236
                        <td class="report_group">[% savedreport.groupname | html %]</td>
237
                        <td>[% savedreport.subgroupname | html %]</td>
238
                        <td class="report_notes">[% savedreport.notes | html %]</td>
239
                        <td>[% savedreport.borrowersurname | html %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname | html %][% END %] ([% savedreport.borrowernumber | html %])</td>
240
                        <td><span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span></td>
241
                        <td><span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates  with_hours => 1 %]</span></td>
242
                        <td><span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates  with_hours => 1 %]</span></td>
243
                        <td class="report_public">
244
                        [% IF (savedreport.public) %]
245
                            Yes
246
                        [% ELSE %]
247
                            No
248
                        [% END %]
249
                        </td>
250
                        <td class="report_json_url">
251
                        [% IF (savedreport.public) %]
252
                            <a href="[% OPACBaseURL | url %]/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% OPACBaseURL | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
253
                        [% ELSE %]
254
                            <a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% Koha.Preference('staffClientBaseURL') | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
255
                        [% END %]
256
                        </td>
257
                        <td>[% savedreport.cache_expiry | html %]</td>
258
                        <td>
259
                            [% FOR result IN savedreport.results %]
260
                                <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&amp;id=[% result.id | uri %]">[% result.date_run | html %]</a>
261
                                <br/>
262
                            [% END %]
263
                        </td>
264
                        <td>
265
                            [% IF savedreport.seems_obsolete %]
266
                                This report seems obsolete, it uses biblioitems.marcxml field.
267
                                <a href="/cgi-bin/koha/svc/convert_report?report_id=[% savedreport.id | uri %]" data-report_id="[% savedreport.id | html %]" class="update_sql btn btn-default btn-xs" title="Update SQL"><i class="fa fa-eye"></i> Update SQL</a>
268
                            [% END %]
389
                            [% END %]
269
                        </td>
390
                        </div>
270
                        <td>
391
                    [% END %]
271
                            <div class="dropup">
272
                                <div class="btn-group">
273
                                    [%# There should be no space between these two buttons, it would render badly %]
274
                                    <a class="btn btn-default btn-xs" role="button"
275
                                       href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Run%20this%20report"><i
276
                                       class="fa fa-play"></i> Run</a><a
277
                                       class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
278
                                       href="#"><b class="caret"></b></a>
279
                                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
280
                                        <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
281
                                        [% IF ( CAN_user_reports_create_reports ) %]
282
                                            <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&amp;phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
283
                                            <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% savedreport.savedsql |uri %]&amp;reportname=[% savedreport.report_name |uri %]&amp;notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
284
                                        [% END %]
285
                                        [% IF (Koha.Preference('Mana') == 1) %]
286
                                            <li><a class="ShareButton" data-toggle="modal" href="#mana_share_report" title="Share your report with Mana Knowledge Base"><i class="fa fa-share-alt"></i> Share</a></li>
287
                                        [% END %]
288
                                        <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
289
                                        [% IF ( CAN_user_reports_delete_reports ) %]
290
                                            <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&amp;phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
291
                                        [% END %]
292
                                    </ul>
293
                                </div>
294
                            </div>
295
                        </td>
296
                    </tr>
297
                [% END %]
392
                [% END %]
298
            </tbody>
299
        </table>
300
393
301
        [% IF ( CAN_user_reports_delete_reports ) %]
394
                [% INCLUDE 'mana/mana-share-report.inc' %]
302
        <fieldset class="action">
303
            <input type="submit" value="Delete selected" />
304
        </fieldset>
305
        [% END %]
306
    </form>
307
    </div>
308
</div>
309
[% ELSE %]<div class="dialog message">
310
    [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
311
    <h4>No saved reports match your criteria. </h4>
312
    [% IF ( CAN_user_reports_create_reports ) %]
313
    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
314
    <input type="hidden" name="phase" value="Build new" />
315
        <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
316
    </form>
317
318
    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
319
        <input type="hidden" name="phase" value="Create report from SQL" />
320
        <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
321
    </form>
322
323
    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
324
    <input type="hidden" name="phase" value="Use saved" />
325
    <input type="hidden" name="filter_set" value="1" />
326
    <input type="hidden" name="filter_keyword" value="" />
327
        <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
328
    </form>
329
395
330
    [% END %]
396
                [% IF ( build1 ) %]
331
    [% ELSE %]
397
                    [% IF ( cache_error) %]
332
    <h4>There are no saved reports. </h4>
398
                        <div class="dialog alert">
333
    [% IF ( CAN_user_reports_create_reports ) %]
399
                            <b> Please choose a cache_expiry less than 30 days </b>
334
        <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
400
                        </div>
335
    [% END %]
401
                    [% END %]
336
    [% END %]
337
    </div>
338
[% END %]
339
[% END %]
340
341
[% INCLUDE 'mana/mana-share-report.inc' %]
342
402
343
[% IF ( build1 ) %]
403
                    <h1>Build a report</h1>
344
[% IF ( cache_error) %]
404
                    <form action="/cgi-bin/koha/reports/guided_reports.pl">
345
<div class="dialog alert">
405
                        <fieldset class="rows">
346
<b> Please choose a cache_expiry less than 30 days </b>
406
                            <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
347
</div>
407
                            <ol>
348
[% END %]
408
                                <li>
349
<h1>Build a report</h1>
409
                                    <label for="area">Choose: </label>
350
<form action="/cgi-bin/koha/reports/guided_reports.pl">
410
                                    <select name="area" id="area">
351
<fieldset class="rows">
411
                                        [%- FOREACH area IN areas -%]
352
<legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
412
                                            <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
353
<ol>
413
                                        [%- END -%]
354
  <li>
414
                                    </select>
355
    <label for="area">Choose: </label>
415
                                </li>
356
      <select name="area" id="area">
416
                                [% IF (public) %]
357
    [%- FOREACH area IN areas -%]
417
                                    <li>
358
      <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
418
                                        <label for="public">Report is public:</label>
359
    [%- END -%]
419
                                        <select id="public" name="public">
360
      </select>
420
                                            <option value="0">No (default)</option>
361
  </li>
421
                                            <option value="1" selected="selected">Yes</option>
362
[% IF (public) %]
422
                                        </select>
363
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
423
                                    </li>
364
[% ELSE %]
424
                                [% ELSE %]
365
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
425
                                    <li>
366
[% END %]
426
                                        <label for="public">Report is public:</label>
367
[% IF (usecache) %] <li>
427
                                        <select id="public" name="public">
368
<label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
428
                                            <option value="0" selected="selected">No (default)</option>
369
<select id="cache_expiry_units" name="cache_expiry_units">
429
                                            <option value="1">Yes</option>
370
<option value="seconds">Seconds (default)</option>
430
                                        </select>
371
<option value="minutes">Minutes</option>
431
                                    </li>
372
<option value="hours">Hours</option>
432
                                [% END %]
373
<option value="days">Days</option>
374
</select>
375
</li>[% END %]
376
</ol>
377
</fieldset>
378
<fieldset class="action">
379
<input type="hidden" name="phase" value="Report on this Area" />
380
<input type="submit" name="submit" value="Next &gt;&gt;" />
381
382
</fieldset>
383
</form>
384
[% END %]
385
433
434
                                [% IF (usecache) %]
435
                                    <li>
436
                                        <label for="cache_expiry">Cache expiry:</label>
437
                                        <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
438
                                        <select id="cache_expiry_units" name="cache_expiry_units">
439
                                            <option value="seconds">Seconds (default)</option>
440
                                            <option value="minutes">Minutes</option>
441
                                            <option value="hours">Hours</option>
442
                                            <option value="days">Days</option>
443
                                        </select>
444
                                    </li>
445
                                [% END %]
446
                            </ol>
447
                        </fieldset>
448
                        <fieldset class="action">
449
                            <input type="hidden" name="phase" value="Report on this Area" />
450
                            <input type="submit" name="submit" value="Next &gt;&gt;" />
451
                        </fieldset>
452
                    </form>
453
                [% END %]
386
454
387
[% IF ( build2 ) %]
455
                [% IF ( build2 ) %]
388
<h1>Build a report</h1>
456
                    <h1>Build a report</h1>
389
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
457
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
390
<input type="hidden" name="area" value="[% area | html %]" />
458
                        <input type="hidden" name="area" value="[% area | html %]" />
391
<input type="hidden" name="public" value="[% public | html %]" />
459
                        <input type="hidden" name="public" value="[% public | html %]" />
392
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
460
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
393
<fieldset class="rows"><legend>Step 2 of 6: Pick a report type</legend>
461
                        <fieldset class="rows">
394
<ol><li><label for="types">Choose: </label>
462
                            <legend>Step 2 of 6: Pick a report type</legend>
395
    <select id="types" name="types">
463
                            <ol>
396
        <option value="1">Tabular</option>
464
                                <li>
397
        <option value="2" disabled="disabled">Summary</option>
465
                                    <label for="types">Choose: </label>
398
        <option value="3" disabled="disabled">Matrix</option>
466
                                    <select id="types" name="types">
399
    </select>
467
                                        <option value="1">Tabular</option>
400
</li></ol></fieldset>
468
                                        <option value="2" disabled="disabled">Summary</option>
401
469
                                        <option value="3" disabled="disabled">Matrix</option>
402
<fieldset class="action">
470
                                    </select>
403
    <input type="hidden" name="phase" value="Choose this type" />
471
                                </li>
404
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
472
                            </ol>
405
    <input type="submit" name="submit" value="Next &gt;&gt;" />
473
                        </fieldset>
406
</fieldset>
474
407
</form>
475
                        <fieldset class="action">
476
                            <input type="hidden" name="phase" value="Choose this type" />
477
                            <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
478
                            <input type="submit" name="submit" value="Next &gt;&gt;" />
479
                        </fieldset>
480
                    </form>
481
                [% END %]
408
482
409
[% END %]
483
                [% IF ( build3 ) %]
484
                    <h1>Build a report</h1>
485
                    <h3>Step 3 of 6: Select columns for display</h3>
486
                    <p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
487
488
                    <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
489
                        <input type="hidden" name="area" value="[% area | html %]" />
490
                        <input type="hidden" name="type" value="[% type | html %]" />
491
                        <input type="hidden" name="public" value="[% public | html %]" />
492
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
493
                        <fieldset>
494
                            <div class="row">
495
                                <div class="col-sm-6">
496
                                    <div style="float: left;">
497
                                        <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
498
                                            [% FOREACH column IN columns %]
499
                                                [% IF ( column.table ) %]
500
                                                    [% IF ( loop.first ) %]
501
                                                    [% ELSE %]
502
                                                        </optgroup>
503
                                                    [% END %]
504
                                                    <optgroup label="[% column.table | html %]">
505
                                                [% ELSE %]
506
                                                    <option value="[% column.name | html %]">
507
                                                        [% IF ( column.description ) %]
508
                                                            [% column.description | html %] &nbsp; / &nbsp; [% column.name | html %]
509
                                                        [% ELSE %]
510
                                                            [% column.name | html %]
511
                                                        [% END %]
512
                                                    </option>
513
                                                [% END %]
514
                                            [% END %]
515
                                            </optgroup>
516
                                        </select>
517
                                    </div>
518
                                    <div style="width: 6.3em; float: right; margin-top: 100px">
519
                                        <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
520
                                        <input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
521
                                    </div>
522
                                </div>
410
523
411
[% IF ( build3 ) %]
524
                                <div class="col-sm-6">
412
<h1>Build a report</h1>
525
                                    <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
413
<h3>Step 3 of 6: Select columns for display</h3>
526
                                    </select>
414
<p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
527
                                </div>
415
528
                            </div>
416
<form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
529
                        </fieldset>
417
    <input type="hidden" name="area" value="[% area | html %]" />
530
                        <fieldset class="action">
418
    <input type="hidden" name="type" value="[% type | html %]" />
531
                            <input type="hidden" name="phase" value="Choose these columns" />
419
    <input type="hidden" name="public" value="[% public | html %]" />
532
                            <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
420
    <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
533
                            <input type="submit" name="submit" value="Next &gt;&gt;" />
421
    <fieldset>
534
                        </fieldset>
422
<div class="row">
535
                    </form>
423
<div class="col-sm-6">
536
                [% END %]
424
    <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
425
[% FOREACH column IN columns %]
426
[% IF ( column.table ) %]
427
428
[% IF ( loop.first ) %]
429
[% ELSE %]
430
</optgroup>
431
[% END %]
432
537
433
<optgroup label="[% column.table | html %]">
538
                [% IF ( build4 ) %]
434
[% ELSE %]
539
                    <h1>Build a report</h1>
435
<option value="[% column.name | html %]">
540
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
436
[% IF ( column.description ) %][% column.description | html %] &nbsp; / &nbsp; [% column.name | html %]
541
                        <input type="hidden" name="area" value="[% area | html %]" />
437
[% ELSE %]
542
                        <input type="hidden" name="type" value="[% type | html %]" />
438
[% column.name | html %]
543
                        <input type="hidden" name="column" value="[% column | html %]" />
439
[% END %]
544
                        <input type="hidden" name="public" value="[% public | html %]" />
440
</option>
545
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
441
[% END %]
546
                        <fieldset>
442
[% END %]
547
                            <legend>Step 4 of 6: Select criteria to limit on</legend>
443
</optgroup>
548
                            <table>
444
</select></div>
549
                                [% FOREACH criteri IN criteria %]
445
<div style="width: 6.3em; float: right; margin-top: 100px"><input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
550
                                    <tr>
446
<input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" /></div>
551
                                        <td>
447
</div>
552
                                            <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
553
                                            <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
554
                                        </td>
555
                                        [% IF ( criteri.date ) %]
556
                                            <td>
557
                                                <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
558
                                                <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
559
                                            </td>
560
                                        </tr>
561
                                        [% ELSE %]
562
                                            [% IF ( criteri.textrange ) %]
563
                                                <td>
564
                                                    from
565
                                                    <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
566
                                                    <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
567
                                                </td>
568
                                            </tr>
569
                                            [% ELSE %]
570
                                                [% IF ( criteri.daterange ) %]
571
                                                    <td>
572
                                                        from
573
                                                        <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
574
                                                        to
575
                                                        <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
576
                                                        <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
577
                                                    </td>
578
                                                </tr>
579
                                                [% ELSE %]
580
                                                    <td>
581
                                                        <select name="[% criteri.name | html %]_value">
582
                                                           [% FOREACH value IN criteri.values %]
583
                                                                <option value="[% value.availablevalues | html %]">
584
                                                                    [% IF ( value.default ) %]
585
                                                                        Default
586
                                                                    [% ELSE %]
587
                                                                        [% value.display_value | html %]
588
                                                                    [% END %]
589
                                                                </option>
590
                                                            [% END %]
591
                                                        </select>
592
                                                    </td>
593
                                                </tr>
594
                                                [% END %]
595
                                            [% END %]
596
                                        [% END %]
597
                                [% END %]
598
                            </table>
599
                        </fieldset>
600
601
                        [% IF ( definitions ) %]
602
                            <fieldset>
603
                                <legend>Dictionary definitions</legend>
604
                                <table>
605
                                    [% FOREACH definition IN definitions %]
606
                                        <tr>
607
                                            <td>
608
                                                <input type="checkbox" name="definition" value="[% definition.id | html %]" />
609
                                                [% definition.name | html %]
610
                                            </td>
611
                                        </tr>
612
                                    [% END %]
613
                                </table>
614
                            </fieldset>
615
                        [% END %]
448
616
449
<div class="col-sm-6">
617
                        <fieldset class="action">
450
<select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
618
                            <input type="hidden" name="phase" value="Choose these criteria" />
451
</div>
619
                            <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
452
</div>
620
                            <input type="submit" name="submit" value="Next &gt;&gt;" />
453
</fieldset>
621
                        </fieldset>
454
<fieldset class="action">
622
                    </form>
455
    <input type="hidden" name="phase" value="Choose these columns" />
623
                [% END %]
456
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
457
    <input type="submit" name="submit" value="Next &gt;&gt;" />
458
</fieldset>
459
</form>
460
624
461
[% END %]
625
                [% IF ( build5 ) %]
626
                    <h1>Build a report</h1>
627
                    <h3>Step 5 of 6: Pick which columns to total</h3>
628
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
629
                        <input type="hidden" name="area" value="[% area | html %]" />
630
                        <input type="hidden" name="type" value="[% type | html %]" />
631
                        <input type="hidden" name="column" value="[% column | html %]" />
632
                        <input type="hidden" name="definition" value="[% definition | html %]" />
633
                        <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
634
                        <input type="hidden" name="public" value="[% public | html %]" />
635
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
636
                        <fieldset>
637
                            <table>
638
                                [% FOREACH total_b IN total_by %]
639
                                    <tr>
640
                                        <td>
641
                                            <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
642
                                            <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
643
                                        </td>
644
                                        <td>
645
                                            <select name="[% total_b.name | html %]_tvalue">
646
                                                [% FOREACH selec IN total_b.select %]
647
                                                    <option value="[% selec.value | html %]">[% selec.value | html %]</option>
648
                                                [% END %]
649
                                            </select>
650
                                        </td>
651
                                    </tr>
652
                                [% END %]
653
                            </table>
654
                        </fieldset>
655
656
                        <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
657
                            <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
658
                            <input type="submit" name="submit" value="Next &gt;&gt;" />
659
                        </fieldset>
660
                    </form>
661
                [% END %]
462
662
463
[% IF ( build4 ) %]
663
                [% IF ( build6 ) %]
464
<h1>Build a report</h1>
664
                    <h1>Build a report</h1>
465
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
665
                    <h3>Step 6 of 6: Choose how you want the report ordered</h3>
466
    <input type="hidden" name="area" value="[% area | html %]" />
666
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
467
    <input type="hidden" name="type" value="[% type | html %]" />
667
                        <input type="hidden" name="area" value="[% area | html %]" />
468
    <input type="hidden" name="column" value="[% column | html %]" />
668
                        <input type="hidden" name="type" value="[% type | html %]" />
469
    <input type="hidden" name="public" value="[% public | html %]" />
669
                        <input type="hidden" name="column" value="[% column | html %]" />
470
    <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
670
                        <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
471
    <fieldset><legend>Step 4 of 6: Select criteria to limit on</legend>
671
                        <input type="hidden" name="definition" value="[% definition | html %]" />
472
    <table>
672
                        <input type="hidden" name="totals" value="[% totals | html %]" />
473
        [% FOREACH criteri IN criteria %]
673
                        <input type="hidden" name="public" value="[% public | html %]" />
474
        <tr>
674
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
475
        <td>
675
                        <fieldset>
476
            <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" /> 
676
                            <table>
477
            <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
677
                                [% FOREACH order_b IN order_by %]
478
        </td>
678
                                    <tr>
479
        [% IF ( criteri.date ) %]
679
                                        <td>
480
        <td>
680
                                            <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
481
            <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
681
                                            <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
482
		<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
682
                                        </td>
483
        </td>
683
                                        <td>
484
        </tr>
684
                                            <select name="[% order_b.name | html %]_ovalue">
485
        [% ELSE %]
685
                                                [% FOREACH selec IN order_b.select %]
486
        [% IF ( criteri.textrange ) %]
686
                                                    <option value="[% selec.value | html %]">[% selec.value | html %]</option>
487
            <td>from
687
                                                [% END %]
488
            <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to 
688
                                            </select>
489
            <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
689
                                        </td>
490
            </td>
690
                                    </tr>
491
            </tr>
691
                                [% END %]
492
        [% ELSE %]
692
                            </table>
493
            [% IF ( criteri.daterange ) %]
693
                        </fieldset>
494
            <td>from 
694
                        <fieldset class="action">
495
            <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
695
                            <input type="hidden" name="phase" value="Build report" />
496
            to
696
                            <input type="submit" name="submit" value="Finish" />
497
            <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
697
                        </fieldset>
498
			<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
698
                    </form>
499
            </td>
500
        </tr>
501
            [% ELSE %]
502
            <td>
503
                <select name="[% criteri.name | html %]_value">
504
                [% FOREACH value IN criteri.values %]
505
                <option value="[% value.availablevalues | html %]">[% IF ( value.default ) %]Default[% ELSE %][% value.display_value | html %][% END %]</option>
506
                [% END %]
699
                [% END %]
507
                </select>
508
            </td>
509
            </tr>
510
            [% END %]
511
        [% END %]
512
        [% END %]
513
    [% END %]
514
    </table>
515
    </fieldset>
516
517
[% IF ( definitions ) %]
518
<fieldset><legend>Dictionary definitions</legend>
519
<table>
520
[% FOREACH definition IN definitions %]
521
    <tr><td><input type="checkbox" name="definition" value="[% definition.id | html %]" /> [% definition.name | html %]</td></tr>
522
[% END %]
523
</table>
524
</fieldset>
525
[% END %]
526
700
527
<fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
701
                [% IF ( showreport ) %]
528
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
702
                    <h1>Confirm custom report</h1>
529
    <input type="submit" name="submit" value="Next &gt;&gt;" /> </fieldset>
703
                    <p>Your report will be generated with the following SQL statement.</p>
530
</form>
704
                    <p>
531
[% END %]
705
                        [% sql | html %]
706
                    </p>
707
708
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
709
                        <input type="hidden" name="sql" value="[% sql | html %]" />
710
                        <input type="hidden" name="type" value="[% type | html %]" />
711
                        <input type="hidden" name="public" value="[% public | html %]" />
712
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
713
                        <p>You will need to save the report before you can execute it</p>
714
                        <fieldset class="action"><input type="hidden" name="phase" value="Save" />
715
                            <input type="submit" name="submit" value="Save" />
716
                        </fieldset>
717
                    </form>
718
                [% END %]
532
719
720
                [% IF ( save ) %]
721
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
722
                        <input type="hidden" name="sql" value="[% sql | html %]" />
723
                        <input type="hidden" name="type" value="[% type | html %]" />
724
                        <input type="hidden" name="area" value="[% area | html %]" />
725
                        <input type="hidden" name="public" value="[% public | html %]" />
726
                        <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
727
                        <fieldset class="rows">
728
                            <legend>Save your custom report</legend>
729
                            <ol>
730
                                <li>
731
                                    <label for="reportname" class="required">Report name: </label>
732
                                    <input type="text" id="reportname" name="reportname" class="required" required="required" />
733
                                    <span class="required">Required</span>
734
                                </li>
735
                                [% PROCESS group_and_subgroup_selection %]
736
                                <li>
737
                                    <label for="notes">Notes:</label>
738
                                    <textarea name="notes" id="notes"></textarea>
739
                                </li>
740
                            </ol>
741
                        </fieldset>
742
                        <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
743
                            <input type="submit" name="submit" value="Save report" />
744
                        </fieldset>
745
                    </form>
746
                [% END %]
533
747
534
[% IF ( build5 ) %]
748
                [% IF ( warn_authval_problem ) %]
535
<h1>Build a report</h1>
749
                    <div class="dialog alert">
536
<h3>Step 5 of 6: Pick which columns to total</h3>
750
                        <h3>Errors found when processing parameters for report: [% name | html %]</h3>
537
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
751
                        [% FOREACH problematic_authval IN problematic_authvals %]
538
<input type="hidden" name="area" value="[% area | html %]" />
752
                            <p>
539
<input type="hidden" name="type" value="[% type | html %]" />
753
                            <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
540
<input type="hidden" name="column" value="[% column | html %]" />
754
                                you selected does not exist.
541
<input type="hidden" name="definition" value="[% definition | html %]" />
755
                            </p>
542
<input type="hidden" name="criteria" value="[% criteriastring | html %]" />
756
                        [% END %]
543
<input type="hidden" name="public" value="[% public | html %]" />
757
                        <!-- Save Anyway Form -->
544
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
758
                        <form action='/cgi-bin/koha/reports/guided_reports.pl'>
545
<fieldset><table>
759
                        <!--Every parameter the user issued is provided as a hidden field for recovery-->
546
[% FOREACH total_b IN total_by %]
760
                            <input type='hidden' name='id' value='[% id | html %]' />
547
<tr><td><input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" /> <label for="[% total_b.name | html %]">[% total_b.name | html %]</label></td>
761
                            <input type='hidden' name='sql' value='[% sql | html %]' />
548
<td><select name="[% total_b.name | html %]_tvalue">
762
                            <input type='hidden' name='reportname' value='[% reportname | html %]' />
549
763
                            <input type='hidden' name='group' value='[% group | html %]' />
550
[% FOREACH selec IN total_b.select %]
764
                            <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
551
<option value="[% selec.value | html %]">[% selec.value | html %]</option>
765
                            <input type='hidden' name='notes' value='[% notes | html %]' />
552
[% END %]
766
                            <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
553
</select>
767
                            <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
768
                            <input type='hidden' name='public' value='[% public | html %]' />
769
                        [% IF ( phase_update) %]
770
                            <input type='hidden' name='phase' value='Update SQL' />
771
                            <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
772
                        [% ELSIF ( phase_save) %]
773
                            <input type='hidden' name='area' value='[% area | html %]' />
774
                            <input type='hidden' name='phase' value='Save Report' />
775
                            <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
776
                        [% END %]
777
                        </form>
778
                        <!-- Go back to editing -->
779
                        <form action='/cgi-bin/koha/reports/guided_reports.pl'>
780
                            <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
781
                        </form>
782
                    </div>
783
                [% END %]
554
784
555
</td></tr>
785
                [% IF ( enter_params ) %]
556
[% END %]
786
                    <form action='/cgi-bin/koha/reports/guided_reports.pl'>
557
</table></fieldset>
787
                        <input type='hidden' name='reports' value="[% reports | html %]" />
788
                        [% IF ( auth_val_error ) %]
789
                            <input type='hidden' name='phase' value='Edit SQL' />
790
                            <div class="dialog alert">
791
                                <h3>Errors found when processing parameters for report: [% name | html %]</h3>
792
                                [% FOREACH auth_val_error IN auth_val_errors %]
793
                                    <p>
794
                                        <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
795
                                        you selected does not exist.
796
                                    </p>
797
                                [% END %]
798
                            </div>
799
                            <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
800
                        [% ELSE %]
801
                            <input type='hidden' name='phase' value='Run this report' />
802
                            <h1>Enter parameters for report [% name | html %]:</h1>
803
                            [% IF ( notes ) %]
804
                                <p>[% notes | html %]</p>
805
                            [% END %]
806
                            <fieldset class="rows">
807
                                <ol>
808
                                    [% FOREACH sql_param IN sql_params %]
809
                                        <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
810
                                        [% IF sql_param.input == 'date' %]
811
                                            <li>
812
                                                <label for="date_[% sql_param_entry | html %][% loop.count | html %]">[% sql_param.entry | html %]:</label> <input id="date_[% sql_param_entry | html %][% loop.count | html %]" type="text" value="" size="10" name="sql_params" class="datepicker" />
813
                                            </li>
814
                                        [% ELSIF ( sql_param.input == 'text' ) %]
815
                                            <li>
816
                                                <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
817
                                                <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
818
                                            </li>
819
                                        [% ELSE %]
820
                                            <li>
821
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
822
                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1"  size="1" id="[%- sql_param.input.id | html -%]">
823
                                                    [% IF (sql_param.include_all) %]
824
                                                        <option value="%">All</option>
825
                                                    [% END %]
826
                                                    [% FOREACH value IN sql_param.input.values %]
827
                                                        <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
828
                                                    [% END %]
829
                                                </select>
830
                                            </li>
831
                                        [% END %]
832
                                    [% END %]
833
                                </ol>
834
                            </fieldset>
835
                            <fieldset class="action">
836
                                <input type="submit" value="Run the report" />
837
                            </fieldset>
838
                        [% END %]
839
                    </form>
840
                [% END %]
558
841
559
<fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
842
                [% IF ( execute ) %]
560
    <input type="button" name="back" value="&lt;&lt; Back" class="goback" />
843
                    <h1>[% name | html %]</h1>
561
    <input type="submit" name="submit" value="Next &gt;&gt;" /></fieldset>
844
                    [% IF ( notes ) %]
562
</form>
845
                        <p><span class="label">Notes:</span> [% notes | html %]</p>
563
[% END %]
846
                    [% END %]
847
                    [% IF ( unlimited_total ) %]
848
                        <p>
849
                            <span class="label">Total number of results:</span>
850
                            [% unlimited_total | html %]
851
                            [% IF unlimited_total > limit %]
852
                                ([% limit | html %] shown)
853
                            [% END %].
854
                        </p>
855
                    [% END %]
564
856
857
                    <div id="sql_output" style="display:none;">
858
                        <span class="label">Report SQL:</span>
859
                        <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
860
                    </div>
861
862
                    <div>
863
                        <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
864
                        <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
865
                    </div>
866
                    <div id="chart" class="clearfix"></div>
867
868
                    [% IF ( execute ) %]
869
                        [% UNLESS ( errors ) %]
870
                            <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
871
                                <input type="hidden" name="recordtype" value="biblio" />
872
                                <input type="hidden" name="op" value="list" />
873
                                [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
874
                                <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
875
                            </form>
876
877
                            <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
878
                                <input type="hidden" name="recordtype" value="biblio" />
879
                                <input type="hidden" name="op" value="list" />
880
                                [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
881
                                <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
882
                            </form>
883
884
                            <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
885
                                <input type="hidden" name="op" value="show" />
886
                                [% FOREACH result IN results %]
887
                                    [% FOREACH cells IN result.cells %]
888
                                        [% place = loop.index %]
889
                                        [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
890
                                        [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber'  %]
891
                                            [% SET batch_itemnumbers = 1 %]
892
                                            [% SET header_row.$place.has_itemnumbers = 1 %]
893
                                            <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
894
                                        [% END %]
895
                                    [% END %]
896
                                [% END %]
897
                            </form>
898
899
                            <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
900
                                <input type="hidden" name="op" value="show" />
901
                                <input type="hidden" name="del" value="1" />
902
                                [% FOREACH result IN results %]
903
                                    [% FOREACH cells IN result.cells %]
904
                                        [% place = loop.index %]
905
                                        [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
906
                                        [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber'  %]
907
                                            [% SET batch_itemnumbers = 1 %]
908
                                            [% SET header_row.$place.has_itemnumbers = 1 %]
909
                                            <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
910
                                        [% END %]
911
                                    [% END %]
912
                                [% END %]
913
                            </form>
914
915
                            <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
916
                                [% FOREACH result IN results %]
917
                                    [% FOREACH cells IN result.cells %]
918
                                        [% place = loop.index %]
919
                                        [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
920
                                        [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
921
                                            [% SET batch_biblionumbers = 1 %]
922
                                            [% SET header_row.$place.has_biblionumbers = 1 %]
923
                                            <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
924
                                        [% END %]
925
                                    [% END %]
926
                                [% END %]
927
                            </form>
928
929
                            <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
930
                                <input type="hidden" name="op" value="show" />
931
                                [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
932
                                <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %][% SET batch_cardnumbers = 1 %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
933
                            </form>
934
935
                            [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
936
                                <p>
937
                                    <div class="dropdown">
938
                                        <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
939
                                            Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
940
                                            <span class="caret"></span>
941
                                        </button>
942
                                        <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
943
                                            [% FOREACH header_ro IN header_row %]
944
                                                [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
945
                                                    <li class="dropdown-header">Bibliographic records</li>
946
                                                    <li>
947
                                                        <a href="#" data-submit="batch_record_modification" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record modification" class="batch_op send_to_record_mod">Batch record modification</a>
948
                                                    </li>
949
                                                    <li>
950
                                                        <a href="#" data-submit="batch_record_deletion" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record deletion" class="batch_op send_to_record_del">Batch record deletion</a>
951
                                                    </li>
952
                                                    <li>
953
                                                        <a href="#" data-submit="batch_add_to_list" data-toggle="tooltip" data-placement="right" title="Send visible records to a list" class="batch_op send_to_list">Add to list</a>
954
                                                    </li>
955
                                                [% END %]
956
                                                [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
957
                                                    [% IF ( batch_biblionumbers ) %]
958
                                                        <li role="separator" class="divider"></li>
959
                                                    [% END %]
960
                                                    <li class="dropdown-header">Item records</li>
961
                                                    <li>
962
                                                        <a href="#" data-submit="batch_item_modification" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item modification" class="batch_op send_to_item_mod">Batch item modification</a>
963
                                                    </li>
964
                                                    <li>
965
                                                        <a href="#" data-submit="batch_item_deletion" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item deletion" class="batch_op send_to_item_del">Batch item deletion</a>
966
                                                    </li>
967
                                                [% END %]
968
                                                [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
969
                                                    [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
970
                                                        <li role="separator" class="divider"></li>
971
                                                    [% END %]
972
                                                    <li class="dropdown-header">Patron records</li>
973
                                                    <li>
974
                                                        <a href="#" data-submit="batch_patron_modification" data-toggle="tooltip" data-placement="right" title="Send visible results to batch patron modification" class="batch_op send_to_patron_mod">Batch patron modification</a>
975
                                                    </li>
976
                                                [% END %]
977
                                            [% END %]
978
                                        </ul> <!-- /.dropdown-menu -->
979
                                    </div> <!-- /.dropdown -->
980
                                </p>
981
                            [% END %]
982
                        [% END # UNLESS ( errors ) %]
983
                    [% END # IF ( execute ) %]
565
984
566
[% IF ( build6 ) %]
985
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
567
<h1>Build a report</h1>
986
                        <input type="hidden" name="phase" value="Run this report"/>
568
<h3>Step 6 of 6: Choose how you want the report ordered</h3>
987
                        <input type="hidden" name="reports" value="[% report_id | html %]"/>
569
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
570
<input type="hidden" name="area" value="[% area | html %]" />
571
<input type="hidden" name="type" value="[% type | html %]" />
572
<input type="hidden" name="column" value="[% column | html %]" />
573
<input type="hidden" name="criteria" value="[% criteriastring | html %]" />
574
<input type="hidden" name="definition" value="[% definition | html %]" />
575
<input type="hidden" name="totals" value="[% totals | html %]" />
576
<input type="hidden" name="public" value="[% public | html %]" />
577
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
578
<fieldset><table>[% FOREACH order_b IN order_by %]
579
<tr><td><input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" /> <label for="[% order_b.name | html %]">[% order_b.name | html %]</label></td><td>
580
<select name="[% order_b.name | html %]_ovalue">
581
582
[% FOREACH selec IN order_b.select %]
583
<option value="[% selec.value | html %]">[% selec.value | html %]</option>
584
[% END %]
585
</select>
586
</td></tr>
587
988
588
[% END %]
989
                        [% FOREACH p IN sql_params %]
589
</table></fieldset>
990
                            <input type="hidden" name="sql_params" value="[% p | html %]"/>
991
                        [% END %]
992
                        [% FOREACH n IN param_names %]
993
                            <input type="hidden" name="param_name" value="[% n | html %]"/>
994
                        [% END %]
590
995
591
<fieldset class="action">
996
                        <label for="limit">Rows per page: </label>
592
<input type="hidden" name="phase" value="Build report" />
997
                        <select name="limit" id="limit">
593
<input type="submit" name="submit" value="Finish" /></fieldset>
998
                            [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
594
</form>
999
                            [% FOREACH l IN limits %]
595
[% END %]
1000
                                [% IF l == limit %]
1001
                                    <option value="[% l | html %]" selected="selected">[% l | html %]</option>
1002
                                [% ELSE %]
1003
                                    <option value="[% l | html %]">[% l | html %]</option>
1004
                                [% END %]
1005
                            [% END %]
1006
                        </select>
1007
                    </form>
1008
1009
                    <div class="pages">[% pagination_bar | $raw %]</div>
1010
                    [% UNLESS ( errors ) %]
1011
                        <table>
1012
                            <tr>
1013
                                [% FOREACH header_ro IN header_row %]
1014
                                    <th>[% header_ro.cell | html %]</th>
1015
                                [% END %]
1016
                            </tr>
1017
                            [% FOREACH result IN results %]
1018
                                <tr>
1019
                                    [% FOREACH cells IN result.cells %]
1020
                                        <td>[% cells.cell | $raw %]</td>
1021
                                    [% END %]
1022
                                </tr>
1023
                            [% END %]
1024
                        </table>
1025
                    [% END %]
596
1026
1027
                    [% INCLUDE 'chart.inc' %]
597
1028
598
[% IF ( showreport ) %]
1029
                [% END %]
599
<h1>Confirm custom report</h1>
600
<p>Your report will be generated with the following SQL statement.</p>
601
<p> 
602
[% sql | html %]
603
</p>
604
605
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
606
<input type="hidden" name="sql" value="[% sql | html %]" />
607
<input type="hidden" name="type" value="[% type | html %]" />
608
<input type="hidden" name="public" value="[% public | html %]" />
609
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
610
<p>You will need to save the report before you can execute it</p>
611
<fieldset class="action"><input type="hidden" name="phase" value="Save" />  
612
<input type="submit" name="submit" value="Save" />  </fieldset>
613
</form>
614
[% END %]
615
1030
616
[% IF ( save ) %]
1031
                [% IF ( create ) %]
617
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1032
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
618
<input type="hidden" name="sql" value="[% sql | html %]" />
1033
                        <fieldset class="rows">
619
<input type="hidden" name="type" value="[% type | html %]" />
1034
                            <legend>Create report from SQL</legend>
620
<input type="hidden" name="area" value="[% area | html %]" />
1035
                            <ol>
621
<input type="hidden" name="public" value="[% public | html %]" />
1036
                                <li>
622
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
1037
                                    <label for="reportname" class="required">Report name:</label>
623
<fieldset class="rows">
1038
                                    [% IF ( reportname ) %]
624
<legend>Save your custom report</legend>
1039
                                        <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
625
<ol>
1040
                                    [% ELSE %]
626
    <li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" class="required" required="required" /> <span class="required">Required</span></li>
1041
                                        <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
627
    [% PROCESS group_and_subgroup_selection %]
1042
                                    [% END %]
628
    <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
1043
                                    <span class="required">Required</span>
629
</ol></fieldset>
1044
                                </li>
630
<fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
1045
                                [% PROCESS group_and_subgroup_selection %]
631
<input type="submit" name="submit" value="Save report" /></fieldset>
1046
632
</form>
1047
                                [% IF (public) %]
633
[% END %]
1048
                                    <li>
1049
                                        <label for="public">Report is public:</label>
1050
                                        <select id="public" name="public">
1051
                                            <option value="0">No (default)</option>
1052
                                            <option value="1" selected="selected">Yes</option>
1053
                                        </select>
1054
                                    </li>
1055
                                [% ELSE %]
1056
                                    <li>
1057
                                        <label for="public">Report is public:</label>
1058
                                        <select id="public" name="public">
1059
                                            <option value="0" selected="selected">No (default)</option>
1060
                                            <option value="1">Yes</option>
1061
                                        </select>
1062
                                    </li>
1063
                                [% END %]
634
1064
635
[% IF ( warn_authval_problem ) %]
1065
                                [% IF (usecache) %]
636
    <div class="dialog alert">
1066
                                    <li>
637
        <h3>Errors found when processing parameters for report: [% name | html %]</h3>
1067
                                        <label for="cache_expiry">Cache expiry:</label>
638
        [% FOREACH problematic_authval IN problematic_authvals %]
1068
                                        <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
639
            <p>
1069
                                        <select id="cache_expiry_units" name="cache_expiry_units">
640
            <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
1070
                                            <option value="seconds" selected="selected">Seconds (default)</option>
641
                you selected does not exist.
1071
                                            <option value="minutes">Minutes</option>
642
            </p>
1072
                                            <option value="hours">Hours</option>
643
        [% END %]
1073
                                            <option value="days">Days</option>
644
        <!-- Save Anyway Form -->
1074
                                        </select>
645
        <form action='/cgi-bin/koha/reports/guided_reports.pl'>
1075
                                    </li>
646
        <!--Every parameter the user issued is provided as a hidden field for recovery-->
1076
                                [% END %]
647
            <input type='hidden' name='id' value='[% id | html %]' />
1077
                                <li>
648
            <input type='hidden' name='sql' value='[% sql | html %]' />
1078
                                    <label for="notes">Notes:</label>
649
            <input type='hidden' name='reportname' value='[% reportname | html %]' />
1079
                                    <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
650
            <input type='hidden' name='group' value='[% group | html %]' />
1080
                                </li>
651
            <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
1081
                            </ol>
652
            <input type='hidden' name='notes' value='[% notes | html %]' />
1082
                        </fieldset>
653
            <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
1083
654
            <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
1084
                        <fieldset class="rows">
655
            <input type='hidden' name='public' value='[% public | html %]' />
1085
                            <legend>SQL:</legend>
656
        [% IF ( phase_update) %]
1086
                            <div style="margin:1em;">
657
            <input type='hidden' name='phase' value='Update SQL' />
1087
                                <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
658
            <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
1088
                                <span class="required">Required</span>
659
        [% ELSIF ( phase_save) %]
1089
                            </div>
660
            <input type='hidden' name='area' value='[% area | html %]' />
1090
                        </fieldset>
661
            <input type='hidden' name='phase' value='Save Report' />
1091
662
            <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
1092
                        <fieldset class="action">
663
        [% END %]
1093
                            <input type="hidden" name="phase" value="Save Report" />
664
        </form>
1094
                            <input type="submit" name="submit" value="Save report" />
665
        <!-- Go back to editing -->
1095
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
666
        <form action='/cgi-bin/koha/reports/guided_reports.pl'>
1096
                        </fieldset>
667
            <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
1097
                    </form>
668
        </form>
1098
                [% END %]
669
    </div>
670
[% END %]
671
1099
672
[% IF ( enter_params ) %]
1100
                [% IF saved_results %]
673
    <form action='/cgi-bin/koha/reports/guided_reports.pl'>
1101
                    <h1>Saved report results</h1>
674
        <input type='hidden' name='reports' value="[% reports | html %]" />
1102
                    <h2>[% name | html %]</h2>
675
    [% IF ( auth_val_error ) %]
1103
                    <p>[% notes | html %]</p>
676
        <input type='hidden' name='phase' value='Edit SQL' />
1104
                    <table>
677
        <div class="dialog alert">
1105
                        [% FOREACH rows IN saved_results %]
678
            <h3>Errors found when processing parameters for report: [% name | html %]</h3>
1106
                            <tr>
679
            [% FOREACH auth_val_error IN auth_val_errors %]
1107
                                [% FOREACH col IN rows %]
680
                <p>
1108
                                    <td>[% col | html %]</td>
681
                    <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
1109
                                [% END %]
682
                    you selected does not exist.
1110
                            </tr>
683
                </p>
684
            [% END %]
685
        </div>
686
        <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
687
    [% ELSE %]
688
        <input type='hidden' name='phase' value='Run this report' />
689
        <h1>Enter parameters for report [% name | html %]:</h1>
690
        [% IF ( notes ) %]<p>[% notes | html %]</p>[% END %]
691
        <fieldset class="rows">
692
            <ol>
693
            [% FOREACH sql_param IN sql_params %]
694
                <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
695
                [% IF sql_param.input == 'date' %]
696
                    <li>
697
                    <label for="date_[% sql_param_entry | html %][% loop.count | html %]">[% sql_param.entry | html %]:</label> <input id="date_[% sql_param_entry | html %][% loop.count | html %]" type="text" value="" size="10" name="sql_params" class="datepicker" />
698
                    </li>
699
                [% ELSIF ( sql_param.input == 'text' ) %]
700
                    <li><label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label><input id="sql_params[% loop.count | html %]" type="text" name="sql_params" /></li>
701
                [% ELSE %]
702
                    <li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
703
                        <select name="[%- sql_param.input.name | html -%]" tabindex="1"  size="1" id="[%- sql_param.input.id | html -%]">
704
                        [% IF (sql_param.include_all) %]<option value="%">All</option>[% END %]
705
                        [% FOREACH value IN sql_param.input.values %]
706
                            <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
707
                        [% END %]
1111
                        [% END %]
708
                        </select>
1112
                    </table>
709
                    </li>
710
                [% END %]
1113
                [% END %]
711
            [% END %]
712
            </ol>
713
        </fieldset>
714
        <fieldset class="action"><input type="submit" value="Run the report" /></fieldset>
715
    [% END %]
716
    </form>
717
[% END %]
718
1114
719
[% IF ( execute ) %]
1115
                [% IF ( showsql ) %]
720
<h1>[% name | html %]</h1>
1116
                    <fieldset class="rows">
721
[% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes | html %]</p>[% END %]
1117
                        <legend>[% reportname | html %]</legend>
722
[% IF ( unlimited_total ) %]<p><span class="label">Total number of results:</span> [% unlimited_total | html %][% IF unlimited_total > limit %] ([% limit | html %] shown)[% END %].</p>[% END %]
1118
                        <ol>
723
1119
                            [% IF ( notes ) %]
724
<div id="sql_output" style="display:none;">
1120
                                <li>
725
    <span class="label">Report SQL:</span>
1121
                                    <span class="label">Notes:</span>
726
    <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
1122
                                    [% notes | html %]
727
</div>
1123
                                </li>
728
1124
                            [% ELSE %]
729
<div>
1125
                            [% END %]
730
    <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
1126
                            <li>
731
    <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
1127
                                <textarea id="sql">[% sql | html %]</textarea>
732
</div>
1128
                            </li>
733
<div id="chart" class="clearfix"></div>
1129
                        </ol>
734
1130
                    </fieldset>
735
[% IF ( execute ) %]
736
    [% UNLESS ( errors ) %]
737
        <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
738
            <input type="hidden" name="recordtype" value="biblio" />
739
            <input type="hidden" name="op" value="list" />
740
            [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
741
            <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
742
[% cells.cell | html %][% END %][% END %][% END %]</textarea>
743
        </form>
744
745
        <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
746
            <input type="hidden" name="recordtype" value="biblio" />
747
            <input type="hidden" name="op" value="list" />
748
            [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
749
            <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
750
[% cells.cell | html %][% END %][% END %][% END %]</textarea>
751
        </form>
752
753
        <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
754
            <input type="hidden" name="op" value="show" />
755
            [% FOREACH result IN results %]
756
                [% FOREACH cells IN result.cells %]
757
                    [% place = loop.index %]
758
                    [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
759
                    [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber'  %]
760
                        [% SET batch_itemnumbers = 1 %]
761
                        [% SET header_row.$place.has_itemnumbers = 1 %]
762
                        <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
763
                    [% END %]
764
                [% END %]
765
            [% END %]
766
        </form>
767
768
        <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
769
            <input type="hidden" name="op" value="show" />
770
            <input type="hidden" name="del" value="1" />
771
            [% FOREACH result IN results %]
772
                [% FOREACH cells IN result.cells %]
773
                    [% place = loop.index %]
774
                    [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
775
                    [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber'  %]
776
                        [% SET batch_itemnumbers = 1 %]
777
                        [% SET header_row.$place.has_itemnumbers = 1 %]
778
                        <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
779
                    [% END %]
780
                [% END %]
1131
                [% END %]
781
            [% END %]
1132
782
        </form>
1133
                [% IF ( save_successful ) %]
783
1134
                    [% UNLESS ( errors ) %]
784
        <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
1135
                        </br>
785
            [% FOREACH result IN results %]
1136
                        <div id="report_updated">
786
                [% FOREACH cells IN result.cells %]
1137
                            <div class="dialog message">
787
                    [% place = loop.index %]
1138
                                <p>Your report "[% reportname | html %]" has been saved</p>
788
                    [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
1139
                            </div>
789
                    [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
1140
                        </div>
790
                        [% SET batch_biblionumbers = 1 %]
791
                        [% SET header_row.$place.has_biblionumbers = 1 %]
792
                        <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
793
                    [% END %]
1141
                    [% END %]
794
                [% END %]
1142
                [% END %]
795
            [% END %]
1143
796
        </form>
1144
                [% IF ( editsql ) %]
797
1145
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
798
        <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
1146
                        <input type="hidden" name="phase" value="Update SQL" />
799
            <input type="hidden" name="op" value="show" />
1147
                        <input type="hidden" name="id" value="[% id | html %]"/>
800
            [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
1148
                        <fieldset class="rows">
801
            <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %][% SET batch_cardnumbers = 1 %]
1149
                            <legend>Edit SQL report</legend>
802
[% cells.cell | html %][% END %][% END %][% END %]</textarea>
1150
                            <ol>
803
        </form>
804
805
        [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
806
            <p>
807
                <div class="dropdown">
808
                    <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
809
                        Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
810
                        <span class="caret"></span>
811
                    </button>
812
                    <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
813
                        [% FOREACH header_ro IN header_row %]
814
                            [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
815
                                <li class="dropdown-header">Bibliographic records</li>
816
                                <li>
817
                                    <a href="#" data-submit="batch_record_modification" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record modification" class="batch_op send_to_record_mod">Batch record modification</a>
818
                                </li>
819
                                <li>
820
                                    <a href="#" data-submit="batch_record_deletion" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record deletion" class="batch_op send_to_record_del">Batch record deletion</a>
821
                                </li>
822
                                <li>
1151
                                <li>
823
                                    <a href="#" data-submit="batch_add_to_list" data-toggle="tooltip" data-placement="right" title="Send visible records to a list" class="batch_op send_to_list">Add to list</a>
1152
                                    <label for="reportname" class="required">Report name: </label>
1153
                                    <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1154
                                    <span class="required">Required</span>
824
                                </li>
1155
                                </li>
825
                            [% END %]
1156
                                [% PROCESS group_and_subgroup_selection %]
826
                            [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1157
                                [% IF (public) %]
827
                                [% IF ( batch_biblionumbers ) %]
1158
                                    <li>
828
                                    <li role="separator" class="divider"></li>
1159
                                        <label for="public">Report is public:</label>
1160
                                        <select id="public" name="public">
1161
                                            <option value="0">No (default)</option>
1162
                                            <option value="1" selected="selected">Yes</option>
1163
                                        </select>
1164
                                    </li>
1165
                                [% ELSE %]
1166
                                    <li>
1167
                                        <label for="public">Report is public:</label>
1168
                                        <select id="public" name="public">
1169
                                            <option value="0" selected="selected">No (default)</option>
1170
                                            <option value="1">Yes</option>
1171
                                        </select>
1172
                                    </li>
829
                                [% END %]
1173
                                [% END %]
830
                                <li class="dropdown-header">Item records</li>
1174
831
                                <li>
1175
                                [% IF (usecache) %]
832
                                    <a href="#" data-submit="batch_item_modification" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item modification" class="batch_op send_to_item_mod">Batch item modification</a>
1176
                                    <li>
833
                                </li>
1177
                                        <label for="cache_expiry">Cache expiry:</label>
834
                                <li>
1178
                                        <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
835
                                    <a href="#" data-submit="batch_item_deletion" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item deletion" class="batch_op send_to_item_del">Batch item deletion</a>
1179
                                        <select id="cache_expiry_units" name="cache_expiry_units">
836
                                </li>
1180
                                            <option value="seconds">Seconds (default)</option>
837
                            [% END %]
1181
                                            <option value="minutes">Minutes</option>
838
                            [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1182
                                            <option value="hours">Hours</option>
839
                                [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
1183
                                            <option value="days">Days</option>
840
                                    <li role="separator" class="divider"></li>
1184
                                        </select>
1185
                                    </li>
841
                                [% END %]
1186
                                [% END %]
842
                                <li class="dropdown-header">Patron records</li>
843
                                <li>
1187
                                <li>
844
                                    <a href="#" data-submit="batch_patron_modification" data-toggle="tooltip" data-placement="right" title="Send visible results to batch patron modification" class="batch_op send_to_patron_mod">Batch patron modification</a>
1188
                                    <label for="notes">Notes:</label>
1189
                                    <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
845
                                </li>
1190
                                </li>
846
                            [% END %]
1191
                            </ol>
847
                        [% END %]
1192
                        </fieldset>
848
                    </ul> <!-- /.dropdown-menu -->
1193
849
                </div> <!-- /.dropdown -->
1194
                        <fieldset class="rows">
850
            </p>
1195
                            <legend>SQL:</legend>
851
        [% END %]
1196
                            <div style="margin:1em;">
852
    [% END # UNLESS ( errors ) %]
1197
                                <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
853
[% END # IF ( execute ) %]
1198
                                <span class="required">Required</span>
854
1199
                            </div>
855
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1200
                        </fieldset>
856
    <input type="hidden" name="phase" value="Run this report"/>
857
    <input type="hidden" name="reports" value="[% report_id | html %]"/>
858
859
    [% FOREACH p IN sql_params %]
860
        <input type="hidden" name="sql_params" value="[% p | html %]"/>
861
    [% END %]
862
    [% FOREACH n IN param_names %]
863
        <input type="hidden" name="param_name" value="[% n | html %]"/>
864
    [% END %]
865
1201
866
    <label for="limit">Rows per page: </label>
1202
                        <fieldset class="action">
867
    <select name="limit" id="limit">
1203
                            <input type="submit" name="submit" value="Update SQL" />
868
        [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1204
                            <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
869
        [% FOREACH l IN limits %]
1205
                        </fieldset>
870
                [% IF l == limit %]
1206
                    </form>
871
                    <option value="[% l | html %]" selected="selected">[% l | html %]</option>
872
                [% ELSE %]
873
                    <option value="[% l | html %]">[% l | html %]</option>
874
                [% END %]
875
        [% END %]
876
    </select>
877
</form>
878
879
<div class="pages">[% pagination_bar | $raw %]</div>
880
[% UNLESS ( errors ) %]
881
    <table>
882
        <tr>
883
            [% FOREACH header_ro IN header_row %]
884
                <th>[% header_ro.cell | html %]</th>
885
            [% END %]
886
        </tr>
887
        [% FOREACH result IN results %]
888
            <tr>
889
                [% FOREACH cells IN result.cells %]
890
                    <td>[% cells.cell | $raw %]</td>
891
                [% END %]
1207
                [% END %]
892
            </tr>
893
        [% END %]
894
    </table>
895
[% END %]
896
897
[% INCLUDE 'chart.inc' %]
898
899
[% END %]
900
901
[% IF ( create ) %]
902
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
903
<fieldset class="rows">
904
<legend>Create report from SQL</legend>
905
<ol>
906
    <li><label for="reportname" class="required">Report name:</label>
907
        [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
908
        [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
909
    </li>
910
    [% PROCESS group_and_subgroup_selection %]
911
912
[% IF (public) %]
913
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
914
[% ELSE %]
915
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
916
[% END %]
917
[% IF (usecache) %] <li>
918
<label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
919
<select id="cache_expiry_units" name="cache_expiry_units">
920
<option value="seconds" selected="selected">Seconds (default)</option>
921
<option value="minutes">Minutes</option>
922
<option value="hours">Hours</option>
923
<option value="days">Days</option>
924
</select>
925
</li>[% END %]
926
    <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
927
</ol>
928
</fieldset>
929
<fieldset class="rows">
930
<legend>SQL:</legend>
931
<div style="margin:1em;">
932
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
933
</div>
934
</fieldset>
935
936
<fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
937
<input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
938
</fieldset>
939
</form>
940
[% END %]
941
942
[% IF saved_results %]
943
<h1>Saved report results</h1>
944
<h2>[% name | html %]</h2>
945
<p>[% notes | html %]</p>
946
<table>
947
[% FOREACH rows IN saved_results %]
948
<tr>
949
[% FOREACH col IN rows %]
950
<td>[% col | html %]</td>
951
[% END %]
952
<tr>
953
[% END %]
954
</table>
955
[% END %]
956
957
[% IF ( showsql ) %]
958
<fieldset class="rows">
959
    <legend>[% reportname | html %]</legend>
960
    <ol>
961
        [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes | html %]</li>[% ELSE %][% END %]
962
        <li><textarea id="sql">[% sql | html %]</textarea></li>
963
    </ol>
964
</fieldset>
965
[% END %]
966
967
[% IF ( save_successful ) %]
968
[% UNLESS ( errors ) %]
969
</br>
970
<div id="report_updated">
971
    <div class="dialog message">
972
        <p>Your report "[% reportname | html %]" has been saved</p>
973
    </div>
974
</div>
975
[% END %]
976
[% END %]
977
978
[% IF ( editsql ) %]
979
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
980
<input type="hidden" name="phase" value="Update SQL" />
981
<input type="hidden" name="id" value="[% id | html %]"/>
982
<fieldset class="rows">
983
<legend>Edit SQL report</legend>
984
<ol>
985
<li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" /> <span class="required">Required</span></li>
986
[% PROCESS group_and_subgroup_selection %]
987
[% IF (public) %]
988
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
989
[% ELSE %]
990
  <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
991
[% END %]
992
[% IF (usecache) %] <li>
993
<label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
994
<select id="cache_expiry_units" name="cache_expiry_units">
995
<option value="seconds">Seconds (default)</option>
996
<option value="minutes">Minutes</option>
997
<option value="hours">Hours</option>
998
<option value="days">Days</option>
999
</select>
1000
</li>[% END %]
1001
<li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
1002
</ol>
1003
</fieldset>
1004
1005
<fieldset class="rows">
1006
    <legend>SQL:</legend>
1007
    <div style="margin:1em;">
1008
        <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
1009
    </div>
1010
</fieldset>
1011
1012
<fieldset class="action">
1013
<input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1014
</fieldset>
1015
</form>
1016
1017
1208
1018
[% END %]
1209
                [% IF ( errors ) %]
1019
1210
                    <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1020
[% IF ( errors ) %]
1211
                        <div class="dialog alert">
1021
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1212
                            <b>The following error was encountered:</b><br />
1022
<div class="dialog alert">
1213
                            [% FOREACH error IN errors %]
1023
<b>The following error was encountered:</b><br />
1214
                                [% IF ( error.sqlerr ) %]
1024
[% FOREACH error IN errors %]
1215
                                    This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.<br />
1025
    [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.
1216
                                    Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1026
    <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
1217
                                    Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
1027
    <br />Please return to the &quot;Saved Reports&quot; screen and delete this report or retry creating a new one.
1218
                                [% ELSIF ( error.queryerr ) %]
1028
    [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr | html %]<br />Please check the log for further details.
1219
                                    The database returned the following error: <br />
1029
    [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
1220
                                    [% error.queryerr | html %]<br />Please check the log for further details.
1030
    [% ELSE %]
1221
                                [% ELSIF ( error.cache_expiry ) %]
1031
    [% END %]
1222
                                    Please select a cache expiry less than 30 days.
1032
    <div id="onerror_actions">
1223
                                [% ELSE %]
1033
        <a href="#" class="button goback">Return to previous page</a>
1224
                                [% END %]
1034
    </div>
1225
                                <div id="onerror_actions">
1035
[% END %]
1226
                                    <a href="#" class="button goback">Return to previous page</a>
1036
</div>
1227
                                </div>
1037
<fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
1228
                            [% END %]
1038
<input type="submit" name="submit" value="Saved reports" /></fieldset>
1229
                        </div>
1039
</form>
1230
                        <fieldset class="action">
1040
[% END %]
1231
                            <input type="hidden" name="phase" value="Use saved" />
1232
                            <input type="submit" name="submit" value="Saved reports" />
1233
                        </fieldset>
1234
                    </form>
1235
                [% END %]
1041
1236
1042
            </main>
1237
            </main>
1043
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
1238
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
1044
1239
1045
        <div class="col-sm-2 col-sm-pull-10">
1240
        <div class="col-sm-2 col-sm-pull-10">
1046
            <aside>
1241
            <aside>
1047
1242
                [% IF ( saved1 ) %]
1048
1243
                    <div id="saved-reports-filter">
1049
[% IF ( saved1 ) %]
1244
                        <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1050
<div id="saved-reports-filter">
1245
                            <input type="hidden" name="phase" value="Use saved" />
1051
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1246
                            <input type="hidden" name="filter_set" value="1" />
1052
  <input type="hidden" name="phase" value="Use saved" />
1247
                            <fieldset class="brief">
1053
  <input type="hidden" name="filter_set" value="1" />
1248
                                <h3>Filter</h3>
1054
  <fieldset class="brief">
1249
                                <ol>
1055
  <h3>Filter</h3>
1250
                                    <li>
1056
  <ol>
1251
                                        <label for="filter_date">Date:</label>
1057
    <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1252
                                        <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1058
    <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1253
                                        <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1059
1254
                                    </li>
1060
    </li>
1255
                                    <li>
1061
    <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" /></li>
1256
                                        <label for="filter_author">Author:</label>
1062
    <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" /></li>
1257
                                        <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1063
  </ol>
1258
                                    </li>
1064
  </fieldset>
1259
                                    <li>
1065
  <fieldset class="action">
1260
                                        <label for="filter_keyword">Keyword:</label>
1066
    <input type="submit" value="Apply filter" />
1261
                                        <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1067
    <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1262
                                    </li>
1068
  </fieldset>
1263
                                </ol>
1069
</form>
1264
                            </fieldset>
1070
</div>
1265
                            <fieldset class="action">
1071
[% END %]
1266
                                <input type="submit" value="Apply filter" />
1072
1267
                                <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1073
1268
                            </fieldset>
1269
                        </form>
1270
                    </div>
1271
                [% END %]
1074
                [% INCLUDE 'guided-reports-view.inc' %]
1272
                [% INCLUDE 'guided-reports-view.inc' %]
1075
            </aside>
1273
            </aside>
1076
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1274
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1077
     </div> <!-- /.row -->
1275
     </div> <!-- /.row -->
1078
1276
1079
1080
[% MACRO jsinclude BLOCK %]
1277
[% MACRO jsinclude BLOCK %]
1081
    [% Asset.js("js/charts.js") | $raw %]
1278
    [% Asset.js("js/charts.js") | $raw %]
1082
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1279
    [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
Lines 1151-1157 canned reports and writing custom SQL reports.</p> Link Here
1151
                validator.resetForm();//remove error class on name elements and clear history
1348
                validator.resetForm();//remove error class on name elements and clear history
1152
                validator.reset();//remove all error and success data
1349
                validator.reset();//remove all error and success data
1153
            }
1350
            }
1154
1155
        [% END %]
1351
        [% END %]
1156
1352
1157
        [% IF ( showsql ) %]
1353
        [% IF ( showsql ) %]
Lines 1180-1186 canned reports and writing custom SQL reports.</p> Link Here
1180
        }
1376
        }
1181
1377
1182
        $(document).ready(function(){
1378
        $(document).ready(function(){
1183
1184
            $("body").on('click',".fetch_chart_data",function(){
1379
            $("body").on('click',".fetch_chart_data",function(){
1185
                if( [% unlimited_total || 0 | $raw %] > 1000 ){
1380
                if( [% unlimited_total || 0 | $raw %] > 1000 ){
1186
                    if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
1381
                    if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
Lines 1571-1576 canned reports and writing custom SQL reports.</p> Link Here
1571
                    load_group_subgroups();
1766
                    load_group_subgroups();
1572
                });
1767
                });
1573
            [% END %]
1768
            [% END %]
1769
1574
            $(".delete").on("click",function(){
1770
            $(".delete").on("click",function(){
1575
                return confirmDelete(MSG_CONFIRM_DELETE);
1771
                return confirmDelete(MSG_CONFIRM_DELETE);
1576
            });
1772
            });
1577
- 

Return to bug 24886