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 %]
44 [% 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 [% INCLUDE 'chart.inc' %]
822 [% IF ( notes ) %]<p><span class="label">Notes:</span> [% notes | html %]</p>[% END %]
823 [% 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 %]
824 <div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql | html %]</pre></div>
827 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
828 <input type="hidden" name="phase" value="Run this report"/>
829 <input type="hidden" name="reports" value="[% report_id | html %]"/>
831 [% FOREACH p IN sql_params %]
832 <input type="hidden" name="sql_params" value="[% p | html %]"/>
834 [% FOREACH n IN param_names %]
835 <input type="hidden" name="param_name" value="[% n | html %]"/>
838 <label for="limit">Rows per page: </label>
839 <select name="limit" id="limit">
840 [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
841 [% FOREACH l IN limits %]
843 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
845 <option value="[% l | html %]">[% l | html %]</option>
851 <div class="pages">[% pagination_bar | $raw %]</div>
852 [% UNLESS ( errors ) %]
853 <form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="report_results">
854 <input type="hidden" name="op" value="show" />
857 [% FOREACH header_ro IN header_row %]
858 [% IF header_ro.cell == 'itemnumber' %]
860 [% header_ro.cell | html %] <button type="submit" data-toggle="tooltip" title="Send visible items to batch modification" class="btn btn-xs btn-default send_to_item_mod"><i class="fa fa-pencil"></i> Batch modify</button>
863 <th>[% header_ro.cell | html %]</th>
867 [% FOREACH result IN results %]
869 [% FOREACH cells IN result.cells %]
870 [% place = loop.index %]
871 [% IF header_row.$place.cell == 'itemnumber' %]
872 <input type="hidden" name="[% header_row.$place.cell | html %]" value="[% cells.cell | html %]" />
874 <td>[% cells.cell | $raw %]</td>
885 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
886 <fieldset class="rows">
887 <legend>Create report from SQL</legend>
889 <li><label for="reportname" class="required">Report name:</label>
890 [% IF ( reportname ) %]<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
891 [% ELSE %]<input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />[% END %] <span class="required">Required</span>
893 [% PROCESS group_and_subgroup_selection %]
896 <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>
898 <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>
900 [% IF (usecache) %] <li>
901 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
902 <select id="cache_expiry_units" name="cache_expiry_units">
903 <option value="seconds" selected="selected">Seconds (default)</option>
904 <option value="minutes">Minutes</option>
905 <option value="hours">Hours</option>
906 <option value="days">Days</option>
909 <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
912 <fieldset class="rows">
913 <legend>SQL:</legend>
914 <div style="margin:1em;">
915 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
919 <fieldset class="action"><input type="hidden" name="phase" value="Save Report" />
920 <input type="submit" name="submit" value="Save report" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
925 [% IF saved_results %]
926 <h1>Saved report results</h1>
927 <h2>[% name | html %]</h2>
928 <p>[% notes | html %]</p>
930 [% FOREACH rows IN saved_results %]
932 [% FOREACH col IN rows %]
933 <td>[% col | html %]</td>
941 <fieldset class="rows">
942 <legend>[% reportname | html %]</legend>
944 [% IF ( notes ) %]<li><span class="label">Notes:</span> [% notes | html %]</li>[% ELSE %][% END %]
945 <li><textarea id="sql">[% sql | html %]</textarea></li>
950 [% IF ( save_successful ) %]
951 [% UNLESS ( errors ) %]
953 <div id="report_updated">
954 <div class="dialog message">
955 <p>Your report "[% reportname | html %]" has been saved</p>
962 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated">
963 <input type="hidden" name="phase" value="Update SQL" />
964 <input type="hidden" name="id" value="[% id | html %]"/>
965 <fieldset class="rows">
966 <legend>Edit SQL report</legend>
968 <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>
969 [% PROCESS group_and_subgroup_selection %]
971 <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>
973 <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>
975 [% IF (usecache) %] <li>
976 <label for="cache_expiry">Cache expiry:</label><input type="text" id="cache_expiry" name="cache_expiry" value="[% cache_expiry | html %]"></input>
977 <select id="cache_expiry_units" name="cache_expiry_units">
978 <option value="seconds">Seconds (default)</option>
979 <option value="minutes">Minutes</option>
980 <option value="hours">Hours</option>
981 <option value="days">Days</option>
984 <li><label for="notes">Notes:</label><textarea id="notes" name="notes" cols="50" rows="2">[% notes | html %]</textarea></li>
988 <fieldset class="rows">
989 <legend>SQL:</legend>
990 <div style="margin:1em;">
991 <textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea> <span class="required">Required</span>
995 <fieldset class="action">
996 <input type="submit" name="submit" value="Update SQL" /> <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved" class="cancel">Cancel</a>
1004 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
1005 <div class="dialog alert">
1006 <b>The following error was encountered:</b><br />
1007 [% FOREACH error IN errors %]
1008 [% IF ( error.sqlerr ) %]This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.
1009 <br />Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.
1010 <br />Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
1011 [% ELSIF ( error.queryerr ) %]The database returned the following error: <br />[% error.queryerr | html %]<br />Please check the log for further details.
1012 [% ELSIF ( error.cache_expiry ) %]Please select a cache expiry less than 30 days.
1015 <div id="onerror_actions">
1016 <a href="#" class="button goback">Return to previous page</a>
1020 <fieldset class="action"><input type="hidden" name="phase" value="Use saved" />
1021 <input type="submit" name="submit" value="Saved reports" /></fieldset>
1026 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1028 <div class="col-sm-2 col-sm-pull-10">
1033 <div id="saved-reports-filter">
1034 <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get">
1035 <input type="hidden" name="phase" value="Use saved" />
1036 <input type="hidden" name="filter_set" value="1" />
1037 <fieldset class="brief">
1040 <li><label for="filter_date">Date:</label> <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
1041 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
1044 <li><label for="filter_author">Author:</label> <input type="text" id="filter_author" name="filter_author" value="[% filters.author | html %]" size="16" /></li>
1045 <li><label for="filter_keyword">Keyword:</label> <input type="text" id="filter_keyword" name="filter_keyword" value="[% filters.keyword | html %]" size="16" /></li>
1048 <fieldset class="action">
1049 <input type="submit" value="Apply filter" />
1050 <a id="resetReportsFilter" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved&clear_filters=1">Clear</a>
1057 [% INCLUDE 'guided-reports-view.inc' %]
1059 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1060 </div> <!-- /.row -->
1063 [% MACRO jsinclude BLOCK %]
1064 [% Asset.js("js/charts.js") | $raw %]
1065 [% Asset.js("lib/d3c3/d3.min.js") | $raw %]
1066 [% Asset.js("lib/d3c3/c3.min.js") | $raw %]
1067 [% INCLUDE 'calendar.inc' %]
1068 [% INCLUDE 'mana.inc' %]
1070 [% INCLUDE 'datatables.inc' %]
1071 [% INCLUDE 'columns_settings.inc' %]
1073 [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
1074 [% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
1077 function hide_bar_element() {
1078 $('#chart-column-horizontal').hide()
1079 $('.chart-column-group').each(function( index ) {
1082 $('.chart-column-line').each(function( index ) {
1087 function show_bar_element() {
1088 $('#chart-column-horizontal').show()
1089 $('.chart-column-group').each(function( index ) {
1092 $('.chart-column-line').each(function( index ) {
1097 function removeColumn(id) {
1100 if ( $('.chart-column-conf').length == 1 ) {
1101 $('.chart-column-delete').remove();
1105 var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
1106 var group_subgroups = {};
1107 [% FOREACH group IN groups_with_subgroups %]
1108 var gid = "[% group.id | html %]"
1109 group_subgroups[gid] = new Array();
1110 [% FOREACH subgroup IN group.subgroups %]
1111 var sgid = "[% subgroup.id | html %]";
1112 var sgname = "[% subgroup.name | html %]";
1113 group_subgroups[gid].push([sgid, sgname]);
1117 [% IF ( create || editsql || save ) %]
1118 var editor = CodeMirror.fromTextArea(sql, {
1125 [% IF ( showsql ) %]
1126 var editor = CodeMirror.fromTextArea(sql, {
1134 function load_group_subgroups () {
1135 var group = $("#group_select").val();
1136 var sg = $("#subgroup");
1137 $(sg).find('option[value!=""]').each(function() {
1142 var select = $(sg).find('select')[0];
1143 $.each( group_subgroups[group], function(index, value) {
1144 $('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select);
1146 $("#subgroup, #subgroup *").show();
1150 $(document).ready(function(){
1154 if ( $('.chart-column-conf').length == 1 ) {
1155 $('.chart-column-delete').remove();
1158 $(".chart-column-delete").on('click', function(e){
1160 removeColumn('column_' + $(this).data('column'));
1163 $('#download-chart').click(function() {
1164 var svg = '<svg>' + $('#chart svg').html() + '</svg>';
1165 this.href = 'data:application/octet-stream;base64,' + btoa(svg);
1166 this.setAttribute('download', 'chart.svg');
1169 $('#chart-type').change(function() {
1170 if ($(this).val() == 'bar') {
1178 $('#download-chart').hide();
1181 [% IF results && !errors %]
1182 $('#draw-chart').click(function() {
1184 var btn_text = $("#draw-chart").html();
1185 $("#draw-chart").html(_("Loading..."));
1187 var x_elements = $('select[name="x"]').val();
1188 var y_elements = [];
1193 headers = [% header_row.json | $raw %];
1196 if ($('input[name="chart-include-all"]').prop('checked')) {
1197 results = [% allresults.json | $raw %]
1200 results = [% results.json | $raw %]
1203 if ($('input[name="chart-exclude-last"]').prop('checked')) {
1204 results.splice(-1, 1);
1207 $('select[name="y"]').each(function( index ) {
1208 y_elements.push( $(this).val() );
1210 $('select[name="group"]').each(function( index ) {
1211 groups.push( $(this).val() );
1213 $('.column-line').each(function( index ) {
1214 if ($(this).prop('checked')) {
1215 lines.push( $(this).attr('name') );
1219 // Remove deleted columns from headers and results.
1220 var deleted_indexes = [];
1221 var kept_headers = [];
1222 $.each(headers, function(index, value) {
1223 if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) {
1224 // This header is neither a x element nor in y elements. Don't need it.
1225 deleted_indexes.push(index);
1228 kept_headers.push({cell: value.cell});
1232 // Remove coresponding cells.
1233 var kept_results = [];
1234 $.each(results, function(index, value) {
1237 $.each(value.cells, function(i, val) {
1238 if ($.inArray(i, deleted_indexes) === -1) {
1239 line['cells'].push({cell: val.cell});
1242 kept_results.push(line);
1245 options.type = $('select[name="chart-type"]').val();
1246 options.horizontal = $('input[name="column-horizontal"]').prop('checked');
1247 options.lines = lines;
1249 chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options);
1250 $('#chart').prepend('<div style="font-size: 1rem; text-align: center;">' + "[% name | html %]" + '</div>');
1251 $('#download-chart').show();
1252 $("#draw-chart").html(_(btn_text));
1253 $("html, body").animate({ scrollTop: $(document).height() }, "slow");
1257 load_group_subgroups();
1260 $('[data-toggle="tooltip"]').tooltip();
1261 var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
1263 $('#limit').change(function() {
1264 $('#limitselect').submit();
1267 $(document).click(function() {
1268 $('#report_updated').hide();
1271 $(".goback").on("click",function(e){
1273 window.history.back();
1276 $(".mana_search_button").on("click",function(){
1277 mana_search($("#mana_search_field").val());
1280 $(".ShareButton").on("click", function(){
1281 $("#note-error").hide();
1282 if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){
1283 $(".shared_infos").hide();
1284 $("#note-error").show();
1287 $("#reportid").val($(this).closest("tr").find(".report_id").text());
1288 $("#shared_id").html($(this).closest("tr").find(".report_id").text());
1289 $("#shared_name").html($(this).closest("tr").find(".report_name").text());
1290 $("#shared_sql").html($(this).closest("tr").find(".report_sql").val());
1291 $("#shared_type").html($(this).closest("tr").find(".report_type").text());
1292 $("#shared_group").html($(this).closest("tr").find(".report_group").text());
1293 $("#shared_notes").html($(this).closest("tr").find(".report_notes").text());
1297 $("#ManaCloseButton").on("click", function() {
1298 $(".shared_infos").show();
1301 $("#addColumn").on("click",function(){
1305 $("#delColumn").on("click",function(){
1310 var rtable = KohaTable("table_reports", {
1311 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
1312 'bAutoWidth': false,
1313 'sPaginationType': 'four_button',
1314 'aaSorting': [[ 1, "asc" ]],
1316 { 'bSortable': false, 'bSearchable':false, 'aTargets': [0, -1] },
1317 { 'bSearchable': false, 'aTargets': [3] },
1318 { "aTargets": [ 1, 2 ], "sType": "natural" },
1319 { "sType": "title-string", "aTargets" : [ "title-string" ] },
1320 { "visible": false, "aTargets" : [ "hidden" ] }
1323 'sZeroRecords': _("No matching reports found")
1325 }, columns_settings);
1327 var rtabs = $("#tabs").tabs();
1328 rtabs.on("tabsactivate", function(e, ui) {
1329 $("#subgroup_filter option").each(function() {
1330 if($(this).val().length > 0) {
1334 rtable.fnFilter('', 4);
1335 rtable.fnFilter('', 5);
1336 rtable.fnSetColumnVis(4, true);
1337 rtable.fnSetColumnVis(5, true);
1339 var g_id = $(ui.newTab).children().attr('id');
1340 var g_name = $(ui.newTab).text();
1341 if ( g_name == _("All") ) {
1346 if (g_id && g_id.length > 0) {
1347 rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
1348 rtable.fnSetColumnVis(4, false);
1349 for(var i in group_subgroups[g_id]) {
1350 $("#subgroup_filter").append(
1351 '<option value="' + group_subgroups[g_id][i][0] + '">'
1352 + group_subgroups[g_id][i][1] + '</option>'
1355 $("#subgroup_filter_block").show();
1357 $("#subgroup_filter_block").hide();
1360 $("#subgroup_filter_block").hide();
1362 $("#subgroup_filter").change(function() {
1363 var selected = $(this).find('option:selected');
1364 var sg_id = $(selected).val();
1365 var sg_name = $(selected).text();
1366 if (sg_id.length > 0) {
1367 rtable.fnFilter('^' + sg_name + '$', 5, true, true, true, false);
1368 rtable.fnSetColumnVis(5, false);
1370 rtable.fnFilter('', 5);
1371 rtable.fnSetColumnVis(5, true);
1375 $("#reports_form").submit(function(){
1376 var checkedItems = $("input[name=ids]:checked");
1377 if ($(checkedItems).size() == 0) {
1378 alert(_("You must select one or more reports to delete"));
1381 $(checkedItems).parents('tr').addClass("warn");
1382 if( confirm(_("Are you sure you want to delete the selected reports?")) ) {
1385 $(checkedItems).parents('tr').removeClass("warn");
1390 $("body").on("click", ".update_sql", function(e){
1392 var ltitle = $(this).text();
1393 var report_id = $(this).data("report_id");
1394 var page = $(this).attr("href");
1395 $("#update_sql .modal-body").load(page + " div", function(){
1396 var diff1 = $("#col1 .show_sql").text();
1397 var diff2 = $("#col2 .show_sql").text();
1398 var diffs = diffString( escape(diff1), escape(diff2) );
1399 $("#col1 .show_sql,#col2 .show_sql").html(diffs);
1401 $('#update_sql').modal('show');
1402 $("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?phase=Use saved&op=convert&report_id=" + report_id);
1405 $("#update_sql").on("hidden.bs.modal", function(){
1406 $("#update_sql_label").html("");
1407 $("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
1411 [% IF ( showsql ) %]
1412 $("#sql").focus(function() {
1417 $(".toggle_sql").click(function(){
1418 $("#sql_output").toggle();
1419 $("#toggle_sql_hid").toggle();
1420 $("#toggle_sql_vis").toggle();
1423 $(".toggle_chart_settings").click(function(){
1424 $("#makechart").toggle();
1425 $("#toggle_chart_settings_hid").toggle();
1426 $("#toggle_chart_settings_vis").toggle();
1429 $("#table_reports").delegate(".confirmdelete", 'click', function(){
1430 $(this).parents('tr').attr("class","warn");
1431 if(confirm(_("Are you sure you want to delete this saved report?"))){
1434 $(this).parents('tr').attr("class","");
1439 [% IF (create || editsql || save) %]
1440 $("#select_group").change(function() {
1441 if($(this).prop('checked')) {
1442 $("#group_input").prop('disabled', true);
1443 $("#groupdesc_input").prop('disabled', true);
1444 $("#group_select").prop('disabled', false);
1445 if ($("#group_select").val().length > 0) {
1446 $("#select_subgroup").prop('checked', true);
1447 $("#select_subgroup").change();
1448 $("#subgroup, #subgroup *").show();
1450 $("#subgroup").hide();
1454 $("#create_group").change(function() {
1455 if($(this).prop('checked')) {
1456 $("#group_input").prop('disabled', false);
1457 $("#groupdesc_input").prop('disabled', false);
1458 $("#group_select").prop('disabled', true);
1459 $("#create_subgroup").prop('checked', true).change();
1460 $("#subgroup_select").hide();
1461 $("#subgroup input[type='radio']").hide();
1462 $("#subgroup label[for]").hide();
1463 $("#subgroup_input").show();
1464 $("#subgroupdesc_input").show();
1465 $("#subgroup").show();
1468 $("#select_subgroup").change(function() {
1469 if($(this).prop('checked')) {
1470 $("#subgroup_select").prop('disabled', false);
1471 $("#subgroup_input").prop('disabled', true);
1472 $("#subgroupdesc_input").prop('disabled', true);
1475 $("#create_subgroup").change(function() {
1476 if($(this).prop('checked')) {
1477 $("#subgroup_input").prop('disabled', false);
1478 $("#subgroupdesc_input").prop('disabled', false);
1479 $("#subgroup_select").prop('disabled', true);
1482 $("#select_group").change();
1483 $("#select_subgroup").change();
1484 $("#group_select").on("change",function(){
1485 load_group_subgroups();
1488 $(".delete").on("click",function(){
1489 return confirmDelete(MSG_CONFIRM_DELETE);
1492 $('div#ManaShareButton').click(function() {
1493 $("#mana_share_form").submit();
1496 $("#mana_search_form").submit(function(e){
1501 function addColumn() {
1502 $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
1504 function delColumn() {
1505 $("#selectedColumns option:selected").remove();
1507 $("#column_submit").submit(function() {
1508 if ($("#selectedColumns option").size() < 1) {
1509 alert(_("No columns selected!"));
1512 $("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns
1518 [% INCLUDE 'intranet-bottom.inc' %]
1520 [% BLOCK group_and_subgroup_selection %]
1522 <label>Report group:</label>
1523 <input type="radio" name="select_or_create_group"
1524 id="select_group" checked="checked" />
1525 <label for="select_group" style="float:none">Select</label>
1526 <select name="group" id="group_select">
1527 <option value="">(None)</option>
1528 [% FOREACH group IN groups_with_subgroups %]
1529 [% IF (group.selected) %]
1530 <option value="[% group.id | html %]" selected="selected">
1532 <option value="[% group.id | html %]">
1534 [% group.name | html %]
1538 <input type="radio" name="select_or_create_group" id="create_group" />
1539 <label for="create_group" style="float:none">or create:</label>
1540 <input type="text" name="group" id="group_input" title="Group code" placeholder="Code" />
1541 <input type="text" name="groupdesc" id="groupdesc_input" title="Group name" placeholder="Name" />
1544 <label>Report subgroup:</label>
1545 <input type="radio" name="select_or_create_subgroup"
1546 id="select_subgroup" checked="checked" />
1547 <label for="select_subgroup" style="float:none">Select</label>
1548 <select name="subgroup" id="subgroup_select">
1549 <option value="">(None)</option>
1550 [% FOREACH group IN groups_with_subgroups %]
1551 [% IF (group.selected) %]
1552 [% FOREACH subgroup IN group.subgroups %]
1553 [% IF (subgroup.selected) %]
1554 <option value="[% subgroup.id | html %]" selected="selected">
1556 <option value="[% subgroup.id | html %]">
1558 [% subgroup.name | html %]
1564 <input type="radio" name="select_or_create_subgroup"
1565 id="create_subgroup" />
1566 <label for="create_subgroup" style="float:none">or create</label>
1567 <input type="text" name="subgroup" id="subgroup_input" title="Subgroup code" placeholder="Code" />
1568 <input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />