4 [%- BLOCK area_name -%]
6 [%- CASE 'CIRC' -%]Circulation
7 [%- CASE 'CAT' -%]Catalog
8 [%- CASE 'PAT' -%]Patrons
9 [%- CASE 'ACQ' -%]Acquisitions
10 [%- CASE 'ACC' -%]Accounts
11 [%- CASE 'SER' -%]Serials
15 [% INCLUDE 'doc-head-open.inc' %]
17 <title>Koha › Reports › Guided reports wizard [%- IF ( saved1 ) -%]› Saved reports
18 [%- ELSIF ( create ) -%]› Create from SQL
19 [%- ELSIF ( showsql ) -%]› Saved reports › SQL view
20 [%- ELSIF ( execute ) -%]› Saved reports › [% name %] Report
21 [%- ELSIF ( editsql ) -%]› Saved reports › Edit SQL report
23 [%- IF ( build1 ) -%]› Build a report, step 1 of 6: Choose a module
24 [%- ELSIF ( build2 ) -%]› Build a report, step 2 of 6: Pick a report type
25 [%- ELSIF ( build3 ) -%]› Build a report, step 3 of 6: Select columns for display
26 [%- ELSIF ( build4 ) -%]› Build a report, step 4 of 6: Select criteria to limit on
27 [%- ELSIF ( build5 ) -%]› Build a report, step 5 of 6: Pick which columns to total
28 [%- ELSIF ( build6 ) -%]› Build a report, step 6 of 6: Select how you want the report ordered
31 [% INCLUDE 'doc-head-close.inc' %]
32 <style type="text/css">
33 #sql { width: 90%; height: 9em;}
34 #update_sql .modal-dialog { width: 80%; }
35 ins { background-color: #e6ffe6; }
36 del { background-color: #ffe6e6; }
37 #col1, #col2 { width:45%; float:left; }
38 #col1 ins, #col2 del { display: none; }
39 .show_sql { font-family: monospace; }
41 background-color: #EBF3FF;
42 border: 1px solid #88b0e8;
44 display: inline-block;
52 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
56 <body id="rep_guided_reports_start" class="rep">
57 [% INCLUDE 'header.inc' %]
58 [% INCLUDE 'circ-search.inc' %]
60 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
61 › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
62 › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
64 [% IF ( saved1 ) %]› Saved reports
65 [% ELSIF ( create ) %]› Create from SQL
66 [% ELSIF ( showsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › SQL view
67 [% ELSIF ( editsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › Edit SQL report
68 [% ELSIF ( execute ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › <em>[% name %]</em> Report
69 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
70 [% IF ( build1 ) %]› Step 1 of 6: Choose a module
71 [% ELSIF ( build2 ) %]› Step 2 of 6: Pick a report type
72 [% ELSIF ( build3 ) %]› Step 3 of 6: Select columns for display
73 [% ELSIF ( build4 ) %]› Step 4 of 6: Select criteria to limit on
74 [% ELSIF ( build5 ) %]› Step 5 of 6: Pick which columns to total
75 [% ELSIF ( build6 ) %]› Step 6 of 6: Select how you want the report ordered
80 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
81 <div class="modal-dialog">
82 <div class="modal-content">
83 <div class="modal-header">
84 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
85 <h3 id="update_sql_label">Update SQL</h3>
87 <div class="modal-body">
88 <div id="loading"> <img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /> Loading </div>
90 <div class="modal-footer">
91 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
92 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
98 <div id="doc3" class="yui-t1">
102 [% INCLUDE "reports-toolbar.inc" %]
105 <h2>Guided reports</h2>
106 <p>Use the guided reports engine to create non standard reports.
107 This feature aims to provide some middle ground between the built in
108 canned reports and writing custom SQL reports.</p>
110 <h3>Build and run reports</h3>
111 [% IF ( CAN_user_reports_create_reports ) %]
112 <form action="/cgi-bin/koha/reports/guided_reports.pl">
113 <input type="hidden" name="phase" value="Build new" />
114 <input type="submit" name="submit" value="Build new"/>
117 [% IF ( CAN_user_reports_execute_reports ) %]
118 <form action="/cgi-bin/koha/reports/guided_reports.pl">
119 <input type="hidden" name="phase" value="Use saved"/>
120 <input type="submit" name="submit" value="Use saved"/>
123 [% IF ( CAN_user_reports_create_reports ) %]
124 <form action="/cgi-bin/koha/reports/guided_reports.pl">
125 <input type="hidden" name="phase" value="Create report from SQL"/>
126 <input type="submit" name="submit" value="Create report from SQL"/>
129 <h3>Reports Dictionary</h3>
130 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
131 <form action="/cgi-bin/koha/reports/dictionary.pl">
132 <input type="hidden" name="phase" value="View Dictionary"/>
133 <input type="submit" name="submit" value="View dictionary"/>
137 [% IF report_converted %]
138 <div class="dialog message">
139 The report "[% report_converted %]" has been converted.
144 [% IF ( savedreports ) %]<h1>Saved reports</h1>
146 <div id="tabs" class="toptabs">
148 <li><a href="#reports">All</a></li>
149 [% FOREACH group IN groups_with_subgroups %]
150 <li><a id="[% group.id %]" href="#reports">[% group.name %]</a></li>
154 <div id="subgroup_filter_block">
155 <label for="subgroup_filter">Subgroup:</label>
156 <select id="subgroup_filter">
157 <option value="">All</option>
160 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
161 <input type="hidden" name="phase" value="Delete Multiple" />
162 <table id="table_reports">
173 <th class="title-string">Creation date</th>
174 <th class="title-string">Last edit</th>
175 <th class="title-string">Last run</th>
176 <th class="report_public">Public</th>
177 <th class="report_json_url">JSON URL</th>
178 [% IF (usecache) %] <th>Cache expiry (seconds)</th> [% END %]
179 <th>Saved results</th>
180 [% IF has_obsolete_reports %]<th>Update</th>[% END %]
185 [% FOREACH savedreport IN savedreports %]
186 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
188 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
189 <input type="checkbox" name="ids" value="[% savedreport.id %]" />
192 <td><label for="ids">[% savedreport.id %]</label></td>
194 [% IF ( savedreport.report_name ) %]
195 [% savedreport.report_name %]
200 <td>[% savedreport.type %]</td>
201 <td>[% savedreport.groupname %]</td>
202 <td>[% savedreport.subgroupname %]</td>
203 <td>[% savedreport.notes %]</td>
204 <td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td>
205 <td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td>
206 <td><span title="[% savedreport.last_modified %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span></td>
207 <td><span title="[% savedreport.last_run %]">[% savedreport.last_run | $KohaDates with_hours => 1 %]</span></td>
208 <td class="report_public">
209 [% IF (savedreport.public) %]
215 <td class="report_json_url">
216 [% IF (savedreport.public) %]
217 <a href="[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% OPACBaseURL %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
219 <a href="/cgi-bin/koha/svc/report?id=[% savedreport.id | uri %]">[% Koha.Preference('staffClientBaseURL') %]/cgi-bin/koha/svc/report?id=[% savedreport.id | html %]</a>
222 [% IF (usecache) %] <td>[% savedreport.cache_expiry %]</td> [% END %]
224 [% FOR result IN savedreport.results %]
225 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id %]">[% result.date_run %]</a>
229 [% IF has_obsolete_reports %]
231 [% IF savedreport.seems_obsolete %]
232 This report seems obsolete, it uses biblioitems.marcxml field.
233 <a href="/cgi-bin/koha/svc/convert_report?report_id=[% savedreport.id %]" data-report_id="[% savedreport.id %]" class="update_sql btn btn-default btn-xs" title="Update SQL"><i class="fa fa-eye"></i> Update SQL</a>
239 <div class="btn-group">
240 [%# There should be no space between these two buttons, it would render badly %]
241 <a class="btn btn-default btn-xs" role="button"
242 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Run%20this%20report"><i
243 class="fa fa-play"></i> Run</a><a
244 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id %]" role="button" data-toggle="dropdown"
245 href="#"><b class="caret"></b></a>
246 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id %]">
247 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
248 [% IF ( CAN_user_reports_create_reports ) %]
249 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
250 <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>
252 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
253 [% IF ( CAN_user_reports_delete_reports ) %]
254 <li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li>
264 [% IF ( CAN_user_reports_delete_reports ) %]
265 <fieldset class="action">
266 <input type="submit" value="Delete selected" />
272 [% ELSE %]<div class="dialog message">
273 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
274 <h4>No saved reports match your criteria. </h4>
275 [% IF ( CAN_user_reports_create_reports ) %]
276 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
277 <input type="hidden" name="phase" value="Build new" />
278 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
281 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
282 <input type="hidden" name="phase" value="Create report from SQL" />
283 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
286 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
287 <input type="hidden" name="phase" value="Use saved" />
288 <input type="hidden" name="filter_set" value="1" />
289 <input type="hidden" name="filter_keyword" value="" />
290 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
295 <h4>There are no saved reports. </h4>
296 [% IF ( CAN_user_reports_create_reports ) %]
297 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
306 [% IF ( cache_error) %]
307 <div class="dialog alert">
308 <b> Please choose a cache_expiry less than 30 days </b>
311 <h1>Build a report</h1>
312 <form action="/cgi-bin/koha/reports/guided_reports.pl">
313 <fieldset class="rows">
314 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
317 <label for="area">Choose: </label>
318 <select name="area" id="area">
319 [%- FOREACH area IN areas -%]
320 <option value="[% area %]">[%- PROCESS area_name area=area -%]</option>
325 <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>
327 <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>
329 [% IF (usecache) %] <li>
330 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
331 <select id="cache_expiry_units" name="cache_expiry_units">
332 <option value="seconds">Seconds (default)</option>
333 <option value="minutes">Minutes</option>
334 <option value="hours">Hours</option>
335 <option value="days">Days</option>
340 <fieldset class="action">
341 <input type="hidden" name="phase" value="Report on this Area" />
342 <input type="submit" name="submit" value="Next >>" />
350 <h1>Build a report</h1>
351 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
352 <input type="hidden" name="area" value="[% area %]" />
353 <input type="hidden" name="public" value="[% public %]" />
354 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
355 <fieldset class="rows"><legend>Step 2 of 6: Pick a report type</legend>
356 <ol><li><label for="types">Choose: </label>
357 <select id="types" name="types">
358 <option value="1">Tabular</option>
359 <option value="2" disabled="disabled">Summary</option>
360 <option value="3" disabled="disabled">Matrix</option>
362 </li></ol></fieldset>
364 <fieldset class="action">
365 <input type="hidden" name="phase" value="Choose this type" />
366 <input type="button" name="back" value="<< Back" class="goback" />
367 <input type="submit" name="submit" value="Next >>" />
371 <div class="yui-gb"><div class="yui-u first"></div>
373 <!--- Summary and Matrix reports have not yet been implemented-->
374 <!--<div class="yui-u">Summary:
375 <img src="[% interface %]/[% theme %]/img/reports-summary-graphic.gif" /></div>
376 <div class="yui-u">Matrix:
377 <img src="[% interface %]/[% theme %]/img/reports-matrix-graphic.gif" /></div>-->
382 <h1>Build a report</h1>
383 <h3>Step 3 of 6: Select columns for display</h3>
384 <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>
386 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
387 <input type="hidden" name="area" value="[% area %]" />
388 <input type="hidden" name="type" value="[% type %]" />
389 <input type="hidden" name="public" value="[% public %]" />
390 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
393 <div class="yui-u first"> <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
394 [% FOREACH column IN columns %]
395 [% IF ( column.table ) %]
397 [% IF ( loop.first ) %]
402 <optgroup label="[% column.table %]">
404 <option value="[% column.name %]">
405 [% IF ( column.description ) %][% column.description %] / [% column.name %]
414 <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 />
415 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" /></div>
419 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
424 <fieldset class="action">
425 <input type="hidden" name="phase" value="Choose these columns" />
426 <input type="button" name="back" value="<< Back" class="goback" />
427 <input type="submit" name="submit" value="Next >>" />
435 <h1>Build a report</h1>
436 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
437 <input type="hidden" name="area" value="[% area %]" />
438 <input type="hidden" name="type" value="[% type %]" />
439 <input type="hidden" name="column" value="[% column %]" />
440 <input type="hidden" name="public" value="[% public %]" />
441 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
442 <fieldset><legend>Step 4 of 6: Select criteria to limit on</legend>
444 [% FOREACH criteri IN criteria %]
447 <input type="checkbox" name="criteria_column" id="[% criteri.name %]" value="[% criteri.name %]" />
448 <label for="[% criteri.name %]">[% criteri.description %] </label>
450 [% IF ( criteri.date ) %]
452 <input type="text" size="10" id="[% criteri.name %]_value" name="[% criteri.name %]_value" value="" class="datepicker" />
453 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
457 [% IF ( criteri.textrange ) %]
459 <input type="text" size="10" id="[% criteri.from %]_value" name="[% criteri.from %]_value" value="" /> to
460 <input type="text" size="10" id="[% criteri.to %]_value" name="[% criteri.to %]_value" value="" />
464 [% IF ( criteri.daterange ) %]
466 <input type="text" size="10" id="from_[% criteri.name %]_value" name="from_[% criteri.name %]_value" value="" class="datepickerfrom" />
468 <input type="text" size="10" id="to_[% criteri.name %]_value" name="to_[% criteri.name %]_value" value="" class="datepickerto" />
469 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
474 <select name="[% criteri.name %]_value">
475 [% FOREACH value IN criteri.values %]
476 <option value="[% value.availablevalues %]">[% IF ( value.default ) %]Default[% ELSE %][% value.display_value |html %][% END %]</option>
488 [% IF ( definitions ) %]
489 <fieldset><legend>Dictionary definitions</legend>
491 [% FOREACH definition IN definitions %]
492 <tr><td><input type="checkbox" name="definition" value="[% definition.id %]" /> [% definition.name %]</td></tr>
498 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
499 <input type="button" name="back" value="<< Back" class="goback" />
500 <input type="submit" name="submit" value="Next >>" /> </fieldset>
506 <h1>Build a report</h1>
507 <h3>Step 5 of 6: Pick which columns to total</h3>
508 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
509 <input type="hidden" name="area" value="[% area %]" />
510 <input type="hidden" name="type" value="[% type %]" />
511 <input type="hidden" name="column" value="[% column %]" />
512 <input type="hidden" name="definition" value="[% definition %]" />
513 <input type="hidden" name="criteria" value="[% criteriastring %]" />
514 <input type="hidden" name="public" value="[% public %]" />
515 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
517 [% FOREACH total_b IN total_by %]
518 <tr><td><input type="checkbox" name="total_by" id="[% total_b.name %]" value="[% total_b.name %]" /> <label for="[% total_b.name %]">[% total_b.name %]</label></td>
519 <td><select name="[% total_b.name %]_tvalue">
521 [% FOREACH selec IN total_b.select %]
522 <option value="[% selec.value %]">[% selec.value %]</option>
530 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
531 <input type="button" name="back" value="<< Back" class="goback" />
532 <input type="submit" name="submit" value="Next >>" /></fieldset>
538 <h1>Build a report</h1>
539 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
540 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
541 <input type="hidden" name="area" value="[% area %]" />
542 <input type="hidden" name="type" value="[% type %]" />
543 <input type="hidden" name="column" value="[% column %]" />
544 <input type="hidden" name="criteria" value="[% criteriastring %]" />
545 <input type="hidden" name="definition" value="[% definition %]" />
546 <input type="hidden" name="totals" value="[% totals %]" />
547 <input type="hidden" name="public" value="[% public %]" />
548 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
549 <fieldset><table>[% FOREACH order_b IN order_by %]
550 <tr><td><input type="checkbox" id="[% order_b.name %]" name="order_by" value="[% order_b.name %]" /> <label for="[% order_b.name %]">[% order_b.name %]</label></td><td>
551 <select name="[% order_b.name %]_ovalue">
553 [% FOREACH selec IN order_b.select %]
554 <option value="[% selec.value %]">[% selec.value %]</option>
562 <fieldset class="action">
563 <input type="hidden" name="phase" value="Build report" />
564 <input type="submit" name="submit" value="Finish" /></fieldset>
569 [% IF ( showreport ) %]
570 <h1>Confirm custom report</h1>
571 <p>Your report will be generated with the following SQL statement.</p>
576 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
577 <input type="hidden" name="sql" value="[% sql %]" />
578 <input type="hidden" name="type" value="[% type %]" />
579 <input type="hidden" name="public" value="[% public %]" />
580 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
581 <p>You will need to save the report before you can execute it</p>
582 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
583 <input type="submit" name="submit" value="Save" /> </fieldset>
588 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
589 <input type="hidden" name="sql" value="[% sql |html %]" />
590 <input type="hidden" name="type" value="[% type %]" />
591 <input type="hidden" name="area" value="[% area %]" />
592 <input type="hidden" name="public" value="[% public %]" />
593 <input type="hidden" name="cache_expiry" value="[% cache_expiry %]" />
594 <fieldset class="rows">
595 <legend>Save your custom report</legend>
597 <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>
598 [% PROCESS group_and_subgroup_selection %]
599 <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
601 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
602 <input type="submit" name="submit" value="Save report" /></fieldset>
606 [% IF ( warn_authval_problem ) %]
607 <div class="dialog alert">
608 <h3>Errors found when processing parameters for report: [% name %]</h3>
609 [% FOREACH problematic_authval IN problematic_authvals %]
611 <strong>[% problematic_authval.name %]:</strong> The authorized value category (<strong>[% problematic_authval.authval %]</strong>)
612 you selected does not exist.
615 <!-- Save Anyway Form -->
616 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
617 <!--Every parameter the user issued is provided as a hidden field for recovery-->
618 <input type='hidden' name='id' value='[% id %]' />
619 <input type='hidden' name='sql' value='[% sql %]' />
620 <input type='hidden' name='reportname' value='[% reportname %]' />
621 <input type='hidden' name='group' value='[% group %]' />
622 <input type='hidden' name='subgroup' value='[% subgroup %]' />
623 <input type='hidden' name='notes' value='[% notes %]' />
624 <input type='hidden' name='cache_expiry' value='[% cache_expiry %]' />
625 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units %]' />
626 <input type='hidden' name='public' value='[% public %]' />
627 [% IF ( phase_update) %]
628 <input type='hidden' name='phase' value='Update SQL' />
629 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
630 [% ELSIF ( phase_save) %]
631 <input type='hidden' name='area' value='[% area %]' />
632 <input type='hidden' name='phase' value='Save Report' />
633 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
636 <!-- Go back to editing -->
637 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
638 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
643 [% IF ( enter_params ) %]
644 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
645 <input type='hidden' name='reports' value="[% reports %]" />
646 [% IF ( auth_val_error ) %]
647 <input type='hidden' name='phase' value='Edit SQL' />
648 <div class="dialog alert">
649 <h3>Errors found when processing parameters for report: [% name %]</h3>
650 [% FOREACH auth_val_error IN auth_val_errors %]
652 <strong>[% auth_val_error.entry %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val %]</strong>)
653 you selected does not exist.
657 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
659 <input type='hidden' name='phase' value='Run this report' />
660 <h1>Enter parameters for report [% name %]:</h1>
661 [% IF ( notes ) %]<p>[% notes %]</p>[% END %]
662 <fieldset class="rows">
664 [% FOREACH sql_param IN sql_params %]
665 [% IF sql_param.input == 'date' %]
667 <label for="date_[% sql_param_entry %][% loop.count %]">[% sql_param.entry %]:</label> <input id="date_[% sql_param_entry %][% loop.count %]" type="text" value="" size="10" name="sql_params" class="datepicker" />
669 [% ELSIF ( sql_param.input == 'text' ) %]
670 <li><label for="sql_params[% loop.count %]">[% sql_param.entry %]: </label><input id="sql_params[% loop.count %]" type="text" name="sql_params" /></li>
672 <li><label for="sql_params_[% sql_param.labelid %]">[% sql_param.entry %]:</label>
673 <select name="[%- sql_param.input.name -%]" tabindex="1" size="1" id="[%- sql_param.input.id -%]">
674 [% FOREACH value IN sql_param.input.values %]
675 <option value="[%- value -%]">[%- sql_param.input.labels.$value -%]</option>
683 <fieldset class="action"><input type="submit" value="Run the report" /></fieldset>
690 [% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes %]</p>[% END %]
691 [% IF ( unlimited_total ) %]<p><span class="label">Total number of results:</span> [% unlimited_total %][% IF unlimited_total > limit %] ([% limit %] shown)[% END %].</p>[% END %]
692 <div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql |html %]</pre></div>
695 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
696 <input type="hidden" name="phase" value="Run this report"/>
697 <input type="hidden" name="reports" value="[% report_id %]"/>
699 [% FOREACH p IN sql_params %]
700 <input type="hidden" name="sql_params" value="[% p %]"/>
703 <label for="limit">Rows per page: </label>
704 <select name="limit" id="limit">
705 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
706 [% FOREACH l IN limits %]
708 <option value="[% l %]" selected="selected">[% l %]</option>
710 <option value="[% l %]">[% l %]</option>
716 <div class="pages">[% pagination_bar %]</div>
717 [% UNLESS ( errors ) %]
718 <form method="POST" id="report_results">
719 <input type="hidden" name="op" value="show" />
722 [% FOREACH header_ro IN header_row %]
723 [% IF header_ro.cell == 'itemnumber' %]
725 [% header_ro.cell %] <a href="#" data-toggle="tooltip" title="Send visible items to batch modification" class="send_to_item_mod"><i class="fa fa-pencil"></i> Batch modify</a>
728 <th>[% header_ro.cell %]</th>
732 [% FOREACH result IN results %]
734 [% FOREACH cells IN result.cells %]
735 [% place = loop.index %]
736 [% IF header_row.$place.cell == 'itemnumber' %]
737 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
739 <td>[% cells.cell %]</td>
749 <script type="text/javascript">
750 $(document).ready(function() {
751 load_group_subgroups();
754 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
755 <fieldset class="rows">
756 <legend>Create report from SQL</legend>
758 <li><label for="reportname" class="required">Report name:</label>
759 [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
760 [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
762 [% PROCESS group_and_subgroup_selection %]
765 <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>
767 <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>
769 [% IF (usecache) %] <li>
770 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
771 <select id="cache_expiry_units" name="cache_expiry_units">
772 <option value="seconds" selected="selected">Seconds (default)</option>
773 <option value="minutes">Minutes</option>
774 <option value="hours">Hours</option>
775 <option value="days">Days</option>
778 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
781 <fieldset class="rows">
782 <legend>SQL:</legend>
783 <div style="margin:1em;">
784 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql %]</textarea> <span class="required">Required</span>
788 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
789 <input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
794 [% IF ( compound ) %]
795 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
796 Master: <select name="master">
797 [% FOREACH savedreport IN savedreports %]
798 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
802 Sub report:<select name="subreport">
803 [% FOREACH savedreport IN savedreports %]
804 <option value="[% savedreport.id %]">[% savedreport.report_name %]</option>
808 <input type="hidden" name="phase" value="Save Compound" />
809 <input type="submit" name="submit" value="Save compound" />
813 [% IF ( save_compound ) %]
819 [% IF saved_results %]
820 <h1>Saved report results</h1>
824 [% FOREACH rows IN saved_results %]
826 [% FOREACH col IN rows %]
835 <fieldset class="rows">
836 <legend>[% reportname %]</legend>
838 [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes %]</li>[% ELSE %][% END %]
839 <li><textarea id="sql">[% sql %]</textarea></li>
844 [% IF ( save_successful ) %]
845 [% UNLESS ( errors ) %]
847 <div id="report_updated">
848 <div class="dialog message">
849 <p>Your report "[% reportname %]" has been saved</p>
856 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
857 <input type="hidden" name="phase" value="Update SQL" />
858 <input type="hidden" name="id" value="[% id %]"/>
859 <fieldset class="rows">
860 <legend>Edit SQL report</legend>
862 <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>
863 [% PROCESS group_and_subgroup_selection %]
865 <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>
867 <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>
869 [% IF (usecache) %] <li>
870 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry %]"></input>
871 <select id="cache_expiry_units" name="cache_expiry_units">
872 <option value="seconds">Seconds (default)</option>
873 <option value="minutes">Minutes</option>
874 <option value="hours">Hours</option>
875 <option value="days">Days</option>
878 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
882 <fieldset class="rows">
883 <legend>SQL:</legend>
884 <div style="margin:1em;">
885 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql %]</textarea> <span class="required">Required</span>
889 <fieldset class="action">
890 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
898 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
899 <div class="dialog alert">
900 <b>The following error was encountered:</b><br />
901 [% FOREACH error IN errors %]
902 [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr %]</b>.
903 <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
904 <br />Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
905 [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr %]<br />Please check the log for further details.
906 [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
909 <div id="onerror_actions">
910 <a href="#" class="button goback">Return to previous page</a>
914 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
915 <input type="submit" name="submit" value="Saved reports" /></fieldset>
924 <div id="saved-reports-filter">
925 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
926 <input type="hidden" name="phase" value="Use saved" />
927 <input type="hidden" name="filter_set" value="1" />
928 <fieldset class="brief">
931 <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date %]" class="datepicker" />
932 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
935 <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author %]" size="16" /></li>
936 <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword %]" size="16" /></li>
939 <fieldset class="action">
940 <input type="submit" value="Apply filter" />
941 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
948 [% INCLUDE 'guided-reports-view.inc' %]
952 [% MACRO jsinclude BLOCK %]
953 [% INCLUDE 'calendar.inc' %]
955 [% INCLUDE 'datatables.inc' %]
957 <script type="text/javascript">
958 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
959 var group_subgroups = {};
960 [% FOREACH group IN groups_with_subgroups %]
961 var gid = "[% group.id %]"
962 group_subgroups[gid] = new Array();
963 [% FOREACH subgroup IN group.subgroups %]
964 var sgid = "[% subgroup.id %]";
965 var sgname = "[% subgroup.name %]";
966 group_subgroups[gid].push([sgid, sgname]);
970 function load_group_subgroups () {
971 var group = $("#group_select").val();
972 var sg = $("#subgroup");
973 $(sg).find('option[value!=""]').each(function() {
978 var select = $(sg).find('select')[0];
979 $.each( group_subgroups[group], function(index, value) {
980 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
982 $("#subgroup, #subgroup *").show();
986 $(document).ready(function(){
988 $('[data-toggle="tooltip"]').tooltip();
990 $('#limit').change(function() {
991 $('#limitselect').submit();
994 $(document).click(function() {
995 $('#report_updated').hide();
998 $(".goback").on("click",function(e){
1000 window.history.back();
1003 $("#addColumn").on("click",function(){
1007 $("#delColumn").on("click",function(){
1011 $(".send_to_item_mod").click(function(e){
1013 $("#report_results").attr("action","/cgi-bin/koha/tools/batchMod.pl");
1014 $("#report_results").submit();
1018 var rtable = $("#table_reports").dataTable($.extend(true, {}, dataTablesDefaults, {
1019 'iDisplayLength': [% Koha.Preference('NumSavedReports') %],
1020 'bAutoWidth': false,
1021 'sPaginationType': 'four_button',
1022 'aaSorting': [[ 1, "asc" ]],
1024 { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
1025 { 'bSearchable': false, 'aTargets': [3] },
1026 { "aTargets": [ 1, 2 ], "sType": "natural" },
1027 { "sType": "title-string", "aTargets" : [ "title-string" ] }
1030 'sZeroRecords': _("No matching reports found")
1034 var rtabs = $("#tabs").tabs();
1035 rtabs.on("tabsactivate", function(e, ui) {
1036 $("#subgroup_filter option").each(function() {
1037 if($(this).val().length > 0) {
1041 rtable.fnFilter('', 4);
1042 rtable.fnFilter('', 5);
1043 rtable.fnSetColumnVis(4, true);
1044 rtable.fnSetColumnVis(5, true);
1046 var g_id = $(ui.newTab).children().attr('id');
1047 var g_name = $(ui.newTab).text();
1048 if ( g_name == _("All") ) {
1053 if (g_id && g_id.length > 0) {
1054 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1055 rtable.fnSetColumnVis(4, false);
1056 for(var i in group_subgroups[g_id]) {
1057 $("#subgroup_filter").append(
1058 '<option value="' + group_subgroups[g_id][i][0] + '">'
1059 + group_subgroups[g_id][i][1] + '</option>'
1062 $("#subgroup_filter_block").show();
1064 $("#subgroup_filter_block").hide();
1067 $("#subgroup_filter_block").hide();
1069 $("#subgroup_filter").change(function() {
1070 var selected = $(this).find('option:selected');
1071 var sg_id = $(selected).val();
1072 var sg_name = $(selected).text();
1073 if (sg_id.length > 0) {
1074 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1075 rtable.fnSetColumnVis(5, false);
1077 rtable.fnFilter('', 5);
1078 rtable.fnSetColumnVis(5, true);
1082 $("#reports_form").submit(function(){
1083 var checkedItems = $("input[name=ids]:checked");
1084 if ($(checkedItems).size() == 0) {
1085 alert(_("You must select one or more reports to delete"));
1088 $(checkedItems).parents('tr').addClass("warn");
1089 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1092 $(checkedItems).parents('tr').removeClass("warn");
1097 $("body").on("click", ".update_sql", function(e){
1099 var ltitle = $(this).text();
1100 var report_id = $(this).data("report_id");
1101 var page = $(this).attr("href");
1102 $("#update_sql .modal-body").load(page + " div", function(){
1103 var diff1 = $("#col1 .show_sql").text();
1104 var diff2 = $("#col2 .show_sql").text();
1105 var diffs = diffString( escape(diff1), escape(diff2) );
1106 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1108 $('#update_sql').modal('show');
1109 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1112 $("#update_sql").on("hidden.bs.modal", function(){
1113 $("#update_sql_label").html("");
1114 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1118 [% IF ( showsql ) %]
1119 $("#sql").focus(function() {
1124 $(".toggle_sql").click(function(){
1125 $("#sql_output").toggle();
1126 $("#toggle_sql_hid").toggle();
1127 $("#toggle_sql_vis").toggle();
1130 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1131 $(this).parents('tr').attr("class","warn");
1132 if(confirm(_("Are you sure you want to delete this saved report?"))){
1135 $(this).parents('tr').attr("class","");
1140 [% IF (create || editsql || save) %]
1141 $("#select_group").change(function() {
1142 if($(this).prop('checked')) {
1143 $("#group_input").prop('disabled', true);
1144 $("#groupdesc_input").prop('disabled', true);
1145 $("#group_select").prop('disabled', false);
1146 if ($("#group_select").val().length > 0) {
1147 $("#select_subgroup").prop('checked', true);
1148 $("#select_subgroup").change();
1149 $("#subgroup, #subgroup *").show();
1151 $("#subgroup").hide();
1155 $("#create_group").change(function() {
1156 if($(this).prop('checked')) {
1157 $("#group_input").prop('disabled', false);
1158 $("#groupdesc_input").prop('disabled', false);
1159 $("#group_select").prop('disabled', true);
1160 $("#create_subgroup").prop('checked', true).change();
1161 $("#subgroup_select").hide();
1162 $("#subgroup input[type='radio']").hide();
1163 $("#subgroup label[for]").hide();
1164 $("#subgroup_input").show();
1165 $("#subgroupdesc_input").show();
1166 $("#subgroup").show();
1169 $("#select_subgroup").change(function() {
1170 if($(this).prop('checked')) {
1171 $("#subgroup_select").prop('disabled', false);
1172 $("#subgroup_input").prop('disabled', true);
1173 $("#subgroupdesc_input").prop('disabled', true);
1176 $("#create_subgroup").change(function() {
1177 if($(this).prop('checked')) {
1178 $("#subgroup_input").prop('disabled', false);
1179 $("#subgroupdesc_input").prop('disabled', false);
1180 $("#subgroup_select").prop('disabled', true);
1183 $("#select_group").change();
1184 $("#select_subgroup").change();
1185 $("#group_select").on("change",function(){
1186 load_group_subgroups();
1189 $(".delete").on("click",function(){
1190 return confirmDelete(MSG_CONFIRM_DELETE);
1193 function addColumn() {
1194 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1196 function delColumn() {
1197 $("#selectedColumns option:selected").remove();
1199 $("#column_submit").submit(function() {
1200 if ($("#selectedColumns option").size() < 1) {
1201 alert(_("No columns selected!"));
1204 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1210 [% INCLUDE 'intranet-bottom.inc' %]
1212 [% BLOCK group_and_subgroup_selection %]
1214 <label>Report group:</label>
1215 <input type="radio" name="select_or_create_group"
1216 id="select_group" checked="checked" />
1217 <label for="select_group" style="float:none">Select</label>
1218 <select name="group" id="group_select">
1219 <option value="">(None)</option>
1220 [% FOREACH group IN groups_with_subgroups %]
1221 [% IF (group.selected) %]
1222 <option value="[% group.id %]" selected="selected">
1224 <option value="[% group.id %]">
1230 <input type="radio" name="select_or_create_group" id="create_group" />
1231 <label for="create_group" style="float:none">or create:</label>
1232 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
1233 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
1236 <label>Report subgroup:</label>
1237 <input type="radio" name="select_or_create_subgroup"
1238 id="select_subgroup" checked="checked" />
1239 <label for="select_subgroup" style="float:none">Select</label>
1240 <select name="subgroup" id="subgroup_select">
1241 <option value="">(None)</option>
1242 [% FOREACH group IN groups_with_subgroups %]
1243 [% IF (group.selected) %]
1244 [% FOREACH subgroup IN group.subgroups %]
1245 [% IF (subgroup.selected) %]
1246 <option value="[% subgroup.id %]" selected="selected">
1248 <option value="[% subgroup.id %]">
1256 <input type="radio" name="select_or_create_subgroup"
1257 id="create_subgroup" />
1258 <label for="create_subgroup" style="float:none">or create</label>
1259 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
1260 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />