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' %]
24 Saved reports › [%- ELSIF ( create ) -%]
25 Create from SQL › [%- ELSIF ( showsql ) -%]
26 SQL view › Saved reports › [%- ELSIF ( execute ) -%]
27 Report [% name | html %] ([% id | html %]) › Saved reports › [%- ELSIF ( editsql ) -%]
28 Edit report [% reportname | html %] ([% id | html %]) › Saved reports › [%- END -%]
31 Build a report, step 1 of 6: Choose a module › [%- ELSIF ( build2 ) -%]
32 Build a report, step 2 of 6: Pick a report type › [%- ELSIF ( build3 ) -%]
33 Build a report, step 3 of 6: Select columns for display › [%- ELSIF ( build4 ) -%]
34 Build a report, step 4 of 6: Select criteria to limit on › [%- ELSIF ( build5 ) -%]
35 Build a report, step 5 of 6: Pick which columns to total › [%- ELSIF ( build6 ) -%]
36 Build a report, step 6 of 6: Select how you want the report ordered › [%- END -%]
37 Guided reports wizard › Reports › Koha
40 [% INCLUDE 'doc-head-close.inc' %]
41 [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
49 #mana_search_errortext { font-family: monospace; font-weight: bold; }
51 [% Asset.css("css/reports.css") | $raw %]
52 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
55 <body id="rep_guided_reports_start" class="rep">
56 [% INCLUDE 'header.inc' %]
57 [% INCLUDE 'circ-search.inc' %]
59 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
62 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
65 <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
68 <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
73 <a href="#" aria-current="page">
77 [% ELSIF ( create ) %]
79 <a href="#" aria-current="page">
83 [% ELSIF ( showsql ) %]
85 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
88 <a href="#" aria-current="page">
89 [% reportname | html %] ([% id | html %])
92 [% ELSIF ( editsql ) %]
94 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
97 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
100 <a href="#" aria-current="page">
104 [% ELSIF ( execute ) %]
106 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
109 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
112 <a href="#" aria-current="page">
116 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
118 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
121 <a href="#" aria-current="page">
123 Step 1 of 6: Choose a module
124 [% ELSIF ( build2 ) %]
125 Step 2 of 6: Pick a report type
126 [% ELSIF ( build3 ) %]
127 Step 3 of 6: Select columns for display
128 [% ELSIF ( build4 ) %]
129 Step 4 of 6: Select criteria to limit on
130 [% ELSIF ( build5 ) %]
131 Step 5 of 6: Pick which columns to total
132 [% ELSIF ( build6 ) %]
133 Step 6 of 6: Select how you want the report ordered
138 </nav> <!-- /#breadcrumbs -->
140 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
141 <div class="modal-dialog">
142 <div class="modal-content">
143 <div class="modal-header">
144 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
145 <h3 id="update_sql_label">Update SQL</h3>
147 <div class="modal-body">
148 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
150 <div class="modal-footer">
151 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
152 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
154 </div> <!-- /.modal-content -->
155 </div> <!-- /.modal-dialog -->
156 </div> <!-- #update_sql -->
158 <div class="main container-fluid">
160 <div class="col-sm-10 col-sm-push-2">
163 [% INCLUDE "reports-toolbar.inc" %]
166 <h2>Guided reports</h2>
167 <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>
169 <h3>Build and run reports</h3>
171 [% IF ( CAN_user_reports_create_reports ) %]
172 <form action="/cgi-bin/koha/reports/guided_reports.pl">
173 <input type="hidden" name="phase" value="Build new" />
174 <input type="submit" name="submit" value="Build new"/>
178 [% IF ( CAN_user_reports_execute_reports ) %]
179 <form action="/cgi-bin/koha/reports/guided_reports.pl">
180 <input type="hidden" name="phase" value="Use saved"/>
181 <input type="submit" name="submit" value="Use saved"/>
185 [% IF ( CAN_user_reports_create_reports ) %]
186 <form action="/cgi-bin/koha/reports/guided_reports.pl">
187 <input type="hidden" name="phase" value="Create report from SQL"/>
188 <input type="submit" name="submit" value="Create report from SQL"/>
192 <h3>Reports Dictionary</h3>
193 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
194 <form action="/cgi-bin/koha/reports/dictionary.pl">
195 <input type="hidden" name="phase" value="View Dictionary"/>
196 <input type="submit" name="submit" value="View dictionary"/>
198 [% END # /IF (start) %]
200 [% IF report_converted %]
201 <div class="dialog message">
202 The report "[% report_converted | html %]" has been converted.
206 [% IF report_converted %]
207 <div class="dialog message">
208 The report "[% report_converted | html %]" has been converted.
213 [% IF ( savedreports ) %]
214 <h1>Saved reports</h1>
216 [% IF ( filters.date || filters.author || filters.keyword ) %]
218 <span class="filter">
219 [% IF ( filters.date ) %]
220 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
222 [% IF ( filters.author ) %]
223 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
225 [% IF ( filters.keyword ) %]
226 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
228 <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>
233 <div id="tabs" class="toptabs">
235 <li><a href="#reports">All</a></li>
236 [% FOREACH group IN groups_with_subgroups %]
237 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
241 <div id="subgroup_filter_block">
242 <label for="subgroup_filter">Subgroup:</label>
243 <select id="subgroup_filter">
244 <option value="">All</option>
248 [% IF (Koha.Preference('Mana') == 1) %]
250 <div id="mana_search_message" class="dialog message">
251 <p> [% manamsg | html %] </p>
256 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
257 <input type="hidden" name="phase" value="Delete Multiple" />
258 <table id="table_reports">
261 <th class="NoSort"> </th>
269 <th>Creation date</th>
272 <th class="report_public">Public</th>
273 <th class="report_json_url">JSON URL</th>
275 <th>Cache expiry (seconds)</th>
277 <th class="hidden"> </th>
279 <th>Saved results</th>
280 [% IF has_obsolete_reports %]
283 <th class="hidden"> </th>
285 <th class="NoSort noExport">Actions</th>
289 [% FOREACH savedreport IN savedreports %]
290 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
291 <td class="report_checkbox">
292 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
293 <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
295 <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
297 <td class="report_id">
298 <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
300 <td class="report_name">
301 [% IF ( savedreport.report_name ) %]
302 [% savedreport.report_name | html %]
307 <td class="report_type">
308 [% savedreport.type | html %]
310 <td class="report_group">
311 [% savedreport.groupname | html %]
314 [% savedreport.subgroupname | html %]
316 <td class="report_notes">
317 [% savedreport.notes | html %]
320 [% savedreport.borrowersurname | html %]
321 [% IF ( savedreport.borrowerfirstname ) %]
322 , [% savedreport.borrowerfirstname | html %]
324 ([% savedreport.borrowernumber | html %])
326 <td data-order="[% savedreport.date_created | html %]">
327 [% savedreport.date_created | $KohaDates %]
329 <td data-order="[% savedreport.last_modified | html %]">
330 [% savedreport.last_modified | $KohaDates with_hours => 1 %]
332 <td data-order="[% savedreport.last_run | html %]">
333 [% savedreport.last_run | $KohaDates with_hours => 1 %]
335 <td class="report_public">
336 [% IF (savedreport.public) %]
342 <td class="report_json_url">
343 [% IF (savedreport.public) %]
344 <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>
346 <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>
350 [% savedreport.cache_expiry | html %]
353 [% FOR result IN savedreport.results %]
354 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
359 [% IF savedreport.seems_obsolete %]
360 This report seems obsolete, it uses biblioitems.marcxml field.
361 <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>
365 <div class="btn-group dropup">
366 [%# There should be no space between these two buttons, it would render badly %]
367 <a class="btn btn-default btn-xs" role="button"
368 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
369 class="fa fa-play"></i> Run</a><a
370 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
371 href="#"><b class="caret"></b></a>
372 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
373 <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>
375 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
376 <i class="fa fa-eye"></i> Preview SQL
379 [% IF ( CAN_user_reports_create_reports ) %]
380 <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>
381 <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>
383 [% IF (Koha.Preference('Mana') == 1) %]
384 <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>
386 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
387 [% IF ( CAN_user_reports_delete_reports ) %]
388 <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>
392 <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
399 [% IF ( CAN_user_reports_delete_reports ) %]
400 <fieldset class="action">
401 <input type="submit" value="Delete selected" />
407 [% ELSE # IF ( savedreports ) %]
408 <div class="dialog message">
409 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
410 <h4>No saved reports match your criteria. </h4>
411 [% IF ( CAN_user_reports_create_reports ) %]
412 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
413 <input type="hidden" name="phase" value="Build new" />
414 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
417 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
418 <input type="hidden" name="phase" value="Create report from SQL" />
419 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
422 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
423 <input type="hidden" name="phase" value="Use saved" />
424 <input type="hidden" name="filter_set" value="1" />
425 <input type="hidden" name="filter_keyword" value="" />
426 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
430 <h4>There are no saved reports. </h4>
431 [% IF ( CAN_user_reports_create_reports ) %]
432 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
434 [% END # IF (filter_set || filters.date || filters.author || filters.keyword) %]
435 </div> <!-- /.dialog.message -->
436 [% END # /IF ( savedreports ) %]
437 [% END # /IF ( saved1 ) %]
439 [% INCLUDE 'mana/mana-share-report.inc' %]
442 [% IF ( cache_error) %]
443 <div class="dialog alert">
444 <strong> Please choose a cache_expiry less than 30 days </strong>
448 <h1>Build a report</h1>
449 <form action="/cgi-bin/koha/reports/guided_reports.pl">
450 <fieldset class="rows">
451 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
454 <label for="area">Choose: </label>
455 <select name="area" id="area">
456 [%- FOREACH area IN areas -%]
457 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
463 <label for="public">Report is public:</label>
464 <select id="public" name="public">
465 <option value="0">No (default)</option>
466 <option value="1" selected="selected">Yes</option>
471 <label for="public">Report is public:</label>
472 <select id="public" name="public">
473 <option value="0" selected="selected">No (default)</option>
474 <option value="1">Yes</option>
481 <label for="cache_expiry">Cache expiry:</label>
482 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
483 <select id="cache_expiry_units" name="cache_expiry_units">
484 <option value="seconds">Seconds (default)</option>
485 <option value="minutes">Minutes</option>
486 <option value="hours">Hours</option>
487 <option value="days">Days</option>
492 </fieldset> <!-- /.rows -->
493 <fieldset class="action">
494 <input type="hidden" name="phase" value="Report on this Area" />
495 <input type="submit" name="submit" value="Next >>" />
501 <h1>Build a report</h1>
502 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
503 <input type="hidden" name="area" value="[% area | html %]" />
504 <input type="hidden" name="public" value="[% public | html %]" />
505 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
506 <fieldset class="rows">
507 <legend>Step 2 of 6: Pick a report type</legend>
510 <label for="types">Choose: </label>
511 <select id="types" name="types">
512 <option value="1">Tabular</option>
513 <option value="2" disabled="disabled">Summary</option>
514 <option value="3" disabled="disabled">Matrix</option>
520 <fieldset class="action">
521 <input type="hidden" name="phase" value="Choose this type" />
522 <input type="button" name="back" value="<< Back" class="goback" />
523 <input type="submit" name="submit" value="Next >>" />
526 [% END # /IF (build2 ) %]
529 <h1>Build a report</h1>
530 <h3>Step 3 of 6: Select columns for display</h3>
531 <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>
533 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
534 <input type="hidden" name="area" value="[% area | html %]" />
535 <input type="hidden" name="type" value="[% type | html %]" />
536 <input type="hidden" name="public" value="[% public | html %]" />
537 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
540 <div class="col-sm-6">
541 <div style="float: left;">
542 <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
543 [% FOREACH column IN columns %]
544 [% IF ( column.table ) %]
545 [% IF ( loop.first ) %]
549 <optgroup label="[% column.table | html %]">
551 <option value="[% column.name | html %]">
552 [% IF ( column.description ) %]
553 [% column.description | html %] / [% column.name | html %]
555 [% column.name | html %]
563 <div style="width: 6.3em; float: right; margin-top: 100px">
564 <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
565 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
567 </div> <!-- /.col-sm-6 -->
569 <div class="col-sm-6">
570 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
573 </div> <!-- /.row -->
575 <fieldset class="action">
576 <input type="hidden" name="phase" value="Choose these columns" />
577 <input type="button" name="back" value="<< Back" class="goback" />
578 <input type="submit" name="submit" value="Next >>" />
580 </form> <!-- /#column_submit -->
581 [% END # /IF ( build3 ) %]
584 <h1>Build a report</h1>
585 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
586 <input type="hidden" name="area" value="[% area | html %]" />
587 <input type="hidden" name="type" value="[% type | html %]" />
588 <input type="hidden" name="column" value="[% column | html %]" />
589 <input type="hidden" name="public" value="[% public | html %]" />
590 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
592 <legend>Step 4 of 6: Select criteria to limit on</legend>
594 [% FOREACH criteri IN criteria %]
597 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
598 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
600 [% IF ( criteri.date ) %]
602 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
603 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
607 [% IF ( criteri.textrange ) %]
610 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
611 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
615 [% IF ( criteri.daterange ) %]
618 <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
620 <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
621 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
626 <select name="[% criteri.name | html %]_value">
627 [% FOREACH value IN criteri.values %]
628 <option value="[% value.availablevalues | html %]">
629 [% IF ( value.default ) %]
632 [% value.display_value | html %]
646 [% IF ( definitions ) %]
648 <legend>Dictionary definitions</legend>
650 [% FOREACH definition IN definitions %]
653 <input type="checkbox" name="definition" value="[% definition.id | html %]" />
654 [% definition.name | html %]
662 <fieldset class="action">
663 <input type="hidden" name="phase" value="Choose these criteria" />
664 <input type="button" name="back" value="<< Back" class="goback" />
665 <input type="submit" name="submit" value="Next >>" />
668 [% END # /IF ( build4 ) %]
671 <h1>Build a report</h1>
672 <h3>Step 5 of 6: Pick which columns to total</h3>
673 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
674 <input type="hidden" name="area" value="[% area | html %]" />
675 <input type="hidden" name="type" value="[% type | html %]" />
676 <input type="hidden" name="column" value="[% column | html %]" />
677 <input type="hidden" name="definition" value="[% definition | html %]" />
678 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
679 <input type="hidden" name="public" value="[% public | html %]" />
680 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
683 [% FOREACH total_b IN total_by %]
686 <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
687 <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
690 <select name="[% total_b.name | html %]_tvalue">
691 [% FOREACH selec IN total_b.select %]
692 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
701 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
702 <input type="button" name="back" value="<< Back" class="goback" />
703 <input type="submit" name="submit" value="Next >>" />
706 [% END # /IF ( build5 ) %]
709 <h1>Build a report</h1>
710 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
711 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
712 <input type="hidden" name="area" value="[% area | html %]" />
713 <input type="hidden" name="type" value="[% type | html %]" />
714 <input type="hidden" name="column" value="[% column | html %]" />
715 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
716 <input type="hidden" name="definition" value="[% definition | html %]" />
717 <input type="hidden" name="totals" value="[% totals | html %]" />
718 <input type="hidden" name="public" value="[% public | html %]" />
719 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
722 [% FOREACH order_b IN order_by %]
725 <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
726 <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
729 <select name="[% order_b.name | html %]_ovalue">
730 [% FOREACH selec IN order_b.select %]
731 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
739 <fieldset class="action">
740 <input type="hidden" name="phase" value="Build report" />
741 <input type="submit" name="submit" value="Finish" />
744 [% END #/ IF ( build6 ) %]
746 [% IF ( showreport ) %]
747 <h1>Confirm custom report</h1>
748 <p>Your report will be generated with the following SQL statement.</p>
753 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
754 <input type="hidden" name="sql" value="[% sql | html %]" />
755 <input type="hidden" name="type" value="[% type | html %]" />
756 <input type="hidden" name="public" value="[% public | html %]" />
757 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
758 <p>You will need to save the report before you can execute it</p>
759 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
760 <input type="submit" name="submit" value="Next" />
763 [% END #/ IF ( showreport ) %]
766 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
767 <input type="hidden" name="sql" value="[% sql | html %]" />
768 <input type="hidden" name="type" value="[% type | html %]" />
769 <input type="hidden" name="area" value="[% area | html %]" />
770 <input type="hidden" name="public" value="[% public | html %]" />
771 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
772 <fieldset class="rows">
773 <legend>Save your custom report</legend>
776 <label for="reportname" class="required">Report name: </label>
777 <input type="text" id="reportname" name="reportname" class="required" required="required" />
778 <span class="required">Required</span>
780 [% PROCESS group_and_subgroup_selection %]
782 <label for="notes">Notes:</label>
783 <textarea name="notes" id="notes"></textarea>
787 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
788 <input type="submit" name="submit" value="Save report" />
791 [% END # /IF( save ) %]
793 [% IF ( warn_authval_problem ) %]
794 <div class="dialog alert">
795 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
796 [% FOREACH problematic_authval IN problematic_authvals %]
798 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
799 you selected does not exist.
802 <!-- Save Anyway Form -->
803 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
804 <!--Every parameter the user issued is provided as a hidden field for recovery-->
805 <input type='hidden' name='id' value='[% id | html %]' />
806 <input type='hidden' name='sql' value='[% sql | html %]' />
807 <input type='hidden' name='reportname' value='[% reportname | html %]' />
808 <input type='hidden' name='group' value='[% group | html %]' />
809 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
810 <input type='hidden' name='notes' value='[% notes | html %]' />
811 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
812 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
813 <input type='hidden' name='public' value='[% public | html %]' />
814 [% IF ( phase_update) %]
815 <input type='hidden' name='phase' value='Update SQL' />
816 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
817 [% ELSIF ( phase_save) %]
818 <input type='hidden' name='area' value='[% area | html %]' />
819 <input type='hidden' name='phase' value='Save Report' />
820 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
823 <!-- Go back to editing -->
824 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
825 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
828 [% END # /IF ( warn_authval_problem )%]
830 [% IF ( enter_params ) %]
831 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
832 <input type='hidden' name='reports' value="[% reports | html %]" />
833 [% IF ( auth_val_error ) %]
834 <input type='hidden' name='phase' value='Edit SQL' />
835 <div class="dialog alert">
836 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
837 [% FOREACH auth_val_error IN auth_val_errors %]
839 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
840 you selected does not exist.
844 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
845 [% ELSE # IF ( auth_val_error ) %]
846 <input type='hidden' name='phase' value='Run this report' />
847 <h1>Enter parameters for report [% name | html %]:</h1>
849 <p>[% notes | html %]</p>
851 <fieldset class="rows">
853 [% FOREACH sql_param IN sql_params %]
854 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
855 [% IF sql_param.input == 'date' %]
857 <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" />
859 [% ELSIF ( sql_param.input == 'text' ) %]
861 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
862 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
864 [% ELSIF ( sql_param.input == 'textarea' ) %]
866 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
867 <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
871 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
872 <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]">
873 [% IF (sql_param.include_all) %]
874 <option value="%">All</option>
876 [% FOREACH value IN sql_param.input.values %]
877 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
881 [% END # /IF sql_param.input == 'date' %]
882 [% END # /FOREACH sql_param %]
884 </fieldset> <!-- /.rows -->
885 <fieldset class="action">
886 <input type="submit" value="Run the report" />
888 [% END # / IF ( auth_val_error ) %]
890 [% END # /IF ( enter_params ) %]
893 <h1>[% name | html %] <span id="report_id">([% id | html %])</span></h1>
895 <p><span class="label">Notes:</span> [% notes | html %]</p>
897 [% IF ( unlimited_total ) %]
899 <span class="label">Total number of results:</span>
900 [% unlimited_total | html %]
901 [% IF unlimited_total > limit %]
902 ([% limit | html %] shown)
907 <div id="sql_output" style="display:none;">
908 <span class="label">Report SQL:</span>
909 <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
913 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
914 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
916 <div id="chart" class="clearfix"></div>
919 [% UNLESS ( errors ) %]
920 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
921 <input type="hidden" name="recordtype" value="biblio" />
922 <input type="hidden" name="op" value="list" />
923 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
924 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
925 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
929 <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
930 <input type="hidden" name="recordtype" value="biblio" />
931 <input type="hidden" name="op" value="list" />
932 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
933 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
934 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
938 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
939 <input type="hidden" name="op" value="show" />
940 [% FOREACH result IN results %]
941 [% FOREACH cells IN result.cells %]
942 [% place = loop.index %]
943 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
944 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
945 [% SET batch_itemnumbers = 1 %]
946 [% SET header_row.$place.has_itemnumbers = 1 %]
947 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
953 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
954 <input type="hidden" name="op" value="show" />
955 <input type="hidden" name="del" value="1" />
956 [% FOREACH result IN results %]
957 [% FOREACH cells IN result.cells %]
958 [% place = loop.index %]
959 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
960 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
961 [% SET batch_itemnumbers = 1 %]
962 [% SET header_row.$place.has_itemnumbers = 1 %]
963 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
969 <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
970 [% FOREACH result IN results %]
971 [% FOREACH cells IN result.cells %]
972 [% place = loop.index %]
973 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
974 [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
975 [% SET batch_biblionumbers = 1 %]
976 [% SET header_row.$place.has_biblionumbers = 1 %]
977 <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
983 <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
984 <input type="hidden" name="op" value="show" />
985 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
986 <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
987 [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
991 [% BLOCK batch_list %]
992 [%- FOREACH result IN results %]
993 [%- FOREACH cells IN result.cells %]
994 [%- place = loop.index %]
995 [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
996 [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
1001 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1003 <div class="btn-group">
1004 <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
1005 Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
1006 <span class="caret"></span>
1008 <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
1009 [% FOREACH header_ro IN header_row %]
1010 [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1011 <li class="dropdown-header">Bibliographic records</li>
1013 <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>
1016 <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>
1019 <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>
1022 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1023 [% IF ( batch_biblionumbers ) %]
1024 <li role="separator" class="divider"></li>
1026 <li class="dropdown-header">Item records</li>
1028 <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>
1031 <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>
1034 [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1035 [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
1036 <li role="separator" class="divider"></li>
1038 <li class="dropdown-header">Patron records</li>
1040 <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>
1044 </ul> <!-- /.dropdown-menu -->
1045 </div> <!-- /.dropdown -->
1047 [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1048 [% END # UNLESS ( errors ) %]
1049 [% END # IF ( execute ) %]
1051 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1052 <input type="hidden" name="phase" value="Run this report"/>
1053 <input type="hidden" name="reports" value="[% report_id | html %]"/>
1055 [% FOREACH p IN sql_params %]
1056 <input type="hidden" name="sql_params" value="[% p | html %]"/>
1058 [% FOREACH n IN param_names %]
1059 <input type="hidden" name="param_name" value="[% n | html %]"/>
1062 <label for="limit">Rows per page: </label>
1063 <select name="limit" id="limit">
1064 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1065 [% FOREACH l IN limits %]
1067 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
1069 <option value="[% l | html %]">[% l | html %]</option>
1073 </form> <!-- /#limitselect -->
1075 <div class="pages">[% pagination_bar | $raw %]</div>
1076 [% UNLESS ( errors ) %]
1079 [% FOREACH header_ro IN header_row %]
1080 <th>[% header_ro.cell | html %]</th>
1083 [% FOREACH result IN results %]
1085 [% FOREACH cells IN result.cells %]
1086 <td>[% cells.cell | $raw %]</td>
1092 <div class="pages">[% pagination_bar | $raw %]</div>
1094 [% INCLUDE 'chart.inc' %]
1096 [% END #/IF ( execute ) %]
1099 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1100 <fieldset class="rows">
1101 <legend>Create report from SQL</legend>
1104 <label for="reportname" class="required">Report name:</label>
1105 [% IF ( reportname ) %]
1106 <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
1108 <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
1110 <span class="required">Required</span>
1112 [% PROCESS group_and_subgroup_selection %]
1116 <label for="public">Report is public:</label>
1117 <select id="public" name="public">
1118 <option value="0">No (default)</option>
1119 <option value="1" selected="selected">Yes</option>
1124 <label for="public">Report is public:</label>
1125 <select id="public" name="public">
1126 <option value="0" selected="selected">No (default)</option>
1127 <option value="1">Yes</option>
1130 [% END # /IF (public) %]
1134 <label for="cache_expiry">Cache expiry:</label>
1135 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
1136 <select id="cache_expiry_units" name="cache_expiry_units">
1137 <option value="seconds" selected="selected">Seconds (default)</option>
1138 <option value="minutes">Minutes</option>
1139 <option value="hours">Hours</option>
1140 <option value="days">Days</option>
1143 [% END # /IF (usecache) %]
1145 <label for="notes">Notes:</label>
1146 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1149 </fieldset> <!-- /.rows -->
1151 <fieldset class="rows">
1152 <legend>SQL:</legend>
1153 <div style="margin:1em;">
1154 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1155 <span class="required">Required</span>
1159 <fieldset class="action">
1160 <input type="hidden" name="phase" value="Save Report" />
1161 <input type="submit" name="submit" value="Save report" />
1162 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1165 [% END #/IF ( create ) %]
1167 [% IF saved_results %]
1168 <h1>Saved report results</h1>
1169 <h2>[% name | html %]</h2>
1170 <p>[% notes | html %]</p>
1172 [% FOREACH rows IN saved_results %]
1174 [% FOREACH col IN rows %]
1175 <td>[% col | html %]</td>
1180 [% END # /IF saved_results %]
1182 [% IF ( showsql ) %]
1183 <fieldset class="rows">
1184 <legend>[% reportname | html %]</legend>
1188 <span class="label">Notes:</span>
1194 <textarea id="sql">[% sql | html %]</textarea>
1198 [% END # /IF ( showsql ) %]
1200 [% IF ( save_successful ) %]
1201 [% UNLESS ( errors ) %]
1203 <div id="report_updated">
1204 <div class="dialog message">
1205 <p>Your report "[% reportname | html %]" has been saved</p>
1211 [% IF ( editsql ) %]
1212 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1213 <input type="hidden" name="phase" value="Update SQL" />
1214 <input type="hidden" name="id" value="[% id | html %]"/>
1215 <fieldset class="rows">
1216 <legend>Edit SQL report</legend>
1219 <label for="reportname" class="required">Report name: </label>
1220 <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1221 <span class="required">Required</span>
1223 [% PROCESS group_and_subgroup_selection %]
1226 <label for="public">Report is public:</label>
1227 <select id="public" name="public">
1228 <option value="0">No (default)</option>
1229 <option value="1" selected="selected">Yes</option>
1234 <label for="public">Report is public:</label>
1235 <select id="public" name="public">
1236 <option value="0" selected="selected">No (default)</option>
1237 <option value="1">Yes</option>
1240 [% END # /IF (public) %]
1244 <label for="cache_expiry">Cache expiry:</label>
1245 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
1246 <select id="cache_expiry_units" name="cache_expiry_units">
1247 <option value="seconds">Seconds (default)</option>
1248 <option value="minutes">Minutes</option>
1249 <option value="hours">Hours</option>
1250 <option value="days">Days</option>
1255 <label for="notes">Notes:</label>
1256 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1259 </fieldset> <!-- /.rows -->
1261 <fieldset class="rows">
1262 <legend>SQL:</legend>
1263 <div style="margin:1em;">
1264 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1265 <span class="required">Required</span>
1269 <fieldset class="action">
1270 <input type="submit" name="submit" value="Update SQL" />
1271 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1274 [% END # /IF ( editsql ) %]
1277 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1278 <div class="dialog alert">
1279 <strong>The following error was encountered:</strong><br />
1280 [% FOREACH error IN errors %]
1281 [% IF ( error.sqlerr ) %]
1282 This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1283 Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1284 Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1285 [% ELSIF ( error.queryerr ) %]
1286 The database returned the following error: <br />
1287 [% error.queryerr | html %]<br />Please check the log for further details.
1288 [% ELSIF ( error.cache_expiry ) %]
1289 Please select a cache expiry less than 30 days.
1292 <div id="onerror_actions">
1293 <a href="#" class="button goback">Return to previous page</a>
1297 <fieldset class="action">
1298 <input type="hidden" name="phase" value="Use saved" />
1299 <input type="submit" name="submit" value="Saved reports" />
1302 [% END # /IF ( errors ) %]
1305 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1307 <div class="col-sm-2 col-sm-pull-10">
1310 <div id="saved-reports-filter">
1311 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1312 <input type="hidden" name="phase" value="Use saved" />
1313 <input type="hidden" name="filter_set" value="1" />
1314 <fieldset class="brief">
1318 <label for="filter_date">Date:</label>
1319 <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1320 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1323 <label for="filter_author">Author:</label>
1324 <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1327 <label for="filter_keyword">Keyword:</label>
1328 <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1331 </fieldset> <!-- /.brief -->
1332 <fieldset class="action">
1333 <input type="submit" value="Apply filter" />
1334 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1337 </div> <!-- /#saved-reports-filter -->
1339 [% INCLUDE 'guided-reports-view.inc' %]
1341 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1342 </div> <!-- /.row -->
1344 [% MACRO jsinclude BLOCK %]
1345 [% Asset.js("js/charts.js") | $raw %]
1346 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1347 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1348 [% INCLUDE 'calendar.inc' %]
1349 [% INCLUDE 'datatables.inc' %]
1351 [% INCLUDE 'columns_settings.inc' %]
1353 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
1354 [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
1355 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1356 [% Asset.js( "js/mana.js" ) | $raw %]
1359 function hide_bar_element() {
1360 $('#chart-column-horizontal').hide()
1361 $('.chart-column-group').each(function( index ) {
1364 $('.chart-column-line').each(function( index ) {
1369 function show_bar_element() {
1370 $('#chart-column-horizontal').show()
1371 $('.chart-column-group').each(function( index ) {
1374 $('.chart-column-line').each(function( index ) {
1379 function removeColumn(id) {
1382 if ( $('.chart-column-conf').length == 1 ) {
1383 $('.chart-column-delete').remove();
1387 /* overlay a syntax-highlighting definition on top of the existing sql one */
1388 CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
1389 var sqlParamsOverlay = {
1390 token: function(stream, state) {
1392 if (stream.match("<<")) {
1393 while ((ch = stream.next()) != null)
1394 if (ch == ">" && stream.next() == ">") {
1399 while (stream.next() != null && !stream.match("<<", false)) {}
1403 return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
1406 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1407 var group_subgroups = {};
1408 [% FOREACH group IN groups_with_subgroups %]
1409 var gid = "[% group.id | html %]"
1410 group_subgroups[gid] = new Array();
1411 [% FOREACH subgroup IN group.subgroups %]
1412 var sgid = "[% subgroup.id | html %]";
1413 var sgname = "[% subgroup.name | html %]";
1414 group_subgroups[gid].push([sgid, sgname]);
1418 [% IF ( create || editsql || save ) %]
1420 var editor = CodeMirror.fromTextArea(sql, {
1422 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1427 // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232
1428 function clearValidation( formElement ){
1429 // formElement should be a jQuery object
1430 var validator = formElement.validate();
1431 // Iterate through named elements inside of the form, and mark them as error free
1432 $('[name]',formElement).each(function(){
1433 validator.successList.push(this);//mark as error free
1434 validator.showErrors();//remove error messages if present
1436 validator.resetForm();//remove error class on name elements and clear history
1437 validator.reset();//remove all error and success data
1441 [% IF ( showsql ) %]
1442 var editor = CodeMirror.fromTextArea(sql, {
1444 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1450 function load_group_subgroups () {
1451 var group = $("#group_select").val();
1452 var sg = $("#subgroup");
1453 $(sg).find('option[value!=""]').each(function() {
1458 var select = $(sg).find('select')[0];
1459 $.each( group_subgroups[group], function(index, value) {
1460 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1462 $("#subgroup, #subgroup *").show();
1466 $(document).ready(function(){
1468 var activeTab = localStorage.getItem("sql_reports_activetab");
1470 $("body").on('click',".fetch_chart_data",function(){
1471 if( [% unlimited_total || 0 | $raw %] > 1000 ){
1472 if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
1483 if ( $('.chart-column-conf').length == 1 ) {
1484 $('.chart-column-delete').remove();
1487 $(".chart-column-delete").on('click', function(e){
1489 removeColumn('column_' + $(this).data('column'));
1492 $('#download-chart').click(function() {
1493 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1494 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1495 this.setAttribute('download', 'chart.svg');
1498 $('#chart-type').change(function() {
1499 if ($(this).val() == 'bar') {
1507 $('#download-chart').hide();
1510 [% IF results && !errors %]
1511 $('#draw-chart').click(function() {
1513 var x_elements = $('select[name="x"]').val();
1514 var y_elements = [];
1519 headers = [% header_row.json | $raw %];
1522 [% IF allresults.size %]
1523 if ($('input[name="chart-include-all"]').prop('checked')) {
1524 results = [% allresults.json | $raw %]
1527 results = [% results.json | $raw %]
1530 results = [% results.json | $raw %];
1533 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1534 results.splice(-1, 1);
1537 $('select[name="y"]').each(function( index ) {
1538 y_elements.push( $(this).val() );
1540 $('select[name="group"]').each(function( index ) {
1541 groups.push( $(this).val() );
1543 $('.column-line').each(function( index ) {
1544 if ($(this).prop('checked')) {
1545 lines.push( $(this).attr('name') );
1549 // Remove deleted columns from headers and results.
1550 var deleted_indexes = [];
1551 var kept_headers = [];
1552 $.each(headers, function(index, value) {
1553 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1554 // This header is neither a x element nor in y elements. Don't need it.
1555 deleted_indexes.push(index);
1558 kept_headers.push({cell: value.cell});
1562 // Remove coresponding cells.
1563 var kept_results = [];
1564 $.each(results, function(index, value) {
1567 $.each(value.cells, function(i, val) {
1568 if ($.inArray(i, deleted_indexes) === -1) {
1569 line['cells'].push({cell: val.cell});
1572 kept_results.push(line);
1575 options.type = $('select[name="chart-type"]').val();
1576 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1577 options.lines = lines;
1579 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1580 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1581 $("#toggle_chart_settings_vis").hide();
1582 $("#chartModal").modal("hide");
1586 load_group_subgroups();
1589 $('[data-toggle="tooltip"]').tooltip();
1590 var columns_settings = [% TablesSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1592 $('#limit').change(function() {
1593 $('#limitselect').submit();
1596 $(document).click(function() {
1597 $('#report_updated').hide();
1600 $(".goback").on("click",function(e){
1602 window.history.back();
1605 $("body").on("click", ".mana_search_button", function(){
1606 $("#mana-loading").show();
1607 mana_search($("#mana_search_field").val());
1610 $(".ShareButton").on("click", function(){
1611 $("#note-error").hide();
1612 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1613 $(".shared_infos").hide();
1614 $("#note-error").show();
1617 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1618 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1619 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1620 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1621 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1622 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1623 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1627 $("#ManaCloseButton").on("click", function() {
1628 $(".shared_infos").show();
1631 $("#addColumn").on("click",function(){
1635 $("#delColumn").on("click",function(){
1640 var rtable = KohaTable("table_reports", {
1641 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1642 'bAutoWidth': false,
1643 'sPaginationType': 'full',
1644 'aaSorting': [[ 1, "asc" ]],
1646 { "visible": false, "aTargets" : [ "hidden" ] }
1649 'sZeroRecords': _("No matching reports found")
1651 }, columns_settings);
1653 var rtabs = $("#tabs").tabs({
1654 create: function( e, ui ){
1655 tabsInit( ui, rtable );
1657 activate: function( e, ui ){
1658 tabsInit( ui, rtable );
1662 $("#tabs").tabs("option","active", activeTab );
1664 $("#subgroup_filter_block").hide();
1666 $("#subgroup_filter").change(function() {
1667 var selected = $(this).find('option:selected');
1668 var sg_id = $(selected).val();
1669 var sg_name = $(selected).text();
1670 if (sg_id.length > 0) {
1671 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1672 rtable.fnSetColumnVis(5, false);
1674 rtable.fnFilter('', 5);
1675 rtable.fnSetColumnVis(5, true);
1679 $("#reports_form").submit(function(){
1680 var checkedItems = $("input[name=ids]:checked");
1681 if ($(checkedItems).size() == 0) {
1682 alert(_("You must select one or more reports to delete"));
1685 $(checkedItems).parents('tr').addClass("warn");
1686 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1689 $(checkedItems).parents('tr').removeClass("warn");
1694 $("body").on("click", ".update_sql", function(e){
1696 var ltitle = $(this).text();
1697 var report_id = $(this).data("report_id");
1698 var page = $(this).attr("href");
1699 $("#update_sql .modal-body").load(page + " div", function(){
1700 var diff1 = $("#col1 .show_sql").text();
1701 var diff2 = $("#col2 .show_sql").text();
1702 var diffs = diffString( escape(diff1), escape(diff2) );
1703 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1705 $('#update_sql').modal('show');
1706 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1709 $("#update_sql").on("hidden.bs.modal", function(){
1710 $("#update_sql_label").html("");
1711 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1715 [% IF ( showsql ) %]
1716 $("#sql").focus(function() {
1721 $(".toggle_sql").click(function(){
1722 $("#sql_output").toggle();
1723 $("#toggle_sql_hid").toggle();
1724 $("#toggle_sql_vis").toggle();
1726 showsql = CodeMirror.fromTextArea(sql, {
1735 $(".toggle_chart_settings").click(function(){
1736 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1739 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1740 $(this).parents('tr').attr("class","warn");
1741 if(confirm(_("Are you sure you want to delete this saved report?"))){
1744 $(this).parents('tr').attr("class","");
1749 [% IF (create || editsql || save) %]
1751 var validated_form = $("#sql_report_form").validate({
1752 reportname: "required",
1755 depends: function(element) {
1756 return $("#create_group").prop("checked") && $("#groupdesc_input").val() != '';
1762 depends: function(element) {
1763 return $("#create_group").prop("checked") && $("#group_input").val() != '';
1769 $("#select_group").change(function() {
1770 if($(this).prop('checked')) {
1771 $("#group_input").attr("class","").prop('disabled', true).prop("required", false);
1772 $("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false);
1773 $("#group_select").prop('disabled', false);
1774 clearValidation( $("#sql_report_form") );
1775 if ($("#group_select").val().length > 0) {
1776 $("#select_subgroup").prop('checked', true);
1777 $("#select_subgroup").change();
1778 $("#subgroup, #subgroup *").show();
1780 $("#subgroup").hide();
1784 $("#create_group").change(function() {
1785 if($(this).prop('checked')) {
1786 $("#group_input").prop('disabled', false).prop("required", true );
1787 $("#groupdesc_input").prop('disabled', false).prop("required", true );
1788 $("#group_select").prop('disabled', true);
1789 // $("#create_subgroup").prop('checked', true).change();
1790 $("#subgroup_select").hide();
1791 $("#subgroup input[type='radio']").hide();
1792 $("#subgroup label[for]").hide();
1793 $("#subgroup_input").prop("required", false ).prop("disabled", false).show();
1794 $("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show();
1795 $("#subgroup").show();
1796 // Add validation rules for fields which were previously hidden
1797 $("#subgroup_input").rules("add", {
1799 depends: function(element) {
1800 return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != '';
1804 $("#subgroupdesc_input").rules("add", {
1806 depends: function(element) {
1807 return $("#create_group").prop("checked") && $("#subgroup_input").val() != '';
1813 $("#select_subgroup").change(function() {
1814 if($(this).prop('checked')) {
1815 $("#subgroup_select").prop('disabled', false);
1816 $("#subgroup_input").prop('disabled', true).prop("required", false );
1817 $("#subgroupdesc_input").prop('disabled', true).prop("required", false );
1818 clearValidation( $("#sql_report_form") );
1821 $("#create_subgroup").change(function() {
1822 if($(this).prop('checked')) {
1823 $("#subgroup_input").prop('disabled', false).prop("required", true );
1824 $("#subgroupdesc_input").prop('disabled', false).prop("required", true );
1825 $("#subgroup_select").val("").prop('disabled', true);
1828 $("#select_group").change();
1829 $("#select_subgroup").change();
1830 $("#group_select").on("change",function(){
1831 load_group_subgroups();
1835 $(".delete").on("click",function(){
1836 return confirmDelete(MSG_CONFIRM_DELETE);
1839 $("#mana_search_form").submit(function(e){
1843 $("#column_submit").submit(function() {
1844 if ($("#selectedColumns option").size() < 1) {
1845 alert(_("No columns selected!"));
1848 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1853 $("body").on("click", ".mana-use", function(e) {
1855 $(this).find("i").attr("class","fa fa-refresh fa-spin");
1856 mana_use( $(this).data("report_id") );
1859 $("#mana_search_result").on("hide.bs.modal", function(){
1860 $("#mana_result_content").html("");
1861 $("#mana_search_field").val("");
1864 $(".batch_op").on("click", function(e){
1866 var target_form = $(this).data("submit");
1867 $("#" + target_form ).submit();
1870 $("#batch_add_to_list").on("submit", function(e){
1875 $("body").on("click", ".preview_sql", function(e){
1877 var reportid = $(this).data("reportid");
1878 previewSql( reportid );
1882 function tabsInit( ui, rtable ){
1883 var thisTab = ui.newTab ? ui.newTab : ui.tab;
1884 var activeTab = thisTab.index();
1885 localStorage.setItem("sql_reports_activetab", activeTab );
1887 $("#subgroup_filter option").each(function() {
1888 if($(this).val().length > 0) {
1892 rtable.fnFilter('', 4);
1893 rtable.fnFilter('', 5);
1894 rtable.fnSetColumnVis(4, true);
1895 rtable.fnSetColumnVis(5, true);
1897 var g_id = $(ui.newTab).children().attr('id');
1898 var g_name = $(ui.newTab).text();
1899 if ( g_name == _("All") ) {
1904 if (g_id && g_id.length > 0) {
1905 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1906 rtable.fnSetColumnVis(4, false);
1907 for(var i in group_subgroups[g_id]) {
1908 $("#subgroup_filter").append(
1909 '<option value="' + group_subgroups[g_id][i][0] + '">'
1910 + group_subgroups[g_id][i][1] + '</option>'
1913 $("#subgroup_filter_block").show();
1915 $("#subgroup_filter_block").hide();
1919 function addColumn() {
1920 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1922 function delColumn() {
1923 $("#selectedColumns option:selected").remove();
1927 function mana_use( mana_id ){
1930 url: "/cgi-bin/koha/svc/mana/use",
1931 data: {id:mana_id, resource: 'report', saveinbase: 1},
1934 .done( function (result){
1935 if ( result.errmsg ){
1936 alert( result.errmsg );
1939 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
1942 .fail(function( error ) {
1943 $(".mana_use_status").hide();
1944 $("#mana_use_errortext").html( error.status + " " + error.statusText );
1945 $("#mana_use_failed").show();
1946 $(".mana-use i").attr("class","fa fa-download");
1950 function mana_search( textquery ){
1951 $(".mana_search_status").hide();
1952 $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
1954 if ( status == "error" ) {
1955 $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
1956 $("#mana_search_failed").show();
1957 $("#mana-loading").hide();
1959 $(".mana_search_status").hide();
1960 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
1961 $("#mana-loading").hide();
1962 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
1963 "sPaginationType":"full",
1966 { "width": "35%", "targets": 1 }
1969 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
1970 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
1974 $(".showbutton").on("click", function(e){
1976 $(this).parent().hide();
1977 $(this).parent().next().show();
1980 $(".hidebutton").on("click", function(e){
1982 $(this).parent().hide();
1983 $(this).parent().prev().show();
1986 if($("td.dataTables_empty").length == 0){
1987 $("#mana_search_message").show();
1993 function addToList() {
1994 var biblionumbers = [];
1995 $(".bib_to_list").each(function() {
1996 var biblionumber = Number( $(this).val() );
1997 if( biblionumbers.indexOf( biblionumber ) < 0 ){
1998 biblionumbers.push( biblionumber );
2001 bibs = biblionumbers.join("/");
2002 var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
2003 window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
2007 // Adapted from https://gist.github.com/jnormore/7418776
2008 function previewSql(reportid) {
2011 var message = $("#previewSql" + reportid ).val();
2012 var title = $("#previewSql" + reportid ).data("title");
2013 if( $("#preview-sql-modal").length > 0) {
2014 $("#preview-sql-modal").remove();
2016 $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
2017 <div class="modal-dialog">\
2018 <div class="modal-content">\
2019 <div class="modal-header" style="min-height:40px;">\
2020 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
2021 <span aria-hidden="true">×</span>\
2023 <h4 class="modal-title">' + title + '</h4>\
2025 <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
2026 <div class="modal-footer">\
2027 <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>\
2028 <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>\
2029 <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>\
2030 <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>\
2031 <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>\
2032 <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>\
2038 $("#preview-sql-modal").modal('show');
2039 CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
2049 [% INCLUDE 'intranet-bottom.inc' %]
2051 [% BLOCK group_and_subgroup_selection %]
2053 <label>Report group:</label>
2054 <input type="radio" name="select_or_create_group"
2055 id="select_group" checked="checked" />
2056 <label for="select_group" style="float:none">Select</label>
2057 <select name="group" id="group_select">
2058 <option value="">(None)</option>
2059 [% FOREACH group IN groups_with_subgroups %]
2060 [% IF (group.selected) %]
2061 <option value="[% group.id | html %]" selected="selected">
2063 <option value="[% group.id | html %]">
2065 [% group.name | html %]
2069 <input type="radio" name="select_or_create_group" id="create_group" />
2070 <label for="create_group" style="float:none">or create:</label>
2071 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
2072 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
2075 <label>Report subgroup:</label>
2076 <input type="radio" name="select_or_create_subgroup"
2077 id="select_subgroup" checked="checked" />
2078 <label for="select_subgroup" style="float:none">Select</label>
2079 <select name="subgroup" id="subgroup_select">
2080 <option value="">(None)</option>
2081 [% FOREACH group IN groups_with_subgroups %]
2082 [% IF (group.selected) %]
2083 [% FOREACH subgroup IN group.subgroups %]
2084 [% IF (subgroup.selected) %]
2085 <option value="[% subgroup.id | html %]" selected="selected">
2087 <option value="[% subgroup.id | html %]">
2089 [% subgroup.name | html %]
2095 <input type="radio" name="select_or_create_subgroup"
2096 id="create_subgroup" />
2097 <label for="create_subgroup" style="float:none">or create</label>
2098 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
2099 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />