5 [% USE ColumnsSettings %]
7 [%- BLOCK area_name -%]
9 [%- CASE 'CIRC' -%]Circulation
10 [%- CASE 'CAT' -%]Catalog
11 [%- CASE 'PAT' -%]Patrons
12 [%- CASE 'ACQ' -%]Acquisitions
13 [%- CASE 'ACC' -%]Accounts
14 [%- CASE 'SER' -%]Serials
18 [% INCLUDE 'doc-head-open.inc' %]
20 <title>Koha › Reports › Guided reports wizard [%- IF ( saved1 ) -%]› Saved reports
21 [%- ELSIF ( create ) -%]› Create from SQL
22 [%- ELSIF ( showsql ) -%]› Saved reports › SQL view
23 [%- ELSIF ( execute ) -%]› Saved reports › [% name | html %] Report
24 [%- ELSIF ( editsql ) -%]› Saved reports › Edit SQL report
26 [%- IF ( build1 ) -%]› Build a report, step 1 of 6: Choose a module
27 [%- ELSIF ( build2 ) -%]› Build a report, step 2 of 6: Pick a report type
28 [%- ELSIF ( build3 ) -%]› Build a report, step 3 of 6: Select columns for display
29 [%- ELSIF ( build4 ) -%]› Build a report, step 4 of 6: Select criteria to limit on
30 [%- ELSIF ( build5 ) -%]› Build a report, step 5 of 6: Pick which columns to total
31 [%- ELSIF ( build6 ) -%]› Build a report, step 6 of 6: Select how you want the report ordered
34 [% INCLUDE 'doc-head-close.inc' %]
36 [% Asset.css("css/reports.css") | $raw %]
37 [% Asset.css("css/datatables.css") | $raw %]
41 <body id="rep_guided_reports_start" class="rep">
42 [% INCLUDE 'header.inc' %]
43 [% INCLUDE 'circ-search.inc' %]
45 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
46 › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
47 › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
49 [% IF ( saved1 ) %]› Saved reports
50 [% ELSIF ( create ) %]› Create from SQL
51 [% ELSIF ( showsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › SQL view
52 [% ELSIF ( editsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › Edit SQL report
53 [% ELSIF ( execute ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › <em>[% name | html %]</em> Report
54 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
55 [% IF ( build1 ) %]› Step 1 of 6: Choose a module
56 [% ELSIF ( build2 ) %]› Step 2 of 6: Pick a report type
57 [% ELSIF ( build3 ) %]› Step 3 of 6: Select columns for display
58 [% ELSIF ( build4 ) %]› Step 4 of 6: Select criteria to limit on
59 [% ELSIF ( build5 ) %]› Step 5 of 6: Pick which columns to total
60 [% ELSIF ( build6 ) %]› Step 6 of 6: Select how you want the report ordered
65 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
66 <div class="modal-dialog">
67 <div class="modal-content">
68 <div class="modal-header">
69 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
70 <h3 id="update_sql_label">Update SQL</h3>
72 <div class="modal-body">
73 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
75 <div class="modal-footer">
76 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
77 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
83 <div id="doc3" class="yui-t1">
87 [% INCLUDE "reports-toolbar.inc" %]
90 <h2>Guided reports</h2>
91 <p>Use the guided reports engine to create non standard reports.
92 This feature aims to provide some middle ground between the built in
93 canned reports and writing custom SQL reports.</p>
95 <h3>Build and run reports</h3>
96 [% IF ( CAN_user_reports_create_reports ) %]
97 <form action="/cgi-bin/koha/reports/guided_reports.pl">
98 <input type="hidden" name="phase" value="Build new" />
99 <input type="submit" name="submit" value="Build new"/>
102 [% IF ( CAN_user_reports_execute_reports ) %]
103 <form action="/cgi-bin/koha/reports/guided_reports.pl">
104 <input type="hidden" name="phase" value="Use saved"/>
105 <input type="submit" name="submit" value="Use saved"/>
108 [% IF ( CAN_user_reports_create_reports ) %]
109 <form action="/cgi-bin/koha/reports/guided_reports.pl">
110 <input type="hidden" name="phase" value="Create report from SQL"/>
111 <input type="submit" name="submit" value="Create report from SQL"/>
114 <h3>Reports Dictionary</h3>
115 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
116 <form action="/cgi-bin/koha/reports/dictionary.pl">
117 <input type="hidden" name="phase" value="View Dictionary"/>
118 <input type="submit" name="submit" value="View dictionary"/>
122 [% IF report_converted %]
123 <div class="dialog message">
124 The report "[% report_converted | html %]" has been converted.
129 [% IF ( savedreports ) %]<h1>Saved reports</h1>
131 [% IF ( filters.date || filters.author || filters.keyword ) %]
133 <span class="filter">
134 [% IF ( filters.date ) %]
135 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
137 [% IF ( filters.author ) %]
138 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
140 [% IF ( filters.keyword ) %]
141 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
143 <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>
148 <div id="tabs" class="toptabs">
150 <li><a href="#reports">All</a></li>
151 [% FOREACH group IN groups_with_subgroups %]
152 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
156 <div id="subgroup_filter_block">
157 <label for="subgroup_filter">Subgroup:</label>
158 <select id="subgroup_filter">
159 <option value="">All</option>
162 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
163 <input type="hidden" name="phase" value="Delete Multiple" />
164 <table id="table_reports">
175 <th class="title-string">Creation date</th>
176 <th class="title-string">Last edit</th>
177 <th class="title-string">Last run</th>
178 <th class="report_public">Public</th>
179 <th class="report_json_url">JSON URL</th>
181 <th>Cache expiry (seconds)</th>
183 <th class="hidden"> </th>
185 <th>Saved results</th>
186 [% IF has_obsolete_reports %]
189 <th class="hidden"> </th>
195 [% FOREACH savedreport IN savedreports %]
196 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
198 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
199 <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
202 <td><label for="ids">[% savedreport.id | html %]</label></td>
204 [% IF ( savedreport.report_name ) %]
205 [% savedreport.report_name | html %]
210 <td>[% savedreport.type | html %]</td>
211 <td>[% savedreport.groupname | html %]</td>
212 <td>[% savedreport.subgroupname | html %]</td>
213 <td>[% savedreport.notes | html %]</td>
214 <td>[% savedreport.borrowersurname | html %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname | html %][% END %] ([% savedreport.borrowernumber | html %])</td>
215 <td><span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span></td>
216 <td><span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 | html %]</span></td>
217 <td><span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates with_hours => 1 | html %]</span></td>
218 <td class="report_public">
219 [% IF (savedreport.public) %]
225 <td class="report_json_url">
226 [% IF (savedreport.public) %]
227 <a href="[% OPACBaseURL | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% OPACBaseURL | html %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
229 <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>
232 <td>[% savedreport.cache_expiry | html %]</td>
234 [% FOR result IN savedreport.results %]
235 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | html %]">[% result.date_run | html %]</a>
240 [% IF savedreport.seems_obsolete %]
241 This report seems obsolete, it uses biblioitems.marcxml field.
242 <a href="/cgi-bin/koha/svc/convert_report?report_id=[% savedreport.id | html %]" 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>
247 <div class="btn-group">
248 [%# There should be no space between these two buttons, it would render badly %]
249 <a class="btn btn-default btn-xs" role="button"
250 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
251 class="fa fa-play"></i> Run</a><a
252 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
253 href="#"><b class="caret"></b></a>
254 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
255 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
256 [% IF ( CAN_user_reports_create_reports ) %]
257 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
258 <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
260 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | html %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
261 [% IF ( CAN_user_reports_delete_reports ) %]
262 <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
272 [% IF ( CAN_user_reports_delete_reports ) %]
273 <fieldset class="action">
274 <input type="submit" value="Delete selected" />
280 [% ELSE %]<div class="dialog message">
281 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
282 <h4>No saved reports match your criteria. </h4>
283 [% IF ( CAN_user_reports_create_reports ) %]
284 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
285 <input type="hidden" name="phase" value="Build new" />
286 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
289 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
290 <input type="hidden" name="phase" value="Create report from SQL" />
291 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
294 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
295 <input type="hidden" name="phase" value="Use saved" />
296 <input type="hidden" name="filter_set" value="1" />
297 <input type="hidden" name="filter_keyword" value="" />
298 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
303 <h4>There are no saved reports. </h4>
304 [% IF ( CAN_user_reports_create_reports ) %]
305 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
314 [% IF ( cache_error) %]
315 <div class="dialog alert">
316 <b> Please choose a cache_expiry less than 30 days </b>
319 <h1>Build a report</h1>
320 <form action="/cgi-bin/koha/reports/guided_reports.pl">
321 <fieldset class="rows">
322 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
325 <label for="area">Choose: </label>
326 <select name="area" id="area">
327 [%- FOREACH area IN areas -%]
328 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
333 <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>
335 <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>
337 [% IF (usecache) %] <li>
338 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
339 <select id="cache_expiry_units" name="cache_expiry_units">
340 <option value="seconds">Seconds (default)</option>
341 <option value="minutes">Minutes</option>
342 <option value="hours">Hours</option>
343 <option value="days">Days</option>
348 <fieldset class="action">
349 <input type="hidden" name="phase" value="Report on this Area" />
350 <input type="submit" name="submit" value="Next >>" />
358 <h1>Build a report</h1>
359 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
360 <input type="hidden" name="area" value="[% area | html %]" />
361 <input type="hidden" name="public" value="[% public | html %]" />
362 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
363 <fieldset class="rows"><legend>Step 2 of 6: Pick a report type</legend>
364 <ol><li><label for="types">Choose: </label>
365 <select id="types" name="types">
366 <option value="1">Tabular</option>
367 <option value="2" disabled="disabled">Summary</option>
368 <option value="3" disabled="disabled">Matrix</option>
370 </li></ol></fieldset>
372 <fieldset class="action">
373 <input type="hidden" name="phase" value="Choose this type" />
374 <input type="button" name="back" value="<< Back" class="goback" />
375 <input type="submit" name="submit" value="Next >>" />
379 <div class="yui-gb"><div class="yui-u first"></div>
381 <!--- Summary and Matrix reports have not yet been implemented-->
382 <!--<div class="yui-u">Summary:
383 <img src="[% interface | html %]/[% theme | html %]/img/reports-summary-graphic.gif" /></div>
384 <div class="yui-u">Matrix:
385 <img src="[% interface | html %]/[% theme | html %]/img/reports-matrix-graphic.gif" /></div>-->
390 <h1>Build a report</h1>
391 <h3>Step 3 of 6: Select columns for display</h3>
392 <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>
394 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
395 <input type="hidden" name="area" value="[% area | html %]" />
396 <input type="hidden" name="type" value="[% type | html %]" />
397 <input type="hidden" name="public" value="[% public | html %]" />
398 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
401 <div class="yui-u first"> <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
402 [% FOREACH column IN columns %]
403 [% IF ( column.table ) %]
405 [% IF ( loop.first ) %]
410 <optgroup label="[% column.table | html %]">
412 <option value="[% column.name | html %]">
413 [% IF ( column.description ) %][% column.description | html %] / [% column.name | html %]
415 [% column.name | html %]
422 <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 />
423 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" /></div>
427 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
432 <fieldset class="action">
433 <input type="hidden" name="phase" value="Choose these columns" />
434 <input type="button" name="back" value="<< Back" class="goback" />
435 <input type="submit" name="submit" value="Next >>" />
443 <h1>Build a report</h1>
444 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
445 <input type="hidden" name="area" value="[% area | html %]" />
446 <input type="hidden" name="type" value="[% type | html %]" />
447 <input type="hidden" name="column" value="[% column | html %]" />
448 <input type="hidden" name="public" value="[% public | html %]" />
449 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
450 <fieldset><legend>Step 4 of 6: Select criteria to limit on</legend>
452 [% FOREACH criteri IN criteria %]
455 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
456 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
458 [% IF ( criteri.date ) %]
460 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
461 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
465 [% IF ( criteri.textrange ) %]
467 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
468 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
472 [% IF ( criteri.daterange ) %]
474 <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
476 <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
477 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
482 <select name="[% criteri.name | html %]_value">
483 [% FOREACH value IN criteri.values %]
484 <option value="[% value.availablevalues | html %]">[% IF ( value.default ) %]Default[% ELSE %][% value.display_value | html %][% END %]</option>
496 [% IF ( definitions ) %]
497 <fieldset><legend>Dictionary definitions</legend>
499 [% FOREACH definition IN definitions %]
500 <tr><td><input type="checkbox" name="definition" value="[% definition.id | html %]" /> [% definition.name | html %]</td></tr>
506 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
507 <input type="button" name="back" value="<< Back" class="goback" />
508 <input type="submit" name="submit" value="Next >>" /> </fieldset>
514 <h1>Build a report</h1>
515 <h3>Step 5 of 6: Pick which columns to total</h3>
516 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
517 <input type="hidden" name="area" value="[% area | html %]" />
518 <input type="hidden" name="type" value="[% type | html %]" />
519 <input type="hidden" name="column" value="[% column | html %]" />
520 <input type="hidden" name="definition" value="[% definition | html %]" />
521 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
522 <input type="hidden" name="public" value="[% public | html %]" />
523 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
525 [% FOREACH total_b IN total_by %]
526 <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>
527 <td><select name="[% total_b.name | html %]_tvalue">
529 [% FOREACH selec IN total_b.select %]
530 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
538 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
539 <input type="button" name="back" value="<< Back" class="goback" />
540 <input type="submit" name="submit" value="Next >>" /></fieldset>
546 <h1>Build a report</h1>
547 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
548 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
549 <input type="hidden" name="area" value="[% area | html %]" />
550 <input type="hidden" name="type" value="[% type | html %]" />
551 <input type="hidden" name="column" value="[% column | html %]" />
552 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
553 <input type="hidden" name="definition" value="[% definition | html %]" />
554 <input type="hidden" name="totals" value="[% totals | html %]" />
555 <input type="hidden" name="public" value="[% public | html %]" />
556 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
557 <fieldset><table>[% FOREACH order_b IN order_by %]
558 <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>
559 <select name="[% order_b.name | html %]_ovalue">
561 [% FOREACH selec IN order_b.select %]
562 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
570 <fieldset class="action">
571 <input type="hidden" name="phase" value="Build report" />
572 <input type="submit" name="submit" value="Finish" /></fieldset>
577 [% IF ( showreport ) %]
578 <h1>Confirm custom report</h1>
579 <p>Your report will be generated with the following SQL statement.</p>
584 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
585 <input type="hidden" name="sql" value="[% sql | html %]" />
586 <input type="hidden" name="type" value="[% type | html %]" />
587 <input type="hidden" name="public" value="[% public | html %]" />
588 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
589 <p>You will need to save the report before you can execute it</p>
590 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
591 <input type="submit" name="submit" value="Save" /> </fieldset>
596 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
597 <input type="hidden" name="sql" value="[% sql | html %]" />
598 <input type="hidden" name="type" value="[% type | html %]" />
599 <input type="hidden" name="area" value="[% area | html %]" />
600 <input type="hidden" name="public" value="[% public | html %]" />
601 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
602 <fieldset class="rows">
603 <legend>Save your custom report</legend>
605 <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>
606 [% PROCESS group_and_subgroup_selection %]
607 <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
609 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
610 <input type="submit" name="submit" value="Save report" /></fieldset>
614 [% IF ( warn_authval_problem ) %]
615 <div class="dialog alert">
616 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
617 [% FOREACH problematic_authval IN problematic_authvals %]
619 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
620 you selected does not exist.
623 <!-- Save Anyway Form -->
624 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
625 <!--Every parameter the user issued is provided as a hidden field for recovery-->
626 <input type='hidden' name='id' value='[% id | html %]' />
627 <input type='hidden' name='sql' value='[% sql | html %]' />
628 <input type='hidden' name='reportname' value='[% reportname | html %]' />
629 <input type='hidden' name='group' value='[% group | html %]' />
630 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
631 <input type='hidden' name='notes' value='[% notes | html %]' />
632 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
633 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
634 <input type='hidden' name='public' value='[% public | html %]' />
635 [% IF ( phase_update) %]
636 <input type='hidden' name='phase' value='Update SQL' />
637 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
638 [% ELSIF ( phase_save) %]
639 <input type='hidden' name='area' value='[% area | html %]' />
640 <input type='hidden' name='phase' value='Save Report' />
641 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
644 <!-- Go back to editing -->
645 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
646 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
651 [% IF ( enter_params ) %]
652 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
653 <input type='hidden' name='reports' value="[% reports | html %]" />
654 [% IF ( auth_val_error ) %]
655 <input type='hidden' name='phase' value='Edit SQL' />
656 <div class="dialog alert">
657 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
658 [% FOREACH auth_val_error IN auth_val_errors %]
660 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
661 you selected does not exist.
665 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
667 <input type='hidden' name='phase' value='Run this report' />
668 <h1>Enter parameters for report [% name | html %]:</h1>
669 [% IF ( notes ) %]<p>[% notes | html %]</p>[% END %]
670 <fieldset class="rows">
672 [% FOREACH sql_param IN sql_params %]
673 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
674 [% IF sql_param.input == 'date' %]
676 <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" />
678 [% ELSIF ( sql_param.input == 'text' ) %]
679 <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>
681 <li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
682 <select name="[%- sql_param.input.name | html -%]" tabindex="1" size="1" id="[%- sql_param.input.id | html -%]">
683 [% FOREACH value IN sql_param.input.values %]
684 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
692 <fieldset class="action"><input type="submit" value="Run the report" /></fieldset>
698 <h1>[% name | html %]</h1>
699 [% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes | html %]</p>[% END %]
700 [% 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 %]
701 <div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql | html %]</pre></div>
704 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
705 <input type="hidden" name="phase" value="Run this report"/>
706 <input type="hidden" name="reports" value="[% report_id | html %]"/>
708 [% FOREACH p IN sql_params %]
709 <input type="hidden" name="sql_params" value="[% p | html %]"/>
712 <label for="limit">Rows per page: </label>
713 <select name="limit" id="limit">
714 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
715 [% FOREACH l IN limits %]
717 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
719 <option value="[% l | html %]">[% l | html %]</option>
725 <div class="pages">[% pagination_bar | $raw %]</div>
726 [% UNLESS ( errors ) %]
727 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
728 <input type="hidden" name="op" value="show" />
731 [% FOREACH header_ro IN header_row %]
732 [% IF header_ro.cell == 'itemnumber' %]
734 [% header_ro.cell | html %] <button type="submit" data-toggle="tooltip" title="Send visible items to batch modification" class="btn btn-xs btn-default send_to_item_mod"><i class="fa fa-pencil"></i> Batch modify</button>
737 <th>[% header_ro.cell | html %]</th>
741 [% FOREACH result IN results %]
743 [% FOREACH cells IN result.cells %]
744 [% place = loop.index | html %]
745 [% IF header_row.$place.cell == 'itemnumber' %]
746 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
748 <td>[% cells.cell | html %]</td>
758 <script type="text/javascript">
759 $(document).ready(function() {
760 load_group_subgroups();
763 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
764 <fieldset class="rows">
765 <legend>Create report from SQL</legend>
767 <li><label for="reportname" class="required">Report name:</label>
768 [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
769 [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
771 [% PROCESS group_and_subgroup_selection %]
774 <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>
776 <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>
778 [% IF (usecache) %] <li>
779 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
780 <select id="cache_expiry_units" name="cache_expiry_units">
781 <option value="seconds" selected="selected">Seconds (default)</option>
782 <option value="minutes">Minutes</option>
783 <option value="hours">Hours</option>
784 <option value="days">Days</option>
787 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
790 <fieldset class="rows">
791 <legend>SQL:</legend>
792 <div style="margin:1em;">
793 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
797 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
798 <input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
803 [% IF saved_results %]
804 <h1>Saved report results</h1>
805 <h2>[% name | html %]</h2>
806 <p>[% notes | html %]</p>
808 [% FOREACH rows IN saved_results %]
810 [% FOREACH col IN rows %]
811 <td>[% col | html %]</td>
819 <fieldset class="rows">
820 <legend>[% reportname | html %]</legend>
822 [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes | html %]</li>[% ELSE %][% END %]
823 <li><textarea id="sql">[% sql | html %]</textarea></li>
828 [% IF ( save_successful ) %]
829 [% UNLESS ( errors ) %]
831 <div id="report_updated">
832 <div class="dialog message">
833 <p>Your report "[% reportname | html %]" has been saved</p>
840 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
841 <input type="hidden" name="phase" value="Update SQL" />
842 <input type="hidden" name="id" value="[% id | html %]"/>
843 <fieldset class="rows">
844 <legend>Edit SQL report</legend>
846 <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>
847 [% PROCESS group_and_subgroup_selection %]
849 <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>
851 <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>
853 [% IF (usecache) %] <li>
854 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
855 <select id="cache_expiry_units" name="cache_expiry_units">
856 <option value="seconds">Seconds (default)</option>
857 <option value="minutes">Minutes</option>
858 <option value="hours">Hours</option>
859 <option value="days">Days</option>
862 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
866 <fieldset class="rows">
867 <legend>SQL:</legend>
868 <div style="margin:1em;">
869 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
873 <fieldset class="action">
874 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
882 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
883 <div class="dialog alert">
884 <b>The following error was encountered:</b><br />
885 [% FOREACH error IN errors %]
886 [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.
887 <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
888 <br />Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
889 [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr | html %]<br />Please check the log for further details.
890 [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
893 <div id="onerror_actions">
894 <a href="#" class="button goback">Return to previous page</a>
898 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
899 <input type="submit" name="submit" value="Saved reports" /></fieldset>
908 <div id="saved-reports-filter">
909 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
910 <input type="hidden" name="phase" value="Use saved" />
911 <input type="hidden" name="filter_set" value="1" />
912 <fieldset class="brief">
915 <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
916 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
919 <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" /></li>
920 <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" /></li>
923 <fieldset class="action">
924 <input type="submit" value="Apply filter" />
925 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
932 [% INCLUDE 'guided-reports-view.inc' %]
936 [% MACRO jsinclude BLOCK %]
937 [% INCLUDE 'calendar.inc' %]
939 [% INCLUDE 'datatables.inc' %]
940 [% INCLUDE 'columns_settings.inc' %]
943 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
944 var group_subgroups = {};
945 [% FOREACH group IN groups_with_subgroups %]
946 var gid = "[% group.id | html %]"
947 group_subgroups[gid] = new Array();
948 [% FOREACH subgroup IN group.subgroups %]
949 var sgid = "[% subgroup.id | html %]";
950 var sgname = "[% subgroup.name | html %]";
951 group_subgroups[gid].push([sgid, sgname]);
955 function load_group_subgroups () {
956 var group = $("#group_select").val();
957 var sg = $("#subgroup");
958 $(sg).find('option[value!=""]').each(function() {
963 var select = $(sg).find('select')[0];
964 $.each( group_subgroups[group], function(index, value) {
965 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
967 $("#subgroup, #subgroup *").show();
971 $(document).ready(function(){
973 $('[data-toggle="tooltip"]').tooltip();
974 var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
976 $('#limit').change(function() {
977 $('#limitselect').submit();
980 $(document).click(function() {
981 $('#report_updated').hide();
984 $(".goback").on("click",function(e){
986 window.history.back();
989 $("#addColumn").on("click",function(){
993 $("#delColumn").on("click",function(){
998 var rtable = KohaTable("table_reports", {
999 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1000 'bAutoWidth': false,
1001 'sPaginationType': 'four_button',
1002 'aaSorting': [[ 1, "asc" ]],
1004 { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
1005 { 'bSearchable': false, 'aTargets': [3] },
1006 { "aTargets": [ 1, 2 ], "sType": "natural" },
1007 { "sType": "title-string", "aTargets" : [ "title-string" ] },
1008 { "visible": false, "aTargets" : [ "hidden" ] }
1011 'sZeroRecords': _("No matching reports found")
1013 }, columns_settings);
1015 var rtabs = $("#tabs").tabs();
1016 rtabs.on("tabsactivate", function(e, ui) {
1017 $("#subgroup_filter option").each(function() {
1018 if($(this).val().length > 0) {
1022 rtable.fnFilter('', 4);
1023 rtable.fnFilter('', 5);
1024 rtable.fnSetColumnVis(4, true);
1025 rtable.fnSetColumnVis(5, true);
1027 var g_id = $(ui.newTab).children().attr('id');
1028 var g_name = $(ui.newTab).text();
1029 if ( g_name == _("All") ) {
1034 if (g_id && g_id.length > 0) {
1035 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1036 rtable.fnSetColumnVis(4, false);
1037 for(var i in group_subgroups[g_id]) {
1038 $("#subgroup_filter").append(
1039 '<option value="' + group_subgroups[g_id][i][0] + '">'
1040 + group_subgroups[g_id][i][1] + '</option>'
1043 $("#subgroup_filter_block").show();
1045 $("#subgroup_filter_block").hide();
1048 $("#subgroup_filter_block").hide();
1050 $("#subgroup_filter").change(function() {
1051 var selected = $(this).find('option:selected');
1052 var sg_id = $(selected).val();
1053 var sg_name = $(selected).text();
1054 if (sg_id.length > 0) {
1055 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1056 rtable.fnSetColumnVis(5, false);
1058 rtable.fnFilter('', 5);
1059 rtable.fnSetColumnVis(5, true);
1063 $("#reports_form").submit(function(){
1064 var checkedItems = $("input[name=ids]:checked");
1065 if ($(checkedItems).size() == 0) {
1066 alert(_("You must select one or more reports to delete"));
1069 $(checkedItems).parents('tr').addClass("warn");
1070 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1073 $(checkedItems).parents('tr').removeClass("warn");
1078 $("body").on("click", ".update_sql", function(e){
1080 var ltitle = $(this).text();
1081 var report_id = $(this).data("report_id");
1082 var page = $(this).attr("href");
1083 $("#update_sql .modal-body").load(page + " div", function(){
1084 var diff1 = $("#col1 .show_sql").text();
1085 var diff2 = $("#col2 .show_sql").text();
1086 var diffs = diffString( escape(diff1), escape(diff2) );
1087 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1089 $('#update_sql').modal('show');
1090 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1093 $("#update_sql").on("hidden.bs.modal", function(){
1094 $("#update_sql_label").html("");
1095 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1099 [% IF ( showsql ) %]
1100 $("#sql").focus(function() {
1105 $(".toggle_sql").click(function(){
1106 $("#sql_output").toggle();
1107 $("#toggle_sql_hid").toggle();
1108 $("#toggle_sql_vis").toggle();
1111 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1112 $(this).parents('tr').attr("class","warn");
1113 if(confirm(_("Are you sure you want to delete this saved report?"))){
1116 $(this).parents('tr').attr("class","");
1121 [% IF (create || editsql || save) %]
1122 $("#select_group").change(function() {
1123 if($(this).prop('checked')) {
1124 $("#group_input").prop('disabled', true);
1125 $("#groupdesc_input").prop('disabled', true);
1126 $("#group_select").prop('disabled', false);
1127 if ($("#group_select").val().length > 0) {
1128 $("#select_subgroup").prop('checked', true);
1129 $("#select_subgroup").change();
1130 $("#subgroup, #subgroup *").show();
1132 $("#subgroup").hide();
1136 $("#create_group").change(function() {
1137 if($(this).prop('checked')) {
1138 $("#group_input").prop('disabled', false);
1139 $("#groupdesc_input").prop('disabled', false);
1140 $("#group_select").prop('disabled', true);
1141 $("#create_subgroup").prop('checked', true).change();
1142 $("#subgroup_select").hide();
1143 $("#subgroup input[type='radio']").hide();
1144 $("#subgroup label[for]").hide();
1145 $("#subgroup_input").show();
1146 $("#subgroupdesc_input").show();
1147 $("#subgroup").show();
1150 $("#select_subgroup").change(function() {
1151 if($(this).prop('checked')) {
1152 $("#subgroup_select").prop('disabled', false);
1153 $("#subgroup_input").prop('disabled', true);
1154 $("#subgroupdesc_input").prop('disabled', true);
1157 $("#create_subgroup").change(function() {
1158 if($(this).prop('checked')) {
1159 $("#subgroup_input").prop('disabled', false);
1160 $("#subgroupdesc_input").prop('disabled', false);
1161 $("#subgroup_select").prop('disabled', true);
1164 $("#select_group").change();
1165 $("#select_subgroup").change();
1166 $("#group_select").on("change",function(){
1167 load_group_subgroups();
1170 $(".delete").on("click",function(){
1171 return confirmDelete(MSG_CONFIRM_DELETE);
1174 function addColumn() {
1175 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1177 function delColumn() {
1178 $("#selectedColumns option:selected").remove();
1180 $("#column_submit").submit(function() {
1181 if ($("#selectedColumns option").size() < 1) {
1182 alert(_("No columns selected!"));
1185 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1191 [% INCLUDE 'intranet-bottom.inc' %]
1193 [% BLOCK group_and_subgroup_selection %]
1195 <label>Report group:</label>
1196 <input type="radio" name="select_or_create_group"
1197 id="select_group" checked="checked" />
1198 <label for="select_group" style="float:none">Select</label>
1199 <select name="group" id="group_select">
1200 <option value="">(None)</option>
1201 [% FOREACH group IN groups_with_subgroups %]
1202 [% IF (group.selected) %]
1203 <option value="[% group.id | html %]" selected="selected">
1205 <option value="[% group.id | html %]">
1207 [% group.name | html %]
1211 <input type="radio" name="select_or_create_group" id="create_group" />
1212 <label for="create_group" style="float:none">or create:</label>
1213 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
1214 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
1217 <label>Report subgroup:</label>
1218 <input type="radio" name="select_or_create_subgroup"
1219 id="select_subgroup" checked="checked" />
1220 <label for="select_subgroup" style="float:none">Select</label>
1221 <select name="subgroup" id="subgroup_select">
1222 <option value="">(None)</option>
1223 [% FOREACH group IN groups_with_subgroups %]
1224 [% IF (group.selected) %]
1225 [% FOREACH subgroup IN group.subgroups %]
1226 [% IF (subgroup.selected) %]
1227 <option value="[% subgroup.id | html %]" selected="selected">
1229 <option value="[% subgroup.id | html %]">
1231 [% subgroup.name | html %]
1237 <input type="radio" name="select_or_create_subgroup"
1238 id="create_subgroup" />
1239 <label for="create_subgroup" style="float:none">or create</label>
1240 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
1241 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />