3 [% USE AuthorisedValues %]
6 [% USE TablesSettings %]
10 [%- BLOCK area_name -%]
12 [%- CASE 'CIRC' -%]Circulation
13 [%- CASE 'CAT' -%]Catalog
14 [%- CASE 'PAT' -%]Patrons
15 [%- CASE 'ACQ' -%]Acquisitions
16 [%- CASE 'ACC' -%]Accounts
17 [%- CASE 'SER' -%]Serials
21 [% INCLUDE 'doc-head-open.inc' %]
25 Saved reports › [%- ELSIF ( create ) -%]
26 Create from SQL › [%- ELSIF ( showsql ) -%]
27 SQL view › Saved reports › [%- ELSIF ( execute ) -%]
28 Report [% name | html %] ([% id | html %]) › Saved reports › [%- ELSIF ( editsql ) -%]
29 Edit report [% reportname | html %] ([% id | html %]) › Saved reports › [%- END -%]
32 Build a report, step 1 of 6: Choose a module › [%- ELSIF ( build2 ) -%]
33 Build a report, step 2 of 6: Pick a report type › [%- ELSIF ( build3 ) -%]
34 Build a report, step 3 of 6: Select columns for display › [%- ELSIF ( build4 ) -%]
35 Build a report, step 4 of 6: Select criteria to limit on › [%- ELSIF ( build5 ) -%]
36 Build a report, step 5 of 6: Pick which columns to total › [%- ELSIF ( build6 ) -%]
37 Build a report, step 6 of 6: Select how you want the report ordered › [%- END -%]
38 Guided reports wizard › Reports › Koha
41 [% INCLUDE 'doc-head-close.inc' %]
42 [% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
50 .cm-columnPlaceholder {
53 #mana_search_errortext { font-family: monospace; font-weight: bold; }
55 [% Asset.css("css/reports.css") | $raw %]
56 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
59 <body id="rep_guided_reports_start" class="rep">
60 [% INCLUDE 'header.inc' %]
61 [% INCLUDE 'circ-search.inc' %]
63 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
66 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
69 <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
72 <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
77 <a href="#" aria-current="page">
81 [% ELSIF ( create ) %]
83 <a href="#" aria-current="page">
87 [% ELSIF ( showsql ) %]
89 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
92 <a href="#" aria-current="page">
93 [% reportname | html %] ([% id | html %])
96 [% ELSIF ( editsql ) %]
98 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
101 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
104 <a href="#" aria-current="page">
108 [% ELSIF ( execute ) %]
110 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
113 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
116 <a href="#" aria-current="page">
120 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
122 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
125 <a href="#" aria-current="page">
127 Step 1 of 6: Choose a module
128 [% ELSIF ( build2 ) %]
129 Step 2 of 6: Pick a report type
130 [% ELSIF ( build3 ) %]
131 Step 3 of 6: Select columns for display
132 [% ELSIF ( build4 ) %]
133 Step 4 of 6: Select criteria to limit on
134 [% ELSIF ( build5 ) %]
135 Step 5 of 6: Pick which columns to total
136 [% ELSIF ( build6 ) %]
137 Step 6 of 6: Select how you want the report ordered
142 </nav> <!-- /#breadcrumbs -->
144 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
145 <div class="modal-dialog">
146 <div class="modal-content">
147 <div class="modal-header">
148 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
149 <h3 id="update_sql_label">Update SQL</h3>
151 <div class="modal-body">
152 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
154 <div class="modal-footer">
155 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
156 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
158 </div> <!-- /.modal-content -->
159 </div> <!-- /.modal-dialog -->
160 </div> <!-- #update_sql -->
162 <div class="main container-fluid">
164 <div class="col-sm-10 col-sm-push-2">
167 [% INCLUDE "reports-toolbar.inc" %]
170 <h2>Guided reports</h2>
171 <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>
173 <h3>Build and run reports</h3>
175 [% IF ( CAN_user_reports_create_reports ) %]
176 <form action="/cgi-bin/koha/reports/guided_reports.pl">
177 <input type="hidden" name="phase" value="Build new" />
178 <input type="submit" name="submit" value="Build new"/>
182 [% IF ( CAN_user_reports_execute_reports ) %]
183 <form action="/cgi-bin/koha/reports/guided_reports.pl">
184 <input type="hidden" name="phase" value="Use saved"/>
185 <input type="submit" name="submit" value="Use saved"/>
189 [% IF ( CAN_user_reports_create_reports ) %]
190 <form action="/cgi-bin/koha/reports/guided_reports.pl">
191 <input type="hidden" name="phase" value="Create report from SQL"/>
192 <input type="submit" name="submit" value="Create report from SQL"/>
196 <h3>Reports Dictionary</h3>
197 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
198 <form action="/cgi-bin/koha/reports/dictionary.pl">
199 <input type="hidden" name="phase" value="View Dictionary"/>
200 <input type="submit" name="submit" value="View dictionary"/>
202 [% END # /IF (start) %]
204 [% IF report_converted %]
205 <div class="dialog message">
206 The report "[% report_converted | html %]" has been converted.
210 [% IF report_converted %]
211 <div class="dialog message">
212 The report "[% report_converted | html %]" has been converted.
217 [% IF ( savedreports ) %]
218 <h1>Saved reports</h1>
220 [% IF ( filters.date || filters.author || filters.keyword ) %]
222 <span class="filter">
223 [% IF ( filters.date ) %]
224 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
226 [% IF ( filters.author ) %]
227 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
229 [% IF ( filters.keyword ) %]
230 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
232 <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>
237 <div id="tabs" class="toptabs">
239 <li><a href="#reports">All</a></li>
240 [% FOREACH group IN groups_with_subgroups %]
241 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
245 <div id="subgroup_filter_block">
246 <label for="subgroup_filter">Subgroup:</label>
247 <select id="subgroup_filter">
248 <option value="">All</option>
252 [% IF (Koha.Preference('Mana') == 1) %]
254 <div id="mana_search_message" class="dialog message">
255 <p> [% manamsg | html %] </p>
260 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
261 <input type="hidden" name="phase" value="Delete Multiple" />
262 <table id="table_reports">
265 <th class="NoSort"> </th>
273 <th>Creation date</th>
276 <th class="report_public">Public</th>
277 <th class="report_json_url">JSON URL</th>
279 <th>Cache expiry (seconds)</th>
281 <th class="hidden"> </th>
283 <th>Saved results</th>
284 [% IF has_obsolete_reports %]
287 <th class="hidden"> </th>
289 <th class="NoSort noExport">Actions</th>
293 [% FOREACH savedreport IN savedreports %]
294 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
295 <td class="report_checkbox">
296 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
297 <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
299 <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
301 <td class="report_id">
302 <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
304 <td class="report_name">
305 [% IF ( savedreport.report_name ) %]
306 [% savedreport.report_name | html %]
311 <td class="report_type">
312 [% savedreport.type | html %]
314 <td class="report_group">
315 [% savedreport.groupname | html %]
318 [% savedreport.subgroupname | html %]
320 <td class="report_notes">
321 [% savedreport.notes | html %]
324 [% savedreport.borrowersurname | html %]
325 [% IF ( savedreport.borrowerfirstname ) %]
326 , [% savedreport.borrowerfirstname | html %]
328 ([% savedreport.borrowernumber | html %])
330 <td data-order="[% savedreport.date_created | html %]">
331 [% savedreport.date_created | $KohaDates %]
333 <td data-order="[% savedreport.last_modified | html %]">
334 [% savedreport.last_modified | $KohaDates with_hours => 1 %]
336 <td data-order="[% savedreport.last_run | html %]">
337 [% savedreport.last_run | $KohaDates with_hours => 1 %]
339 <td class="report_public">
340 [% IF (savedreport.public) %]
346 <td class="report_json_url">
347 [% IF (savedreport.public) %]
348 <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>
350 <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>
354 [% savedreport.cache_expiry | html %]
357 [% FOR result IN savedreport.results %]
358 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
363 [% IF savedreport.seems_obsolete %]
364 This report seems obsolete, it uses biblioitems.marcxml field.
365 <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>
369 <div class="btn-group dropup">
370 [%# There should be no space between these two buttons, it would render badly %]
371 <a class="btn btn-default btn-xs" role="button"
372 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
373 class="fa fa-play"></i> Run</a><a
374 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
375 href="#"><b class="caret"></b></a>
376 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
377 <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>
379 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
380 <i class="fa fa-eye"></i> Preview SQL
383 [% IF ( CAN_user_reports_create_reports ) %]
384 <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>
385 <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>
387 [% IF (Koha.Preference('Mana') == 1) %]
388 <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>
390 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
391 [% IF ( CAN_user_reports_delete_reports ) %]
392 <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>
396 <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
403 [% IF ( CAN_user_reports_delete_reports ) %]
404 <fieldset class="action">
405 <input type="submit" value="Delete selected" />
411 [% ELSE # IF ( savedreports ) %]
412 <div class="dialog message">
413 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
414 <h4>No saved reports match your criteria. </h4>
415 [% IF ( CAN_user_reports_create_reports ) %]
416 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
417 <input type="hidden" name="phase" value="Build new" />
418 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
421 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
422 <input type="hidden" name="phase" value="Create report from SQL" />
423 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
426 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
427 <input type="hidden" name="phase" value="Use saved" />
428 <input type="hidden" name="filter_set" value="1" />
429 <input type="hidden" name="filter_keyword" value="" />
430 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
434 <h4>There are no saved reports. </h4>
435 [% IF ( CAN_user_reports_create_reports ) %]
436 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
438 [% END # IF (filter_set || filters.date || filters.author || filters.keyword) %]
439 </div> <!-- /.dialog.message -->
440 [% END # /IF ( savedreports ) %]
441 [% END # /IF ( saved1 ) %]
443 [% INCLUDE 'mana/mana-share-report.inc' %]
446 [% IF ( cache_error) %]
447 <div class="dialog alert">
448 <strong> Please choose a cache_expiry less than 30 days </strong>
452 <h1>Build a report</h1>
453 <form action="/cgi-bin/koha/reports/guided_reports.pl">
454 <fieldset class="rows">
455 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
458 <label for="area">Choose: </label>
459 <select name="area" id="area">
460 [%- FOREACH area IN areas -%]
461 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
467 <label for="public">Report is public:</label>
468 <select id="public" name="public">
469 <option value="0">No (default)</option>
470 <option value="1" selected="selected">Yes</option>
475 <label for="public">Report is public:</label>
476 <select id="public" name="public">
477 <option value="0" selected="selected">No (default)</option>
478 <option value="1">Yes</option>
485 <label for="cache_expiry">Cache expiry:</label>
486 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
487 <select id="cache_expiry_units" name="cache_expiry_units">
488 <option value="seconds">Seconds (default)</option>
489 <option value="minutes">Minutes</option>
490 <option value="hours">Hours</option>
491 <option value="days">Days</option>
496 </fieldset> <!-- /.rows -->
497 <fieldset class="action">
498 <input type="hidden" name="phase" value="Report on this Area" />
499 <input type="submit" name="submit" value="Next >>" />
505 <h1>Build a report</h1>
506 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
507 <input type="hidden" name="area" value="[% area | html %]" />
508 <input type="hidden" name="public" value="[% public | html %]" />
509 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
510 <fieldset class="rows">
511 <legend>Step 2 of 6: Pick a report type</legend>
514 <label for="types">Choose: </label>
515 <select id="types" name="types">
516 <option value="1">Tabular</option>
517 <option value="2" disabled="disabled">Summary</option>
518 <option value="3" disabled="disabled">Matrix</option>
524 <fieldset class="action">
525 <input type="hidden" name="phase" value="Choose this type" />
526 <input type="button" name="back" value="<< Back" class="goback" />
527 <input type="submit" name="submit" value="Next >>" />
530 [% END # /IF (build2 ) %]
533 <h1>Build a report</h1>
534 <h3>Step 3 of 6: Select columns for display</h3>
535 <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>
537 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
538 <input type="hidden" name="area" value="[% area | html %]" />
539 <input type="hidden" name="type" value="[% type | html %]" />
540 <input type="hidden" name="public" value="[% public | html %]" />
541 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
544 <div class="col-sm-6">
545 <div style="float: left;">
546 <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
547 [% FOREACH column IN columns %]
548 [% IF ( column.table ) %]
549 [% IF ( loop.first ) %]
553 <optgroup label="[% column.table | html %]">
555 <option value="[% column.name | html %]">
556 [% IF ( column.description ) %]
557 [% column.description | html %] / [% column.name | html %]
559 [% column.name | html %]
567 <div style="width: 6.3em; float: right; margin-top: 100px">
568 <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
569 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
571 </div> <!-- /.col-sm-6 -->
573 <div class="col-sm-6">
574 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
577 </div> <!-- /.row -->
579 <fieldset class="action">
580 <input type="hidden" name="phase" value="Choose these columns" />
581 <input type="button" name="back" value="<< Back" class="goback" />
582 <input type="submit" name="submit" value="Next >>" />
584 </form> <!-- /#column_submit -->
585 [% END # /IF ( build3 ) %]
588 <h1>Build a report</h1>
589 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
590 <input type="hidden" name="area" value="[% area | html %]" />
591 <input type="hidden" name="type" value="[% type | html %]" />
592 <input type="hidden" name="column" value="[% column | html %]" />
593 <input type="hidden" name="public" value="[% public | html %]" />
594 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
596 <legend>Step 4 of 6: Select criteria to limit on</legend>
598 [% FOREACH criteri IN criteria %]
601 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
602 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
604 [% IF ( criteri.date ) %]
606 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="flatpickr" />
607 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
611 [% IF ( criteri.textrange ) %]
614 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
615 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
619 [% IF ( criteri.daterange ) %]
622 <input type="text" size="10" id="from_[% criteri.name.remove('\.') | html %]_value" name="from_[% criteri.name | html %]_value" value="" />
624 <input type="text" size="10" id="to_[% criteri.name.remove('\.') | html %]_value" name="to_[% criteri.name | html %]_value" value="" />
625 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
630 <select name="[% criteri.name | html %]_value">
631 [% FOREACH value IN criteri.values %]
632 <option value="[% value.availablevalues | html %]">
633 [% IF ( value.default ) %]
636 [% value.display_value | html %]
650 [% IF ( definitions ) %]
652 <legend>Dictionary definitions</legend>
654 [% FOREACH definition IN definitions %]
657 <input type="checkbox" name="definition" value="[% definition.id | html %]" />
658 [% definition.name | html %]
666 <fieldset class="action">
667 <input type="hidden" name="phase" value="Choose these criteria" />
668 <input type="button" name="back" value="<< Back" class="goback" />
669 <input type="submit" name="submit" value="Next >>" />
672 [% END # /IF ( build4 ) %]
675 <h1>Build a report</h1>
676 <h3>Step 5 of 6: Pick which columns to total</h3>
677 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
678 <input type="hidden" name="area" value="[% area | html %]" />
679 <input type="hidden" name="type" value="[% type | html %]" />
680 <input type="hidden" name="column" value="[% column | html %]" />
681 <input type="hidden" name="definition" value="[% definition | html %]" />
682 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
683 <input type="hidden" name="public" value="[% public | html %]" />
684 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
687 [% FOREACH total_b IN total_by %]
690 <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
691 <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
694 <select name="[% total_b.name | html %]_tvalue">
695 [% FOREACH selec IN total_b.select %]
696 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
705 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
706 <input type="button" name="back" value="<< Back" class="goback" />
707 <input type="submit" name="submit" value="Next >>" />
710 [% END # /IF ( build5 ) %]
713 <h1>Build a report</h1>
714 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
715 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
716 <input type="hidden" name="area" value="[% area | html %]" />
717 <input type="hidden" name="type" value="[% type | html %]" />
718 <input type="hidden" name="column" value="[% column | html %]" />
719 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
720 <input type="hidden" name="definition" value="[% definition | html %]" />
721 <input type="hidden" name="totals" value="[% totals | html %]" />
722 <input type="hidden" name="public" value="[% public | html %]" />
723 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
726 [% FOREACH order_b IN order_by %]
729 <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
730 <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
733 <select name="[% order_b.name | html %]_ovalue">
734 [% FOREACH selec IN order_b.select %]
735 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
743 <fieldset class="action">
744 <input type="hidden" name="phase" value="Build report" />
745 <input type="submit" name="submit" value="Finish" />
748 [% END #/ IF ( build6 ) %]
750 [% IF ( showreport ) %]
751 <h1>Confirm custom report</h1>
752 <p>Your report will be generated with the following SQL statement.</p>
757 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
758 <input type="hidden" name="sql" value="[% sql | html %]" />
759 <input type="hidden" name="type" value="[% type | html %]" />
760 <input type="hidden" name="public" value="[% public | html %]" />
761 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
762 <p>You will need to save the report before you can execute it</p>
763 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
764 <input type="submit" name="submit" value="Next" />
767 [% END #/ IF ( showreport ) %]
770 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
771 <input type="hidden" name="sql" value="[% sql | html %]" />
772 <input type="hidden" name="type" value="[% type | html %]" />
773 <input type="hidden" name="area" value="[% area | html %]" />
774 <input type="hidden" name="public" value="[% public | html %]" />
775 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
776 <fieldset class="rows">
777 <legend>Save your custom report</legend>
780 <label for="reportname" class="required">Report name: </label>
781 <input type="text" id="reportname" name="reportname" class="required" required="required" />
782 <span class="required">Required</span>
784 [% PROCESS group_and_subgroup_selection %]
786 <label for="notes">Notes:</label>
787 <textarea name="notes" id="notes"></textarea>
791 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
792 <input type="submit" name="submit" value="Save report" />
795 [% END # /IF( save ) %]
797 [% IF ( warn_authval_problem ) %]
798 <div class="dialog alert">
799 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
800 [% FOREACH problematic_authval IN problematic_authvals %]
802 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
803 you selected does not exist.
806 <!-- Save Anyway Form -->
807 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
808 <!--Every parameter the user issued is provided as a hidden field for recovery-->
809 <input type='hidden' name='id' value='[% id | html %]' />
810 <input type='hidden' name='sql' value='[% sql | html %]' />
811 <input type='hidden' name='reportname' value='[% reportname | html %]' />
812 <input type='hidden' name='group' value='[% group | html %]' />
813 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
814 <input type='hidden' name='notes' value='[% notes | html %]' />
815 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
816 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
817 <input type='hidden' name='public' value='[% public | html %]' />
818 [% IF ( phase_update) %]
819 <input type='hidden' name='phase' value='Update SQL' />
820 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
821 [% ELSIF ( phase_save) %]
822 <input type='hidden' name='area' value='[% area | html %]' />
823 <input type='hidden' name='phase' value='Save Report' />
824 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
827 <!-- Go back to editing -->
828 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
829 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
832 [% END # /IF ( warn_authval_problem )%]
834 [% IF ( enter_params ) %]
835 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
836 <input type='hidden' name='reports' value="[% reports | html %]" />
837 [% IF ( auth_val_error ) %]
838 <input type='hidden' name='phase' value='Edit SQL' />
839 <div class="dialog alert">
840 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
841 [% FOREACH auth_val_error IN auth_val_errors %]
843 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
844 you selected does not exist.
848 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
849 [% ELSE # IF ( auth_val_error ) %]
850 <input type='hidden' name='phase' value='Run this report' />
851 <h1>Enter parameters for report [% name | html %]:</h1>
853 <p>[% notes | html %]</p>
855 <fieldset class="rows">
857 [% FOREACH sql_param IN sql_params %]
858 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
859 [% IF sql_param.input == 'date' %]
861 <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" />
863 [% ELSIF ( sql_param.input == 'text' ) %]
865 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
866 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
868 [% ELSIF ( sql_param.input == 'textarea' ) %]
870 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
871 <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
875 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
876 <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]">
877 [% IF (sql_param.include_all) %]
878 <option value="%">All</option>
880 [% FOREACH value IN sql_param.input.values %]
881 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
885 [% END # /IF sql_param.input == 'date' %]
886 [% END # /FOREACH sql_param %]
888 </fieldset> <!-- /.rows -->
889 <fieldset class="action">
890 <input type="submit" value="Run the report" />
892 [% END # / IF ( auth_val_error ) %]
894 [% END # /IF ( enter_params ) %]
897 <h1>[% name | html %] <span id="report_id">([% id | html %])</span></h1>
899 <p><span class="label">Notes:</span> [% notes | html %]</p>
901 [% IF ( unlimited_total ) %]
903 <span class="label">Total number of results:</span>
904 [% unlimited_total | html %]
905 [% IF unlimited_total > limit %]
906 ([% limit | html %] shown)
911 <div id="sql_output" style="display:none;">
912 <span class="label">Report SQL:</span>
913 <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
917 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
918 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
920 <div id="chart" class="clearfix"></div>
923 [% UNLESS ( errors ) %]
924 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
925 <input type="hidden" name="recordtype" value="biblio" />
926 <input type="hidden" name="op" value="list" />
927 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
928 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
929 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
933 <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
934 <input type="hidden" name="recordtype" value="biblio" />
935 <input type="hidden" name="op" value="list" />
936 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
937 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
938 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
942 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
943 <input type="hidden" name="op" value="show" />
944 [% FOREACH result IN results %]
945 [% FOREACH cells IN result.cells %]
946 [% place = loop.index %]
947 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
948 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
949 [% SET batch_itemnumbers = 1 %]
950 [% SET header_row.$place.has_itemnumbers = 1 %]
951 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
957 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
958 <input type="hidden" name="op" value="show" />
959 <input type="hidden" name="del" value="1" />
960 [% FOREACH result IN results %]
961 [% FOREACH cells IN result.cells %]
962 [% place = loop.index %]
963 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
964 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
965 [% SET batch_itemnumbers = 1 %]
966 [% SET header_row.$place.has_itemnumbers = 1 %]
967 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
973 <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
974 [% FOREACH result IN results %]
975 [% FOREACH cells IN result.cells %]
976 [% place = loop.index %]
977 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
978 [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
979 [% SET batch_biblionumbers = 1 %]
980 [% SET header_row.$place.has_biblionumbers = 1 %]
981 <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
987 <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
988 <input type="hidden" name="op" value="show" />
989 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
990 <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
991 [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
995 [% BLOCK batch_list %]
996 [%- FOREACH result IN results %]
997 [%- FOREACH cells IN result.cells %]
998 [%- place = loop.index %]
999 [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
1000 [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
1005 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1007 <div class="btn-group">
1008 <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
1009 Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
1010 <span class="caret"></span>
1012 <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
1013 [% FOREACH header_ro IN header_row %]
1014 [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1015 <li class="dropdown-header">Bibliographic records</li>
1017 <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>
1020 <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>
1023 <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>
1026 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1027 [% IF ( batch_biblionumbers ) %]
1028 <li role="separator" class="divider"></li>
1030 <li class="dropdown-header">Item records</li>
1032 <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>
1035 <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>
1038 [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1039 [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
1040 <li role="separator" class="divider"></li>
1042 <li class="dropdown-header">Patron records</li>
1044 <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>
1048 </ul> <!-- /.dropdown-menu -->
1049 </div> <!-- /.dropdown -->
1051 [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1052 [% END # UNLESS ( errors ) %]
1053 [% END # IF ( execute ) %]
1055 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1056 <input type="hidden" name="phase" value="Run this report"/>
1057 <input type="hidden" name="reports" value="[% report_id | html %]"/>
1059 [% FOREACH p IN sql_params %]
1060 <input type="hidden" name="sql_params" value="[% p | html %]"/>
1062 [% FOREACH n IN param_names %]
1063 <input type="hidden" name="param_name" value="[% n | html %]"/>
1066 <label for="limit">Rows per page: </label>
1067 <select name="limit" id="limit">
1068 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1069 [% FOREACH l IN limits %]
1071 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
1073 <option value="[% l | html %]">[% l | html %]</option>
1077 </form> <!-- /#limitselect -->
1079 <div class="pages">[% pagination_bar | $raw %]</div>
1080 [% UNLESS ( errors ) %]
1083 [% FOREACH header_ro IN header_row %]
1084 <th>[% header_ro.cell | html %]</th>
1087 [% FOREACH result IN results %]
1089 [% FOREACH cells IN result.cells %]
1090 <td>[% cells.cell | $raw %]</td>
1096 <div class="pages">[% pagination_bar | $raw %]</div>
1098 [% INCLUDE 'chart.inc' %]
1100 [% END #/IF ( execute ) %]
1103 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1104 <fieldset class="rows">
1105 <legend>Create report from SQL</legend>
1108 <label for="reportname" class="required">Report name:</label>
1109 [% IF ( reportname ) %]
1110 <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
1112 <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
1114 <span class="required">Required</span>
1116 [% PROCESS group_and_subgroup_selection %]
1120 <label for="public">Report is public:</label>
1121 <select id="public" name="public">
1122 <option value="0">No (default)</option>
1123 <option value="1" selected="selected">Yes</option>
1128 <label for="public">Report is public:</label>
1129 <select id="public" name="public">
1130 <option value="0" selected="selected">No (default)</option>
1131 <option value="1">Yes</option>
1134 [% END # /IF (public) %]
1138 <label for="cache_expiry">Cache expiry:</label>
1139 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
1140 <select id="cache_expiry_units" name="cache_expiry_units">
1141 <option value="seconds" selected="selected">Seconds (default)</option>
1142 <option value="minutes">Minutes</option>
1143 <option value="hours">Hours</option>
1144 <option value="days">Days</option>
1147 [% END # /IF (usecache) %]
1149 <label for="notes">Notes:</label>
1150 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1153 </fieldset> <!-- /.rows -->
1155 <fieldset class="rows">
1156 <legend>SQL:</legend>
1157 <div style="margin:1em;">
1158 [% PROCESS insert_runtime_parameter %]
1159 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1160 <span class="required">Required</span>
1164 <fieldset class="action">
1165 <input type="hidden" name="phase" value="Save Report" />
1166 <input type="submit" name="submit" value="Save report" />
1167 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1170 [% END #/IF ( create ) %]
1172 [% IF saved_results %]
1173 <h1>Saved report results</h1>
1174 <h2>[% name | html %]</h2>
1175 <p>[% notes | html %]</p>
1177 [% FOREACH rows IN saved_results %]
1179 [% FOREACH col IN rows %]
1180 <td>[% col | html %]</td>
1185 [% END # /IF saved_results %]
1187 [% IF ( showsql ) %]
1188 <fieldset class="rows">
1189 <legend>[% reportname | html %]</legend>
1193 <span class="label">Notes:</span>
1199 <textarea id="sql">[% sql | html %]</textarea>
1203 [% END # /IF ( showsql ) %]
1205 [% IF ( save_successful ) %]
1206 [% UNLESS ( errors ) %]
1208 <div id="report_updated">
1209 <div class="dialog message">
1210 <p>Your report "[% reportname | html %]" has been saved</p>
1216 [% IF ( editsql ) %]
1217 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1218 <input type="hidden" name="phase" value="Update SQL" />
1219 <input type="hidden" name="id" value="[% id | html %]"/>
1220 <fieldset class="rows">
1221 <legend>Edit SQL report</legend>
1224 <label for="reportname" class="required">Report name: </label>
1225 <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1226 <span class="required">Required</span>
1228 [% PROCESS group_and_subgroup_selection %]
1231 <label for="public">Report is public:</label>
1232 <select id="public" name="public">
1233 <option value="0">No (default)</option>
1234 <option value="1" selected="selected">Yes</option>
1239 <label for="public">Report is public:</label>
1240 <select id="public" name="public">
1241 <option value="0" selected="selected">No (default)</option>
1242 <option value="1">Yes</option>
1245 [% END # /IF (public) %]
1249 <label for="cache_expiry">Cache expiry:</label>
1250 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
1251 <select id="cache_expiry_units" name="cache_expiry_units">
1252 <option value="seconds">Seconds (default)</option>
1253 <option value="minutes">Minutes</option>
1254 <option value="hours">Hours</option>
1255 <option value="days">Days</option>
1260 <label for="notes">Notes:</label>
1261 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1264 </fieldset> <!-- /.rows -->
1266 <fieldset class="rows">
1267 <legend>SQL:</legend>
1268 [% PROCESS insert_runtime_parameter %]
1269 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1270 <span class="required" style="margin-left:30px;">Required</span>
1273 <fieldset class="action">
1274 <input type="submit" name="submit" value="Update SQL" />
1275 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1278 [% END # /IF ( editsql ) %]
1281 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1282 <div class="dialog alert">
1283 <strong>The following error was encountered:</strong><br />
1284 [% FOREACH error IN errors %]
1285 [% IF ( error.sqlerr ) %]
1286 This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1287 Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1288 Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1289 [% ELSIF ( error.queryerr ) %]
1290 The database returned the following error: <br />
1291 [% error.queryerr | html %]<br />Please check the log for further details.
1292 [% ELSIF ( error.cache_expiry ) %]
1293 Please select a cache expiry less than 30 days.
1296 <div id="onerror_actions">
1297 <a href="#" class="button goback">Return to previous page</a>
1301 <fieldset class="action">
1302 <input type="hidden" name="phase" value="Use saved" />
1303 <input type="submit" name="submit" value="Saved reports" />
1306 [% END # /IF ( errors ) %]
1309 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1311 <div class="col-sm-2 col-sm-pull-10">
1314 <div id="saved-reports-filter">
1315 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1316 <input type="hidden" name="phase" value="Use saved" />
1317 <input type="hidden" name="filter_set" value="1" />
1318 <fieldset class="brief">
1322 <label for="filter_date">Date:</label>
1323 <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="flatpickr" />
1324 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1327 <label for="filter_author">Author:</label>
1328 <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1331 <label for="filter_keyword">Keyword:</label>
1332 <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1335 </fieldset> <!-- /.brief -->
1336 <fieldset class="action">
1337 <input type="submit" value="Apply filter" />
1338 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1341 </div> <!-- /#saved-reports-filter -->
1343 [% INCLUDE 'guided-reports-view.inc' %]
1345 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1346 </div> <!-- /.row -->
1348 <!-- Runtime Parameters Modal -->
1349 <div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel">
1350 <div class="modal-dialog" role="document">
1351 <div class="modal-content">
1352 <div class="modal-header">
1353 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1354 <h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4>
1356 <form id="send_runtime_parameter">
1357 <input type="hidden" name="param_category" id="param_category" />
1358 <div class="modal-body">
1359 <div class="form-group">
1360 <label for="paramLabel">Parameter label: </label>
1361 <input class="form-control" type="text" name="paramLabel" id="paramLabel">
1362 <div class="hint">Optional. The label for the field shown when the report is run, e.g. "Select a library."</div>
1364 <div id="authorised_value_category" class="form-group" style="display:none">
1365 <label for="authorised_value">Authorized value category:</label>
1366 <select class="form-control" name="authorised_value" id="authorised_value">
1367 <option value=""></option>
1368 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
1370 <div class="hint">Select which authorized value category the user will choose from.</div>
1372 </div> <!-- /.modal-body -->
1373 <div class="modal-footer">
1374 <button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button>
1375 <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
1376 </div> <!-- /.modal-footer -->
1377 </form> <!-- /#send_runtime_parameter -->
1378 </div> <!-- /.modal-content -->
1379 </div> <!-- /.modal-dialog -->
1380 </div> <!-- /#runtime_parameters -->
1382 [% MACRO jsinclude BLOCK %]
1383 [% Asset.js("js/charts.js") | $raw %]
1384 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1385 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1386 [% INCLUDE 'calendar.inc' %]
1387 [% INCLUDE 'datatables.inc' %]
1389 [% INCLUDE 'columns_settings.inc' %]
1391 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
1392 [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
1393 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1394 [% Asset.js( "js/mana.js" ) | $raw %]
1397 function hide_bar_element() {
1398 $('#chart-column-horizontal').hide()
1399 $('.chart-column-group').each(function( index ) {
1402 $('.chart-column-line').each(function( index ) {
1407 function show_bar_element() {
1408 $('#chart-column-horizontal').show()
1409 $('.chart-column-group').each(function( index ) {
1412 $('.chart-column-line').each(function( index ) {
1417 function removeColumn(id) {
1420 if ( $('.chart-column-conf').length == 1 ) {
1421 $('.chart-column-delete').remove();
1425 /* overlay a syntax-highlighting definition on top of the existing sql one */
1426 CodeMirror.defineMode("sqlPlaceholders", function(config, parserConfig) {
1427 var sqlPlaceholdersOverlay = {
1428 token: function(stream, state) {
1431 if (stream.match("<<")) {
1432 while ((ch = stream.next()) != null) {
1433 if (ch == ">" && stream.next() == ">") {
1440 if (stream.match("[[")) {
1441 while ((ch = stream.next()) != null) {
1442 if (ch == "]" && stream.next() == "]") {
1444 return "columnPlaceholder";
1449 else if (stream.next() != null) {
1454 return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlPlaceholdersOverlay);
1457 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1458 var group_subgroups = {};
1459 [% FOREACH group IN groups_with_subgroups %]
1460 var gid = "[% group.id | html %]"
1461 group_subgroups[gid] = new Array();
1462 [% FOREACH subgroup IN group.subgroups %]
1463 var sgid = "[% subgroup.id | html %]";
1464 var sgname = "[% subgroup.name | html %]";
1465 group_subgroups[gid].push([sgid, sgname]);
1469 [% IF ( create || editsql || save ) %]
1471 var editor = CodeMirror.fromTextArea(sql, {
1473 mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1478 // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232
1479 function clearValidation( formElement ){
1480 // formElement should be a jQuery object
1481 var validator = formElement.validate();
1482 // Iterate through named elements inside of the form, and mark them as error free
1483 $('[name]',formElement).each(function(){
1484 validator.successList.push(this);//mark as error free
1485 validator.showErrors();//remove error messages if present
1487 validator.resetForm();//remove error class on name elements and clear history
1488 validator.reset();//remove all error and success data
1492 [% IF ( showsql ) %]
1493 var editor = CodeMirror.fromTextArea(sql, {
1495 mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
1501 function showParamModal( category ){
1502 var modal = $("#runtime_parameters");
1503 var modalTitle = $("#runtime_parametersLabel");
1504 switch ( category ){
1505 case "insertAuthVal":
1506 modalTitle.text( _("Insert authorized value parameter") );
1507 $("#paramLabel").val( _("Authorized value") );
1508 $("#authorised_value_category").show();
1509 $("#authorised_value").prop("required", true ).attr("required", "required");
1512 modalTitle.text( _("Insert date parameter") );
1513 $("#paramLabel").val( _("Date") );
1514 $("#param_category").val("date");
1516 case "insertItemtypes":
1517 modalTitle.text( _("Insert item types parameter") );
1518 $("#paramLabel").val( _("Item type") );
1519 $("#param_category").val("itemtypes");
1521 case "insertBranches":
1522 modalTitle.text( _("Insert libraries parameter") );
1523 $("#paramLabel").val( _("Library") );
1524 $("#param_category").val("branches");
1526 case "insertCategorycode":
1527 modalTitle.text( _("Insert patron category parameter") );
1528 $("#paramLabel").val( _("Patron category") );
1529 $("#param_category").val("categorycode");
1532 modalTitle.text( _("Insert text parameter") );
1533 $("#paramLabel").val( _("Text") );
1534 $("#param_category").val("");
1537 $("#paramLabel").select();
1538 modal.modal("show");
1541 function load_group_subgroups () {
1542 var group = $("#group_select").val();
1543 var sg = $("#subgroup");
1544 $(sg).find('option[value!=""]').each(function() {
1549 var select = $(sg).find('select')[0];
1550 $.each( group_subgroups[group], function(index, value) {
1551 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1553 $("#subgroup, #subgroup *").show();
1557 $(document).ready(function(){
1559 var activeTab = localStorage.getItem("sql_reports_activetab");
1561 $("body").on('click',".fetch_chart_data",function(){
1562 if( [% unlimited_total || 0 | $raw %] > 1000 ){
1563 if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){
1574 if ( $('.chart-column-conf').length == 1 ) {
1575 $('.chart-column-delete').remove();
1578 $(".chart-column-delete").on('click', function(e){
1580 removeColumn('column_' + $(this).data('column'));
1583 $('#download-chart').click(function() {
1584 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1585 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1586 this.setAttribute('download', 'chart.svg');
1589 $('#chart-type').change(function() {
1590 if ($(this).val() == 'bar') {
1598 $('#download-chart').hide();
1601 [% IF results && !errors %]
1602 $('#draw-chart').click(function() {
1604 var x_elements = $('select[name="x"]').val();
1605 var y_elements = [];
1610 headers = [% header_row.json | $raw %];
1613 [% IF allresults.size %]
1614 if ($('input[name="chart-include-all"]').prop('checked')) {
1615 results = [% allresults.json | $raw %]
1618 results = [% results.json | $raw %]
1621 results = [% results.json | $raw %];
1624 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1625 results.splice(-1, 1);
1628 $('select[name="y"]').each(function( index ) {
1629 y_elements.push( $(this).val() );
1631 $('select[name="group"]').each(function( index ) {
1632 groups.push( $(this).val() );
1634 $('.column-line').each(function( index ) {
1635 if ($(this).prop('checked')) {
1636 lines.push( $(this).attr('name') );
1640 // Remove deleted columns from headers and results.
1641 var deleted_indexes = [];
1642 var kept_headers = [];
1643 $.each(headers, function(index, value) {
1644 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1645 // This header is neither a x element nor in y elements. Don't need it.
1646 deleted_indexes.push(index);
1649 kept_headers.push({cell: value.cell});
1653 // Remove coresponding cells.
1654 var kept_results = [];
1655 $.each(results, function(index, value) {
1658 $.each(value.cells, function(i, val) {
1659 if ($.inArray(i, deleted_indexes) === -1) {
1660 line['cells'].push({cell: val.cell});
1663 kept_results.push(line);
1666 options.type = $('select[name="chart-type"]').val();
1667 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1668 options.lines = lines;
1670 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1671 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1672 $("#toggle_chart_settings_vis").hide();
1673 $("#chartModal").modal("hide");
1677 load_group_subgroups();
1680 $('[data-toggle="tooltip"]').tooltip();
1681 var columns_settings = [% TablesSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1683 $('#limit').change(function() {
1684 $('#limitselect').submit();
1687 $(document).click(function() {
1688 $('#report_updated').hide();
1691 $(".goback").on("click",function(e){
1693 window.history.back();
1696 $("body").on("click", ".mana_search_button", function(){
1697 $("#mana-loading").show();
1698 mana_search($("#mana_search_field").val());
1701 $(".ShareButton").on("click", function(){
1702 $("#note-error").hide();
1703 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1704 $(".shared_infos").hide();
1705 $("#note-error").show();
1708 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1709 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1710 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1711 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1712 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1713 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1714 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1718 $("#ManaCloseButton").on("click", function() {
1719 $(".shared_infos").show();
1722 $("#addColumn").on("click",function(){
1726 $("#delColumn").on("click",function(){
1731 var rtable = KohaTable("table_reports", {
1732 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1733 'bAutoWidth': false,
1734 'sPaginationType': 'full',
1735 'aaSorting': [[ 1, "asc" ]],
1737 { "visible": false, "aTargets" : [ "hidden" ] }
1740 'sZeroRecords': _("No matching reports found")
1742 }, columns_settings);
1744 var rtabs = $("#tabs").tabs({
1745 create: function( e, ui ){
1746 tabsInit( ui, rtable );
1748 activate: function( e, ui ){
1749 tabsInit( ui, rtable );
1753 $("#tabs").tabs("option","active", activeTab );
1755 $("#subgroup_filter_block").hide();
1757 $("#subgroup_filter").change(function() {
1758 var selected = $(this).find('option:selected');
1759 var sg_id = $(selected).val();
1760 var sg_name = $(selected).text();
1761 if (sg_id.length > 0) {
1762 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1763 rtable.fnSetColumnVis(5, false);
1765 rtable.fnFilter('', 5);
1766 rtable.fnSetColumnVis(5, true);
1770 $("#reports_form").submit(function(){
1771 var checkedItems = $("input[name=ids]:checked");
1772 if ($(checkedItems).size() == 0) {
1773 alert(_("You must select one or more reports to delete"));
1776 $(checkedItems).parents('tr').addClass("warn");
1777 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1780 $(checkedItems).parents('tr').removeClass("warn");
1785 $("body").on("click", ".update_sql", function(e){
1787 var ltitle = $(this).text();
1788 var report_id = $(this).data("report_id");
1789 var page = $(this).attr("href");
1790 $("#update_sql .modal-body").load(page + " div", function(){
1791 var diff1 = $("#col1 .show_sql").text();
1792 var diff2 = $("#col2 .show_sql").text();
1793 var diffs = diffString( escape(diff1), escape(diff2) );
1794 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1796 $('#update_sql').modal('show');
1797 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1800 $("#update_sql").on("hidden.bs.modal", function(){
1801 $("#update_sql_label").html("");
1802 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1806 [% IF ( showsql ) %]
1807 $("#sql").focus(function() {
1812 $(".toggle_sql").click(function(){
1813 $("#sql_output").toggle();
1814 $("#toggle_sql_hid").toggle();
1815 $("#toggle_sql_vis").toggle();
1817 showsql = CodeMirror.fromTextArea(sql, {
1826 $(".toggle_chart_settings").click(function(){
1827 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1830 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1831 $(this).parents('tr').attr("class","warn");
1832 if(confirm(_("Are you sure you want to delete this saved report?"))){
1835 $(this).parents('tr').attr("class","");
1840 [% IF (create || editsql || save) %]
1842 var validated_form = $("#sql_report_form").validate({
1843 reportname: "required",
1846 depends: function(element) {
1847 return $("#create_group").prop("checked") && $("#groupdesc_input").val() != '';
1853 depends: function(element) {
1854 return $("#create_group").prop("checked") && $("#group_input").val() != '';
1860 $("#select_group").change(function() {
1861 if($(this).prop('checked')) {
1862 $("#group_input").attr("class","").prop('disabled', true).prop("required", false);
1863 $("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false);
1864 $("#group_select").prop('disabled', false);
1865 clearValidation( $("#sql_report_form") );
1866 if ($("#group_select").val().length > 0) {
1867 $("#select_subgroup").prop('checked', true);
1868 $("#select_subgroup").change();
1869 $("#subgroup, #subgroup *").show();
1871 $("#subgroup").hide();
1875 $("#create_group").change(function() {
1876 if($(this).prop('checked')) {
1877 $("#group_input").prop('disabled', false).prop("required", true );
1878 $("#groupdesc_input").prop('disabled', false).prop("required", true );
1879 $("#group_select").prop('disabled', true);
1880 // $("#create_subgroup").prop('checked', true).change();
1881 $("#subgroup_select").hide();
1882 $("#subgroup input[type='radio']").hide();
1883 $("#subgroup label[for]").hide();
1884 $("#subgroup_input").prop("required", false ).prop("disabled", false).show();
1885 $("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show();
1886 $("#subgroup").show();
1887 // Add validation rules for fields which were previously hidden
1888 $("#subgroup_input").rules("add", {
1890 depends: function(element) {
1891 return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != '';
1895 $("#subgroupdesc_input").rules("add", {
1897 depends: function(element) {
1898 return $("#create_group").prop("checked") && $("#subgroup_input").val() != '';
1904 $("#select_subgroup").change(function() {
1905 if($(this).prop('checked')) {
1906 $("#subgroup_select").prop('disabled', false);
1907 $("#subgroup_input").prop('disabled', true).prop("required", false );
1908 $("#subgroupdesc_input").prop('disabled', true).prop("required", false );
1909 clearValidation( $("#sql_report_form") );
1912 $("#create_subgroup").change(function() {
1913 if($(this).prop('checked')) {
1914 $("#subgroup_input").prop('disabled', false).prop("required", true );
1915 $("#subgroupdesc_input").prop('disabled', false).prop("required", true );
1916 $("#subgroup_select").val("").prop('disabled', true);
1919 $("#select_group").change();
1920 $("#select_subgroup").change();
1921 $("#group_select").on("change",function(){
1922 load_group_subgroups();
1925 $(".insertParam").on("click", function(e){
1927 var category = this.id;
1928 showParamModal( category );
1931 $("#runtime_parameters").on("shown.bs.modal", function(){
1932 $("#paramLabel").focus();
1935 $("#runtime_parameters").on("hide.bs.modal", function(){
1936 $("#send_runtime_parameter")[0].reset();
1937 $("#authorised_value_category").val("").hide();
1938 $("#authorised_value").prop("required", false ).removeAttr("required");
1941 $("#send_runtime_parameter").on("submit", function(e){
1943 /* Get form values */
1944 var paramLabel = $("#paramLabel").val();
1945 var param_category = $("#param_category").val();
1946 var categoryLabel = $("#authorised_value").val();
1947 // Get CodeMirror environment variables
1948 var selection = editor.getSelection();
1949 var doc = editor.getDoc();
1950 var cursor = doc.getCursor();
1955 /* Build runtime parameter text string */
1957 if( paramLabel && param_category ){
1958 text += paramLabel + "|" + param_category;
1959 } else if( paramLabel ) {
1961 } else if( param_category ){
1962 text += param_category;
1965 text = " <<" + text + ">> ";
1966 if( selection.length > 0){
1967 editor.replaceSelection(text);
1969 doc.replaceRange(text, pos);
1972 $("#runtime_parameters").modal("hide");
1975 $("#authorised_value").on("change", function(){
1976 $("#param_category").val( $(this).val() );
1981 $(".delete").on("click",function(){
1982 return confirmDelete(MSG_CONFIRM_DELETE);
1985 $("#mana_search_form").submit(function(e){
1989 $("#column_submit").submit(function() {
1990 if ($("#selectedColumns option").size() < 1) {
1991 alert(_("No columns selected!"));
1994 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1999 $("body").on("click", ".mana-use", function(e) {
2001 $(this).find("i").attr("class","fa fa-refresh fa-spin");
2002 mana_use( $(this).data("report_id") );
2005 $("#mana_search_result").on("hide.bs.modal", function(){
2006 $("#mana_result_content").html("");
2007 $("#mana_search_field").val("");
2010 $(".batch_op").on("click", function(e){
2012 var target_form = $(this).data("submit");
2013 $("#" + target_form ).submit();
2016 $("#batch_add_to_list").on("submit", function(e){
2021 $("body").on("click", ".preview_sql", function(e){
2023 var reportid = $(this).data("reportid");
2024 previewSql( reportid );
2028 function tabsInit( ui, rtable ){
2029 var thisTab = ui.newTab ? ui.newTab : ui.tab;
2030 var activeTab = thisTab.index();
2031 localStorage.setItem("sql_reports_activetab", activeTab );
2033 $("#subgroup_filter option").each(function() {
2034 if($(this).val().length > 0) {
2038 rtable.fnFilter('', 4);
2039 rtable.fnFilter('', 5);
2040 rtable.fnSetColumnVis(4, true);
2041 rtable.fnSetColumnVis(5, true);
2043 var g_id = $(ui.newTab).children().attr('id');
2044 var g_name = $(ui.newTab).text();
2045 if ( g_name == _("All") ) {
2050 if (g_id && g_id.length > 0) {
2051 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
2052 rtable.fnSetColumnVis(4, false);
2053 for(var i in group_subgroups[g_id]) {
2054 $("#subgroup_filter").append(
2055 '<option value="' + group_subgroups[g_id][i][0] + '">'
2056 + group_subgroups[g_id][i][1] + '</option>'
2059 $("#subgroup_filter_block").show();
2061 $("#subgroup_filter_block").hide();
2065 function addColumn() {
2066 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
2068 function delColumn() {
2069 $("#selectedColumns option:selected").remove();
2073 function mana_use( mana_id ){
2076 url: "/cgi-bin/koha/svc/mana/use",
2077 data: {id:mana_id, resource: 'report', saveinbase: 1},
2080 .done( function (result){
2081 if ( result.errmsg ){
2082 alert( result.errmsg );
2085 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
2088 .fail(function( error ) {
2089 $(".mana_use_status").hide();
2090 $("#mana_use_errortext").html( error.status + " " + error.statusText );
2091 $("#mana_use_failed").show();
2092 $(".mana-use i").attr("class","fa fa-download");
2096 function mana_search( textquery ){
2097 $(".mana_search_status").hide();
2098 $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
2100 if ( status == "error" ) {
2101 $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
2102 $("#mana_search_failed").show();
2103 $("#mana-loading").hide();
2105 $(".mana_search_status").hide();
2106 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
2107 $("#mana-loading").hide();
2108 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
2109 "sPaginationType":"full",
2112 { "width": "35%", "targets": 1 }
2115 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
2116 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
2120 $(".showbutton").on("click", function(e){
2122 $(this).parent().hide();
2123 $(this).parent().next().show();
2126 $(".hidebutton").on("click", function(e){
2128 $(this).parent().hide();
2129 $(this).parent().prev().show();
2132 if($("td.dataTables_empty").length == 0){
2133 $("#mana_search_message").show();
2139 function addToList() {
2140 var biblionumbers = [];
2141 $(".bib_to_list").each(function() {
2142 var biblionumber = Number( $(this).val() );
2143 if( biblionumbers.indexOf( biblionumber ) < 0 ){
2144 biblionumbers.push( biblionumber );
2147 bibs = biblionumbers.join("/");
2148 var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
2149 window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
2153 // Adapted from https://gist.github.com/jnormore/7418776
2154 function previewSql(reportid) {
2157 var message = $("#previewSql" + reportid ).val();
2158 var title = $("#previewSql" + reportid ).data("title");
2159 if( $("#preview-sql-modal").length > 0) {
2160 $("#preview-sql-modal").remove();
2162 $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
2163 <div class="modal-dialog">\
2164 <div class="modal-content">\
2165 <div class="modal-header" style="min-height:40px;">\
2166 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
2167 <span aria-hidden="true">×</span>\
2169 <h4 class="modal-title">' + title + '</h4>\
2171 <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
2172 <div class="modal-footer">\
2173 <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>\
2174 <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>\
2175 <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>\
2176 <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>\
2177 <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>\
2178 <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>\
2184 $("#preview-sql-modal").modal('show');
2185 CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
2193 [% FOREACH criteri IN criteria %]
2194 [% IF ( criteri.daterange ) %]
2195 var from_[% criteri.name.remove('\.') | html %]_value = $("#from_[% criteri.name.remove('\.') | html %]_value").flatpickr({
2196 onClose: function( selectedDates, dateText, instance) {
2197 validate_date( selectedDates, instance );
2198 to_[% criteri.name.remove('\.') | html %]_value.set('minDate', selectedDates[0]);
2201 var to_[% criteri.name.remove('\.') | html %]_value = $("#to_[% criteri.name.remove('\.') | html %]_value").flatpickr({
2202 onClose: function( selectedDates, dateText, instance) {
2203 validate_date( selectedDates, instance );
2212 [% INCLUDE 'intranet-bottom.inc' %]
2214 [% BLOCK group_and_subgroup_selection %]
2216 <label>Report group:</label>
2217 <input type="radio" name="select_or_create_group"
2218 id="select_group" checked="checked" />
2219 <label for="select_group" style="float:none">Select</label>
2220 <select name="group" id="group_select">
2221 <option value="">(None)</option>
2222 [% FOREACH group IN groups_with_subgroups %]
2223 [% IF (group.selected) %]
2224 <option value="[% group.id | html %]" selected="selected">
2226 <option value="[% group.id | html %]">
2228 [% group.name | html %]
2232 <input type="radio" name="select_or_create_group" id="create_group" />
2233 <label for="create_group" style="float:none">or create:</label>
2234 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
2235 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
2238 <label>Report subgroup:</label>
2239 <input type="radio" name="select_or_create_subgroup"
2240 id="select_subgroup" checked="checked" />
2241 <label for="select_subgroup" style="float:none">Select</label>
2242 <select name="subgroup" id="subgroup_select">
2243 <option value="">(None)</option>
2244 [% FOREACH group IN groups_with_subgroups %]
2245 [% IF (group.selected) %]
2246 [% FOREACH subgroup IN group.subgroups %]
2247 [% IF (subgroup.selected) %]
2248 <option value="[% subgroup.id | html %]" selected="selected">
2250 <option value="[% subgroup.id | html %]">
2252 [% subgroup.name | html %]
2258 <input type="radio" name="select_or_create_subgroup"
2259 id="create_subgroup" />
2260 <label for="create_subgroup" style="float:none">or create</label>
2261 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
2262 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
2266 [% BLOCK insert_runtime_parameter %]
2267 <div class="btn-group" style="margin-left:30px;">
2268 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2269 Insert runtime parameter <span class="caret"></span>
2271 <ul class="dropdown-menu">
2272 <li><a href="#" class="insertParam" id="insertAuthVal">Authorized value</a></li>
2273 <li><a href="#" class="insertParam" id="insertDate">Date</a></li>
2274 <li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li>
2275 <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2276 <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2277 <li><a href="#" class="insertParam" id="insertText">Text field</a></li>