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 #mana_search_errortext { font-family: monospace; font-weight: bold; }
52 [% Asset.css("css/reports.css") | $raw %]
53 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
56 <body id="rep_guided_reports_start" class="rep">
57 [% INCLUDE 'header.inc' %]
58 [% INCLUDE 'circ-search.inc' %]
60 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
63 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
66 <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
69 <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
74 <a href="#" aria-current="page">
78 [% ELSIF ( create ) %]
80 <a href="#" aria-current="page">
84 [% ELSIF ( showsql ) %]
86 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
89 <a href="#" aria-current="page">
90 [% reportname | html %] ([% id | html %])
93 [% ELSIF ( editsql ) %]
95 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
98 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
101 <a href="#" aria-current="page">
105 [% ELSIF ( execute ) %]
107 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
110 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
113 <a href="#" aria-current="page">
117 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
119 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
122 <a href="#" aria-current="page">
124 Step 1 of 6: Choose a module
125 [% ELSIF ( build2 ) %]
126 Step 2 of 6: Pick a report type
127 [% ELSIF ( build3 ) %]
128 Step 3 of 6: Select columns for display
129 [% ELSIF ( build4 ) %]
130 Step 4 of 6: Select criteria to limit on
131 [% ELSIF ( build5 ) %]
132 Step 5 of 6: Pick which columns to total
133 [% ELSIF ( build6 ) %]
134 Step 6 of 6: Select how you want the report ordered
139 </nav> <!-- /#breadcrumbs -->
141 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
142 <div class="modal-dialog">
143 <div class="modal-content">
144 <div class="modal-header">
145 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
146 <h3 id="update_sql_label">Update SQL</h3>
148 <div class="modal-body">
149 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
151 <div class="modal-footer">
152 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
153 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
155 </div> <!-- /.modal-content -->
156 </div> <!-- /.modal-dialog -->
157 </div> <!-- #update_sql -->
159 <div class="main container-fluid">
161 <div class="col-sm-10 col-sm-push-2">
164 [% INCLUDE "reports-toolbar.inc" %]
167 <h2>Guided reports</h2>
168 <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>
170 <h3>Build and run reports</h3>
172 [% IF ( CAN_user_reports_create_reports ) %]
173 <form action="/cgi-bin/koha/reports/guided_reports.pl">
174 <input type="hidden" name="phase" value="Build new" />
175 <input type="submit" name="submit" value="Build new"/>
179 [% IF ( CAN_user_reports_execute_reports ) %]
180 <form action="/cgi-bin/koha/reports/guided_reports.pl">
181 <input type="hidden" name="phase" value="Use saved"/>
182 <input type="submit" name="submit" value="Use saved"/>
186 [% IF ( CAN_user_reports_create_reports ) %]
187 <form action="/cgi-bin/koha/reports/guided_reports.pl">
188 <input type="hidden" name="phase" value="Create report from SQL"/>
189 <input type="submit" name="submit" value="Create report from SQL"/>
193 <h3>Reports Dictionary</h3>
194 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
195 <form action="/cgi-bin/koha/reports/dictionary.pl">
196 <input type="hidden" name="phase" value="View Dictionary"/>
197 <input type="submit" name="submit" value="View dictionary"/>
199 [% END # /IF (start) %]
201 [% IF report_converted %]
202 <div class="dialog message">
203 The report "[% report_converted | html %]" has been converted.
207 [% IF report_converted %]
208 <div class="dialog message">
209 The report "[% report_converted | html %]" has been converted.
214 [% IF ( savedreports ) %]
215 <h1>Saved reports</h1>
217 [% IF ( filters.date || filters.author || filters.keyword ) %]
219 <span class="filter">
220 [% IF ( filters.date ) %]
221 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
223 [% IF ( filters.author ) %]
224 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
226 [% IF ( filters.keyword ) %]
227 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
229 <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>
234 <div id="tabs" class="toptabs">
236 <li><a href="#reports">All</a></li>
237 [% FOREACH group IN groups_with_subgroups %]
238 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
242 <div id="subgroup_filter_block">
243 <label for="subgroup_filter">Subgroup:</label>
244 <select id="subgroup_filter">
245 <option value="">All</option>
249 [% IF (Koha.Preference('Mana') == 1) %]
251 <div id="mana_search_message" class="dialog message">
252 <p> [% manamsg | html %] </p>
257 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
258 <input type="hidden" name="phase" value="Delete Multiple" />
259 <table id="table_reports">
262 <th class="NoSort"> </th>
270 <th>Creation date</th>
273 <th class="report_public">Public</th>
274 <th class="report_json_url">JSON URL</th>
276 <th>Cache expiry (seconds)</th>
278 <th class="hidden"> </th>
280 <th>Saved results</th>
281 [% IF has_obsolete_reports %]
284 <th class="hidden"> </th>
286 <th class="NoSort noExport">Actions</th>
290 [% FOREACH savedreport IN savedreports %]
291 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
292 <td class="report_checkbox">
293 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
294 <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
296 <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
298 <td class="report_id">
299 <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
301 <td class="report_name">
302 [% IF ( savedreport.report_name ) %]
303 [% savedreport.report_name | html %]
308 <td class="report_type">
309 [% savedreport.type | html %]
311 <td class="report_group">
312 [% savedreport.groupname | html %]
315 [% savedreport.subgroupname | html %]
317 <td class="report_notes">
318 [% savedreport.notes | html %]
321 [% savedreport.borrowersurname | html %]
322 [% IF ( savedreport.borrowerfirstname ) %]
323 , [% savedreport.borrowerfirstname | html %]
325 ([% savedreport.borrowernumber | html %])
327 <td data-order="[% savedreport.date_created | html %]">
328 [% savedreport.date_created | $KohaDates %]
330 <td data-order="[% savedreport.last_modified | html %]">
331 [% savedreport.last_modified | $KohaDates with_hours => 1 %]
333 <td data-order="[% savedreport.last_run | html %]">
334 [% savedreport.last_run | $KohaDates with_hours => 1 %]
336 <td class="report_public">
337 [% IF (savedreport.public) %]
343 <td class="report_json_url">
344 [% IF (savedreport.public) %]
345 <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>
347 <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>
351 [% savedreport.cache_expiry | html %]
354 [% FOR result IN savedreport.results %]
355 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
360 [% IF savedreport.seems_obsolete %]
361 This report seems obsolete, it uses biblioitems.marcxml field.
362 <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>
366 <div class="btn-group dropup">
367 [%# There should be no space between these two buttons, it would render badly %]
368 <a class="btn btn-default btn-xs" role="button"
369 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
370 class="fa fa-play"></i> Run</a><a
371 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
372 href="#"><b class="caret"></b></a>
373 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
374 <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>
376 <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
377 <i class="fa fa-eye"></i> Preview SQL
380 [% IF ( CAN_user_reports_create_reports ) %]
381 <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>
382 <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>
384 [% IF (Koha.Preference('Mana') == 1) %]
385 <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>
387 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
388 [% IF ( CAN_user_reports_delete_reports ) %]
389 <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>
393 <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
400 [% IF ( CAN_user_reports_delete_reports ) %]
401 <fieldset class="action">
402 <input type="submit" value="Delete selected" />
408 [% ELSE # IF ( savedreports ) %]
409 <div class="dialog message">
410 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
411 <h4>No saved reports match your criteria. </h4>
412 [% IF ( CAN_user_reports_create_reports ) %]
413 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
414 <input type="hidden" name="phase" value="Build new" />
415 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
418 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
419 <input type="hidden" name="phase" value="Create report from SQL" />
420 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
423 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
424 <input type="hidden" name="phase" value="Use saved" />
425 <input type="hidden" name="filter_set" value="1" />
426 <input type="hidden" name="filter_keyword" value="" />
427 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
431 <h4>There are no saved reports. </h4>
432 [% IF ( CAN_user_reports_create_reports ) %]
433 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
435 [% END # IF (filter_set || filters.date || filters.author || filters.keyword) %]
436 </div> <!-- /.dialog.message -->
437 [% END # /IF ( savedreports ) %]
438 [% END # /IF ( saved1 ) %]
440 [% INCLUDE 'mana/mana-share-report.inc' %]
443 [% IF ( cache_error) %]
444 <div class="dialog alert">
445 <strong> Please choose a cache_expiry less than 30 days </strong>
449 <h1>Build a report</h1>
450 <form action="/cgi-bin/koha/reports/guided_reports.pl">
451 <fieldset class="rows">
452 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
455 <label for="area">Choose: </label>
456 <select name="area" id="area">
457 [%- FOREACH area IN areas -%]
458 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
464 <label for="public">Report is public:</label>
465 <select id="public" name="public">
466 <option value="0">No (default)</option>
467 <option value="1" selected="selected">Yes</option>
472 <label for="public">Report is public:</label>
473 <select id="public" name="public">
474 <option value="0" selected="selected">No (default)</option>
475 <option value="1">Yes</option>
482 <label for="cache_expiry">Cache expiry:</label>
483 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
484 <select id="cache_expiry_units" name="cache_expiry_units">
485 <option value="seconds">Seconds (default)</option>
486 <option value="minutes">Minutes</option>
487 <option value="hours">Hours</option>
488 <option value="days">Days</option>
493 </fieldset> <!-- /.rows -->
494 <fieldset class="action">
495 <input type="hidden" name="phase" value="Report on this Area" />
496 <input type="submit" name="submit" value="Next >>" />
502 <h1>Build a report</h1>
503 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
504 <input type="hidden" name="area" value="[% area | html %]" />
505 <input type="hidden" name="public" value="[% public | html %]" />
506 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
507 <fieldset class="rows">
508 <legend>Step 2 of 6: Pick a report type</legend>
511 <label for="types">Choose: </label>
512 <select id="types" name="types">
513 <option value="1">Tabular</option>
514 <option value="2" disabled="disabled">Summary</option>
515 <option value="3" disabled="disabled">Matrix</option>
521 <fieldset class="action">
522 <input type="hidden" name="phase" value="Choose this type" />
523 <input type="button" name="back" value="<< Back" class="goback" />
524 <input type="submit" name="submit" value="Next >>" />
527 [% END # /IF (build2 ) %]
530 <h1>Build a report</h1>
531 <h3>Step 3 of 6: Select columns for display</h3>
532 <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>
534 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
535 <input type="hidden" name="area" value="[% area | html %]" />
536 <input type="hidden" name="type" value="[% type | html %]" />
537 <input type="hidden" name="public" value="[% public | html %]" />
538 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
541 <div class="col-sm-6">
542 <div style="float: left;">
543 <select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
544 [% FOREACH column IN columns %]
545 [% IF ( column.table ) %]
546 [% IF ( loop.first ) %]
550 <optgroup label="[% column.table | html %]">
552 <option value="[% column.name | html %]">
553 [% IF ( column.description ) %]
554 [% column.description | html %] / [% column.name | html %]
556 [% column.name | html %]
564 <div style="width: 6.3em; float: right; margin-top: 100px">
565 <input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
566 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" />
568 </div> <!-- /.col-sm-6 -->
570 <div class="col-sm-6">
571 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;">
574 </div> <!-- /.row -->
576 <fieldset class="action">
577 <input type="hidden" name="phase" value="Choose these columns" />
578 <input type="button" name="back" value="<< Back" class="goback" />
579 <input type="submit" name="submit" value="Next >>" />
581 </form> <!-- /#column_submit -->
582 [% END # /IF ( build3 ) %]
585 <h1>Build a report</h1>
586 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
587 <input type="hidden" name="area" value="[% area | html %]" />
588 <input type="hidden" name="type" value="[% type | html %]" />
589 <input type="hidden" name="column" value="[% column | html %]" />
590 <input type="hidden" name="public" value="[% public | html %]" />
591 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
593 <legend>Step 4 of 6: Select criteria to limit on</legend>
595 [% FOREACH criteri IN criteria %]
598 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
599 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
601 [% IF ( criteri.date ) %]
603 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
604 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
608 [% IF ( criteri.textrange ) %]
611 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
612 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
616 [% IF ( criteri.daterange ) %]
619 <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
621 <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
622 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
627 <select name="[% criteri.name | html %]_value">
628 [% FOREACH value IN criteri.values %]
629 <option value="[% value.availablevalues | html %]">
630 [% IF ( value.default ) %]
633 [% value.display_value | html %]
647 [% IF ( definitions ) %]
649 <legend>Dictionary definitions</legend>
651 [% FOREACH definition IN definitions %]
654 <input type="checkbox" name="definition" value="[% definition.id | html %]" />
655 [% definition.name | html %]
663 <fieldset class="action">
664 <input type="hidden" name="phase" value="Choose these criteria" />
665 <input type="button" name="back" value="<< Back" class="goback" />
666 <input type="submit" name="submit" value="Next >>" />
669 [% END # /IF ( build4 ) %]
672 <h1>Build a report</h1>
673 <h3>Step 5 of 6: Pick which columns to total</h3>
674 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
675 <input type="hidden" name="area" value="[% area | html %]" />
676 <input type="hidden" name="type" value="[% type | html %]" />
677 <input type="hidden" name="column" value="[% column | html %]" />
678 <input type="hidden" name="definition" value="[% definition | html %]" />
679 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
680 <input type="hidden" name="public" value="[% public | html %]" />
681 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
684 [% FOREACH total_b IN total_by %]
687 <input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" />
688 <label for="[% total_b.name | html %]">[% total_b.name | html %]</label>
691 <select name="[% total_b.name | html %]_tvalue">
692 [% FOREACH selec IN total_b.select %]
693 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
702 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
703 <input type="button" name="back" value="<< Back" class="goback" />
704 <input type="submit" name="submit" value="Next >>" />
707 [% END # /IF ( build5 ) %]
710 <h1>Build a report</h1>
711 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
712 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
713 <input type="hidden" name="area" value="[% area | html %]" />
714 <input type="hidden" name="type" value="[% type | html %]" />
715 <input type="hidden" name="column" value="[% column | html %]" />
716 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
717 <input type="hidden" name="definition" value="[% definition | html %]" />
718 <input type="hidden" name="totals" value="[% totals | html %]" />
719 <input type="hidden" name="public" value="[% public | html %]" />
720 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
723 [% FOREACH order_b IN order_by %]
726 <input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" />
727 <label for="[% order_b.name | html %]">[% order_b.name | html %]</label>
730 <select name="[% order_b.name | html %]_ovalue">
731 [% FOREACH selec IN order_b.select %]
732 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
740 <fieldset class="action">
741 <input type="hidden" name="phase" value="Build report" />
742 <input type="submit" name="submit" value="Finish" />
745 [% END #/ IF ( build6 ) %]
747 [% IF ( showreport ) %]
748 <h1>Confirm custom report</h1>
749 <p>Your report will be generated with the following SQL statement.</p>
754 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
755 <input type="hidden" name="sql" value="[% sql | html %]" />
756 <input type="hidden" name="type" value="[% type | html %]" />
757 <input type="hidden" name="public" value="[% public | html %]" />
758 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
759 <p>You will need to save the report before you can execute it</p>
760 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
761 <input type="submit" name="submit" value="Next" />
764 [% END #/ IF ( showreport ) %]
767 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
768 <input type="hidden" name="sql" value="[% sql | html %]" />
769 <input type="hidden" name="type" value="[% type | html %]" />
770 <input type="hidden" name="area" value="[% area | html %]" />
771 <input type="hidden" name="public" value="[% public | html %]" />
772 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
773 <fieldset class="rows">
774 <legend>Save your custom report</legend>
777 <label for="reportname" class="required">Report name: </label>
778 <input type="text" id="reportname" name="reportname" class="required" required="required" />
779 <span class="required">Required</span>
781 [% PROCESS group_and_subgroup_selection %]
783 <label for="notes">Notes:</label>
784 <textarea name="notes" id="notes"></textarea>
788 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
789 <input type="submit" name="submit" value="Save report" />
792 [% END # /IF( save ) %]
794 [% IF ( warn_authval_problem ) %]
795 <div class="dialog alert">
796 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
797 [% FOREACH problematic_authval IN problematic_authvals %]
799 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
800 you selected does not exist.
803 <!-- Save Anyway Form -->
804 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
805 <!--Every parameter the user issued is provided as a hidden field for recovery-->
806 <input type='hidden' name='id' value='[% id | html %]' />
807 <input type='hidden' name='sql' value='[% sql | html %]' />
808 <input type='hidden' name='reportname' value='[% reportname | html %]' />
809 <input type='hidden' name='group' value='[% group | html %]' />
810 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
811 <input type='hidden' name='notes' value='[% notes | html %]' />
812 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
813 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
814 <input type='hidden' name='public' value='[% public | html %]' />
815 [% IF ( phase_update) %]
816 <input type='hidden' name='phase' value='Update SQL' />
817 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
818 [% ELSIF ( phase_save) %]
819 <input type='hidden' name='area' value='[% area | html %]' />
820 <input type='hidden' name='phase' value='Save Report' />
821 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
824 <!-- Go back to editing -->
825 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
826 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
829 [% END # /IF ( warn_authval_problem )%]
831 [% IF ( enter_params ) %]
832 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
833 <input type='hidden' name='reports' value="[% reports | html %]" />
834 [% IF ( auth_val_error ) %]
835 <input type='hidden' name='phase' value='Edit SQL' />
836 <div class="dialog alert">
837 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
838 [% FOREACH auth_val_error IN auth_val_errors %]
840 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
841 you selected does not exist.
845 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
846 [% ELSE # IF ( auth_val_error ) %]
847 <input type='hidden' name='phase' value='Run this report' />
848 <h1>Enter parameters for report [% name | html %]:</h1>
850 <p>[% notes | html %]</p>
852 <fieldset class="rows">
854 [% FOREACH sql_param IN sql_params %]
855 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
856 [% IF sql_param.input == 'date' %]
858 <label for="date_[% sql_param_entry | html %][% loop.count | html %]">[% sql_param.entry | html %]:</label> <input id="date_[% sql_param_entry | html %][% loop.count | html %]" type="text" value="" size="10" name="sql_params" class="datepicker" />
860 [% ELSIF ( sql_param.input == 'text' ) %]
862 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
863 <input id="sql_params[% loop.count | html %]" type="text" name="sql_params" />
865 [% ELSIF ( sql_param.input == 'textarea' ) %]
867 <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
868 <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
872 <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
873 <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]">
874 [% IF (sql_param.include_all) %]
875 <option value="%">All</option>
877 [% FOREACH value IN sql_param.input.values %]
878 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
882 [% END # /IF sql_param.input == 'date' %]
883 [% END # /FOREACH sql_param %]
885 </fieldset> <!-- /.rows -->
886 <fieldset class="action">
887 <input type="submit" value="Run the report" />
889 [% END # / IF ( auth_val_error ) %]
891 [% END # /IF ( enter_params ) %]
894 <h1>[% name | html %] <span id="report_id">([% id | html %])</span></h1>
896 <p><span class="label">Notes:</span> [% notes | html %]</p>
898 [% IF ( unlimited_total ) %]
900 <span class="label">Total number of results:</span>
901 [% unlimited_total | html %]
902 [% IF unlimited_total > limit %]
903 ([% limit | html %] shown)
908 <div id="sql_output" style="display:none;">
909 <span class="label">Report SQL:</span>
910 <textarea id="sql" readonly="readonly">[% sql | html %]</textarea>
914 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
915 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
917 <div id="chart" class="clearfix"></div>
920 [% UNLESS ( errors ) %]
921 <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/tools/batch_record_modification.pl" id="batch_record_modification">
922 <input type="hidden" name="recordtype" value="biblio" />
923 <input type="hidden" name="op" value="list" />
924 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
925 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
926 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
930 <form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
931 <input type="hidden" name="recordtype" value="biblio" />
932 <input type="hidden" name="op" value="list" />
933 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
934 <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
935 [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
939 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
940 <input type="hidden" name="op" value="show" />
941 [% FOREACH result IN results %]
942 [% FOREACH cells IN result.cells %]
943 [% place = loop.index %]
944 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
945 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
946 [% SET batch_itemnumbers = 1 %]
947 [% SET header_row.$place.has_itemnumbers = 1 %]
948 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
954 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_deletion">
955 <input type="hidden" name="op" value="show" />
956 <input type="hidden" name="del" value="1" />
957 [% FOREACH result IN results %]
958 [% FOREACH cells IN result.cells %]
959 [% place = loop.index %]
960 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
961 [% IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
962 [% SET batch_itemnumbers = 1 %]
963 [% SET header_row.$place.has_itemnumbers = 1 %]
964 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
970 <form method="get" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl" id="batch_add_to_list">
971 [% FOREACH result IN results %]
972 [% FOREACH cells IN result.cells %]
973 [% place = loop.index %]
974 [% NEXT UNLESS cells.cell.match('^(\d+)$') %]
975 [% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
976 [% SET batch_biblionumbers = 1 %]
977 [% SET header_row.$place.has_biblionumbers = 1 %]
978 <input type="hidden" class="bib_to_list" name="biblionumber" value="[% cells.cell | html %]" />
984 <form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
985 <input type="hidden" name="op" value="show" />
986 [% # Preserve the whitespace of the following textarea in order to format the values correctly %]
987 <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
988 [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
992 [% BLOCK batch_list %]
993 [%- FOREACH result IN results %]
994 [%- FOREACH cells IN result.cells %]
995 [%- place = loop.index %]
996 [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
997 [%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
1002 [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1004 <div class="btn-group">
1005 <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
1006 Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
1007 <span class="caret"></span>
1009 <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
1010 [% FOREACH header_ro IN header_row %]
1011 [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
1012 <li class="dropdown-header">Bibliographic records</li>
1014 <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>
1017 <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>
1020 <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>
1023 [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
1024 [% IF ( batch_biblionumbers ) %]
1025 <li role="separator" class="divider"></li>
1027 <li class="dropdown-header">Item records</li>
1029 <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>
1032 <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>
1035 [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
1036 [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
1037 <li role="separator" class="divider"></li>
1039 <li class="dropdown-header">Patron records</li>
1041 <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>
1045 </ul> <!-- /.dropdown-menu -->
1046 </div> <!-- /.dropdown -->
1048 [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
1049 [% END # UNLESS ( errors ) %]
1050 [% END # IF ( execute ) %]
1052 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
1053 <input type="hidden" name="phase" value="Run this report"/>
1054 <input type="hidden" name="reports" value="[% report_id | html %]"/>
1056 [% FOREACH p IN sql_params %]
1057 <input type="hidden" name="sql_params" value="[% p | html %]"/>
1059 [% FOREACH n IN param_names %]
1060 <input type="hidden" name="param_name" value="[% n | html %]"/>
1063 <label for="limit">Rows per page: </label>
1064 <select name="limit" id="limit">
1065 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
1066 [% FOREACH l IN limits %]
1068 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
1070 <option value="[% l | html %]">[% l | html %]</option>
1074 </form> <!-- /#limitselect -->
1076 <div class="pages">[% pagination_bar | $raw %]</div>
1077 [% UNLESS ( errors ) %]
1080 [% FOREACH header_ro IN header_row %]
1081 <th>[% header_ro.cell | html %]</th>
1084 [% FOREACH result IN results %]
1086 [% FOREACH cells IN result.cells %]
1087 <td>[% cells.cell | $raw %]</td>
1093 <div class="pages">[% pagination_bar | $raw %]</div>
1095 [% INCLUDE 'chart.inc' %]
1097 [% END #/IF ( execute ) %]
1100 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1101 <fieldset class="rows">
1102 <legend>Create report from SQL</legend>
1105 <label for="reportname" class="required">Report name:</label>
1106 [% IF ( reportname ) %]
1107 <input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
1109 <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
1111 <span class="required">Required</span>
1113 [% PROCESS group_and_subgroup_selection %]
1117 <label for="public">Report is public:</label>
1118 <select id="public" name="public">
1119 <option value="0">No (default)</option>
1120 <option value="1" selected="selected">Yes</option>
1125 <label for="public">Report is public:</label>
1126 <select id="public" name="public">
1127 <option value="0" selected="selected">No (default)</option>
1128 <option value="1">Yes</option>
1131 [% END # /IF (public) %]
1135 <label for="cache_expiry">Cache expiry:</label>
1136 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
1137 <select id="cache_expiry_units" name="cache_expiry_units">
1138 <option value="seconds" selected="selected">Seconds (default)</option>
1139 <option value="minutes">Minutes</option>
1140 <option value="hours">Hours</option>
1141 <option value="days">Days</option>
1144 [% END # /IF (usecache) %]
1146 <label for="notes">Notes:</label>
1147 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1150 </fieldset> <!-- /.rows -->
1152 <fieldset class="rows">
1153 <legend>SQL:</legend>
1154 <div style="margin:1em;">
1155 [% PROCESS insert_runtime_parameter %]
1156 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1157 <span class="required">Required</span>
1161 <fieldset class="action">
1162 <input type="hidden" name="phase" value="Save Report" />
1163 <input type="submit" name="submit" value="Save report" />
1164 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1167 [% END #/IF ( create ) %]
1169 [% IF saved_results %]
1170 <h1>Saved report results</h1>
1171 <h2>[% name | html %]</h2>
1172 <p>[% notes | html %]</p>
1174 [% FOREACH rows IN saved_results %]
1176 [% FOREACH col IN rows %]
1177 <td>[% col | html %]</td>
1182 [% END # /IF saved_results %]
1184 [% IF ( showsql ) %]
1185 <fieldset class="rows">
1186 <legend>[% reportname | html %]</legend>
1190 <span class="label">Notes:</span>
1196 <textarea id="sql">[% sql | html %]</textarea>
1200 [% END # /IF ( showsql ) %]
1202 [% IF ( save_successful ) %]
1203 [% UNLESS ( errors ) %]
1205 <div id="report_updated">
1206 <div class="dialog message">
1207 <p>Your report "[% reportname | html %]" has been saved</p>
1213 [% IF ( editsql ) %]
1214 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
1215 <input type="hidden" name="phase" value="Update SQL" />
1216 <input type="hidden" name="id" value="[% id | html %]"/>
1217 <fieldset class="rows">
1218 <legend>Edit SQL report</legend>
1221 <label for="reportname" class="required">Report name: </label>
1222 <input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" />
1223 <span class="required">Required</span>
1225 [% PROCESS group_and_subgroup_selection %]
1228 <label for="public">Report is public:</label>
1229 <select id="public" name="public">
1230 <option value="0">No (default)</option>
1231 <option value="1" selected="selected">Yes</option>
1236 <label for="public">Report is public:</label>
1237 <select id="public" name="public">
1238 <option value="0" selected="selected">No (default)</option>
1239 <option value="1">Yes</option>
1242 [% END # /IF (public) %]
1246 <label for="cache_expiry">Cache expiry:</label>
1247 <input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]" />
1248 <select id="cache_expiry_units" name="cache_expiry_units">
1249 <option value="seconds">Seconds (default)</option>
1250 <option value="minutes">Minutes</option>
1251 <option value="hours">Hours</option>
1252 <option value="days">Days</option>
1257 <label for="notes">Notes:</label>
1258 <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea>
1261 </fieldset> <!-- /.rows -->
1263 <fieldset class="rows">
1264 <legend>SQL:</legend>
1265 [% PROCESS insert_runtime_parameter %]
1266 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
1267 <span class="required" style="margin-left:30px;">Required</span>
1270 <fieldset class="action">
1271 <input type="submit" name="submit" value="Update SQL" />
1272 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1275 [% END # /IF ( editsql ) %]
1278 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1279 <div class="dialog alert">
1280 <strong>The following error was encountered:</strong><br />
1281 [% FOREACH error IN errors %]
1282 [% IF ( error.sqlerr ) %]
1283 This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
1284 Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
1285 Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1286 [% ELSIF ( error.queryerr ) %]
1287 The database returned the following error: <br />
1288 [% error.queryerr | html %]<br />Please check the log for further details.
1289 [% ELSIF ( error.cache_expiry ) %]
1290 Please select a cache expiry less than 30 days.
1293 <div id="onerror_actions">
1294 <a href="#" class="button goback">Return to previous page</a>
1298 <fieldset class="action">
1299 <input type="hidden" name="phase" value="Use saved" />
1300 <input type="submit" name="submit" value="Saved reports" />
1303 [% END # /IF ( errors ) %]
1306 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1308 <div class="col-sm-2 col-sm-pull-10">
1311 <div id="saved-reports-filter">
1312 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1313 <input type="hidden" name="phase" value="Use saved" />
1314 <input type="hidden" name="filter_set" value="1" />
1315 <fieldset class="brief">
1319 <label for="filter_date">Date:</label>
1320 <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1321 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1324 <label for="filter_author">Author:</label>
1325 <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" />
1328 <label for="filter_keyword">Keyword:</label>
1329 <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" />
1332 </fieldset> <!-- /.brief -->
1333 <fieldset class="action">
1334 <input type="submit" value="Apply filter" />
1335 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1338 </div> <!-- /#saved-reports-filter -->
1340 [% INCLUDE 'guided-reports-view.inc' %]
1342 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1343 </div> <!-- /.row -->
1345 <!-- Runtime Parameters Modal -->
1346 <div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel">
1347 <div class="modal-dialog" role="document">
1348 <div class="modal-content">
1349 <div class="modal-header">
1350 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
1351 <h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4>
1353 <form id="send_runtime_parameter">
1354 <input type="hidden" name="param_category" id="param_category" />
1355 <div class="modal-body">
1356 <div class="form-group">
1357 <label for="paramLabel">Parameter label: </label>
1358 <input class="form-control" type="text" name="paramLabel" id="paramLabel">
1359 <div class="hint">Optional. The label for the field shown when the report is run, e.g. "Select a library."</div>
1361 <div id="authorised_value_category" class="form-group" style="display:none">
1362 <label for="authorised_value">Authorized value category:</label>
1363 <select class="form-control" name="authorised_value" id="authorised_value" size="1">
1364 <option value=""></option>
1365 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
1367 <div class="hint">Select which authorized value category the user will choose from.</div>
1369 </div> <!-- /.modal-body -->
1370 <div class="modal-footer">
1371 <button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button>
1372 <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
1373 </div> <!-- /.modal-footer -->
1374 </form> <!-- /#send_runtime_parameter -->
1375 </div> <!-- /.modal-content -->
1376 </div> <!-- /.modal-dialog -->
1377 </div> <!-- /#runtime_parameters -->
1379 [% MACRO jsinclude BLOCK %]
1380 [% Asset.js("js/charts.js") | $raw %]
1381 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1382 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1383 [% INCLUDE 'calendar.inc' %]
1384 [% INCLUDE 'datatables.inc' %]
1386 [% INCLUDE 'columns_settings.inc' %]
1388 [% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
1389 [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
1390 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1391 [% Asset.js( "js/mana.js" ) | $raw %]
1394 function hide_bar_element() {
1395 $('#chart-column-horizontal').hide()
1396 $('.chart-column-group').each(function( index ) {
1399 $('.chart-column-line').each(function( index ) {
1404 function show_bar_element() {
1405 $('#chart-column-horizontal').show()
1406 $('.chart-column-group').each(function( index ) {
1409 $('.chart-column-line').each(function( index ) {
1414 function removeColumn(id) {
1417 if ( $('.chart-column-conf').length == 1 ) {
1418 $('.chart-column-delete').remove();
1422 /* overlay a syntax-highlighting definition on top of the existing sql one */
1423 CodeMirror.defineMode("sqlParams", function(config, parserConfig) {
1424 var sqlParamsOverlay = {
1425 token: function(stream, state) {
1427 if (stream.match("<<")) {
1428 while ((ch = stream.next()) != null)
1429 if (ch == ">" && stream.next() == ">") {
1434 while (stream.next() != null && !stream.match("<<", false)) {}
1438 return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlParamsOverlay);
1441 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1442 var group_subgroups = {};
1443 [% FOREACH group IN groups_with_subgroups %]
1444 var gid = "[% group.id | html %]"
1445 group_subgroups[gid] = new Array();
1446 [% FOREACH subgroup IN group.subgroups %]
1447 var sgid = "[% subgroup.id | html %]";
1448 var sgname = "[% subgroup.name | html %]";
1449 group_subgroups[gid].push([sgid, sgname]);
1453 [% IF ( create || editsql || save ) %]
1455 var editor = CodeMirror.fromTextArea(sql, {
1457 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1462 // https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232
1463 function clearValidation( formElement ){
1464 // formElement should be a jQuery object
1465 var validator = formElement.validate();
1466 // Iterate through named elements inside of the form, and mark them as error free
1467 $('[name]',formElement).each(function(){
1468 validator.successList.push(this);//mark as error free
1469 validator.showErrors();//remove error messages if present
1471 validator.resetForm();//remove error class on name elements and clear history
1472 validator.reset();//remove all error and success data
1476 [% IF ( showsql ) %]
1477 var editor = CodeMirror.fromTextArea(sql, {
1479 mode: "sqlParams", /* text/x-sql plus custom sqlParams configuration */
1485 function showParamModal( category ){
1486 var modal = $("#runtime_parameters");
1487 var modalTitle = $("#runtime_parametersLabel");
1488 switch ( category ){
1489 case "insertAuthVal":
1490 modalTitle.text( _("Insert authorized value parameter") );
1491 $("#paramLabel").val("Authorized value")
1492 $("#authorised_value_category").show();
1493 $("#authorised_value").prop("required", true ).attr("required", "required");
1496 modalTitle.text( _("Insert date parameter") );
1497 $("#paramLabel").val("Date")
1498 $("#param_category").val("date");
1500 case "insertItemtypes":
1501 modalTitle.text( _("Insert item types parameter") );
1502 $("#paramLabel").val("Item type")
1503 $("#param_category").val("itemtypes");
1505 case "insertBranches":
1506 modalTitle.text( _("Insert libraries parameter") );
1507 $("#paramLabel").val("Library")
1508 $("#param_category").val("branches");
1510 case "insertCategorycode":
1511 modalTitle.text( _("Insert patron category parameter") );
1512 $("#paramLabel").val("Patron category")
1513 $("#param_category").val("categorycode");
1516 modalTitle.text( _("Insert text parameter") );
1517 $("#paramLabel").val("Text")
1518 $("#param_category").val("");
1521 $("#paramLabel").select();
1522 modal.modal("show");
1525 function load_group_subgroups () {
1526 var group = $("#group_select").val();
1527 var sg = $("#subgroup");
1528 $(sg).find('option[value!=""]').each(function() {
1533 var select = $(sg).find('select')[0];
1534 $.each( group_subgroups[group], function(index, value) {
1535 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1537 $("#subgroup, #subgroup *").show();
1541 $(document).ready(function(){
1543 var activeTab = localStorage.getItem("sql_reports_activetab");
1545 $("body").on('click',".fetch_chart_data",function(){
1546 if( [% unlimited_total || 0 | $raw %] > 1000 ){
1547 if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
1558 if ( $('.chart-column-conf').length == 1 ) {
1559 $('.chart-column-delete').remove();
1562 $(".chart-column-delete").on('click', function(e){
1564 removeColumn('column_' + $(this).data('column'));
1567 $('#download-chart').click(function() {
1568 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1569 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1570 this.setAttribute('download', 'chart.svg');
1573 $('#chart-type').change(function() {
1574 if ($(this).val() == 'bar') {
1582 $('#download-chart').hide();
1585 [% IF results && !errors %]
1586 $('#draw-chart').click(function() {
1588 var x_elements = $('select[name="x"]').val();
1589 var y_elements = [];
1594 headers = [% header_row.json | $raw %];
1597 [% IF allresults.size %]
1598 if ($('input[name="chart-include-all"]').prop('checked')) {
1599 results = [% allresults.json | $raw %]
1602 results = [% results.json | $raw %]
1605 results = [% results.json | $raw %];
1608 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1609 results.splice(-1, 1);
1612 $('select[name="y"]').each(function( index ) {
1613 y_elements.push( $(this).val() );
1615 $('select[name="group"]').each(function( index ) {
1616 groups.push( $(this).val() );
1618 $('.column-line').each(function( index ) {
1619 if ($(this).prop('checked')) {
1620 lines.push( $(this).attr('name') );
1624 // Remove deleted columns from headers and results.
1625 var deleted_indexes = [];
1626 var kept_headers = [];
1627 $.each(headers, function(index, value) {
1628 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1629 // This header is neither a x element nor in y elements. Don't need it.
1630 deleted_indexes.push(index);
1633 kept_headers.push({cell: value.cell});
1637 // Remove coresponding cells.
1638 var kept_results = [];
1639 $.each(results, function(index, value) {
1642 $.each(value.cells, function(i, val) {
1643 if ($.inArray(i, deleted_indexes) === -1) {
1644 line['cells'].push({cell: val.cell});
1647 kept_results.push(line);
1650 options.type = $('select[name="chart-type"]').val();
1651 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1652 options.lines = lines;
1654 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1655 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1656 $("#toggle_chart_settings_vis").hide();
1657 $("#chartModal").modal("hide");
1661 load_group_subgroups();
1664 $('[data-toggle="tooltip"]').tooltip();
1665 var columns_settings = [% TablesSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1667 $('#limit').change(function() {
1668 $('#limitselect').submit();
1671 $(document).click(function() {
1672 $('#report_updated').hide();
1675 $(".goback").on("click",function(e){
1677 window.history.back();
1680 $("body").on("click", ".mana_search_button", function(){
1681 $("#mana-loading").show();
1682 mana_search($("#mana_search_field").val());
1685 $(".ShareButton").on("click", function(){
1686 $("#note-error").hide();
1687 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1688 $(".shared_infos").hide();
1689 $("#note-error").show();
1692 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1693 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1694 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1695 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1696 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1697 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1698 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1702 $("#ManaCloseButton").on("click", function() {
1703 $(".shared_infos").show();
1706 $("#addColumn").on("click",function(){
1710 $("#delColumn").on("click",function(){
1715 var rtable = KohaTable("table_reports", {
1716 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1717 'bAutoWidth': false,
1718 'sPaginationType': 'full',
1719 'aaSorting': [[ 1, "asc" ]],
1721 { "visible": false, "aTargets" : [ "hidden" ] }
1724 'sZeroRecords': _("No matching reports found")
1726 }, columns_settings);
1728 var rtabs = $("#tabs").tabs({
1729 create: function( e, ui ){
1730 tabsInit( ui, rtable );
1732 activate: function( e, ui ){
1733 tabsInit( ui, rtable );
1737 $("#tabs").tabs("option","active", activeTab );
1739 $("#subgroup_filter_block").hide();
1741 $("#subgroup_filter").change(function() {
1742 var selected = $(this).find('option:selected');
1743 var sg_id = $(selected).val();
1744 var sg_name = $(selected).text();
1745 if (sg_id.length > 0) {
1746 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1747 rtable.fnSetColumnVis(5, false);
1749 rtable.fnFilter('', 5);
1750 rtable.fnSetColumnVis(5, true);
1754 $("#reports_form").submit(function(){
1755 var checkedItems = $("input[name=ids]:checked");
1756 if ($(checkedItems).size() == 0) {
1757 alert(_("You must select one or more reports to delete"));
1760 $(checkedItems).parents('tr').addClass("warn");
1761 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1764 $(checkedItems).parents('tr').removeClass("warn");
1769 $("body").on("click", ".update_sql", function(e){
1771 var ltitle = $(this).text();
1772 var report_id = $(this).data("report_id");
1773 var page = $(this).attr("href");
1774 $("#update_sql .modal-body").load(page + " div", function(){
1775 var diff1 = $("#col1 .show_sql").text();
1776 var diff2 = $("#col2 .show_sql").text();
1777 var diffs = diffString( escape(diff1), escape(diff2) );
1778 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1780 $('#update_sql').modal('show');
1781 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1784 $("#update_sql").on("hidden.bs.modal", function(){
1785 $("#update_sql_label").html("");
1786 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1790 [% IF ( showsql ) %]
1791 $("#sql").focus(function() {
1796 $(".toggle_sql").click(function(){
1797 $("#sql_output").toggle();
1798 $("#toggle_sql_hid").toggle();
1799 $("#toggle_sql_vis").toggle();
1801 showsql = CodeMirror.fromTextArea(sql, {
1810 $(".toggle_chart_settings").click(function(){
1811 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1814 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1815 $(this).parents('tr').attr("class","warn");
1816 if(confirm(_("Are you sure you want to delete this saved report?"))){
1819 $(this).parents('tr').attr("class","");
1824 [% IF (create || editsql || save) %]
1826 var validated_form = $("#sql_report_form").validate({
1827 reportname: "required",
1830 depends: function(element) {
1831 return $("#create_group").prop("checked") && $("#groupdesc_input").val() != '';
1837 depends: function(element) {
1838 return $("#create_group").prop("checked") && $("#group_input").val() != '';
1844 $("#select_group").change(function() {
1845 if($(this).prop('checked')) {
1846 $("#group_input").attr("class","").prop('disabled', true).prop("required", false);
1847 $("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false);
1848 $("#group_select").prop('disabled', false);
1849 clearValidation( $("#sql_report_form") );
1850 if ($("#group_select").val().length > 0) {
1851 $("#select_subgroup").prop('checked', true);
1852 $("#select_subgroup").change();
1853 $("#subgroup, #subgroup *").show();
1855 $("#subgroup").hide();
1859 $("#create_group").change(function() {
1860 if($(this).prop('checked')) {
1861 $("#group_input").prop('disabled', false).prop("required", true );
1862 $("#groupdesc_input").prop('disabled', false).prop("required", true );
1863 $("#group_select").prop('disabled', true);
1864 // $("#create_subgroup").prop('checked', true).change();
1865 $("#subgroup_select").hide();
1866 $("#subgroup input[type='radio']").hide();
1867 $("#subgroup label[for]").hide();
1868 $("#subgroup_input").prop("required", false ).prop("disabled", false).show();
1869 $("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show();
1870 $("#subgroup").show();
1871 // Add validation rules for fields which were previously hidden
1872 $("#subgroup_input").rules("add", {
1874 depends: function(element) {
1875 return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != '';
1879 $("#subgroupdesc_input").rules("add", {
1881 depends: function(element) {
1882 return $("#create_group").prop("checked") && $("#subgroup_input").val() != '';
1888 $("#select_subgroup").change(function() {
1889 if($(this).prop('checked')) {
1890 $("#subgroup_select").prop('disabled', false);
1891 $("#subgroup_input").prop('disabled', true).prop("required", false );
1892 $("#subgroupdesc_input").prop('disabled', true).prop("required", false );
1893 clearValidation( $("#sql_report_form") );
1896 $("#create_subgroup").change(function() {
1897 if($(this).prop('checked')) {
1898 $("#subgroup_input").prop('disabled', false).prop("required", true );
1899 $("#subgroupdesc_input").prop('disabled', false).prop("required", true );
1900 $("#subgroup_select").val("").prop('disabled', true);
1903 $("#select_group").change();
1904 $("#select_subgroup").change();
1905 $("#group_select").on("change",function(){
1906 load_group_subgroups();
1909 $(".insertParam").on("click", function(e){
1911 var category = this.id;
1912 showParamModal( category );
1915 $("#runtime_parameters").on("shown.bs.modal", function(){
1916 $("#paramLabel").focus();
1919 $("#runtime_parameters").on("hide.bs.modal", function(){
1920 $("#send_runtime_parameter")[0].reset();
1921 $("#authorised_value_category").val("").hide();
1922 $("#authorised_value").prop("required", false ).removeAttr("required");
1925 $("#send_runtime_parameter").on("submit", function(e){
1927 /* Get form values */
1928 var paramLabel = $("#paramLabel").val();
1929 var param_category = $("#param_category").val();
1930 var categoryLabel = $("#authorised_value").val();
1931 // Get CodeMirror environment variables
1932 var selection = editor.getSelection();
1933 var doc = editor.getDoc();
1934 var cursor = doc.getCursor();
1939 /* Build runtime parameter text string */
1941 if( paramLabel && param_category ){
1942 text += paramLabel + "|" + param_category;
1943 } else if( paramLabel ) {
1945 } else if( param_category ){
1946 text += param_category;
1949 text = " <<" + text + ">> ";
1950 if( selection.length > 0){
1951 editor.replaceSelection(text);
1953 doc.replaceRange(text, pos);
1956 $("#runtime_parameters").modal("hide");
1959 $("#authorised_value").on("change", function(){
1960 $("#param_category").val( $(this).val() );
1965 $(".delete").on("click",function(){
1966 return confirmDelete(MSG_CONFIRM_DELETE);
1969 $("#mana_search_form").submit(function(e){
1973 $("#column_submit").submit(function() {
1974 if ($("#selectedColumns option").size() < 1) {
1975 alert(_("No columns selected!"));
1978 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1983 $("body").on("click", ".mana-use", function(e) {
1985 $(this).find("i").attr("class","fa fa-refresh fa-spin");
1986 mana_use( $(this).data("report_id") );
1989 $("#mana_search_result").on("hide.bs.modal", function(){
1990 $("#mana_result_content").html("");
1991 $("#mana_search_field").val("");
1994 $(".batch_op").on("click", function(e){
1996 var target_form = $(this).data("submit");
1997 $("#" + target_form ).submit();
2000 $("#batch_add_to_list").on("submit", function(e){
2005 $("body").on("click", ".preview_sql", function(e){
2007 var reportid = $(this).data("reportid");
2008 previewSql( reportid );
2012 function tabsInit( ui, rtable ){
2013 var thisTab = ui.newTab ? ui.newTab : ui.tab;
2014 var activeTab = thisTab.index();
2015 localStorage.setItem("sql_reports_activetab", activeTab );
2017 $("#subgroup_filter option").each(function() {
2018 if($(this).val().length > 0) {
2022 rtable.fnFilter('', 4);
2023 rtable.fnFilter('', 5);
2024 rtable.fnSetColumnVis(4, true);
2025 rtable.fnSetColumnVis(5, true);
2027 var g_id = $(ui.newTab).children().attr('id');
2028 var g_name = $(ui.newTab).text();
2029 if ( g_name == _("All") ) {
2034 if (g_id && g_id.length > 0) {
2035 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
2036 rtable.fnSetColumnVis(4, false);
2037 for(var i in group_subgroups[g_id]) {
2038 $("#subgroup_filter").append(
2039 '<option value="' + group_subgroups[g_id][i][0] + '">'
2040 + group_subgroups[g_id][i][1] + '</option>'
2043 $("#subgroup_filter_block").show();
2045 $("#subgroup_filter_block").hide();
2049 function addColumn() {
2050 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
2052 function delColumn() {
2053 $("#selectedColumns option:selected").remove();
2057 function mana_use( mana_id ){
2060 url: "/cgi-bin/koha/svc/mana/use",
2061 data: {id:mana_id, resource: 'report', saveinbase: 1},
2064 .done( function (result){
2065 if ( result.errmsg ){
2066 alert( result.errmsg );
2069 window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1");
2072 .fail(function( error ) {
2073 $(".mana_use_status").hide();
2074 $("#mana_use_errortext").html( error.status + " " + error.statusText );
2075 $("#mana_use_failed").show();
2076 $(".mana-use i").attr("class","fa fa-download");
2080 function mana_search( textquery ){
2081 $(".mana_search_status").hide();
2082 $("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", { resource: 'report', id: textquery, usecomments: 1 }, function( response, status, xhr ) {
2084 if ( status == "error" ) {
2085 $("#mana_search_errortext").html( xhr.status + " " + xhr.statusText );
2086 $("#mana_search_failed").show();
2087 $("#mana-loading").hide();
2089 $(".mana_search_status").hide();
2090 $("#mana_search_result_label").text(_("Results from Mana Knowledge Base"));
2091 $("#mana-loading").hide();
2092 $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{
2093 "sPaginationType":"full",
2096 { "width": "35%", "targets": 1 }
2099 { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
2100 { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
2104 $(".showbutton").on("click", function(e){
2106 $(this).parent().hide();
2107 $(this).parent().next().show();
2110 $(".hidebutton").on("click", function(e){
2112 $(this).parent().hide();
2113 $(this).parent().prev().show();
2116 if($("td.dataTables_empty").length == 0){
2117 $("#mana_search_message").show();
2123 function addToList() {
2124 var biblionumbers = [];
2125 $(".bib_to_list").each(function() {
2126 var biblionumber = Number( $(this).val() );
2127 if( biblionumbers.indexOf( biblionumber ) < 0 ){
2128 biblionumbers.push( biblionumber );
2131 bibs = biblionumbers.join("/");
2132 var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
2133 window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
2137 // Adapted from https://gist.github.com/jnormore/7418776
2138 function previewSql(reportid) {
2141 var message = $("#previewSql" + reportid ).val();
2142 var title = $("#previewSql" + reportid ).data("title");
2143 if( $("#preview-sql-modal").length > 0) {
2144 $("#preview-sql-modal").remove();
2146 $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
2147 <div class="modal-dialog">\
2148 <div class="modal-content">\
2149 <div class="modal-header" style="min-height:40px;">\
2150 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
2151 <span aria-hidden="true">×</span>\
2153 <h4 class="modal-title">' + title + '</h4>\
2155 <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
2156 <div class="modal-footer">\
2157 <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>\
2158 <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>\
2159 <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>\
2160 <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>\
2161 <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>\
2162 <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>\
2168 $("#preview-sql-modal").modal('show');
2169 CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
2179 [% INCLUDE 'intranet-bottom.inc' %]
2181 [% BLOCK group_and_subgroup_selection %]
2183 <label>Report group:</label>
2184 <input type="radio" name="select_or_create_group"
2185 id="select_group" checked="checked" />
2186 <label for="select_group" style="float:none">Select</label>
2187 <select name="group" id="group_select">
2188 <option value="">(None)</option>
2189 [% FOREACH group IN groups_with_subgroups %]
2190 [% IF (group.selected) %]
2191 <option value="[% group.id | html %]" selected="selected">
2193 <option value="[% group.id | html %]">
2195 [% group.name | html %]
2199 <input type="radio" name="select_or_create_group" id="create_group" />
2200 <label for="create_group" style="float:none">or create:</label>
2201 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
2202 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
2205 <label>Report subgroup:</label>
2206 <input type="radio" name="select_or_create_subgroup"
2207 id="select_subgroup" checked="checked" />
2208 <label for="select_subgroup" style="float:none">Select</label>
2209 <select name="subgroup" id="subgroup_select">
2210 <option value="">(None)</option>
2211 [% FOREACH group IN groups_with_subgroups %]
2212 [% IF (group.selected) %]
2213 [% FOREACH subgroup IN group.subgroups %]
2214 [% IF (subgroup.selected) %]
2215 <option value="[% subgroup.id | html %]" selected="selected">
2217 <option value="[% subgroup.id | html %]">
2219 [% subgroup.name | html %]
2225 <input type="radio" name="select_or_create_subgroup"
2226 id="create_subgroup" />
2227 <label for="create_subgroup" style="float:none">or create</label>
2228 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
2229 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
2233 [% BLOCK insert_runtime_parameter %]
2234 <div class="btn-group" style="margin-left:30px;">
2235 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2236 Insert runtime parameter <span class="caret"></span>
2238 <ul class="dropdown-menu">
2239 <li><a href="#" class="insertParam" id="insertAuthVal">Authorized value</a></li>
2240 <li><a href="#" class="insertParam" id="insertDate">Date</a></li>
2241 <li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li>
2242 <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2243 <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2244 <li><a href="#" class="insertParam" id="insertText">Text field</a></li>