5 [% USE TablesSettings %]
9 [%- BLOCK area_name -%]
11 [%- CASE 'CIRC' -%]Circulation
12 [%- CASE 'CAT' -%]Catalog
13 [%- CASE 'PAT' -%]Patrons
14 [%- CASE 'ACQ' -%]Acquisitions
15 [%- CASE 'ACC' -%]Accounts
16 [%- CASE 'SER' -%]Serials
20 [% INCLUDE 'doc-head-open.inc' %]
23 Koha › Reports › Guided reports wizard
25 › Saved reports
26 [%- ELSIF ( create ) -%]
27 › Create from SQL
28 [%- ELSIF ( showsql ) -%]
29 › Saved reports › SQL view
30 [%- ELSIF ( execute ) -%]
31 › Saved reports › Report [% name | html %] ([% id | html %])
32 [%- ELSIF ( editsql ) -%]
33 › Saved reports › Edit report [% reportname | html %] ([% id | html %])
36 › Build a report, step 1 of 6: Choose a module
37 [%- ELSIF ( build2 ) -%]
38 › Build a report, step 2 of 6: Pick a report type
39 [%- ELSIF ( build3 ) -%]
40 › Build a report, step 3 of 6: Select columns for display
41 [%- ELSIF ( build4 ) -%]
42 › Build a report, step 4 of 6: Select criteria to limit on
43 [%- ELSIF ( build5 ) -%]
44 › Build a report, step 5 of 6: Pick which columns to total
45 [%- ELSIF ( build6 ) -%]
46 › Build a report, step 6 of 6: Select how you want the report ordered
50 [% INCLUDE 'doc-head-close.inc' %]
51 [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
59 #mana_search_errortext { font-family: monospace; font-weight: bold; }
61 [% Asset.css("css/reports.css") | $raw %]
62 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
65 <body id="rep_guided_reports_start" class="rep">
66 [% INCLUDE 'header.inc' %]
67 [% INCLUDE 'circ-search.inc' %]
69 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
72 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
75 <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
78 <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
83 <a href="#" aria-current="page">
87 [% ELSIF ( create ) %]
89 <a href="#" aria-current="page">
93 [% ELSIF ( showsql ) %]
95 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
98 <a href="#" aria-current="page">
99 [% reportname | html %] ([% id | html %])
102 [% ELSIF ( editsql ) %]
104 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
107 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
110 <a href="#" aria-current="page">
114 [% ELSIF ( execute ) %]
116 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
119 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
122 <a href="#" aria-current="page">
126 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
128 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
131 <a href="#" aria-current="page">
133 Step 1 of 6: Choose a module
134 [% ELSIF ( build2 ) %]
135 Step 2 of 6: Pick a report type
136 [% ELSIF ( build3 ) %]
137 Step 3 of 6: Select columns for display
138 [% ELSIF ( build4 ) %]
139 Step 4 of 6: Select criteria to limit on
140 [% ELSIF ( build5 ) %]
141 Step 5 of 6: Pick which columns to total
142 [% ELSIF ( build6 ) %]
143 Step 6 of 6: Select how you want the report ordered
148 </nav> <!-- /#breadcrumbs -->
150 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
151 <div class="modal-dialog">
152 <div class="modal-content">
153 <div class="modal-header">
154 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
155 <h3 id="update_sql_label">Update SQL</h3>
157 <div class="modal-body">
158 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
160 <div class="modal-footer">
161 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
162 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
164 </div> <!-- /.modal-content -->
165 </div> <!-- /.modal-dialog -->
166 </div> <!-- #update_sql -->
168 <div class="main container-fluid">
170 <div class="col-sm-10 col-sm-push-2">
173 [% INCLUDE "reports-toolbar.inc" %]
176 <h2>Guided reports</h2>
177 <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>
179 <h3>Build and run reports</h3>
181 [% IF ( CAN_user_reports_create_reports ) %]
182 <form action="/cgi-bin/koha/reports/guided_reports.pl">
183 <input type="hidden" name="phase" value="Build new" />
184 <input type="submit" name="submit" value="Build new"/>
188 [% IF ( CAN_user_reports_execute_reports ) %]
189 <form action="/cgi-bin/koha/reports/guided_reports.pl">
190 <input type="hidden" name="phase" value="Use saved"/>
191 <input type="submit" name="submit" value="Use saved"/>
195 [% IF ( CAN_user_reports_create_reports ) %]
196 <form action="/cgi-bin/koha/reports/guided_reports.pl">
197 <input type="hidden" name="phase" value="Create report from SQL"/>
198 <input type="submit" name="submit" value="Create report from SQL"/>
202 <h3>Reports Dictionary</h3>
203 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
204 <form action="/cgi-bin/koha/reports/dictionary.pl">
205 <input type="hidden" name="phase" value="View Dictionary"/>
206 <input type="submit" name="submit" value="View dictionary"/>
208 [% END # /IF (start) %]
210 [% IF report_converted %]
211 <div class="dialog message">
212 The report "[% report_converted | html %]" has been converted.
216 [% IF report_converted %]
217 <div class="dialog message">
218 The report "[% report_converted | html %]" has been converted.
223 [% IF ( savedreports ) %]
224 <h1>Saved reports</h1>
226 [% IF ( filters.date || filters.author || filters.keyword ) %]
228 <span class="filter">
229 [% IF ( filters.date ) %]
230 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
232 [% IF ( filters.author ) %]
233 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
235 [% IF ( filters.keyword ) %]
236 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
238 <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>
243 <div id="tabs" class="toptabs">
245 <li><a href="#reports">All</a></li>
246 [% FOREACH group IN groups_with_subgroups %]
247 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
251 <div id="subgroup_filter_block">
252 <label for="subgroup_filter">Subgroup:</label>
253 <select id="subgroup_filter">
254 <option value="">All</option>
258 [% IF (Koha.Preference('Mana') == 1) %]
260 <div id="mana_search_message" class="dialog message">
261 <p> [% manamsg | html %] </p>
266 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
267 <input type="hidden" name="phase" value="Delete Multiple" />
268 <table id="table_reports">
271 <th class="NoSort"> </th>
279 <th class="title-string">Creation date</th>
280 <th class="title-string">Last edit</th>
281 <th class="title-string">Last run</th>
282 <th class="report_public">Public</th>
283 <th class="report_json_url">JSON URL</th>
285 <th>Cache expiry (seconds)</th>
287 <th class="hidden"> </th>
289 <th>Saved results</th>
290 [% IF has_obsolete_reports %]
293 <th class="hidden"> </th>
295 <th class="NoSort noExport">Actions</th>
299 [% FOREACH savedreport IN savedreports %]
300 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
301 <td class="report_checkbox">
302 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
303 <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
305 <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
307 <td class="report_id">
308 <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
310 <td class="report_name">
311 [% IF ( savedreport.report_name ) %]
312 [% savedreport.report_name | html %]
317 <td class="report_type">
318 [% savedreport.type | html %]
320 <td class="report_group">
321 [% savedreport.groupname | html %]
324 [% savedreport.subgroupname | html %]
326 <td class="report_notes">
327 [% savedreport.notes | html %]
330 [% savedreport.borrowersurname | html %]
331 [% IF ( savedreport.borrowerfirstname ) %]
332 , [% savedreport.borrowerfirstname | html %]
334 ([% savedreport.borrowernumber | html %])
337 <span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span>
340 <span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span>
343 <span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates with_hours => 1 %]</span>
345 <td class="report_public">
346 [% IF (savedreport.public) %]
352 <td class="report_json_url">
353 [% IF (savedreport.public) %]
354 <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>
356 <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>
360 [% savedreport.cache_expiry | html %]
363 [% FOR result IN savedreport.results %]
364 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
369 [% IF savedreport.seems_obsolete %]
370 This report seems obsolete, it uses biblioitems.marcxml field.
371 <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>
375 <div class="btn-group dropup">
376 [%# There should be no space between these two buttons, it would render badly %]
377 <a class="btn btn-default btn-xs" role="button"
378 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
379 class="fa fa-play"></i> Run</a><a
380 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
381 href="#"><b class="caret"></b></a>
382 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
383 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL"><i class="fa fa-search"></i> View</a></li>
385 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
386 <i class="fa fa-eye"></i> Preview SQL
389 [% IF ( CAN_user_reports_create_reports ) %]
390 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li>
391 <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
393 [% IF (Koha.Preference('Mana') == 1) %]
394 <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>
396 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
397 [% IF ( CAN_user_reports_delete_reports ) %]
398 <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>
402 <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
409 [% IF ( CAN_user_reports_delete_reports ) %]
410 <fieldset class="action">
411 <input type="submit" value="Delete selected" />
417 [% ELSE # IF ( savedreports ) %]
418 <div class="dialog message">
419 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
420 <h4>No saved reports match your criteria. </h4>
421 [% IF ( CAN_user_reports_create_reports ) %]
422 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
423 <input type="hidden" name="phase" value="Build new" />
424 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
427 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
428 <input type="hidden" name="phase" value="Create report from SQL" />
429 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
432 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
433 <input type="hidden" name="phase" value="Use saved" />
434 <input type="hidden" name="filter_set" value="1" />
435 <input type="hidden" name="filter_keyword" value="" />
436 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
440 <h4>There are no saved reports. </h4>
441 [% IF ( CAN_user_reports_create_reports ) %]
442 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
444 [% END # IF (filter_set || filters.date || filters.author || filters.keyword) %]
445 </div> <!-- /.dialog.message -->
446 [% END # /IF ( savedreports ) %]
447 [% END # /IF ( saved1 ) %]
449 [% INCLUDE 'mana/mana-share-report.inc' %]
452 [% IF ( cache_error) %]
453 <div class="dialog alert">
454 <strong> Please choose a cache_expiry less than 30 days </strong>
458 <h1>Build a report</h1>
459 <form action="/cgi-bin/koha/reports/guided_reports.pl">
460 <fieldset class="rows">
461 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
464 <label for="area">Choose: </label>
465 <select name="area" id="area">
466 [%- FOREACH area IN areas -%]
467 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
473 <label for="public">Report is public:</label>
474 <select id="public" name="public">
475 <option value="0">No (default)</option>
476 <option value="1" selected="selected">Yes</option>
481 <label for="public">Report is public:</label>
482 <select id="public" name="public">
483 <option value="0" selected="selected">No (default)</option>
484 <option value="1">Yes</option>
491 <label for="cache_expiry">Cache expiry:</label>
492 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
493 <select id="cache_expiry_units" name="cache_expiry_units">
494 <option value="seconds">Seconds (default)</option>
495 <option value="minutes">Minutes</option>
496 <option value="hours">Hours</option>
497 <option value="days">Days</option>
502 </fieldset> <!-- /.rows -->
503 <fieldset class="action">
504 <input type="hidden" name="phase" value="Report on this Area" />
505 <input type="submit" name="submit" value="Next >>" />
511 <h1>Build a report</h1>
512 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
513 <input type="hidden" name="area" value="[% area | html %]" />
514 <input type="hidden" name="public" value="[% public | html %]" />
515 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
516 <fieldset class="rows">
517 <legend>Step 2 of 6: Pick a report type</legend>
520 <label for="types">Choose: </label>
521 <select id="types" name="types">
522 <option value="1">Tabular</option>
523 <option value="2" disabled="disabled">Summary</option>
524 <option value="3" disabled="disabled">Matrix</option>
530 <fieldset class="action">
531 <input type="hidden" name="phase" value="Choose this type" />
532 <input type="button" name="back" value="<< Back" class="goback" />
533 <input type="submit" name="submit" value="Next >>" />
536 [% END # /IF (build2 ) %]
539 <h1>Build a report</h1>
540 <h3>Step 3 of 6: Select columns for display</h3>
541 <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>
543 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
544 <input type="hidden" name="area" value="[% area | html %]" />
545 <input type="hidden" name="type" value="[% type | html %]" />
546 <input type="hidden" name="public" value="[% public | html %]" />
547 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
550 <div class="col-sm-6">
551 <div style="float: left;">
552 <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
553 [% FOREACH column IN columns %]
554 [% IF ( column.table ) %]
555 [% IF ( loop.first ) %]
559 <optgroup label="[% column.table | html %]">
561 <option value="[% column.name | html %]">
562 [% IF ( column.description ) %]
563 [% column.description | html %] / [% column.name | html %]
565 [% column.name | html %]
573 <div style="width: 6.3em; float: right; margin-top: 100px">
574 <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
575 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
577 </div> <!-- /.col-sm-6 -->
579 <div class="col-sm-6">
580 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
583 </div> <!-- /.row -->
585 <fieldset class="action">
586 <input type="hidden" name="phase" value="Choose these columns" />
587 <input type="button" name="back" value="<< Back" class="goback" />
588 <input type="submit" name="submit" value="Next >>" />
590 </form> <!-- /#column_submit -->
591 [% END # /IF ( build3 ) %]
594 <h1>Build a report</h1>
595 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
596 <input type="hidden" name="area" value="[% area | html %]" />
597 <input type="hidden" name="type" value="[% type | html %]" />
598 <input type="hidden" name="column" value="[% column | html %]" />
599 <input type="hidden" name="public" value="[% public | html %]" />
600 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
602 <legend>Step 4 of 6: Select criteria to limit on</legend>
604 [% FOREACH criteri IN criteria %]
607 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
608 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
610 [% IF ( criteri.date ) %]
612 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
613 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
617 [% IF ( criteri.textrange ) %]
620 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
621 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
625 [% IF ( criteri.daterange ) %]
628 <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
630 <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
631 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
636 <select name="[% criteri.name | html %]_value">
637 [% FOREACH value IN criteri.values %]
638 <option value="[% value.availablevalues | html %]">
639 [% IF ( value.default ) %]
642 [% value.display_value | html %]
656 [% IF ( definitions ) %]
658 <legend>Dictionary definitions</legend>
660 [% FOREACH definition IN definitions %]
663 <input type="checkbox" name="definition" value="[% definition.id | html %]" />
664 [% definition.name | html %]
672 <fieldset class="action">
673 <input type="hidden" name="phase" value="Choose these criteria" />
674 <input type="button" name="back" value="<< Back" class="goback" />
675 <input type="submit" name="submit" value="Next >>" />
678 [% END # /IF ( build4 ) %]
681 <h1>Build a report</h1>
682 <h3>Step 5 of 6: Pick which columns to total</h3>
683 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
684 <input type="hidden" name="area" value="[% area | html %]" />
685 <input type="hidden" name="type" value="[% type | html %]" />
686 <input type="hidden" name="column" value="[% column | html %]" />
687 <input type="hidden" name="definition" value="[% definition | html %]" />
688 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
689 <input type="hidden" name="public" value="[% public | html %]" />
690 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
693 [% FOREACH total_b IN total_by %]
696 <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
697 <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
700 <select name="[% total_b.name | html %]_tvalue">
701 [% FOREACH selec IN total_b.select %]
702 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
711 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
712 <input type="button" name="back" value="<< Back" class="goback" />
713 <input type="submit" name="submit" value="Next >>" />
716 [% END # /IF ( build5 ) %]
719 <h1>Build a report</h1>
720 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
721 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
722 <input type="hidden" name="area" value="[% area | html %]" />
723 <input type="hidden" name="type" value="[% type | html %]" />
724 <input type="hidden" name="column" value="[% column | html %]" />
725 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
726 <input type="hidden" name="definition" value="[% definition | html %]" />
727 <input type="hidden" name="totals" value="[% totals | html %]" />
728 <input type="hidden" name="public" value="[% public | html %]" />
729 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
732 [% FOREACH order_b IN order_by %]
735 <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
736 <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
739 <select name="[% order_b.name | html %]_ovalue">
740 [% FOREACH selec IN order_b.select %]
741 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
749 <fieldset class="action">
750 <input type="hidden" name="phase" value="Build report" />
751 <input type="submit" name="submit" value="Finish" />
754 [% END #/ IF ( build6 ) %]
756 [% IF ( showreport ) %]
757 <h1>Confirm custom report</h1>
758 <p>Your report will be generated with the following SQL statement.</p>
763 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
764 <input type="hidden" name="sql" value="[% sql | html %]" />
765 <input type="hidden" name="type" value="[% type | html %]" />
766 <input type="hidden" name="public" value="[% public | html %]" />
767 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
768 <p>You will need to save the report before you can execute it</p>
769 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
770 <input type="submit" name="submit" value="Next" />
773 [% END #/ IF ( showreport ) %]
776 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
777 <input type="hidden" name="sql" value="[% sql | html %]" />
778 <input type="hidden" name="type" value="[% type | html %]" />
779 <input type="hidden" name="area" value="[% area | html %]" />
780 <input type="hidden" name="public" value="[% public | html %]" />
781 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
782 <fieldset class="rows">
783 <legend>Save your custom report</legend>
786 <label for="reportname" class="required">Report name: </label>
787 <input type="text" id="reportname" name="reportname" class="required" required="required" />
788 <span class="required">Required</span>
790 [% PROCESS group_and_subgroup_selection %]
792 <label for="notes">Notes:</label>
793 <textarea name="notes" id="notes"></textarea>
797 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
798 <input type="submit" name="submit" value="Save report" />
801 [% END # /IF( save ) %]
803 [% IF ( warn_authval_problem ) %]
804 <div class="dialog alert">
805 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
806 [% FOREACH problematic_authval IN problematic_authvals %]
808 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
809 you selected does not exist.
812 <!-- Save Anyway Form -->
813 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
814 <!--Every parameter the user issued is provided as a hidden field for recovery-->
815 <input type='hidden' name='id' value='[% id | html %]' />
816 <input type='hidden' name='sql' value='[% sql | html %]' />
817 <input type='hidden' name='reportname' value='[% reportname | html %]' />
818 <input type='hidden' name='group' value='[% group | html %]' />
819 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
820 <input type='hidden' name='notes' value='[% notes | html %]' />
821 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
822 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
823 <input type='hidden' name='public' value='[% public | html %]' />
824 [% IF ( phase_update) %]
825 <input type='hidden' name='phase' value='Update SQL' />
826 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
827 [% ELSIF ( phase_save) %]
828 <input type='hidden' name='area' value='[% area | html %]' />
829 <input type='hidden' name='phase' value='Save Report' />
830 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
833 <!-- Go back to editing -->
834 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
835 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
838 [% END # /IF ( warn_authval_problem )%]
840 [% IF ( enter_params ) %]
841 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
842 <input type='hidden' name='reports' value="[% reports | html %]" />
843 [% IF ( auth_val_error ) %]
844 <input type='hidden' name='phase' value='Edit SQL' />
845 <div class="dialog alert">
846 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
847 [% FOREACH auth_val_error IN auth_val_errors %]
849 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
850 you selected does not exist.
854 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
855 [% ELSE # IF ( auth_val_error ) %]
856 <input type='hidden' name='phase' value='Run this report' />
857 <h1>Enter parameters for report [% name | html %]:</h1>
859 <p>[% notes | html %]</p>
861 <fieldset class="rows">
863 [% FOREACH sql_param IN sql_params %]
864 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
865 [% IF sql_param.input == 'date' %]
867 <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" />
869 [% ELSIF ( sql_param.input == 'text' ) %]
871 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
872 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
874 [% ELSIF ( sql_param.input == 'textarea' ) %]
876 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
877 <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
881 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
882 <select name="[%- sql_param.input.name | html -%]" tabindex="1" size="1" id="[%- sql_param.input.id | html -%]">
883 [% IF (sql_param.include_all) %]
884 <option value="%">All</option>
886 [% FOREACH value IN sql_param.input.values %]
887 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
891 [% END # /IF sql_param.input == 'date' %]
892 [% END # /FOREACH sql_param %]
894 </fieldset> <!-- /.rows -->
895 <fieldset class="action">
896 <input type="submit" value="Run the report" />
898 [% END # / IF ( auth_val_error ) %]
900 [% END # /IF ( enter_params ) %]
903 <h1>[% name | html %] <span id="report_id">([% id | html %])</span></h1>
905 <p><span class="label">Notes:</span> [% notes | html %]</p>
907 [% IF ( unlimited_total ) %]
909 <span class="label">Total number of results:</span>
910 [% unlimited_total | html %]
911 [% IF unlimited_total > limit %]
912 ([% limit | html %] shown)
917 <div id="sql_output" style="display:none;">
918 <span class="label">Report SQL:</span>
919 <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
923 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
924 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
926 <div id="chart" class="clearfix"></div>
929 [% UNLESS ( errors ) %]
930 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
931 <input type="hidden" name="recordtype" value="biblio" />
932 <input type="hidden" name="op" value="list" />
933 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
934 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
935 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
939 <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
940 <input type="hidden" name="recordtype" value="biblio" />
941 <input type="hidden" name="op" value="list" />
942 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
943 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
944 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
948 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
949 <input type="hidden" name="op" value="show" />
950 [% FOREACH result IN results %]
951 [% FOREACH cells IN result.cells %]
952 [% place = loop.index %]
953 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
954 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
955 [% SET batch_itemnumbers = 1 %]
956 [% SET header_row.$place.has_itemnumbers = 1 %]
957 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
963 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
964 <input type="hidden" name="op" value="show" />
965 <input type="hidden" name="del" value="1" />
966 [% FOREACH result IN results %]
967 [% FOREACH cells IN result.cells %]
968 [% place = loop.index %]
969 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
970 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
971 [% SET batch_itemnumbers = 1 %]
972 [% SET header_row.$place.has_itemnumbers = 1 %]
973 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
979 <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
980 [% FOREACH result IN results %]
981 [% FOREACH cells IN result.cells %]
982 [% place = loop.index %]
983 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
984 [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
985 [% SET batch_biblionumbers = 1 %]
986 [% SET header_row.$place.has_biblionumbers = 1 %]
987 <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
993 <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
994 <input type="hidden" name="op" value="show" />
995 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
996 <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
997 [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
1001 [% BLOCK batch_list %]
1002 [%- FOREACH result IN results %]
1003 [%- FOREACH cells IN result.cells %]
1004 [%- place = loop.index %]
1005 [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
1006 [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
1011 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1013 <div class="btn-group">
1014 <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
1015 Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
1016 <span class="caret"></span>
1018 <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
1019 [% FOREACH header_ro IN header_row %]
1020 [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1021 <li class="dropdown-header">Bibliographic records</li>
1023 <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>
1026 <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>
1029 <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>
1032 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1033 [% IF ( batch_biblionumbers ) %]
1034 <li role="separator" class="divider"></li>
1036 <li class="dropdown-header">Item records</li>
1038 <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>
1041 <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>
1044 [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1045 [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
1046 <li role="separator" class="divider"></li>
1048 <li class="dropdown-header">Patron records</li>
1050 <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>
1054 </ul> <!-- /.dropdown-menu -->
1055 </div> <!-- /.dropdown -->
1057 [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1058 [% END # UNLESS ( errors ) %]
1059 [% END # IF ( execute ) %]
1061 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1062 <input type="hidden" name="phase" value="Run this report"/>
1063 <input type="hidden" name="reports" value="[% report_id | html %]"/>
1065 [% FOREACH p IN sql_params %]
1066 <input type="hidden" name="sql_params" value="[% p | html %]"/>
1068 [% FOREACH n IN param_names %]
1069 <input type="hidden" name="param_name" value="[% n | html %]"/>
1072 <label for="limit">Rows per page: </label>
1073 <select name="limit" id="limit">
1074 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1075 [% FOREACH l IN limits %]
1077 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
1079 <option value="[% l | html %]">[% l | html %]</option>
1083 </form> <!-- /#limitselect -->
1085 <div class="pages">[% pagination_bar | $raw %]</div>
1086 [% UNLESS ( errors ) %]
1089 [% FOREACH header_ro IN header_row %]
1090 <th>[% header_ro.cell | html %]</th>
1093 [% FOREACH result IN results %]
1095 [% FOREACH cells IN result.cells %]
1096 <td>[% cells.cell | $raw %]</td>
1102 <div class="pages">[% pagination_bar | $raw %]</div>
1104 [% INCLUDE 'chart.inc' %]
1106 [% END #/IF ( execute ) %]
1109 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1110 <fieldset class="rows">
1111 <legend>Create report from SQL</legend>
1114 <label for="reportname" class="required">Report name:</label>
1115 [% IF ( reportname ) %]
1116 <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
1118 <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
1120 <span class="required">Required</span>
1122 [% PROCESS group_and_subgroup_selection %]
1126 <label for="public">Report is public:</label>
1127 <select id="public" name="public">
1128 <option value="0">No (default)</option>
1129 <option value="1" selected="selected">Yes</option>
1134 <label for="public">Report is public:</label>
1135 <select id="public" name="public">
1136 <option value="0" selected="selected">No (default)</option>
1137 <option value="1">Yes</option>
1140 [% END # /IF (public) %]
1144 <label for="cache_expiry">Cache expiry:</label>
1145 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
1146 <select id="cache_expiry_units" name="cache_expiry_units">
1147 <option value="seconds" selected="selected">Seconds (default)</option>
1148 <option value="minutes">Minutes</option>
1149 <option value="hours">Hours</option>
1150 <option value="days">Days</option>
1153 [% END # /IF (usecache) %]
1155 <label for="notes">Notes:</label>
1156 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1159 </fieldset> <!-- /.rows -->
1161 <fieldset class="rows">
1162 <legend>SQL:</legend>
1163 <div style="margin:1em;">
1164 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1165 <span class="required">Required</span>
1169 <fieldset class="action">
1170 <input type="hidden" name="phase" value="Save Report" />
1171 <input type="submit" name="submit" value="Save report" />
1172 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1175 [% END #/IF ( create ) %]
1177 [% IF saved_results %]
1178 <h1>Saved report results</h1>
1179 <h2>[% name | html %]</h2>
1180 <p>[% notes | html %]</p>
1182 [% FOREACH rows IN saved_results %]
1184 [% FOREACH col IN rows %]
1185 <td>[% col | html %]</td>
1190 [% END # /IF saved_results %]
1192 [% IF ( showsql ) %]
1193 <fieldset class="rows">
1194 <legend>[% reportname | html %]</legend>
1198 <span class="label">Notes:</span>
1204 <textarea id="sql">[% sql | html %]</textarea>
1208 [% END # /IF ( showsql ) %]
1210 [% IF ( save_successful ) %]
1211 [% UNLESS ( errors ) %]
1213 <div id="report_updated">
1214 <div class="dialog message">
1215 <p>Your report "[% reportname | html %]" has been saved</p>
1221 [% IF ( editsql ) %]
1222 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1223 <input type="hidden" name="phase" value="Update SQL" />
1224 <input type="hidden" name="id" value="[% id | html %]"/>
1225 <fieldset class="rows">
1226 <legend>Edit SQL report</legend>
1229 <label for="reportname" class="required">Report name: </label>
1230 <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1231 <span class="required">Required</span>
1233 [% PROCESS group_and_subgroup_selection %]
1236 <label for="public">Report is public:</label>
1237 <select id="public" name="public">
1238 <option value="0">No (default)</option>
1239 <option value="1" selected="selected">Yes</option>
1244 <label for="public">Report is public:</label>
1245 <select id="public" name="public">
1246 <option value="0" selected="selected">No (default)</option>
1247 <option value="1">Yes</option>
1250 [% END # /IF (public) %]
1254 <label for="cache_expiry">Cache expiry:</label>
1255 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
1256 <select id="cache_expiry_units" name="cache_expiry_units">
1257 <option value="seconds">Seconds (default)</option>
1258 <option value="minutes">Minutes</option>
1259 <option value="hours">Hours</option>
1260 <option value="days">Days</option>
1265 <label for="notes">Notes:</label>
1266 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1269 </fieldset> <!-- /.rows -->
1271 <fieldset class="rows">
1272 <legend>SQL:</legend>
1273 <div style="margin:1em;">
1274 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1275 <span class="required">Required</span>
1279 <fieldset class="action">
1280 <input type="submit" name="submit" value="Update SQL" />
1281 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1284 [% END # /IF ( editsql ) %]
1287 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1288 <div class="dialog alert">
1289 <strong>The following error was encountered:</strong><br />
1290 [% FOREACH error IN errors %]
1291 [% IF ( error.sqlerr ) %]
1292 This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1293 Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1294 Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1295 [% ELSIF ( error.queryerr ) %]
1296 The database returned the following error: <br />
1297 [% error.queryerr | html %]<br />Please check the log for further details.
1298 [% ELSIF ( error.cache_expiry ) %]
1299 Please select a cache expiry less than 30 days.
1302 <div id="onerror_actions">
1303 <a href="#" class="button goback">Return to previous page</a>
1307 <fieldset class="action">
1308 <input type="hidden" name="phase" value="Use saved" />
1309 <input type="submit" name="submit" value="Saved reports" />
1312 [% END # /IF ( errors ) %]
1315 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1317 <div class="col-sm-2 col-sm-pull-10">
1320 <div id="saved-reports-filter">
1321 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1322 <input type="hidden" name="phase" value="Use saved" />
1323 <input type="hidden" name="filter_set" value="1" />
1324 <fieldset class="brief">
1328 <label for="filter_date">Date:</label>
1329 <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1330 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1333 <label for="filter_author">Author:</label>
1334 <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1337 <label for="filter_keyword">Keyword:</label>
1338 <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1341 </fieldset> <!-- /.brief -->
1342 <fieldset class="action">
1343 <input type="submit" value="Apply filter" />
1344 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1347 </div> <!-- /#saved-reports-filter -->
1349 [% INCLUDE 'guided-reports-view.inc' %]
1351 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1352 </div> <!-- /.row -->
1354 [% MACRO jsinclude BLOCK %]
1355 [% Asset.js("js/charts.js") | $raw %]
1356 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1357 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1358 [% INCLUDE 'calendar.inc' %]
1359 [% INCLUDE 'datatables.inc' %]
1361 [% INCLUDE 'columns_settings.inc' %]
1363 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
1364 [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
1365 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1366 [% Asset.js( "js/mana.js" ) | $raw %]
1369 function hide_bar_element() {
1370 $('#chart-column-horizontal').hide()
1371 $('.chart-column-group').each(function( index ) {
1374 $('.chart-column-line').each(function( index ) {
1379 function show_bar_element() {
1380 $('#chart-column-horizontal').show()
1381 $('.chart-column-group').each(function( index ) {
1384 $('.chart-column-line').each(function( index ) {
1389 function removeColumn(id) {
1392 if ( $('.chart-column-conf').length == 1 ) {
1393 $('.chart-column-delete').remove();
1397 /* overlay a syntax-highlighting definition on top of the existing sql one */
1398 CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
1399 var sqlParamsOverlay = {
1400 token: function(stream, state) {
1402 if (stream.match("<<")) {
1403 while ((ch = stream.next()) != null)
1404 if (ch == ">" && stream.next() == ">") {
1409 while (stream.next() != null && !stream.match("<<", false)) {}
1413 return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
1416 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1417 var group_subgroups = {};
1418 [% FOREACH group IN groups_with_subgroups %]
1419 var gid = "[% group.id | html %]"
1420 group_subgroups[gid] = new Array();
1421 [% FOREACH subgroup IN group.subgroups %]
1422 var sgid = "[% subgroup.id | html %]";
1423 var sgname = "[% subgroup.name | html %]";
1424 group_subgroups[gid].push([sgid, sgname]);
1428 [% IF ( create || editsql || save ) %]
1430 var editor = CodeMirror.fromTextArea(sql, {
1432 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1437 // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232
1438 function clearValidation( formElement ){
1439 // formElement should be a jQuery object
1440 var validator = formElement.validate();
1441 // Iterate through named elements inside of the form, and mark them as error free
1442 $('[name]',formElement).each(function(){
1443 validator.successList.push(this);//mark as error free
1444 validator.showErrors();//remove error messages if present
1446 validator.resetForm();//remove error class on name elements and clear history
1447 validator.reset();//remove all error and success data
1451 [% IF ( showsql ) %]
1452 var editor = CodeMirror.fromTextArea(sql, {
1454 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1460 function load_group_subgroups () {
1461 var group = $("#group_select").val();
1462 var sg = $("#subgroup");
1463 $(sg).find('option[value!=""]').each(function() {
1468 var select = $(sg).find('select')[0];
1469 $.each( group_subgroups[group], function(index, value) {
1470 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1472 $("#subgroup, #subgroup *").show();
1476 $(document).ready(function(){
1478 var activeTab = localStorage.getItem("sql_reports_activetab");
1480 $("body").on('click',".fetch_chart_data",function(){
1481 if( [% unlimited_total || 0 | $raw %] > 1000 ){
1482 if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
1493 if ( $('.chart-column-conf').length == 1 ) {
1494 $('.chart-column-delete').remove();
1497 $(".chart-column-delete").on('click', function(e){
1499 removeColumn('column_' + $(this).data('column'));
1502 $('#download-chart').click(function() {
1503 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1504 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1505 this.setAttribute('download', 'chart.svg');
1508 $('#chart-type').change(function() {
1509 if ($(this).val() == 'bar') {
1517 $('#download-chart').hide();
1520 [% IF results && !errors %]
1521 $('#draw-chart').click(function() {
1523 var x_elements = $('select[name="x"]').val();
1524 var y_elements = [];
1529 headers = [% header_row.json | $raw %];
1532 [% IF allresults.size %]
1533 if ($('input[name="chart-include-all"]').prop('checked')) {
1534 results = [% allresults.json | $raw %]
1537 results = [% results.json | $raw %]
1540 results = [% results.json | $raw %];
1543 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1544 results.splice(-1, 1);
1547 $('select[name="y"]').each(function( index ) {
1548 y_elements.push( $(this).val() );
1550 $('select[name="group"]').each(function( index ) {
1551 groups.push( $(this).val() );
1553 $('.column-line').each(function( index ) {
1554 if ($(this).prop('checked')) {
1555 lines.push( $(this).attr('name') );
1559 // Remove deleted columns from headers and results.
1560 var deleted_indexes = [];
1561 var kept_headers = [];
1562 $.each(headers, function(index, value) {
1563 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1564 // This header is neither a x element nor in y elements. Don't need it.
1565 deleted_indexes.push(index);
1568 kept_headers.push({cell: value.cell});
1572 // Remove coresponding cells.
1573 var kept_results = [];
1574 $.each(results, function(index, value) {
1577 $.each(value.cells, function(i, val) {
1578 if ($.inArray(i, deleted_indexes) === -1) {
1579 line['cells'].push({cell: val.cell});
1582 kept_results.push(line);
1585 options.type = $('select[name="chart-type"]').val();
1586 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1587 options.lines = lines;
1589 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1590 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1591 $("#toggle_chart_settings_vis").hide();
1592 $("#chartModal").modal("hide");
1596 load_group_subgroups();
1599 $('[data-toggle="tooltip"]').tooltip();
1600 var columns_settings = [% TablesSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1602 $('#limit').change(function() {
1603 $('#limitselect').submit();
1606 $(document).click(function() {
1607 $('#report_updated').hide();
1610 $(".goback").on("click",function(e){
1612 window.history.back();
1615 $("body").on("click", ".mana_search_button", function(){
1616 $("#mana-loading").show();
1617 mana_search($("#mana_search_field").val());
1620 $(".ShareButton").on("click", function(){
1621 $("#note-error").hide();
1622 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1623 $(".shared_infos").hide();
1624 $("#note-error").show();
1627 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1628 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1629 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1630 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1631 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1632 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1633 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1637 $("#ManaCloseButton").on("click", function() {
1638 $(".shared_infos").show();
1641 $("#addColumn").on("click",function(){
1645 $("#delColumn").on("click",function(){
1650 var rtable = KohaTable("table_reports", {
1651 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1652 'bAutoWidth': false,
1653 'sPaginationType': 'full',
1654 'aaSorting': [[ 1, "asc" ]],
1656 { 'bSearchable': false, 'aTargets': [3] },
1657 { "aTargets": [ 1, 2 ], "sType": "natural" },
1658 { "visible": false, "aTargets" : [ "hidden" ] }
1661 'sZeroRecords': _("No matching reports found")
1663 }, columns_settings);
1665 var rtabs = $("#tabs").tabs({
1666 create: function( e, ui ){
1667 tabsInit( ui, rtable );
1669 activate: function( e, ui ){
1670 tabsInit( ui, rtable );
1674 $("#tabs").tabs("option","active", activeTab );
1676 $("#subgroup_filter_block").hide();
1678 $("#subgroup_filter").change(function() {
1679 var selected = $(this).find('option:selected');
1680 var sg_id = $(selected).val();
1681 var sg_name = $(selected).text();
1682 if (sg_id.length > 0) {
1683 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1684 rtable.fnSetColumnVis(5, false);
1686 rtable.fnFilter('', 5);
1687 rtable.fnSetColumnVis(5, true);
1691 $("#reports_form").submit(function(){
1692 var checkedItems = $("input[name=ids]:checked");
1693 if ($(checkedItems).size() == 0) {
1694 alert(_("You must select one or more reports to delete"));
1697 $(checkedItems).parents('tr').addClass("warn");
1698 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1701 $(checkedItems).parents('tr').removeClass("warn");
1706 $("body").on("click", ".update_sql", function(e){
1708 var ltitle = $(this).text();
1709 var report_id = $(this).data("report_id");
1710 var page = $(this).attr("href");
1711 $("#update_sql .modal-body").load(page + " div", function(){
1712 var diff1 = $("#col1 .show_sql").text();
1713 var diff2 = $("#col2 .show_sql").text();
1714 var diffs = diffString( escape(diff1), escape(diff2) );
1715 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1717 $('#update_sql').modal('show');
1718 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1721 $("#update_sql").on("hidden.bs.modal", function(){
1722 $("#update_sql_label").html("");
1723 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1727 [% IF ( showsql ) %]
1728 $("#sql").focus(function() {
1733 $(".toggle_sql").click(function(){
1734 $("#sql_output").toggle();
1735 $("#toggle_sql_hid").toggle();
1736 $("#toggle_sql_vis").toggle();
1738 showsql = CodeMirror.fromTextArea(sql, {
1747 $(".toggle_chart_settings").click(function(){
1748 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1751 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1752 $(this).parents('tr').attr("class","warn");
1753 if(confirm(_("Are you sure you want to delete this saved report?"))){
1756 $(this).parents('tr').attr("class","");
1761 [% IF (create || editsql || save) %]
1763 var validated_form = $("#sql_report_form").validate({
1764 reportname: "required",
1767 depends: function(element) {
1768 return $("#create_group").prop("checked") && $("#groupdesc_input").val() != '';
1774 depends: function(element) {
1775 return $("#create_group").prop("checked") && $("#group_input").val() != '';
1781 $("#select_group").change(function() {
1782 if($(this).prop('checked')) {
1783 $("#group_input").attr("class","").prop('disabled', true).prop("required", false);
1784 $("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false);
1785 $("#group_select").prop('disabled', false);
1786 clearValidation( $("#sql_report_form") );
1787 if ($("#group_select").val().length > 0) {
1788 $("#select_subgroup").prop('checked', true);
1789 $("#select_subgroup").change();
1790 $("#subgroup, #subgroup *").show();
1792 $("#subgroup").hide();
1796 $("#create_group").change(function() {
1797 if($(this).prop('checked')) {
1798 $("#group_input").prop('disabled', false).prop("required", true );
1799 $("#groupdesc_input").prop('disabled', false).prop("required", true );
1800 $("#group_select").prop('disabled', true);
1801 // $("#create_subgroup").prop('checked', true).change();
1802 $("#subgroup_select").hide();
1803 $("#subgroup input[type='radio']").hide();
1804 $("#subgroup label[for]").hide();
1805 $("#subgroup_input").prop("required", false ).prop("disabled", false).show();
1806 $("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show();
1807 $("#subgroup").show();
1808 // Add validation rules for fields which were previously hidden
1809 $("#subgroup_input").rules("add", {
1811 depends: function(element) {
1812 return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != '';
1816 $("#subgroupdesc_input").rules("add", {
1818 depends: function(element) {
1819 return $("#create_group").prop("checked") && $("#subgroup_input").val() != '';
1825 $("#select_subgroup").change(function() {
1826 if($(this).prop('checked')) {
1827 $("#subgroup_select").prop('disabled', false);
1828 $("#subgroup_input").prop('disabled', true).prop("required", false );
1829 $("#subgroupdesc_input").prop('disabled', true).prop("required", false );
1830 clearValidation( $("#sql_report_form") );
1833 $("#create_subgroup").change(function() {
1834 if($(this).prop('checked')) {
1835 $("#subgroup_input").prop('disabled', false).prop("required", true );
1836 $("#subgroupdesc_input").prop('disabled', false).prop("required", true );
1837 $("#subgroup_select").val("").prop('disabled', true);
1840 $("#select_group").change();
1841 $("#select_subgroup").change();
1842 $("#group_select").on("change",function(){
1843 load_group_subgroups();
1847 $(".delete").on("click",function(){
1848 return confirmDelete(MSG_CONFIRM_DELETE);
1851 $("#mana_search_form").submit(function(e){
1855 $("#column_submit").submit(function() {
1856 if ($("#selectedColumns option").size() < 1) {
1857 alert(_("No columns selected!"));
1860 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1865 $("body").on("click", ".mana-use", function(e) {
1867 $(this).find("i").attr("class","fa fa-refresh fa-spin");
1868 mana_use( $(this).data("report_id") );
1871 $("#mana_search_result").on("hide.bs.modal", function(){
1872 $("#mana_result_content").html("");
1873 $("#mana_search_field").val("");
1876 $(".batch_op").on("click", function(e){
1878 var target_form = $(this).data("submit");
1879 $("#" + target_form ).submit();
1882 $("#batch_add_to_list").on("submit", function(e){
1887 $("body").on("click", ".preview_sql", function(e){
1889 var reportid = $(this).data("reportid");
1890 previewSql( reportid );
1894 function tabsInit( ui, rtable ){
1895 var thisTab = ui.newTab ? ui.newTab : ui.tab;
1896 var activeTab = thisTab.index();
1897 localStorage.setItem("sql_reports_activetab", activeTab );
1899 $("#subgroup_filter option").each(function() {
1900 if($(this).val().length > 0) {
1904 rtable.fnFilter('', 4);
1905 rtable.fnFilter('', 5);
1906 rtable.fnSetColumnVis(4, true);
1907 rtable.fnSetColumnVis(5, true);
1909 var g_id = $(ui.newTab).children().attr('id');
1910 var g_name = $(ui.newTab).text();
1911 if ( g_name == _("All") ) {
1916 if (g_id && g_id.length > 0) {
1917 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1918 rtable.fnSetColumnVis(4, false);
1919 for(var i in group_subgroups[g_id]) {
1920 $("#subgroup_filter").append(
1921 '<option value="' + group_subgroups[g_id][i][0] + '">'
1922 + group_subgroups[g_id][i][1] + '</option>'
1925 $("#subgroup_filter_block").show();
1927 $("#subgroup_filter_block").hide();
1931 function addColumn() {
1932 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1934 function delColumn() {
1935 $("#selectedColumns option:selected").remove();
1939 function mana_use( mana_id ){
1942 url: "/cgi-bin/koha/svc/mana/use",
1943 data: {id:mana_id, resource: 'report', saveinbase: 1},
1946 .done( function (result){
1947 if ( result.errmsg ){
1948 alert( result.errmsg );
1951 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
1954 .fail(function( error ) {
1955 $(".mana_use_status").hide();
1956 $("#mana_use_errortext").html( error.status + " " + error.statusText );
1957 $("#mana_use_failed").show();
1958 $(".mana-use i").attr("class","fa fa-download");
1962 function mana_search( textquery ){
1963 $(".mana_search_status").hide();
1964 $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
1966 if ( status == "error" ) {
1967 $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
1968 $("#mana_search_failed").show();
1969 $("#mana-loading").hide();
1971 $(".mana_search_status").hide();
1972 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
1973 $("#mana-loading").hide();
1974 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
1975 "sPaginationType":"full",
1978 { "width": "35%", "targets": 1 }
1981 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1982 { "sType": "title-string", "aTargets" : [ "title-string" ] },
1983 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
1987 $(".showbutton").on("click", function(e){
1989 $(this).parent().hide();
1990 $(this).parent().next().show();
1993 $(".hidebutton").on("click", function(e){
1995 $(this).parent().hide();
1996 $(this).parent().prev().show();
1999 if($("td.dataTables_empty").length == 0){
2000 $("#mana_search_message").show();
2006 function addToList() {
2007 var biblionumbers = [];
2008 $(".bib_to_list").each(function() {
2009 var biblionumber = Number( $(this).val() );
2010 if( biblionumbers.indexOf( biblionumber ) < 0 ){
2011 biblionumbers.push( biblionumber );
2014 bibs = biblionumbers.join("/");
2015 var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
2016 window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
2020 // Adapted from https://gist.github.com/jnormore/7418776
2021 function previewSql(reportid) {
2024 var message = $("#previewSql" + reportid ).val();
2025 var title = $("#previewSql" + reportid ).data("title");
2026 if( $("#preview-sql-modal").length > 0) {
2027 $("#preview-sql-modal").remove();
2029 $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
2030 <div class="modal-dialog">\
2031 <div class="modal-content">\
2032 <div class="modal-header" style="min-height:40px;">\
2033 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
2034 <span aria-hidden="true">×</span>\
2036 <h4 class="modal-title">' + title + '</h4>\
2038 <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
2039 <div class="modal-footer">\
2040 <a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a>\
2041 <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=' + reportid + '"><i class="fa fa-copy"></i> Duplicate</a>\
2042 <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + reportid + '"><i class="fa fa-clock-o"></i> Schedule</a>\
2043 <a id="preview-modal-delete" class="delete btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a>\
2044 <a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Run%20this%20report"><i class="fa fa-play"></i> Run report</a>\
2045 <a href="#" id="preview-sql-modal-cancel" data-dismiss="modal" class="btn btn-default"><i class="fa fa-remove" aria-hidden="true"></i> Close</a>\
2051 $("#preview-sql-modal").modal('show');
2052 CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
2062 [% INCLUDE 'intranet-bottom.inc' %]
2064 [% BLOCK group_and_subgroup_selection %]
2066 <label>Report group:</label>
2067 <input type="radio" name="select_or_create_group"
2068 id="select_group" checked="checked" />
2069 <label for="select_group" style="float:none">Select</label>
2070 <select name="group" id="group_select">
2071 <option value="">(None)</option>
2072 [% FOREACH group IN groups_with_subgroups %]
2073 [% IF (group.selected) %]
2074 <option value="[% group.id | html %]" selected="selected">
2076 <option value="[% group.id | html %]">
2078 [% group.name | html %]
2082 <input type="radio" name="select_or_create_group" id="create_group" />
2083 <label for="create_group" style="float:none">or create:</label>
2084 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
2085 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
2088 <label>Report subgroup:</label>
2089 <input type="radio" name="select_or_create_subgroup"
2090 id="select_subgroup" checked="checked" />
2091 <label for="select_subgroup" style="float:none">Select</label>
2092 <select name="subgroup" id="subgroup_select">
2093 <option value="">(None)</option>
2094 [% FOREACH group IN groups_with_subgroups %]
2095 [% IF (group.selected) %]
2096 [% FOREACH subgroup IN group.subgroups %]
2097 [% IF (subgroup.selected) %]
2098 <option value="[% subgroup.id | html %]" selected="selected">
2100 <option value="[% subgroup.id | html %]">
2102 [% subgroup.name | html %]
2108 <input type="radio" name="select_or_create_subgroup"
2109 id="create_subgroup" />
2110 <label for="create_subgroup" style="float:none">or create</label>
2111 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
2112 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />