3 [% USE AuthorisedValues %]
6 [% USE TablesSettings %]
8 [% PROCESS 'i18n.inc' %]
12 [%- BLOCK area_name -%]
14 [%- CASE 'CIRC' -%]<span>Circulation</span>
15 [%- CASE 'CAT' -%]<span>Catalog</span>
16 [%- CASE 'PAT' -%]<span>Patrons</span>
17 [%- CASE 'ACQ' -%]<span>Acquisitions</span>
18 [%- CASE 'ACC' -%]<span>Accounts</span>
19 [%- CASE 'SER' -%]<span>Serials</span>
23 [% INCLUDE 'doc-head-open.inc' %]
27 Saved reports › [%- ELSIF ( create ) -%]
28 Create from SQL › [%- ELSIF ( showsql ) -%]
29 SQL view › Saved reports › [%- ELSIF ( execute ) -%]
30 Report [% name | html %] ([% id | html %]) › Saved reports › [%- ELSIF ( editsql ) -%]
31 Edit report [% reportname | html %] ([% id | html %]) › Saved reports › [%- END -%]
34 Build a report, step 1 of 6: Choose a module › [%- ELSIF ( build2 ) -%]
35 Build a report, step 2 of 6: Pick a report type › [%- ELSIF ( build3 ) -%]
36 Build a report, step 3 of 6: Select columns for display › [%- ELSIF ( build4 ) -%]
37 Build a report, step 4 of 6: Select criteria to limit on › [%- ELSIF ( build5 ) -%]
38 Build a report, step 5 of 6: Pick which columns to total › [%- ELSIF ( build6 ) -%]
39 Build a report, step 6 of 6: Select how you want the report ordered › [%- END -%]
40 Guided reports wizard › Reports › Koha
43 [% INCLUDE 'doc-head-close.inc' %]
44 [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
52 .cm-columnPlaceholder {
55 #mana_search_errortext {
56 font-family: monospace; font-weight: bold;
62 [% Asset.css("css/reports.css") | $raw %]
63 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
66 <body id="rep_guided_reports_start" class="rep">
67 [% WRAPPER 'header.inc' %]
68 [% INCLUDE 'circ-search.inc' %]
71 [% WRAPPER 'sub-header.inc' %]
72 [% WRAPPER breadcrumbs %]
73 [% WRAPPER breadcrumb_item %]
74 <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
76 [% WRAPPER breadcrumb_item %]
77 <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
79 [% IF ( showsql || editsql || execute ) %]
80 [% WRAPPER breadcrumb_item %]
81 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
85 [% WRAPPER breadcrumb_item bc_active= 1 %]
86 <span>Saved reports</span>
88 [% ELSIF ( create ) %]
89 [% WRAPPER breadcrumb_item bc_active= 1 %]
90 <span>Create from SQL</span>
92 [% ELSIF ( showsql ) %]
93 [% WRAPPER breadcrumb_item bc_active= 1 %]
94 [% reportname | html %] ([% id | html %])
96 [% ELSIF ( editsql ) %]
97 [% WRAPPER breadcrumb_item %]
98 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
100 [% WRAPPER breadcrumb_item bc_active= 1 %]
103 [% ELSIF ( execute ) %]
104 [% WRAPPER breadcrumb_item %]
105 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
107 [% WRAPPER breadcrumb_item bc_active= 1 %]
110 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
111 [% WRAPPER breadcrumb_item %]
112 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
114 [% WRAPPER breadcrumb_item bc_active= 1 %]
116 <span>Step 1 of 6: Choose a module</span>
117 [% ELSIF ( build2 ) %]
118 <span>Step 2 of 6: Pick a report type</span>
119 [% ELSIF ( build3 ) %]
120 <span>Step 3 of 6: Select columns for display</span>
121 [% ELSIF ( build4 ) %]
122 <span>Step 4 of 6: Select criteria to limit on</span>
123 [% ELSIF ( build5 ) %]
124 <span>Step 5 of 6: Pick which columns to total</span>
125 [% ELSIF ( build6 ) %]
126 <span>Step 6 of 6: Select how you want the report ordered</span>
127 [% END # /IF ( build1 ) %]
128 [% END # /WRAPPER breadcrumb_item %]
129 [% END # /IF ( saved1 ) %]
130 [% END # /WRAPPER breadcrumbs %]
131 [% END # /WRAPPER 'sub-header.inc' %]
133 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
134 <div class="modal-dialog">
135 <div class="modal-content">
136 <div class="modal-header">
137 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
138 <h3 id="update_sql_label">Update SQL</h3>
140 <div class="modal-body">
141 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
143 <div class="modal-footer">
144 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
145 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
147 </div> <!-- /.modal-content -->
148 </div> <!-- /.modal-dialog -->
149 </div> <!-- #update_sql -->
151 <div class="main container-fluid">
153 <div class="col-sm-10 col-sm-push-2">
156 [% INCLUDE "reports-toolbar.inc" %]
159 <h1>Guided reports</h1>
160 <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>
162 <h3>Build and run reports</h3>
164 [% IF ( CAN_user_reports_create_reports ) %]
165 <form action="/cgi-bin/koha/reports/guided_reports.pl">
166 <input type="hidden" name="phase" value="Build new" />
167 <input type="submit" name="submit" class="btn btn-primary" value="Build new" />
171 [% IF ( CAN_user_reports_execute_reports ) %]
172 <form action="/cgi-bin/koha/reports/guided_reports.pl">
173 <input type="hidden" name="phase" value="Use saved"/>
174 <input type="submit" name="submit" class="btn btn-primary" value="Use saved" />
178 [% IF ( CAN_user_reports_create_reports ) %]
179 <form action="/cgi-bin/koha/reports/guided_reports.pl">
180 <input type="hidden" name="phase" value="Create report from SQL"/>
181 <input type="submit" name="submit" class="btn btn-primary" value="Create report from SQL" />
185 <h3>Reports Dictionary</h3>
186 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
187 <form action="/cgi-bin/koha/reports/dictionary.pl">
188 <input type="hidden" name="phase" value="View Dictionary"/>
189 <input type="submit" name="submit" class="btn btn-primary" value="View dictionary" />
191 [% END # /IF (start) %]
193 [% IF report_converted %]
194 <div class="dialog message">
195 The report "[% report_converted | html %]" has been converted.
199 [% IF report_converted %]
200 <div class="dialog message">
201 The report "[% report_converted | html %]" has been converted.
206 <h1>Saved reports</h1>
207 [% IF ( savedreports ) %]
209 [% IF ( filters.date || filters.author || filters.keyword ) %]
211 <span class="filter">
212 [% IF ( filters.date ) %]
213 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
215 [% IF ( filters.author ) %]
216 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
218 [% IF ( filters.keyword ) %]
219 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
221 <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>
226 [% WRAPPER tabs id= "tabs" %]
227 [% WRAPPER tabs_nav %]
228 [% WRAPPER tab_item tabname= "reports" bt_active= 1 %] <span>All</span> [% END %]
229 [% FOREACH group IN groups_with_subgroups %]
230 [% WRAPPER tab_item tabname= group.id %] <span>[% group.name | html %]</span> [% END %]
232 [% END # /WRAPPER tabs_nav %]
234 [% WRAPPER tab_panels %]
235 [% WRAPPER tab_panel tabname="reports" bt_active= 1 %]
237 <div id="subgroup_filter_block">
238 <label for="subgroup_filter">Subgroup:</label>
239 <select id="subgroup_filter">
240 <option value="">All</option>
244 [% IF (Koha.Preference('Mana') == 1) %]
246 <div id="mana_search_message" class="dialog message">
247 <p> [% manamsg | html %] </p>
252 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
253 <input type="hidden" name="phase" value="Delete Multiple" />
254 <table id="table_reports">
257 <th class="NoSort"> </th>
265 <th>Creation date</th>
268 <th class="report_public">Public</th>
269 <th class="report_json_url">JSON URL</th>
271 <th>Cache expiry (seconds)</th>
273 <th class="NoVisible">Cache expiry (seconds)</th>
275 <th>Saved results</th>
276 [% IF has_obsolete_reports %]
279 <th class="NoVisible">Update</th>
281 <th class="NoSort noExport">Actions</th>
285 [% FOREACH savedreport IN savedreports %]
286 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
287 <td class="report_checkbox">
288 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
289 <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
291 <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
293 <td class="report_id">
294 <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
296 <td class="report_name">
297 [% IF ( savedreport.report_name ) %]
298 [% savedreport.report_name | html %]
303 <td class="report_type">
304 [% savedreport.type | html %]
306 <td class="report_group">
307 [% savedreport.groupname | html %]
310 [% savedreport.subgroupname | html %]
312 <td class="report_notes">
313 [% savedreport.notes | html %]
316 [%- savedreport.borrowersurname | html -%][%- IF ( savedreport.borrowerfirstname ) -%], [%- savedreport.borrowerfirstname | html -%][%- END -%]
317 ([% savedreport.borrowernumber | html %])
319 <td data-order="[% savedreport.date_created | html %]">
320 [% savedreport.date_created | $KohaDates %]
322 <td data-order="[% savedreport.last_modified | html %]">
323 [% savedreport.last_modified | $KohaDates with_hours => 1 %]
325 <td data-order="[% savedreport.last_run | html %]">
326 [% savedreport.last_run | $KohaDates with_hours => 1 %]
328 <td class="report_public">
329 [% IF (savedreport.public) %]
335 <td class="report_json_url">
336 [% IF (savedreport.public) %]
337 <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>
339 <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>
343 [% savedreport.cache_expiry | html %]
346 [% FOR result IN savedreport.results %]
347 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
352 [% IF savedreport.seems_obsolete %]
353 This report seems obsolete, it uses biblioitems.marcxml field.
354 <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>
358 <div class="btn-group dropup">
359 [%# There should be no space between these two buttons, it would render badly %]
360 <a class="btn btn-default btn-xs" role="button"
361 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
362 class="fa fa-play"></i> Run</a><a
363 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
364 href="#"><b class="caret"></b></a>
365 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
366 <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>
368 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
369 <i class="fa fa-eye"></i> Preview SQL
372 [% IF ( CAN_user_reports_create_reports ) %]
373 <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>
374 <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>
376 [% IF (Koha.Preference('Mana') == 1) %]
377 <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>
379 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
380 [% IF ( CAN_user_reports_delete_reports ) %]
381 <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>
385 <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
392 [% IF ( CAN_user_reports_delete_reports ) %]
393 <fieldset class="action">
394 <input type="submit" class="btn btn-primary" value="Delete selected" />
398 [% END # /tab_panel# %]
399 [% END # /WRAPPER tab_panels %]
400 [% END # /WRAPPER tabs %]
405 [% ELSE # IF ( savedreports ) %]
406 <div class="dialog message">
407 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
408 <h4>No saved reports match your criteria. </h4>
409 [% IF ( CAN_user_reports_create_reports ) %]
410 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
411 <input type="hidden" name="phase" value="Build new" />
412 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
415 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
416 <input type="hidden" name="phase" value="Create report from SQL" />
417 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
420 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
421 <input type="hidden" name="phase" value="Use saved" />
422 <input type="hidden" name="filter_set" value="1" />
423 <input type="hidden" name="filter_keyword" value="" />
424 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
428 <h4>There are no saved reports. </h4>
429 [% IF ( CAN_user_reports_create_reports ) %]
430 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
432 [% END # IF (filter_set || filters.date || filters.author || filters.keyword) %]
433 </div> <!-- /.dialog.message -->
434 [% END # /IF ( savedreports ) %]
435 [% END # /IF ( saved1 ) %]
437 [% INCLUDE 'mana/mana-share-report.inc' %]
440 [% IF ( cache_error) %]
441 <div class="dialog alert">
442 <strong> Please choose a cache_expiry less than 30 days </strong>
446 <h1>Build a report</h1>
447 <form action="/cgi-bin/koha/reports/guided_reports.pl">
448 <fieldset class="rows">
449 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
452 <label for="area">Choose: </label>
453 <select name="area" id="area">
454 [%- FOREACH area IN areas -%]
455 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
461 <label for="public">Report is public:</label>
462 <select id="public" name="public">
463 <option value="0">No (default)</option>
464 <option value="1" selected="selected">Yes</option>
469 <label for="public">Report is public:</label>
470 <select id="public" name="public">
471 <option value="0" selected="selected">No (default)</option>
472 <option value="1">Yes</option>
479 <label for="cache_expiry">Cache expiry:</label>
480 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
481 <select id="cache_expiry_units" name="cache_expiry_units">
482 <option value="seconds">Seconds (default)</option>
483 <option value="minutes">Minutes</option>
484 <option value="hours">Hours</option>
485 <option value="days">Days</option>
490 </fieldset> <!-- /.rows -->
491 <fieldset class="action">
492 <input type="hidden" name="phase" value="Report on this Area" />
493 <input type="submit" name="submit" value="Next >>" />
499 <h1>Build a report</h1>
500 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
501 <input type="hidden" name="area" value="[% area | html %]" />
502 <input type="hidden" name="public" value="[% public | html %]" />
503 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
504 <fieldset class="rows">
505 <legend>Step 2 of 6: Pick a report type</legend>
508 <label for="types">Choose: </label>
509 <select id="types" name="types">
510 <option value="1">Tabular</option>
511 <option value="2" disabled="disabled">Summary</option>
512 <option value="3" disabled="disabled">Matrix</option>
518 <fieldset class="action">
519 <input type="hidden" name="phase" value="Choose this type" />
520 <input type="button" name="back" value="<< Back" class="goback" />
521 <input type="submit" name="submit" value="Next >>" />
524 [% END # /IF (build2 ) %]
527 <h1>Build a report</h1>
528 <h3>Step 3 of 6: Select columns for display</h3>
529 <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>
531 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
532 <input type="hidden" name="area" value="[% area | html %]" />
533 <input type="hidden" name="type" value="[% type | html %]" />
534 <input type="hidden" name="public" value="[% public | html %]" />
535 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
538 <div class="col-sm-6">
539 <div style="float: left;">
540 <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
541 [% FOREACH column IN columns %]
542 [% IF ( column.table ) %]
543 [% IF ( loop.first ) %]
547 <optgroup label="[% column.table | html %]">
549 <option value="[% column.name | html %]">
550 [% IF ( column.description ) %]
551 [% column.description | html %] / [% column.name | html %]
553 [% column.name | html %]
561 <div style="width: 6.3em; float: right; margin-top: 100px">
562 <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
563 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
565 </div> <!-- /.col-sm-6 -->
567 <div class="col-sm-6">
568 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
571 </div> <!-- /.row -->
573 <fieldset class="action">
574 <input type="hidden" name="phase" value="Choose these columns" />
575 <input type="button" name="back" value="<< Back" class="goback" />
576 <input type="submit" name="submit" value="Next >>" />
578 </form> <!-- /#column_submit -->
579 [% END # /IF ( build3 ) %]
582 <h1>Build a report</h1>
583 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
584 <input type="hidden" name="area" value="[% area | html %]" />
585 <input type="hidden" name="type" value="[% type | html %]" />
586 <input type="hidden" name="column" value="[% column | html %]" />
587 <input type="hidden" name="public" value="[% public | html %]" />
588 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
590 <legend>Step 4 of 6: Select criteria to limit on</legend>
592 [% FOREACH criteri IN criteria %]
595 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
596 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
598 [% IF ( criteri.date ) %]
600 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="flatpickr" />
601 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
605 [% IF ( criteri.textrange ) %]
608 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
609 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
613 [% IF ( criteri.daterange ) %]
616 <input type="text" size="10" id="from_[% criteri.name.remove('\.') | html %]_value" name="from_[% criteri.name | html %]_value" value="" data-date_to="to_[% criteri.name.remove('\.') | html %]_value" class="flatpickr" />
618 <input type="text" size="10" id="to_[% criteri.name.remove('\.') | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="flatpickr" />
619 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
624 <select name="[% criteri.name | html %]_value">
625 [% FOREACH value IN criteri.values %]
626 <option value="[% value.availablevalues | html %]">
627 [% IF ( value.default ) %]
630 [% value.display_value | html %]
644 [% IF ( definitions ) %]
646 <legend>Dictionary definitions</legend>
648 [% FOREACH definition IN definitions %]
651 <input type="checkbox" name="definition" value="[% definition.id | html %]" />
652 [% definition.name | html %]
660 <fieldset class="action">
661 <input type="hidden" name="phase" value="Choose these criteria" />
662 <input type="button" name="back" value="<< Back" class="goback" />
663 <input type="submit" name="submit" value="Next >>" />
666 [% END # /IF ( build4 ) %]
669 <h1>Build a report</h1>
670 <h3>Step 5 of 6: Pick which columns to total</h3>
671 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
672 <input type="hidden" name="area" value="[% area | html %]" />
673 <input type="hidden" name="type" value="[% type | html %]" />
674 <input type="hidden" name="column" value="[% column | html %]" />
675 <input type="hidden" name="definition" value="[% definition | html %]" />
676 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
677 <input type="hidden" name="public" value="[% public | html %]" />
678 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
681 [% FOREACH total_b IN total_by %]
684 <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
685 <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
688 <select name="[% total_b.name | html %]_tvalue">
689 [% FOREACH selec IN total_b.select %]
690 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
699 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
700 <input type="button" name="back" value="<< Back" class="goback" />
701 <input type="submit" name="submit" value="Next >>" />
704 [% END # /IF ( build5 ) %]
707 <h1>Build a report</h1>
708 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
709 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
710 <input type="hidden" name="area" value="[% area | html %]" />
711 <input type="hidden" name="type" value="[% type | html %]" />
712 <input type="hidden" name="column" value="[% column | html %]" />
713 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
714 <input type="hidden" name="definition" value="[% definition | html %]" />
715 <input type="hidden" name="totals" value="[% totals | html %]" />
716 <input type="hidden" name="public" value="[% public | html %]" />
717 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
720 [% FOREACH order_b IN order_by %]
723 <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
724 <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
727 <select name="[% order_b.name | html %]_ovalue">
728 [% FOREACH selec IN order_b.select %]
729 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
737 <fieldset class="action">
738 <input type="hidden" name="phase" value="Build report" />
739 <input type="submit" name="submit" class="btn btn-primary" value="Finish" />
742 [% END #/ IF ( build6 ) %]
744 [% IF ( showreport ) %]
745 <h1>Confirm custom report</h1>
746 <p>Your report will be generated with the following SQL statement.</p>
751 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
752 <input type="hidden" name="sql" value="[% sql | html %]" />
753 <input type="hidden" name="type" value="[% type | html %]" />
754 <input type="hidden" name="public" value="[% public | html %]" />
755 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
756 <p>You will need to save the report before you can execute it</p>
757 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
758 <input type="submit" name="submit" class="btn btn-primary" value="Next" />
761 [% END #/ IF ( showreport ) %]
764 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
765 <input type="hidden" name="sql" value="[% sql | html %]" />
766 <input type="hidden" name="type" value="[% type | html %]" />
767 <input type="hidden" name="area" value="[% area | html %]" />
768 <input type="hidden" name="public" value="[% public | html %]" />
769 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
770 <fieldset class="rows">
771 <legend><h1>Save your custom report</h1></legend>
774 <label for="reportname" class="required">Report name: </label>
775 <input type="text" id="reportname" name="reportname" class="required" required="required" />
776 <span class="required">Required</span>
778 [% PROCESS group_and_subgroup_selection %]
780 <label for="notes">Notes:</label>
781 <textarea name="notes" id="notes"></textarea>
785 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
786 <input type="submit" name="submit" class="btn btn-primary" value="Save report" />
789 [% END # /IF( save ) %]
791 [% IF ( warn_authval_problem ) %]
792 <div class="dialog alert">
793 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
794 [% FOREACH problematic_authval IN problematic_authvals %]
796 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
797 you selected does not exist.
800 <!-- Save Anyway Form -->
801 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
802 <!--Every parameter the user issued is provided as a hidden field for recovery-->
803 <input type='hidden' name='id' value='[% id | html %]' />
804 <input type='hidden' name='sql' value='[% sql | html %]' />
805 <input type='hidden' name='reportname' value='[% reportname | html %]' />
806 <input type='hidden' name='group' value='[% group | html %]' />
807 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
808 <input type='hidden' name='notes' value='[% notes | html %]' />
809 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
810 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
811 <input type='hidden' name='public' value='[% public | html %]' />
812 [% IF ( phase_update) %]
813 <input type='hidden' name='phase' value='Update SQL' />
814 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
815 [% ELSIF ( phase_save) %]
816 <input type='hidden' name='area' value='[% area | html %]' />
817 <input type='hidden' name='phase' value='Save Report' />
818 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
821 <!-- Go back to editing -->
822 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
823 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
826 [% END # /IF ( warn_authval_problem )%]
828 [% IF ( enter_params ) %]
829 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
830 <input type='hidden' name='reports' value="[% reports | html %]" />
831 [% IF ( auth_val_error ) %]
832 <input type='hidden' name='phase' value='Edit SQL' />
833 <div class="dialog alert">
834 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
835 [% FOREACH auth_val_error IN auth_val_errors %]
837 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
838 you selected does not exist.
842 <fieldset class="action"><input type="submit" class="btn btn-primary" value="Edit SQL" /></fieldset>
843 [% ELSE # IF ( auth_val_error ) %]
844 <input type='hidden' name='phase' value='Run this report' />
845 <h1>Enter parameters for report [% name | html %]:</h1>
847 <p>[% notes | html %]</p>
849 <fieldset class="rows">
851 [% FOREACH sql_param IN sql_params %]
852 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
853 [% IF sql_param.input == 'date' %]
855 <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="flatpickr" />
857 [% ELSIF ( sql_param.input == 'text' ) %]
859 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
860 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
862 [% ELSIF ( sql_param.input == 'textarea' ) %]
864 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
865 <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
869 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
870 <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]">
871 [% IF (sql_param.include_all) %]
872 <option value="%">All</option>
874 [% FOREACH value IN sql_param.input.values %]
875 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
879 [% END # /IF sql_param.input == 'date' %]
880 [% END # /FOREACH sql_param %]
882 </fieldset> <!-- /.rows -->
883 <fieldset class="action">
884 <input type="submit" class="btn btn-primary" value="Run the report" />
886 [% END # / IF ( auth_val_error ) %]
888 [% END # /IF ( enter_params ) %]
891 <h1>[% name | html %] <span class="report_heading_id"><span class="report_label">Report ID:</span> <span class="report_number">[% id | html %]</span></span></h1>
892 <div class="page-section">
894 <p><span class="label">Notes:</span> [% notes | html %]</p>
896 [% IF ( unlimited_total ) %]
898 <span class="label">Total number of results:</span>
899 [% unlimited_total | html %]
900 [% IF unlimited_total >= limit %]
901 ([% results.size | html %] shown)
906 <div id="sql_output" style="display:none;">
907 <span class="label">Report SQL:</span>
908 <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
912 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
913 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
915 <div id="chart" class="clearfix"></div>
918 [% UNLESS ( errors ) %]
919 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification" target="_blank">
920 <input type="hidden" name="recordtype" value="biblio" />
921 <input type="hidden" name="op" value="list" />
922 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
923 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
924 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
928 <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion" target="_blank">
929 <input type="hidden" name="recordtype" value="biblio" />
930 <input type="hidden" name="op" value="list" />
931 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
932 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
933 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
937 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification" target="_blank">
938 <input type="hidden" name="op" value="show" />
939 [% FOREACH result IN results %]
940 [% FOREACH cells IN result.cells %]
941 [% place = loop.index %]
942 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
943 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
944 [% SET batch_itemnumbers = 1 %]
945 [% SET header_row.$place.has_itemnumbers = 1 %]
946 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
952 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion" target="_blank">
953 <input type="hidden" name="op" value="show" />
954 <input type="hidden" name="del" value="1" />
955 [% FOREACH result IN results %]
956 [% FOREACH cells IN result.cells %]
957 [% place = loop.index %]
958 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
959 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
960 [% SET batch_itemnumbers = 1 %]
961 [% SET header_row.$place.has_itemnumbers = 1 %]
962 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
968 <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list" target="_blank">
969 [% FOREACH result IN results %]
970 [% FOREACH cells IN result.cells %]
971 [% place = loop.index %]
972 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
973 [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
974 [% SET batch_biblionumbers = 1 %]
975 [% SET header_row.$place.has_biblionumbers = 1 %]
976 <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
982 <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification" target="_blank">
983 <input type="hidden" name="op" value="show" />
984 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
985 <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
986 [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
990 [% BLOCK batch_list %]
991 [%- FOREACH result IN results %]
992 [%- FOREACH cells IN result.cells %]
993 [%- place = loop.index %]
994 [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
995 [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
1001 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1002 <input type="hidden" name="phase" value="Run this report"/>
1003 <input type="hidden" name="reports" value="[% report_id | html %]"/>
1004 [% FOREACH p IN sql_params %]
1005 <input type="hidden" name="sql_params" value="[% p | html %]"/>
1007 [% FOREACH n IN param_names %]
1008 <input type="hidden" name="param_name" value="[% n | html %]"/>
1010 <input type="hidden" name="limit" id="limit" value="20" />
1011 </form> <!-- /#limitselect -->
1013 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) || ( unlimited_total > 10 && limit <= 1000 ) %]
1014 <div id="toolbar" class="btn-toolbar">
1015 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1016 <div class="btn-group">
1017 <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
1018 Batch operations with [% IF unlimited_total >= limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
1019 <span class="caret"></span>
1021 <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
1022 [% FOREACH header_ro IN header_row %]
1023 [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1024 <li class="dropdown-header">Bibliographic records</li>
1026 <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>
1029 <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>
1032 <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>
1035 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
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 <li class="dropdown-header">Patron records</li>
1047 <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>
1050 [% END # /FOREACH header_ro %]
1051 </ul> <!-- /.dropdown-menu -->
1052 </div> <!-- /.dropdown -->
1053 [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1055 [% IF ( unlimited_total > 10 && limit <= 1000 ) %]
1056 <div class="btn-group">
1057 <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
1059 Rows per page: <strong>[% limit | html %]</strong>
1063 <span class="caret"></span>
1065 <ul class="dropdown-menu">
1066 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1067 [% FOREACH l IN limits %]
1070 <a class="limitselect" data-limit="[% l | html %]" href="#"><i class="fa fa-fw fa-check"></i> [% l | html %]</a>
1074 <a class="limitselect" data-limit="[% l | html %]" href="#"><i class="fa fa-fw"></i> [% l | html %]</a>
1080 [% END # /IF ( unlimited_total > 10 && limit <= 1000 ) %]
1082 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1083 <a href="#" class="btn btn-link" id="toggle_auto_links">
1084 <i class="fa fa-eye autolink" style="display:none"></i>
1085 <i class="fa fa-eye-slash autolink"></i>
1086 <span class="autolink" style="display:none">Show data menus</span>
1087 <span class="autolink">Hide data menus</span>
1090 </div> <!-- /#toolbar.btn-toolbar -->
1091 [% END # /IF batch operations || ( unlimited_total > 10 && limit <= 1000 ) %]
1094 [% pagination_bar | $raw %]
1097 [% END # UNLESS ( errors ) %]
1098 [% END # IF ( execute ) %]
1100 [% UNLESS ( errors ) %]
1101 <table id="report_results">
1104 [% FOREACH header_ro IN header_row %]
1105 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1106 <th class="itemnumber">[% header_ro.cell | html %]</th>
1107 [% ELSIF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1108 <th class="biblionumber">[% header_ro.cell | html %]</th>
1109 [% ELSIF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1110 <th class="cardnumber">[% header_ro.cell | html %]</th>
1111 [% ELSIF header_ro.cell == 'borrowernumber' || header_types.item( header_ro.cell ) == 'borrowernumber' %]
1112 <th class="borrowernumber">[% header_ro.cell | html %]</th>
1114 <th>[% header_ro.cell | html %]</th>
1120 [% FOREACH result IN results %]
1122 [% FOREACH cells IN result.cells %]
1123 [% place = loop.index %]
1124 [%- IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
1125 <td class="batch-op itemnumber" data-number="itemnumber">
1126 <span class="data-plain">[% cells.cell | $raw %]</span>
1127 <div id="itemnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
1128 <ul class="dropdown-menu pull-right" role="menu">
1129 <li><a target="_blank" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-pencil"></i> Edit record</a></li>
1130 <li role="separator" class="divider"></li>
1131 <li><a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-eye"></i> View record</a></li>
1135 [% ELSIF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
1136 <td class="batch-op biblionumber" data-number="biblionumber">
1137 <span class="data-plain">[% cells.cell | $raw %]</span>
1138 <div id="biblionumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
1139 <ul class="dropdown-menu pull-right" role="menu">
1140 <li><a target="_blank" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-pencil"></i> Edit record</a></li>
1141 <li role="separator" class="divider"></li>
1142 <li><a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View record</a></li>
1146 [% ELSIF header_row.$place.cell == 'borrowernumber' || header_types.item(header_row.$place.cell) == 'borrowernumber' %]
1147 <td class="batch-op borrowernumber" data-number="borrowernumber">
1148 <span class="data-plain">[% cells.cell | $raw %]</span>
1149 <div id="borrowernumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
1150 <ul class="dropdown-menu pull-right" role="menu">
1151 <li><a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View patron</a></li>
1152 <li role="separator" class="divider"></li>
1153 <li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-pencil"></i> Edit patron</a></li>
1154 <li role="separator" class="divider"></li>
1155 <li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li>
1159 [% ELSIF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %]
1160 <td class="batch-op cardnumber" data-number="cardnumber">
1161 <span class="data-plain">[% cells.cell | $raw %]</span>
1162 <div id="cardnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
1163 <ul class="dropdown-menu pull-right" role="menu">
1164 <li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li>
1170 [% cells.cell | $raw %]
1179 <div class="pages">[% pagination_bar | $raw %]</div>
1181 [% INCLUDE 'chart.inc' %]
1183 [% END #/IF ( execute ) %]
1186 <h1>Create from SQL</h1>
1187 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1188 <fieldset class="rows">
1189 <legend>Create report from SQL</legend>
1192 <label for="reportname" class="required">Report name:</label>
1193 [% IF ( reportname ) %]
1194 <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
1196 <input type="text" class="required focus" required="required" id="reportname" name="reportname" size="50" />
1198 <span class="required">Required</span>
1200 [% PROCESS group_and_subgroup_selection %]
1204 <label for="public">Report is public:</label>
1205 <select id="public" name="public">
1206 <option value="0">No (default)</option>
1207 <option value="1" selected="selected">Yes</option>
1212 <label for="public">Report is public:</label>
1213 <select id="public" name="public">
1214 <option value="0" selected="selected">No (default)</option>
1215 <option value="1">Yes</option>
1218 [% END # /IF (public) %]
1222 <label for="cache_expiry">Cache expiry:</label>
1223 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
1224 <select id="cache_expiry_units" name="cache_expiry_units">
1225 <option value="seconds" selected="selected">Seconds (default)</option>
1226 <option value="minutes">Minutes</option>
1227 <option value="hours">Hours</option>
1228 <option value="days">Days</option>
1231 [% END # /IF (usecache) %]
1233 <label for="notes">Notes:</label>
1234 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1237 </fieldset> <!-- /.rows -->
1239 <fieldset class="rows">
1240 <legend>SQL:</legend>
1241 <div style="margin:1em;">
1242 [% PROCESS insert_runtime_parameter %]
1243 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10" >[% sql | html %]</textarea>
1244 <span style='color:#383838; font-style:italic'>* In order to achieve auto-complete for columns, please prepend the column name with the table name, followed by a period. For example: 'borrowers.surname'</span>
1246 <span class="required">Required</span>
1250 <fieldset class="action">
1251 <input type="hidden" name="phase" value="Save Report" />
1252 <input type="submit" name="submit" class="btn btn-primary" value="Save report" />
1253 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1257 [% END #/IF ( create ) %]
1259 [% IF saved_results %]
1260 <h1>Saved report results</h1>
1261 <h2>[% name | html %]</h2>
1262 <p>[% notes | html %]</p>
1264 [% FOREACH rows IN saved_results %]
1266 [% FOREACH col IN rows %]
1267 <td>[% col | html %]</td>
1272 [% END # /IF saved_results %]
1274 [% IF ( showsql ) %]
1275 <h1>Saved reports - SQL</h1>
1276 <fieldset class="rows">
1277 <legend>[% reportname | html %]</legend>
1281 <span class="label">Notes:</span>
1287 <textarea id="sql">[% sql | html %]</textarea>
1291 [% END # /IF ( showsql ) %]
1293 [% IF ( save_successful ) %]
1294 [% UNLESS ( errors ) %]
1296 <div id="report_updated">
1297 <div class="dialog message">
1298 <p>Your report "[% reportname | html %]" has been saved</p>
1304 [% IF ( editsql ) %]
1305 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1306 <input type="hidden" name="id" value="[% id | html %]"/>
1307 <fieldset class="rows">
1308 <legend><h1>Edit SQL report</h1></legend>
1311 <label for="reportname" class="required">Report name: </label>
1312 <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1313 <span class="required">Required</span>
1315 [% PROCESS group_and_subgroup_selection %]
1318 <label for="public">Report is public:</label>
1319 <select id="public" name="public">
1320 <option value="0">No (default)</option>
1321 <option value="1" selected="selected">Yes</option>
1326 <label for="public">Report is public:</label>
1327 <select id="public" name="public">
1328 <option value="0" selected="selected">No (default)</option>
1329 <option value="1">Yes</option>
1332 [% END # /IF (public) %]
1336 <label for="cache_expiry">Cache expiry:</label>
1337 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
1338 <select id="cache_expiry_units" name="cache_expiry_units">
1339 <option value="seconds">Seconds (default)</option>
1340 <option value="minutes">Minutes</option>
1341 <option value="hours">Hours</option>
1342 <option value="days">Days</option>
1347 <label for="notes">Notes:</label>
1348 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1351 </fieldset> <!-- /.rows -->
1353 <fieldset class="rows">
1354 <legend>SQL:</legend>
1355 [% PROCESS insert_runtime_parameter %]
1356 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1357 <span style='color:#383838; font-style:italic'>* In order to achieve auto-complete for columns, please prepend the column name with the table name, followed by a period. For example: 'borrowers.surname'</span>
1359 <span class="required" style="margin-left:30px;">Required</span>
1362 <fieldset class="action">
1363 <button class="btn btn-primary" type="submit" name="phase" value="update_sql">Update SQL</button>
1364 <button class="btn btn-default" type="submit" name="phase" value="update_and_run_sql">Update and run SQL</button>
1365 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1368 [% END # /IF ( editsql ) %]
1371 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1372 <div class="dialog alert">
1373 <strong>The following error was encountered:</strong><br />
1374 [% FOREACH error IN errors %]
1375 [% IF ( error.sqlerr ) %]
1376 This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1377 Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1378 Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1379 [% ELSIF ( error.queryerr ) %]
1380 <span>The database returned the following error:</span> <br />
1381 [% error.queryerr | html %]<br />Please check the log for further details.
1382 [% ELSIF ( error.cache_expiry ) %]
1383 Please select a cache expiry less than 30 days.
1386 <div id="onerror_actions">
1387 <a href="#" class="button goback">Return to previous page</a>
1391 <fieldset class="action">
1392 <input type="hidden" name="phase" value="Use saved" />
1393 <input type="submit" name="submit" class="btn btn-primary" value="Saved reports" />
1396 [% END # /IF ( errors ) %]
1399 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1401 <div class="col-sm-2 col-sm-pull-10">
1404 <div id="saved-reports-filter">
1405 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1406 <input type="hidden" name="phase" value="Use saved" />
1407 <input type="hidden" name="filter_set" value="1" />
1408 <fieldset class="brief">
1412 <label for="filter_date">Date:</label>
1413 <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="flatpickr" />
1414 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1417 <label for="filter_author">Author:</label>
1418 <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1421 <label for="filter_keyword">Keyword:</label>
1422 <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1425 </fieldset> <!-- /.brief -->
1426 <fieldset class="action">
1427 <input type="submit" class="btn btn-primary" value="Apply filter" />
1428 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1431 </div> <!-- /#saved-reports-filter -->
1433 [% INCLUDE 'guided-reports-view.inc' %]
1435 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1436 </div> <!-- /.row -->
1438 <!-- Runtime Parameters Modal -->
1439 <div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel">
1440 <div class="modal-dialog" role="document">
1441 <div class="modal-content">
1442 <div class="modal-header">
1443 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1444 <h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4>
1446 <form id="send_runtime_parameter">
1447 <input type="hidden" name="param_category" id="param_category" />
1448 <div class="modal-body">
1449 <div class="form-group">
1450 <label for="paramLabel" class="required">Parameter label: </label>
1451 <input class="form-control required" type="text" name="paramLabel" id="paramLabel" required="required" />
1452 <div class="hint">The label for the field shown when the report is run, e.g. "Select a library."</div>
1454 <div id="authorised_value_category" class="form-group" style="display:none">
1455 <label for="authorised_value">Authorized value category:</label>
1456 <select class="form-control" name="authorised_value" id="authorised_value">
1457 <option value=""></option>
1458 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
1460 <div class="hint">Select which authorized value category the user will choose from.</div>
1462 </div> <!-- /.modal-body -->
1463 <div class="modal-footer">
1464 <button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button>
1465 <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
1466 </div> <!-- /.modal-footer -->
1467 </form> <!-- /#send_runtime_parameter -->
1468 </div> <!-- /.modal-content -->
1469 </div> <!-- /.modal-dialog -->
1470 </div> <!-- /#runtime_parameters -->
1472 [% MACRO jsinclude BLOCK %]
1473 [% Asset.js("js/charts.js") | $raw %]
1474 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1475 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1476 [% INCLUDE 'calendar.inc' %]
1477 [% INCLUDE 'datatables.inc' %]
1479 [% INCLUDE 'columns_settings.inc' %]
1481 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
1482 [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
1483 [% Asset.js( "lib/codemirror/sql.js" ) | $raw %]
1484 [% Asset.js( "lib/codemirror/show-hint.js" ) | $raw %]
1485 [% Asset.css("lib/codemirror/show-hint.css") | $raw %]
1486 [% Asset.js( "lib/codemirror/sql-hint.js" ) | $raw %]
1487 [% Asset.js( "lib/codemirror/highlight.js" ) | $raw %]
1488 [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1489 [% Asset.js( "js/mana.js" ) | $raw %]
1493 function hide_bar_element() {
1494 $('#chart-column-horizontal').hide()
1495 $('.chart-column-group').each(function( index ) {
1498 $('.chart-column-line').each(function( index ) {
1503 function show_bar_element() {
1504 $('#chart-column-horizontal').show()
1505 $('.chart-column-group').each(function( index ) {
1508 $('.chart-column-line').each(function( index ) {
1513 function removeColumn(id) {
1516 if ( $('.chart-column-conf').length == 1 ) {
1517 $('.chart-column-delete').remove();
1521 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1522 var group_subgroups = {};
1523 [% FOREACH group IN groups_with_subgroups %]
1524 var gid = "[% group.id | html %]"
1525 group_subgroups[gid] = new Array();
1526 [% FOREACH subgroup IN group.subgroups %]
1527 var sgid = "[% subgroup.id | html %]";
1528 var sgname = "[% subgroup.name | html %]";
1529 group_subgroups[gid].push([sgid, sgname]);
1533 [% IF ( create || editsql || save ) %]
1535 var editor = CodeMirror.fromTextArea(sql, {
1540 keyword: { // Custom highlighting for items bounded in [[ ]] or << >>.
1541 "\\[\\[(.*?)\\]\\]":"style1",
1542 "<<(.*?)>>":"style1"
1544 extraKeys: {"Tab": "autocomplete"}, //enable tab to accept auto-complete
1545 hint: CodeMirror.hint.sql,
1547 tables: [% To.json(tables) | $raw %]
1550 var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script
1573 "91": "left window key",
1574 "92": "right window key",
1579 "110": "decimal point",
1594 "145": "scrolllock",
1600 "192": "graveaccent",
1604 //Trigger auto-complete on all keys not in dictionary of exclusions above.
1605 editor.on("keyup", function(cm, e) {
1606 if (ExcludedTriggerKeys[e.keyCode] == undefined) {
1607 CodeMirror.commands.autocomplete(editor, null, { completeSingle: false });
1611 // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232
1612 function clearValidation( formElement ){
1613 // formElement should be a jQuery object
1614 var validator = formElement.validate();
1615 // Iterate through named elements inside of the form, and mark them as error free
1616 $('[name]',formElement).each(function(){
1617 validator.successList.push(this);//mark as error free
1618 validator.showErrors();//remove error messages if present
1620 validator.resetForm();//remove error class on name elements and clear history
1621 validator.reset();//remove all error and success data
1625 [% IF ( showsql ) %]
1627 var editor = CodeMirror.fromTextArea(sql, {
1632 keyword: { // Custom highlighting for items bounded in [[ ]] or << >>.
1633 "\\[\\[(.*?)\\]\\]":"style2",
1634 "<<(.*?)>>":"style1"
1639 function showParamModal( category ){
1640 var modal = $("#runtime_parameters");
1641 var modalTitle = $("#runtime_parametersLabel");
1642 switch ( category ){
1643 case "insertAuthVal":
1644 modalTitle.text( _("Insert authorized value parameter") );
1645 $("#paramLabel").val( _("Authorized value") );
1646 $("#authorised_value_category").show();
1647 $("label[for='authorised_value']").addClass("required");
1648 $("#authorised_value").prop("required", true ).attr("required", "required").addClass("required");
1650 case "insertCnSource":
1651 modalTitle.text( _("Insert classification source parameter") );
1652 $("#paramLabel").val( _("Source of classification or shelving scheme") );
1653 $("#param_category").val("cn_source");
1655 case "insertFramework":
1656 modalTitle.text( _("Insert bibliographic framework parameter") );
1657 $("#paramLabel").val( _("Framework") );
1658 $("#param_category").val("biblio_framework");
1661 modalTitle.text( _("Insert date parameter") );
1662 $("#paramLabel").val( _("Date") );
1663 $("#param_category").val("date");
1665 case "insertItemtypes":
1666 modalTitle.text( _("Insert item types parameter") );
1667 $("#paramLabel").val( _("Item type") );
1668 $("#param_category").val("itemtypes");
1670 case "insertBranches":
1671 modalTitle.text( _("Insert libraries parameter") );
1672 $("#paramLabel").val( _("Library") );
1673 $("#param_category").val("branches");
1675 case "insertCategorycode":
1676 modalTitle.text( _("Insert patron category parameter") );
1677 $("#paramLabel").val( _("Patron category") );
1678 $("#param_category").val("categorycode");
1680 case "insertCashregister":
1681 modalTitle.text( _("Insert cash register parameter") );
1682 $("#paramLabel").val( _("Cash register") );
1683 $("#param_category").val("cash_registers");
1685 case "insertDebittypes":
1686 modalTitle.text( _("Insert debit type parameter") );
1687 $("#paramLabel").val( _("Debit type") );
1688 $("#param_category").val("debit_types");
1690 case "insertCredittypes":
1691 modalTitle.text( _("Insert credit type parameter") );
1692 $("#paramLabel").val( _("Credit type") );
1693 $("#param_category").val("credit_types");
1696 modalTitle.text( _("Insert list parameter") );
1697 $("#paramLabel").val( _("List of values") );
1698 $("#param_category").val("list");
1701 modalTitle.text( _("Insert text parameter") );
1702 $("#paramLabel").val( _("Text") );
1703 $("#param_category").val("");
1706 $("#paramLabel").select();
1707 modal.modal("show");
1710 function load_group_subgroups () {
1711 var group = $("#group_select").val();
1712 var subgroup = $("#subgroup_select").val();
1713 var sg = $("#subgroup");
1714 $(sg).find('option[value!=""]').each(function() {
1719 var select = $(sg).find('select')[0];
1720 $.each( group_subgroups[group], function(index, value) {
1721 if ( value[0] == subgroup ) {
1722 $('<option selected="selected" value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1724 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1727 $("#subgroup, #subgroup *").show();
1731 $(document).ready(function(){
1733 var activeTab = localStorage.getItem("sql_reports_activetab");
1735 $("body").on('click',".fetch_chart_data",function(){
1736 if( [% unlimited_total || 0 | $raw %] > 1000 ){
1737 if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){
1748 if ( $('.chart-column-conf').length == 1 ) {
1749 $('.chart-column-delete').remove();
1752 $(".chart-column-delete").on('click', function(e){
1754 removeColumn('column_' + $(this).data('column'));
1757 $('#download-chart').click(function() {
1758 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1759 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1760 this.setAttribute('download', 'chart.svg');
1763 $('#chart-type').change(function() {
1764 if ($(this).val() == 'bar') {
1772 $('#download-chart').hide();
1775 [% IF results && !errors %]
1776 $('#draw-chart').click(function() {
1778 var x_elements = $('select[name="x"]').val();
1779 var y_elements = [];
1784 headers = [% header_row.json | $raw %];
1787 [% IF allresults.size %]
1788 if ($('input[name="chart-include-all"]').prop('checked')) {
1789 results = [% allresults.json | $raw %]
1792 results = [% results.json | $raw %]
1795 results = [% results.json | $raw %];
1798 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1799 results.splice(-1, 1);
1802 $('select[name="y"]').each(function( index ) {
1803 y_elements.push( $(this).val() );
1805 $('select[name="group"]').each(function( index ) {
1806 groups.push( $(this).val() );
1808 $('.column-line').each(function( index ) {
1809 if ($(this).prop('checked')) {
1810 lines.push( $(this).attr('name') );
1814 // Remove deleted columns from headers and results.
1815 var deleted_indexes = [];
1816 var kept_headers = [];
1817 $.each(headers, function(index, value) {
1818 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1819 // This header is neither a x element nor in y elements. Don't need it.
1820 deleted_indexes.push(index);
1823 kept_headers.push({cell: value.cell});
1827 // Remove coresponding cells.
1828 var kept_results = [];
1829 $.each(results, function(index, value) {
1832 $.each(value.cells, function(i, val) {
1833 if ($.inArray(i, deleted_indexes) === -1) {
1834 line['cells'].push({cell: val.cell});
1837 kept_results.push(line);
1840 options.type = $('select[name="chart-type"]').val();
1841 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1842 options.lines = lines;
1844 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1845 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1846 $("#toggle_chart_settings_vis").hide();
1847 $("#chartModal").modal("hide");
1851 load_group_subgroups();
1854 $('[data-toggle="tooltip"]').tooltip();
1856 $('#limit').change(function() {
1857 $('#limitselect').submit();
1860 $(document).click(function() {
1861 $('#report_updated').hide();
1864 $(".goback").on("click",function(e){
1866 window.history.back();
1869 $("body").on("click", ".mana_search_button", function(){
1870 $("#mana-loading").show();
1871 mana_search($("#mana_search_field").val());
1874 $(".ShareButton").on("click", function(){
1875 $("#note-error").hide();
1876 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1877 $(".shared_infos").hide();
1878 $("#note-error").show();
1881 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1882 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1883 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1884 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1885 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1886 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1887 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1891 $("#ManaCloseButton").on("click", function() {
1892 $(".shared_infos").show();
1895 $("#addColumn").on("click",function(){
1899 $("#delColumn").on("click",function(){
1904 var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1905 var rtable = KohaTable("table_reports", {
1906 'bAutoWidth': false,
1907 'sPaginationType': 'full',
1908 'aaSorting': [[ 1, "asc" ]],
1910 'sZeroRecords': _("No matching reports found")
1914 $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
1915 tabsInit( $(e.target).parent(), rtable );
1919 $("#tabs li:eq(" + activeTab + ") a").tab("show");
1922 $("#subgroup_filter").change(function() {
1923 var selected = $(this).find('option:selected');
1924 var sg_id = $(selected).val();
1925 var sg_name = $(selected).text();
1926 if (sg_id.length > 0) {
1927 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1928 rtable.fnSetColumnVis(5, false);
1930 rtable.fnFilter('', 5);
1931 rtable.fnSetColumnVis(5, true);
1935 $("#reports_form").submit(function(){
1936 var checkedItems = $("input[name=ids]:checked");
1937 if ($(checkedItems).size() == 0) {
1938 alert(_("You must select one or more reports to delete"));
1941 $(checkedItems).parents('tr').addClass("warn");
1942 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1945 $(checkedItems).parents('tr').removeClass("warn");
1950 $("body").on("click", ".update_sql", function(e){
1952 var ltitle = $(this).text();
1953 var report_id = $(this).data("report_id");
1954 var page = $(this).attr("href");
1955 $("#update_sql .modal-body").load(page + " div", function(){
1956 var diff1 = $("#col1 .show_sql").text();
1957 var diff2 = $("#col2 .show_sql").text();
1958 var diffs = diffString( escape(diff1), escape(diff2) );
1959 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1961 $('#update_sql').modal('show');
1962 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1965 $("#update_sql").on("hidden.bs.modal", function(){
1966 $("#update_sql_label").html("");
1967 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1971 [% IF ( showsql ) %]
1972 $("#sql").focus(function() {
1977 $("#toggle_sql").click(function(){
1978 var sql_output = $("#sql_output");
1979 sql_output.toggle();
1980 if( sql_output.is(":visible") ){
1981 $(this).button('complete');
1983 $(this).button('reset');
1986 showsql = CodeMirror.fromTextArea(sql, {
1995 $(".toggle_chart_settings").click(function(){
1996 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1999 $("#table_reports").delegate(".confirmdelete", 'click', function(){
2000 $(this).parents('tr').attr("class","warn");
2001 if(confirm(_("Are you sure you want to delete this saved report?"))){
2004 $(this).parents('tr').attr("class","");
2009 [% IF (create || editsql || save) %]
2011 var validated_form = $("#sql_report_form").validate({
2012 reportname: "required",
2015 depends: function(element) {
2016 return $("#create_group").prop("checked") && $("#groupdesc_input").val() != '';
2022 depends: function(element) {
2023 return $("#create_group").prop("checked") && $("#group_input").val() != '';
2029 $("#select_group").change(function() {
2030 if($(this).prop('checked')) {
2031 $("#group_input").attr("class","").prop('disabled', true).prop("required", false);
2032 $("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false);
2033 $("#group_select").prop('disabled', false);
2034 clearValidation( $("#sql_report_form") );
2035 if ($("#group_select").val().length > 0) {
2036 $("#select_subgroup").prop('checked', true);
2037 $("#select_subgroup").change();
2038 $("#subgroup, #subgroup *").show();
2040 $("#subgroup").hide();
2044 $("#create_group").change(function() {
2045 if($(this).prop('checked')) {
2046 $("#group_input").prop('disabled', false).prop("required", true );
2047 $("#groupdesc_input").prop('disabled', false).prop("required", true );
2048 $("#group_select").prop('disabled', true);
2049 // $("#create_subgroup").prop('checked', true).change();
2050 $("#subgroup_select").hide();
2051 $("#subgroup input[type='radio']").hide();
2052 $("#subgroup label[for]").hide();
2053 $("#subgroup_input").prop("required", false ).prop("disabled", false).show();
2054 $("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show();
2055 $("#subgroup").show();
2056 // Add validation rules for fields which were previously hidden
2057 $("#subgroup_input").rules("add", {
2059 depends: function(element) {
2060 return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != '';
2064 $("#subgroupdesc_input").rules("add", {
2066 depends: function(element) {
2067 return $("#create_group").prop("checked") && $("#subgroup_input").val() != '';
2073 $("#select_subgroup").change(function() {
2074 if($(this).prop('checked')) {
2075 $("#subgroup_select").prop('disabled', false);
2076 $("#subgroup_input").prop('disabled', true).prop("required", false );
2077 $("#subgroupdesc_input").prop('disabled', true).prop("required", false );
2078 clearValidation( $("#sql_report_form") );
2081 $("#create_subgroup").change(function() {
2082 if($(this).prop('checked')) {
2083 $("#subgroup_input").prop('disabled', false).prop("required", true );
2084 $("#subgroupdesc_input").prop('disabled', false).prop("required", true );
2085 $("#subgroup_select").val("").prop('disabled', true);
2088 $("#select_group").change();
2089 $("#select_subgroup").change();
2090 $("#group_select").on("change",function(){
2091 load_group_subgroups();
2094 $(".insertParam").on("click", function(e){
2096 var category = this.id;
2097 showParamModal( category );
2100 $("#runtime_parameters").on("shown.bs.modal", function(){
2101 $("#paramLabel").focus();
2104 $("#runtime_parameters").on("hide.bs.modal", function(){
2105 $("#send_runtime_parameter")[0].reset();
2106 $("#authorised_value_category").val("").hide();
2107 $("label[for='authorised_value']").removeClass("required");
2108 $("#authorised_value").prop("required", false ).removeAttr("required").removeClass("required");
2111 $("#send_runtime_parameter").on("submit", function(e){
2113 /* Get form values */
2114 var paramLabel = $("#paramLabel").val();
2115 var param_category = $("#param_category").val();
2116 var categoryLabel = $("#authorised_value").val();
2117 // Get CodeMirror environment variables
2118 var selection = editor.getSelection();
2119 var doc = editor.getDoc();
2120 var cursor = doc.getCursor();
2125 /* Build runtime parameter text string */
2127 if( paramLabel && param_category ){
2128 text += paramLabel + "|" + param_category;
2129 } else if( paramLabel ) {
2131 } else if( param_category ){
2132 text += param_category;
2135 text = " <<" + text + ">> ";
2136 if( selection.length > 0){
2137 editor.replaceSelection(text);
2139 doc.replaceRange(text, pos);
2142 $("#runtime_parameters").modal("hide");
2145 $("#authorised_value").on("change", function(){
2146 $("#param_category").val( $(this).val() );
2151 $(".delete").on("click",function(){
2152 return confirmDelete(MSG_CONFIRM_DELETE);
2155 $("#mana_search_form").submit(function(e){
2159 $("#column_submit").submit(function() {
2160 if ($("#selectedColumns option").size() < 1) {
2161 alert(_("No columns selected!"));
2164 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
2169 $("body").on("click", ".mana-use", function(e) {
2171 $(this).find("i").attr("class","fa fa-refresh fa-spin");
2172 mana_use( $(this).data("report_id") );
2175 $("#mana_search_result").on("shown.bs.modal", function(){
2176 $("#mana_search_field").focus();
2179 $("#mana_search_result").on("hide.bs.modal", function(){
2180 $("#mana_result_content").html("");
2181 $("#mana_search_field").val("");
2184 $(".batch_op").on("click", function(e){
2186 var target_form = $(this).data("submit");
2187 $("#" + target_form ).submit();
2190 $("#batch_add_to_list").on("submit", function(e){
2195 $("body").on("click", ".preview_sql", function(e){
2197 var reportid = $(this).data("reportid");
2198 previewSql( reportid );
2200 $(".limitselect").on("click", function(){
2201 var limit = $(this).data("limit");
2202 $("#limit").val( limit );
2203 $("#limitselect").submit();
2208 $("#toggle_auto_links").on("click", function(e){
2210 if( $(".data-plain").is(":visible") ){
2211 /* if a data-plain element is visible, this click hides it and shows auto-links */
2212 localStorage.removeItem("reports_auto_link_off");
2214 /* if a data-plain element is hidden, this click shows it and hides auto-links */
2215 localStorage.setItem("reports_auto_link_off", 1);
2217 $(".data-plain,.autolink").toggle();
2219 if ( localStorage.getItem("reports_auto_link_off") == 1 ){
2220 $("#toggle_auto_links").click();
2223 function tabsInit( tab, rtable ){
2224 var activeTab = tab.index();
2225 localStorage.setItem("sql_reports_activetab", activeTab );
2227 $("#subgroup_filter option").each(function() {
2228 if($(this).val().length > 0) {
2232 rtable.fnFilter('', 4);
2233 rtable.fnFilter('', 5);
2234 rtable.fnSetColumnVis(4, true);
2235 rtable.fnSetColumnVis(5, true);
2237 var g_id = tab.find("a").data("tabname");
2238 var g_name = tab.find("a").text().trim();
2240 if ( g_name == _("All") ) {
2245 if (g_id && g_id.length > 0) {
2246 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
2247 rtable.fnSetColumnVis(4, false);
2248 for(var i in group_subgroups[g_id]) {
2249 $("#subgroup_filter").append(
2250 '<option value="' + group_subgroups[g_id][i][0] + '">'
2251 + group_subgroups[g_id][i][1] + '</option>'
2254 $("#subgroup_filter_block").show();
2256 $("#subgroup_filter_block").hide();
2260 function addColumn() {
2261 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
2263 function delColumn() {
2264 $("#selectedColumns option:selected").remove();
2268 function mana_use( mana_id ){
2271 url: "/cgi-bin/koha/svc/mana/use",
2272 data: {id:mana_id, resource: 'report', saveinbase: 1},
2275 .done( function (result){
2276 if ( result.errmsg ){
2277 alert( result.errmsg );
2280 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
2283 .fail(function( error ) {
2284 $(".mana_use_status").hide();
2285 $("#mana_use_errortext").html( error.status + " " + error.statusText );
2286 $("#mana_use_failed").show();
2287 $(".mana-use i").attr("class","fa fa-download");
2291 function mana_search( textquery ){
2292 $(".mana_search_status").hide();
2293 $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
2295 if ( status == "error" ) {
2296 $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
2297 $("#mana_search_failed").show();
2298 $("#mana-loading").hide();
2300 $(".mana_search_status").hide();
2301 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
2302 $("#mana-loading").hide();
2303 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
2304 "sPaginationType":"full",
2307 { "width": "35%", "targets": 1 }
2310 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
2311 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
2315 $(".showbutton").on("click", function(e){
2317 $(this).parent().hide();
2318 $(this).parent().next().show();
2321 $(".hidebutton").on("click", function(e){
2323 $(this).parent().hide();
2324 $(this).parent().prev().show();
2327 if($("td.dataTables_empty").length == 0){
2328 $("#mana_search_message").show();
2334 function addToList() {
2335 var biblionumbers = [];
2336 $(".bib_to_list").each(function() {
2337 var biblionumber = Number( $(this).val() );
2338 if( biblionumbers.indexOf( biblionumber ) < 0 ){
2339 biblionumbers.push( biblionumber );
2342 bibs = biblionumbers.join("/");
2343 var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
2344 window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
2348 // Adapted from https://gist.github.com/jnormore/7418776
2349 function previewSql(reportid) {
2352 var message = $("#previewSql" + reportid ).val();
2353 var title = $("#previewSql" + reportid ).data("title");
2354 if( $("#preview-sql-modal").length > 0) {
2355 $("#preview-sql-modal").remove();
2357 $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
2358 <div class="modal-dialog">\
2359 <div class="modal-content">\
2360 <div class="modal-header" style="min-height:40px;">\
2361 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
2362 <span aria-hidden="true">×</span>\
2364 <h4 class="modal-title">' + title + '</h4>\
2366 <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
2368 <div class="modal-footer">\
2369 <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>\
2370 <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>\
2371 <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>\
2372 <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>\
2373 <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>\
2374 <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>\
2380 $("#preview-sql-modal").modal('show');
2381 CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
2391 [% INCLUDE 'intranet-bottom.inc' %]
2393 [% BLOCK group_and_subgroup_selection %]
2395 <label>Report group:</label>
2396 <input type="radio" name="select_or_create_group"
2397 id="select_group" checked="checked" />
2398 <label for="select_group" class="radio">Select</label>
2399 <select name="group" id="group_select">
2400 <option value="">(None)</option>
2401 [% FOREACH group IN groups_with_subgroups %]
2402 [% IF (group.selected) %]
2403 <option value="[% group.id | html %]" selected="selected">
2405 <option value="[% group.id | html %]">
2407 [% group.name | html %]
2411 <input type="radio" name="select_or_create_group" id="create_group" />
2412 <label for="create_group" class="radio">or create:</label>
2413 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
2414 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
2417 <label>Report subgroup:</label>
2418 <input type="radio" name="select_or_create_subgroup"
2419 id="select_subgroup" checked="checked" />
2420 <label for="select_subgroup" style="float:none">Select</label>
2421 <select name="subgroup" id="subgroup_select">
2422 <option value="">(None)</option>
2423 [% FOREACH group IN groups_with_subgroups %]
2424 [% IF (group.selected) %]
2425 [% FOREACH subgroup IN group.subgroups %]
2426 [% IF (subgroup.selected) %]
2427 <option value="[% subgroup.id | html %]" selected="selected">
2429 <option value="[% subgroup.id | html %]">
2431 [% subgroup.name | html %]
2437 <input type="radio" name="select_or_create_subgroup"
2438 id="create_subgroup" />
2439 <label for="create_subgroup" style="float:none">or create</label>
2440 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
2441 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
2445 [% BLOCK insert_runtime_parameter %]
2446 <div class="btn-group" style="margin-left:30px;">
2447 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2448 Insert runtime parameter <span class="caret"></span>
2450 <ul class="dropdown-menu">
2451 <li><a href="#" class="insertParam" id="insertAuthVal">Authorized values</a></li>
2452 <li><a href="#" class="insertParam" id="insertFramework">Bibliographic framework</a></li>
2453 <li><a href="#" class="insertParam" id="insertCnSource">Classification sources</a></li>
2454 <li><a href="#" class="insertParam" id="insertDate">Date</a></li>
2455 <li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li>
2456 <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2457 <li><a href="#" class="insertParam" id="insertList">List</a></li>
2458 <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2459 <li><a href="#" class="insertParam" id="insertCashregister">Cash registers</a></li>
2460 <li><a href="#" class="insertParam" id="insertDebittypes">Debit types</a></li>
2461 <li><a href="#" class="insertParam" id="insertCredittypes">Credit types</a></li>
2462 <li><a href="#" class="insertParam" id="insertText">Text field</a></li>