5 [% USE ColumnsSettings %]
9 [%- BLOCK area_name -%]
11 [%- CASE 'CIRC' -%]Circulation
12 [%- CASE 'CAT' -%]Catalog
13 [%- CASE 'PAT' -%]Patrons
14 [%- CASE 'ACQ' -%]Acquisitions
15 [%- CASE 'ACC' -%]Accounts
16 [%- CASE 'SER' -%]Serials
20 [% INCLUDE 'doc-head-open.inc' %]
22 <title>Koha › Reports › Guided reports wizard [%- IF ( saved1 ) -%]› Saved reports
23 [%- ELSIF ( create ) -%]› Create from SQL
24 [%- ELSIF ( showsql ) -%]› Saved reports › SQL view
25 [%- ELSIF ( execute ) -%]› Saved reports › [% name | html %] Report
26 [%- ELSIF ( editsql ) -%]› Saved reports › Edit SQL report
28 [%- IF ( build1 ) -%]› Build a report, step 1 of 6: Choose a module
29 [%- ELSIF ( build2 ) -%]› Build a report, step 2 of 6: Pick a report type
30 [%- ELSIF ( build3 ) -%]› Build a report, step 3 of 6: Select columns for display
31 [%- ELSIF ( build4 ) -%]› Build a report, step 4 of 6: Select criteria to limit on
32 [%- ELSIF ( build5 ) -%]› Build a report, step 5 of 6: Pick which columns to total
33 [%- ELSIF ( build6 ) -%]› Build a report, step 6 of 6: Select how you want the report ordered
36 [% INCLUDE 'doc-head-close.inc' %]
37 [% Asset.css("lib/codemirror/codemirror.css") | $raw %]
43 [% Asset.css("css/reports.css") | $raw %]
45 [% Asset.css("css/datatables.css") | $raw %]
47 [% Asset.css("lib/d3c3/c3.min.css") | $raw %]
50 <body id="rep_guided_reports_start" class="rep">
51 [% INCLUDE 'header.inc' %]
52 [% INCLUDE 'circ-search.inc' %]
54 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
55 › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
56 › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
58 [% IF ( saved1 ) %]› Saved reports
59 [% ELSIF ( create ) %]› Create from SQL
60 [% ELSIF ( showsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › SQL view
61 [% ELSIF ( editsql ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › Edit SQL report
62 [% ELSIF ( execute ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › <em>[% name | html %]</em> Report
63 [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]› <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
64 [% IF ( build1 ) %]› Step 1 of 6: Choose a module
65 [% ELSIF ( build2 ) %]› Step 2 of 6: Pick a report type
66 [% ELSIF ( build3 ) %]› Step 3 of 6: Select columns for display
67 [% ELSIF ( build4 ) %]› Step 4 of 6: Select criteria to limit on
68 [% ELSIF ( build5 ) %]› Step 5 of 6: Pick which columns to total
69 [% ELSIF ( build6 ) %]› Step 6 of 6: Select how you want the report ordered
74 <div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
75 <div class="modal-dialog">
76 <div class="modal-content">
77 <div class="modal-header">
78 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
79 <h3 id="update_sql_label">Update SQL</h3>
81 <div class="modal-body">
82 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
84 <div class="modal-footer">
85 <a href="#" class="btn btn-default" id="update_sql_button" role="button" data-toggle="modal">Update</a>
86 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
92 <div class="main container-fluid">
94 <div class="col-sm-10 col-sm-push-2">
97 [% INCLUDE "reports-toolbar.inc" %]
100 <h2>Guided reports</h2>
101 <p>Use the guided reports engine to create non standard reports.
102 This feature aims to provide some middle ground between the built in
103 canned reports and writing custom SQL reports.</p>
105 <h3>Build and run reports</h3>
106 [% IF ( CAN_user_reports_create_reports ) %]
107 <form action="/cgi-bin/koha/reports/guided_reports.pl">
108 <input type="hidden" name="phase" value="Build new" />
109 <input type="submit" name="submit" value="Build new"/>
112 [% IF ( CAN_user_reports_execute_reports ) %]
113 <form action="/cgi-bin/koha/reports/guided_reports.pl">
114 <input type="hidden" name="phase" value="Use saved"/>
115 <input type="submit" name="submit" value="Use saved"/>
118 [% IF ( CAN_user_reports_create_reports ) %]
119 <form action="/cgi-bin/koha/reports/guided_reports.pl">
120 <input type="hidden" name="phase" value="Create report from SQL"/>
121 <input type="submit" name="submit" value="Create report from SQL"/>
124 <h3>Reports Dictionary</h3>
125 <p>Use the reports dictionary to define custom criteria to use in your reports</p>
126 <form action="/cgi-bin/koha/reports/dictionary.pl">
127 <input type="hidden" name="phase" value="View Dictionary"/>
128 <input type="submit" name="submit" value="View dictionary"/>
132 [% IF report_converted %]
133 <div class="dialog message">
134 The report "[% report_converted | html %]" has been converted.
138 [% IF report_converted %]
139 <div class="dialog message">
140 The report "[% report_converted | html %]" has been converted.
146 [% IF ( savedreports ) %]<h1>Saved reports</h1>
148 [% IF ( filters.date || filters.author || filters.keyword ) %]
150 <span class="filter">
151 [% IF ( filters.date ) %]
152 <span class="filter_date"><strong>Date:</strong> [% filters.date | html %]</span>
154 [% IF ( filters.author ) %]
155 <span class="filter_author"><strong>Author:</strong> [% filters.author | html %]</span>
157 [% IF ( filters.keyword ) %]
158 <span class="filter_keyword"><strong>Keyword:</strong> [% filters.keyword | html %]</span>
160 <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>
165 <div id="tabs" class="toptabs">
167 <li><a href="#reports">All</a></li>
168 [% FOREACH group IN groups_with_subgroups %]
169 <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
173 <div id="subgroup_filter_block">
174 <label for="subgroup_filter">Subgroup:</label>
175 <select id="subgroup_filter">
176 <option value="">All</option>
179 <div style="display:inline-block">
181 <div id="mana_search" class="dialog message">
182 <p> [% manamsg | html %] </p>
188 <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
189 <input type="hidden" name="phase" value="Delete Multiple" />
190 <table id="table_reports">
201 <th class="title-string">Creation date</th>
202 <th class="title-string">Last edit</th>
203 <th class="title-string">Last run</th>
204 <th class="report_public">Public</th>
205 <th class="report_json_url">JSON URL</th>
207 <th>Cache expiry (seconds)</th>
209 <th class="hidden"> </th>
211 <th>Saved results</th>
212 [% IF has_obsolete_reports %]
215 <th class="hidden"> </th>
221 [% FOREACH savedreport IN savedreports %]
222 [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
223 <td class="report_checkbox">
224 [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
225 <input type="checkbox" name="ids" value="[% savedreport.id | html %]" />
227 <input hidden class="report_sql" value="[% savedreport.savedsql |html %]">
229 <td class="report_id"><label for="ids">[% savedreport.id | html %]</label></td>
230 <td class="report_name">
231 [% IF ( savedreport.report_name ) %]
232 [% savedreport.report_name | html %]
237 <td class="report_type">[% savedreport.type | html %]</td>
238 <td class="report_group">[% savedreport.groupname | html %]</td>
239 <td>[% savedreport.subgroupname | html %]</td>
240 <td class="report_notes">[% savedreport.notes | html %]</td>
241 <td>[% savedreport.borrowersurname | html %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname | html %][% END %] ([% savedreport.borrowernumber | html %])</td>
242 <td><span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span></td>
243 <td><span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span></td>
244 <td><span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates with_hours => 1 %]</span></td>
245 <td class="report_public">
246 [% IF (savedreport.public) %]
252 <td class="report_json_url">
253 [% IF (savedreport.public) %]
254 <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>
256 <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>
259 <td>[% savedreport.cache_expiry | html %]</td>
261 [% FOR result IN savedreport.results %]
262 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
267 [% IF savedreport.seems_obsolete %]
268 This report seems obsolete, it uses biblioitems.marcxml field.
269 <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>
274 <div class="btn-group">
275 [%# There should be no space between these two buttons, it would render badly %]
276 <a class="btn btn-default btn-xs" role="button"
277 href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
278 class="fa fa-play"></i> Run</a><a
279 class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
280 href="#"><b class="caret"></b></a>
281 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
282 <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL"><i class="fa fa-search"></i> Show</a></li>
283 [% IF ( CAN_user_reports_create_reports ) %]
284 <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>
285 <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
287 [% IF (Koha.Preference('Mana') == 1) %]
288 <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>
290 <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
291 [% IF ( CAN_user_reports_delete_reports ) %]
292 <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>
303 [% IF ( CAN_user_reports_delete_reports ) %]
304 <fieldset class="action">
305 <input type="submit" value="Delete selected" />
311 [% ELSE %]<div class="dialog message">
312 [% IF (filter_set || filters.date || filters.author || filters.keyword) %]
313 <h4>No saved reports match your criteria. </h4>
314 [% IF ( CAN_user_reports_create_reports ) %]
315 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
316 <input type="hidden" name="phase" value="Build new" />
317 <button type="submit" class="new"><i class="fa fa-plus"></i> New guided report</button>
320 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
321 <input type="hidden" name="phase" value="Create report from SQL" />
322 <button type="submit" class="new"><i class="fa fa-plus"></i> New SQL report</button>
325 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
326 <input type="hidden" name="phase" value="Use saved" />
327 <input type="hidden" name="filter_set" value="1" />
328 <input type="hidden" name="filter_keyword" value="" />
329 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> Cancel filter</button>
334 <h4>There are no saved reports. </h4>
335 [% IF ( CAN_user_reports_create_reports ) %]
336 <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a new report?</a>
343 <div id="mana_share_report" class="modal fade" tabindex="-1" role="dialog" arialabelledby="mana_share_modal_label" style="display: none;">
344 <div class="modal-dialog">
345 <div class="modal-content">
346 <div class="modal-header">
347 <h3 id="mana_share_modal_label">Share with Mana</h3>
349 <div class="modal-body">
352 <p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p>
355 <div id="note-error" class="alert alert-danger" role="alert">
356 Please enter a report name and descriptive note before sharing (minimum 20 characters)
358 <div class="shared_infos rows">
359 <li><span class="label">Id: </span><div id="shared_id"></div></li>
360 <li><span class="label">Name: </span><div id="shared_name"></div></li>
361 <li><span class="label">SQL: </span><div id="shared_sql"></div></li>
362 <li><span class="label">Group: </span><div id="shared_group"></div></li>
363 <li><span class="label">Type: </span><div id="shared_type"></div></li>
364 <li><span class="label">Notes: </span><div id="shared_notes"></div></li>
367 <form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl" class="validated" >
368 <input type="hidden" name="phase" value="Share">
370 [% IF (languages_loop) %]
371 <fieldset class="shared_infos">
372 <label for="mana_language">Language:</label>
373 <select id="mana_language" name="mana_language">
374 [% FOREACH languages_loo IN languages_loop %]
375 [% IF ( languages_loo.group_enabled ) %]
376 [% IF ( languages_loo.plural ) %]
377 [% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %]
378 [% IF ( sublanguages_loo.enabled ) %]
379 [% IF ( sublanguages_loo.sublanguage_current ) %]
380 <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
381 [% sublanguages_loo.native_description | html %]
382 [% sublanguages_loo.script_description | html %]
383 [% sublanguages_loo.region_description | html %]
385 [% sublanguages_loo.variant_description | html %]
386 ([% sublanguages_loo.rfc4646_subtag | html %])
389 <option value="[% languages_loo.rfc4646_subtag | html %]">
390 [% sublanguages_loo.native_description | html %]
391 [% sublanguages_loo.script_description | html %]
392 [% sublanguages_loo.region_description | html %]
393 [% sublanguages_loo.variant_description | html %]
394 ([% sublanguages_loo.rfc4646_subtag | html %])
400 [% IF ( languages_loo.group_enabled ) %]
401 [% IF ( languages_loo.current ) %]
402 <option value="[% languages_loo.rfc4646_subtag | html %]" selected>
403 [% IF ( languages_loo.native_description ) %]
404 [% languages_loo.native_description | html %]
406 [% languages_loo.rfc4646_subtag | html %]
410 <option value="[% languages_loo.rfc4646_subtag | html %]">
411 [% IF ( languages_loo.native_description ) %]
412 [% languages_loo.native_description | html %]
414 [% languages_loo.rfc4646_subtag | html %]
425 <input type="hidden" name="mana_language" value="[% lang | html %]">
427 <input type="hidden" id="reportid" name="reportid"/>
431 <div class="modal-footer">
432 <button class="btn" id="ManaCloseButton" data-dismiss="modal" aria-hidden="true">Close</button>
433 [% IF one_language_enabled==0 %]
434 <button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary shared_infos">Share</button>
436 <div id="ManaShareButton" class="btn-group"><a class="btn btn-primary shared_infos">Share</a></div>
445 [% IF ( cache_error) %]
446 <div class="dialog alert">
447 <b> Please choose a cache_expiry less than 30 days </b>
450 <h1>Build a report</h1>
451 <form action="/cgi-bin/koha/reports/guided_reports.pl">
452 <fieldset class="rows">
453 <legend>Step 1 of 6: Choose a module to report on,[% IF (usecache) %] Set cache expiry, [% END %] and choose report visibility </legend>
456 <label for="area">Choose: </label>
457 <select name="area" id="area">
458 [%- FOREACH area IN areas -%]
459 <option value="[% area | html %]">[%- PROCESS area_name area=area -%]</option>
464 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
466 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
468 [% IF (usecache) %] <li>
469 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
470 <select id="cache_expiry_units" name="cache_expiry_units">
471 <option value="seconds">Seconds (default)</option>
472 <option value="minutes">Minutes</option>
473 <option value="hours">Hours</option>
474 <option value="days">Days</option>
479 <fieldset class="action">
480 <input type="hidden" name="phase" value="Report on this Area" />
481 <input type="submit" name="submit" value="Next >>" />
489 <h1>Build a report</h1>
490 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
491 <input type="hidden" name="area" value="[% area | html %]" />
492 <input type="hidden" name="public" value="[% public | html %]" />
493 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
494 <fieldset class="rows"><legend>Step 2 of 6: Pick a report type</legend>
495 <ol><li><label for="types">Choose: </label>
496 <select id="types" name="types">
497 <option value="1">Tabular</option>
498 <option value="2" disabled="disabled">Summary</option>
499 <option value="3" disabled="disabled">Matrix</option>
501 </li></ol></fieldset>
503 <fieldset class="action">
504 <input type="hidden" name="phase" value="Choose this type" />
505 <input type="button" name="back" value="<< Back" class="goback" />
506 <input type="submit" name="submit" value="Next >>" />
513 <h1>Build a report</h1>
514 <h3>Step 3 of 6: Select columns for display</h3>
515 <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>
517 <form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
518 <input type="hidden" name="area" value="[% area | html %]" />
519 <input type="hidden" name="type" value="[% type | html %]" />
520 <input type="hidden" name="public" value="[% public | html %]" />
521 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
524 <div class="col-sm-6">
525 <div style="float: left;"><select id="availableColumns" name="oldcolumns2" multiple="multiple" size="25" style="min-width: 200px;height:300px;">
526 [% FOREACH column IN columns %]
527 [% IF ( column.table ) %]
529 [% IF ( loop.first ) %]
534 <optgroup label="[% column.table | html %]">
536 <option value="[% column.name | html %]">
537 [% IF ( column.description ) %][% column.description | html %] / [% column.name | html %]
539 [% column.name | html %]
546 <div style="width: 6.3em; float: right; margin-top: 100px"><input type="button" name="Add" value="Add" class="button" style="width:6em;" id="addColumn" /><br />
547 <input type="button" name="delete" value="<< Delete" class="button" style="width: 6em; margin: 1em 0;" id="delColumn" /></div>
550 <div class="col-sm-6">
551 <select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
555 <fieldset class="action">
556 <input type="hidden" name="phase" value="Choose these columns" />
557 <input type="button" name="back" value="<< Back" class="goback" />
558 <input type="submit" name="submit" value="Next >>" />
565 <h1>Build a report</h1>
566 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" >
567 <input type="hidden" name="area" value="[% area | html %]" />
568 <input type="hidden" name="type" value="[% type | html %]" />
569 <input type="hidden" name="column" value="[% column | html %]" />
570 <input type="hidden" name="public" value="[% public | html %]" />
571 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
572 <fieldset><legend>Step 4 of 6: Select criteria to limit on</legend>
574 [% FOREACH criteri IN criteria %]
577 <input type="checkbox" name="criteria_column" id="[% criteri.name | html %]" value="[% criteri.name | html %]" />
578 <label for="[% criteri.name | html %]">[% criteri.description | html %] </label>
580 [% IF ( criteri.date ) %]
582 <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
583 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
587 [% IF ( criteri.textrange ) %]
589 <input type="text" size="10" id="[% criteri.from | html %]_value" name="[% criteri.from | html %]_value" value="" /> to
590 <input type="text" size="10" id="[% criteri.to | html %]_value" name="[% criteri.to | html %]_value" value="" />
594 [% IF ( criteri.daterange ) %]
596 <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
598 <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
599 <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
604 <select name="[% criteri.name | html %]_value">
605 [% FOREACH value IN criteri.values %]
606 <option value="[% value.availablevalues | html %]">[% IF ( value.default ) %]Default[% ELSE %][% value.display_value | html %][% END %]</option>
618 [% IF ( definitions ) %]
619 <fieldset><legend>Dictionary definitions</legend>
621 [% FOREACH definition IN definitions %]
622 <tr><td><input type="checkbox" name="definition" value="[% definition.id | html %]" /> [% definition.name | html %]</td></tr>
628 <fieldset class="action"><input type="hidden" name="phase" value="Choose these criteria" />
629 <input type="button" name="back" value="<< Back" class="goback" />
630 <input type="submit" name="submit" value="Next >>" /> </fieldset>
636 <h1>Build a report</h1>
637 <h3>Step 5 of 6: Pick which columns to total</h3>
638 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
639 <input type="hidden" name="area" value="[% area | html %]" />
640 <input type="hidden" name="type" value="[% type | html %]" />
641 <input type="hidden" name="column" value="[% column | html %]" />
642 <input type="hidden" name="definition" value="[% definition | html %]" />
643 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
644 <input type="hidden" name="public" value="[% public | html %]" />
645 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
647 [% FOREACH total_b IN total_by %]
648 <tr><td><input type="checkbox" name="total_by" id="[% total_b.name | html %]" value="[% total_b.name | html %]" /> <label for="[% total_b.name | html %]">[% total_b.name | html %]</label></td>
649 <td><select name="[% total_b.name | html %]_tvalue">
651 [% FOREACH selec IN total_b.select %]
652 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
660 <fieldset class="action"><input type="hidden" name="phase" value="Choose these operations" />
661 <input type="button" name="back" value="<< Back" class="goback" />
662 <input type="submit" name="submit" value="Next >>" /></fieldset>
668 <h1>Build a report</h1>
669 <h3>Step 6 of 6: Choose how you want the report ordered</h3>
670 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
671 <input type="hidden" name="area" value="[% area | html %]" />
672 <input type="hidden" name="type" value="[% type | html %]" />
673 <input type="hidden" name="column" value="[% column | html %]" />
674 <input type="hidden" name="criteria" value="[% criteriastring | html %]" />
675 <input type="hidden" name="definition" value="[% definition | html %]" />
676 <input type="hidden" name="totals" value="[% totals | html %]" />
677 <input type="hidden" name="public" value="[% public | html %]" />
678 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
679 <fieldset><table>[% FOREACH order_b IN order_by %]
680 <tr><td><input type="checkbox" id="[% order_b.name | html %]" name="order_by" value="[% order_b.name | html %]" /> <label for="[% order_b.name | html %]">[% order_b.name | html %]</label></td><td>
681 <select name="[% order_b.name | html %]_ovalue">
683 [% FOREACH selec IN order_b.select %]
684 <option value="[% selec.value | html %]">[% selec.value | html %]</option>
692 <fieldset class="action">
693 <input type="hidden" name="phase" value="Build report" />
694 <input type="submit" name="submit" value="Finish" /></fieldset>
699 [% IF ( showreport ) %]
700 <h1>Confirm custom report</h1>
701 <p>Your report will be generated with the following SQL statement.</p>
706 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
707 <input type="hidden" name="sql" value="[% sql | html %]" />
708 <input type="hidden" name="type" value="[% type | html %]" />
709 <input type="hidden" name="public" value="[% public | html %]" />
710 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
711 <p>You will need to save the report before you can execute it</p>
712 <fieldset class="action"><input type="hidden" name="phase" value="Save" />
713 <input type="submit" name="submit" value="Save" /> </fieldset>
718 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
719 <input type="hidden" name="sql" value="[% sql | html %]" />
720 <input type="hidden" name="type" value="[% type | html %]" />
721 <input type="hidden" name="area" value="[% area | html %]" />
722 <input type="hidden" name="public" value="[% public | html %]" />
723 <input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
724 <fieldset class="rows">
725 <legend>Save your custom report</legend>
727 <li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" class="required" required="required" /> <span class="required">Required</span></li>
728 [% PROCESS group_and_subgroup_selection %]
729 <li><label for="notes">Notes:</label> <textarea name="notes" id="notes"></textarea></li>
731 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
732 <input type="submit" name="submit" value="Save report" /></fieldset>
736 [% IF ( warn_authval_problem ) %]
737 <div class="dialog alert">
738 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
739 [% FOREACH problematic_authval IN problematic_authvals %]
741 <strong>[% problematic_authval.name | html %]:</strong> The authorized value category (<strong>[% problematic_authval.authval | html %]</strong>)
742 you selected does not exist.
745 <!-- Save Anyway Form -->
746 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
747 <!--Every parameter the user issued is provided as a hidden field for recovery-->
748 <input type='hidden' name='id' value='[% id | html %]' />
749 <input type='hidden' name='sql' value='[% sql | html %]' />
750 <input type='hidden' name='reportname' value='[% reportname | html %]' />
751 <input type='hidden' name='group' value='[% group | html %]' />
752 <input type='hidden' name='subgroup' value='[% subgroup | html %]' />
753 <input type='hidden' name='notes' value='[% notes | html %]' />
754 <input type='hidden' name='cache_expiry' value='[% cache_expiry | html %]' />
755 <input type='hidden' name='cache_expiry_units' value='[% cache_expiry_units | html %]' />
756 <input type='hidden' name='public' value='[% public | html %]' />
757 [% IF ( phase_update) %]
758 <input type='hidden' name='phase' value='Update SQL' />
759 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
760 [% ELSIF ( phase_save) %]
761 <input type='hidden' name='area' value='[% area | html %]' />
762 <input type='hidden' name='phase' value='Save Report' />
763 <button type="submit" name="save_anyway" value="Save anyway" class="approve"><i class="fa fa-fw fa-check"></i> Save anyway</button>
766 <!-- Go back to editing -->
767 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
768 <button type="button" class="new goback"><i class="fa fa-fw fa-pencil"></i> Edit SQL</button>
773 [% IF ( enter_params ) %]
774 <form action='/cgi-bin/koha/reports/guided_reports.pl'>
775 <input type='hidden' name='reports' value="[% reports | html %]" />
776 [% IF ( auth_val_error ) %]
777 <input type='hidden' name='phase' value='Edit SQL' />
778 <div class="dialog alert">
779 <h3>Errors found when processing parameters for report: [% name | html %]</h3>
780 [% FOREACH auth_val_error IN auth_val_errors %]
782 <strong>[% auth_val_error.entry | html %]:</strong> The authorized value category (<strong>[% auth_val_error.auth_val | html %]</strong>)
783 you selected does not exist.
787 <fieldset class="action"><input type="submit" value="Edit SQL" /></fieldset>
789 <input type='hidden' name='phase' value='Run this report' />
790 <h1>Enter parameters for report [% name | html %]:</h1>
791 [% IF ( notes ) %]<p>[% notes | html %]</p>[% END %]
792 <fieldset class="rows">
794 [% FOREACH sql_param IN sql_params %]
795 <input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
796 [% IF sql_param.input == 'date' %]
798 <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" />
800 [% ELSIF ( sql_param.input == 'text' ) %]
801 <li><label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label><input id="sql_params[% loop.count | html %]" type="text" name="sql_params" /></li>
803 <li><label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
804 <select name="[%- sql_param.input.name | html -%]" tabindex="1" size="1" id="[%- sql_param.input.id | html -%]">
805 [% FOREACH value IN sql_param.input.values %]
806 <option value="[%- value | html -%]">[%- sql_param.input.labels.$value | html -%]</option>
814 <fieldset class="action"><input type="submit" value="Run the report" /></fieldset>
820 <h1>[% name | html %]</h1>
821 [% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes | html %]</p>[% END %]
822 [% IF ( unlimited_total ) %]<p><span class="label">Total number of results:</span> [% unlimited_total | html %][% IF unlimited_total > limit %] ([% limit | html %] shown)[% END %].</p>[% END %]
823 <div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql | html %]</pre></div>
826 <a href="#" id="toggle_chart_settings_hid" class="toggle_chart_settings" style="display:none"><i class="fa fa-eye-slash"></i> Hide chart</a>
827 <a href="#" id="toggle_chart_settings_vis" class="toggle_chart_settings" style="display:none"><i class="fa fa fa-eye"></i> Show chart</a>
829 <div id="chart" class="clearfix"></div>
831 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
832 <input type="hidden" name="phase" value="Run this report"/>
833 <input type="hidden" name="reports" value="[% report_id | html %]"/>
835 [% FOREACH p IN sql_params %]
836 <input type="hidden" name="sql_params" value="[% p | html %]"/>
838 [% FOREACH n IN param_names %]
839 <input type="hidden" name="param_name" value="[% n | html %]"/>
842 <label for="limit">Rows per page: </label>
843 <select name="limit" id="limit">
844 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
845 [% FOREACH l IN limits %]
847 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
849 <option value="[% l | html %]">[% l | html %]</option>
855 <div class="pages">[% pagination_bar | $raw %]</div>
856 [% UNLESS ( errors ) %]
857 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
858 <input type="hidden" name="op" value="show" />
861 [% FOREACH header_ro IN header_row %]
862 [% IF header_ro.cell == 'itemnumber' %]
864 [% header_ro.cell | html %] <button type="submit" data-toggle="tooltip" title="Send visible items to batch modification" id="batchModify" class="btn btn-xs btn-default send_to_item_mod"><i class="fa fa-pencil"></i> Batch modify</button>
867 <th>[% header_ro.cell | html %]</th>
871 [% FOREACH result IN results %]
873 [% FOREACH cells IN result.cells %]
874 [% place = loop.index %]
875 [% IF header_row.$place.cell == 'itemnumber' %]
876 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
878 <td>[% cells.cell | $raw %]</td>
887 [% INCLUDE 'chart.inc' %]
892 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
893 <fieldset class="rows">
894 <legend>Create report from SQL</legend>
896 <li><label for="reportname" class="required">Report name:</label>
897 [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
898 [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
900 [% PROCESS group_and_subgroup_selection %]
903 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
905 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
907 [% IF (usecache) %] <li>
908 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
909 <select id="cache_expiry_units" name="cache_expiry_units">
910 <option value="seconds" selected="selected">Seconds (default)</option>
911 <option value="minutes">Minutes</option>
912 <option value="hours">Hours</option>
913 <option value="days">Days</option>
916 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
919 <fieldset class="rows">
920 <legend>SQL:</legend>
921 <div style="margin:1em;">
922 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
926 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
927 <input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
932 [% IF saved_results %]
933 <h1>Saved report results</h1>
934 <h2>[% name | html %]</h2>
935 <p>[% notes | html %]</p>
937 [% FOREACH rows IN saved_results %]
939 [% FOREACH col IN rows %]
940 <td>[% col | html %]</td>
948 <fieldset class="rows">
949 <legend>[% reportname | html %]</legend>
951 [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes | html %]</li>[% ELSE %][% END %]
952 <li><textarea id="sql">[% sql | html %]</textarea></li>
957 [% IF ( save_successful ) %]
958 [% UNLESS ( errors ) %]
960 <div id="report_updated">
961 <div class="dialog message">
962 <p>Your report "[% reportname | html %]" has been saved</p>
969 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
970 <input type="hidden" name="phase" value="Update SQL" />
971 <input type="hidden" name="id" value="[% id | html %]"/>
972 <fieldset class="rows">
973 <legend>Edit SQL report</legend>
975 <li><label for="reportname" class="required">Report name: </label><input type="text" id="reportname" name="reportname" value="[% reportname | html %]" size="50" class="required" required="required" /> <span class="required">Required</span></li>
976 [% PROCESS group_and_subgroup_selection %]
978 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0">No (default)</option> <option value="1" selected="selected">Yes</option> </select></li>
980 <li><label for="public">Report is public:</label><select id="public" name="public"> <option value="0" selected="selected">No (default)</option> <option value="1">Yes</option> </select></li>
982 [% IF (usecache) %] <li>
983 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
984 <select id="cache_expiry_units" name="cache_expiry_units">
985 <option value="seconds">Seconds (default)</option>
986 <option value="minutes">Minutes</option>
987 <option value="hours">Hours</option>
988 <option value="days">Days</option>
991 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
995 <fieldset class="rows">
996 <legend>SQL:</legend>
997 <div style="margin:1em;">
998 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
1002 <fieldset class="action">
1003 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1011 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1012 <div class="dialog alert">
1013 <b>The following error was encountered:</b><br />
1014 [% FOREACH error IN errors %]
1015 [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.
1016 <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
1017 <br />Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1018 [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr | html %]<br />Please check the log for further details.
1019 [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
1022 <div id="onerror_actions">
1023 <a href="#" class="button goback">Return to previous page</a>
1027 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
1028 <input type="submit" name="submit" value="Saved reports" /></fieldset>
1033 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1035 <div class="col-sm-2 col-sm-pull-10">
1040 <div id="saved-reports-filter">
1041 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1042 <input type="hidden" name="phase" value="Use saved" />
1043 <input type="hidden" name="filter_set" value="1" />
1044 <fieldset class="brief">
1047 <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1048 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1051 <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" /></li>
1052 <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" /></li>
1055 <fieldset class="action">
1056 <input type="submit" value="Apply filter" />
1057 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1064 [% INCLUDE 'guided-reports-view.inc' %]
1066 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1067 </div> <!-- /.row -->
1070 [% MACRO jsinclude BLOCK %]
1071 [% Asset.js("js/charts.js") | $raw %]
1072 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1073 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1074 [% INCLUDE 'calendar.inc' %]
1075 [% INCLUDE 'mana.inc' %]
1077 [% INCLUDE 'datatables.inc' %]
1078 [% INCLUDE 'columns_settings.inc' %]
1080 [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
1081 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1084 function hide_bar_element() {
1085 $('#chart-column-horizontal').hide()
1086 $('.chart-column-group').each(function( index ) {
1089 $('.chart-column-line').each(function( index ) {
1094 function show_bar_element() {
1095 $('#chart-column-horizontal').show()
1096 $('.chart-column-group').each(function( index ) {
1099 $('.chart-column-line').each(function( index ) {
1104 function removeColumn(id) {
1107 if ( $('.chart-column-conf').length == 1 ) {
1108 $('.chart-column-delete').remove();
1112 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1113 var group_subgroups = {};
1114 [% FOREACH group IN groups_with_subgroups %]
1115 var gid = "[% group.id | html %]"
1116 group_subgroups[gid] = new Array();
1117 [% FOREACH subgroup IN group.subgroups %]
1118 var sgid = "[% subgroup.id | html %]";
1119 var sgname = "[% subgroup.name | html %]";
1120 group_subgroups[gid].push([sgid, sgname]);
1124 [% IF ( create || editsql || save ) %]
1125 var editor = CodeMirror.fromTextArea(sql, {
1132 [% IF ( showsql ) %]
1133 var editor = CodeMirror.fromTextArea(sql, {
1141 function load_group_subgroups () {
1142 var group = $("#group_select").val();
1143 var sg = $("#subgroup");
1144 $(sg).find('option[value!=""]').each(function() {
1149 var select = $(sg).find('select')[0];
1150 $.each( group_subgroups[group], function(index, value) {
1151 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1153 $("#subgroup, #subgroup *").show();
1157 $(document).ready(function(){
1161 if ( $('.chart-column-conf').length == 1 ) {
1162 $('.chart-column-delete').remove();
1165 $(".chart-column-delete").on('click', function(e){
1167 removeColumn('column_' + $(this).data('column'));
1170 $('#download-chart').click(function() {
1171 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1172 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1173 this.setAttribute('download', 'chart.svg');
1176 $('#chart-type').change(function() {
1177 if ($(this).val() == 'bar') {
1185 $('#download-chart').hide();
1188 [% IF results && !errors %]
1189 $('#draw-chart').click(function() {
1191 var x_elements = $('select[name="x"]').val();
1192 var y_elements = [];
1197 headers = [% header_row.json | $raw %];
1200 if ($('input[name="chart-include-all"]').prop('checked')) {
1201 results = [% allresults.json | $raw %]
1204 results = [% results.json | $raw %]
1207 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1208 results.splice(-1, 1);
1211 $('select[name="y"]').each(function( index ) {
1212 y_elements.push( $(this).val() );
1214 $('select[name="group"]').each(function( index ) {
1215 groups.push( $(this).val() );
1217 $('.column-line').each(function( index ) {
1218 if ($(this).prop('checked')) {
1219 lines.push( $(this).attr('name') );
1223 // Remove deleted columns from headers and results.
1224 var deleted_indexes = [];
1225 var kept_headers = [];
1226 $.each(headers, function(index, value) {
1227 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1228 // This header is neither a x element nor in y elements. Don't need it.
1229 deleted_indexes.push(index);
1232 kept_headers.push({cell: value.cell});
1236 // Remove coresponding cells.
1237 var kept_results = [];
1238 $.each(results, function(index, value) {
1241 $.each(value.cells, function(i, val) {
1242 if ($.inArray(i, deleted_indexes) === -1) {
1243 line['cells'].push({cell: val.cell});
1246 kept_results.push(line);
1249 options.type = $('select[name="chart-type"]').val();
1250 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1251 options.lines = lines;
1253 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1254 $("#download-chart,#toggle_chart_settings_hid,#chart").show();
1255 $("#toggle_chart_settings_vis").hide();
1256 $("#chartModal").modal("hide");
1260 load_group_subgroups();
1263 $('[data-toggle="tooltip"]').tooltip();
1264 var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1266 $('#limit').change(function() {
1267 $('#limitselect').submit();
1270 $(document).click(function() {
1271 $('#report_updated').hide();
1274 $(".goback").on("click",function(e){
1276 window.history.back();
1279 $(".mana_search_button").on("click",function(){
1280 mana_search($("#mana_search_field").val());
1283 $(".ShareButton").on("click", function(){
1284 $("#note-error").hide();
1285 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1286 $(".shared_infos").hide();
1287 $("#note-error").show();
1290 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1291 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1292 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1293 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1294 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1295 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1296 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1300 $("#ManaCloseButton").on("click", function() {
1301 $(".shared_infos").show();
1304 $("#addColumn").on("click",function(){
1308 $("#delColumn").on("click",function(){
1313 var rtable = KohaTable("table_reports", {
1314 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1315 'bAutoWidth': false,
1316 'sPaginationType': 'four_button',
1317 'aaSorting': [[ 1, "asc" ]],
1319 { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
1320 { 'bSearchable': false, 'aTargets': [3] },
1321 { "aTargets": [ 1, 2 ], "sType": "natural" },
1322 { "sType": "title-string", "aTargets" : [ "title-string" ] },
1323 { "visible": false, "aTargets" : [ "hidden" ] }
1326 'sZeroRecords': _("No matching reports found")
1328 }, columns_settings);
1330 var rtabs = $("#tabs").tabs();
1331 rtabs.on("tabsactivate", function(e, ui) {
1332 $("#subgroup_filter option").each(function() {
1333 if($(this).val().length > 0) {
1337 rtable.fnFilter('', 4);
1338 rtable.fnFilter('', 5);
1339 rtable.fnSetColumnVis(4, true);
1340 rtable.fnSetColumnVis(5, true);
1342 var g_id = $(ui.newTab).children().attr('id');
1343 var g_name = $(ui.newTab).text();
1344 if ( g_name == _("All") ) {
1349 if (g_id && g_id.length > 0) {
1350 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1351 rtable.fnSetColumnVis(4, false);
1352 for(var i in group_subgroups[g_id]) {
1353 $("#subgroup_filter").append(
1354 '<option value="' + group_subgroups[g_id][i][0] + '">'
1355 + group_subgroups[g_id][i][1] + '</option>'
1358 $("#subgroup_filter_block").show();
1360 $("#subgroup_filter_block").hide();
1363 $("#subgroup_filter_block").hide();
1365 $("#subgroup_filter").change(function() {
1366 var selected = $(this).find('option:selected');
1367 var sg_id = $(selected).val();
1368 var sg_name = $(selected).text();
1369 if (sg_id.length > 0) {
1370 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1371 rtable.fnSetColumnVis(5, false);
1373 rtable.fnFilter('', 5);
1374 rtable.fnSetColumnVis(5, true);
1378 $("#reports_form").submit(function(){
1379 var checkedItems = $("input[name=ids]:checked");
1380 if ($(checkedItems).size() == 0) {
1381 alert(_("You must select one or more reports to delete"));
1384 $(checkedItems).parents('tr').addClass("warn");
1385 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1388 $(checkedItems).parents('tr').removeClass("warn");
1393 $("body").on("click", ".update_sql", function(e){
1395 var ltitle = $(this).text();
1396 var report_id = $(this).data("report_id");
1397 var page = $(this).attr("href");
1398 $("#update_sql .modal-body").load(page + " div", function(){
1399 var diff1 = $("#col1 .show_sql").text();
1400 var diff2 = $("#col2 .show_sql").text();
1401 var diffs = diffString( escape(diff1), escape(diff2) );
1402 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1404 $('#update_sql').modal('show');
1405 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1408 $("#update_sql").on("hidden.bs.modal", function(){
1409 $("#update_sql_label").html("");
1410 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1414 [% IF ( showsql ) %]
1415 $("#sql").focus(function() {
1420 $(".toggle_sql").click(function(){
1421 $("#sql_output").toggle();
1422 $("#toggle_sql_hid").toggle();
1423 $("#toggle_sql_vis").toggle();
1426 $(".toggle_chart_settings").click(function(){
1427 $("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle();
1430 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1431 $(this).parents('tr').attr("class","warn");
1432 if(confirm(_("Are you sure you want to delete this saved report?"))){
1435 $(this).parents('tr').attr("class","");
1440 [% IF (create || editsql || save) %]
1441 $("#select_group").change(function() {
1442 if($(this).prop('checked')) {
1443 $("#group_input").prop('disabled', true);
1444 $("#groupdesc_input").prop('disabled', true);
1445 $("#group_select").prop('disabled', false);
1446 if ($("#group_select").val().length > 0) {
1447 $("#select_subgroup").prop('checked', true);
1448 $("#select_subgroup").change();
1449 $("#subgroup, #subgroup *").show();
1451 $("#subgroup").hide();
1455 $("#create_group").change(function() {
1456 if($(this).prop('checked')) {
1457 $("#group_input").prop('disabled', false);
1458 $("#groupdesc_input").prop('disabled', false);
1459 $("#group_select").prop('disabled', true);
1460 $("#create_subgroup").prop('checked', true).change();
1461 $("#subgroup_select").hide();
1462 $("#subgroup input[type='radio']").hide();
1463 $("#subgroup label[for]").hide();
1464 $("#subgroup_input").show();
1465 $("#subgroupdesc_input").show();
1466 $("#subgroup").show();
1469 $("#select_subgroup").change(function() {
1470 if($(this).prop('checked')) {
1471 $("#subgroup_select").prop('disabled', false);
1472 $("#subgroup_input").prop('disabled', true);
1473 $("#subgroupdesc_input").prop('disabled', true);
1476 $("#create_subgroup").change(function() {
1477 if($(this).prop('checked')) {
1478 $("#subgroup_input").prop('disabled', false);
1479 $("#subgroupdesc_input").prop('disabled', false);
1480 $("#subgroup_select").prop('disabled', true);
1483 $("#select_group").change();
1484 $("#select_subgroup").change();
1485 $("#group_select").on("change",function(){
1486 load_group_subgroups();
1489 $(".delete").on("click",function(){
1490 return confirmDelete(MSG_CONFIRM_DELETE);
1493 $('div#ManaShareButton').click(function() {
1494 $("#mana_share_form").submit();
1497 $("#mana_search_form").submit(function(e){
1501 $("#column_submit").submit(function() {
1502 if ($("#selectedColumns option").size() < 1) {
1503 alert(_("No columns selected!"));
1506 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1511 function addColumn() {
1512 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1514 function delColumn() {
1515 $("#selectedColumns option:selected").remove();
1520 [% INCLUDE 'intranet-bottom.inc' %]
1522 [% BLOCK group_and_subgroup_selection %]
1524 <label>Report group:</label>
1525 <input type="radio" name="select_or_create_group"
1526 id="select_group" checked="checked" />
1527 <label for="select_group" style="float:none">Select</label>
1528 <select name="group" id="group_select">
1529 <option value="">(None)</option>
1530 [% FOREACH group IN groups_with_subgroups %]
1531 [% IF (group.selected) %]
1532 <option value="[% group.id | html %]" selected="selected">
1534 <option value="[% group.id | html %]">
1536 [% group.name | html %]
1540 <input type="radio" name="select_or_create_group" id="create_group" />
1541 <label for="create_group" style="float:none">or create:</label>
1542 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
1543 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
1546 <label>Report subgroup:</label>
1547 <input type="radio" name="select_or_create_subgroup"
1548 id="select_subgroup" checked="checked" />
1549 <label for="select_subgroup" style="float:none">Select</label>
1550 <select name="subgroup" id="subgroup_select">
1551 <option value="">(None)</option>
1552 [% FOREACH group IN groups_with_subgroups %]
1553 [% IF (group.selected) %]
1554 [% FOREACH subgroup IN group.subgroups %]
1555 [% IF (subgroup.selected) %]
1556 <option value="[% subgroup.id | html %]" selected="selected">
1558 <option value="[% subgroup.id | html %]">
1560 [% subgroup.name | html %]
1566 <input type="radio" name="select_or_create_subgroup"
1567 id="create_subgroup" />
1568 <label for="create_subgroup" style="float:none">or create</label>
1569 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
1570 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />