[% USE raw %]
[% USE Asset %]
+[% USE AuthorisedValues %]
[% USE KohaDates %]
[% USE Koha %]
[% USE TablesSettings %]
[% USE JSON.Escape %]
+[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[%- BLOCK area_name -%]
[%- SWITCH area -%]
- [%- CASE 'CIRC' -%]Circulation
- [%- CASE 'CAT' -%]Catalog
- [%- CASE 'PAT' -%]Patrons
- [%- CASE 'ACQ' -%]Acquisitions
- [%- CASE 'ACC' -%]Accounts
- [%- CASE 'SER' -%]Serials
+ [%- CASE 'CIRC' -%]<span>Circulation</span>
+ [%- CASE 'CAT' -%]<span>Catalog</span>
+ [%- CASE 'PAT' -%]<span>Patrons</span>
+ [%- CASE 'ACQ' -%]<span>Acquisitions</span>
+ [%- CASE 'ACC' -%]<span>Accounts</span>
+ [%- CASE 'SER' -%]<span>Serials</span>
[%- END -%]
[%- END -%]
[% INCLUDE 'doc-head-open.inc' %]
<title>
- Koha › Reports › Guided reports wizard
[%- IF ( saved1 ) -%]
- › Saved reports
- [%- ELSIF ( create ) -%]
- › Create from SQL
- [%- ELSIF ( showsql ) -%]
- › Saved reports › SQL view
- [%- ELSIF ( execute ) -%]
- › Saved reports › [% name | html %] Report
- [%- ELSIF ( editsql ) -%]
- › Saved reports › Edit SQL report
- [%- END -%]
+ Saved reports › [%- ELSIF ( create ) -%]
+ Create from SQL › [%- ELSIF ( showsql ) -%]
+ SQL view › Saved reports › [%- ELSIF ( execute ) -%]
+ Report [% name | html %] ([% id | html %]) › Saved reports › [%- ELSIF ( editsql ) -%]
+ Edit report [% reportname | html %] ([% id | html %]) › Saved reports › [%- END -%]
+
[%- IF ( build1 ) -%]
- › Build a report, step 1 of 6: Choose a module
- [%- ELSIF ( build2 ) -%]
- › Build a report, step 2 of 6: Pick a report type
- [%- ELSIF ( build3 ) -%]
- › Build a report, step 3 of 6: Select columns for display
- [%- ELSIF ( build4 ) -%]
- › Build a report, step 4 of 6: Select criteria to limit on
- [%- ELSIF ( build5 ) -%]
- › Build a report, step 5 of 6: Pick which columns to total
- [%- ELSIF ( build6 ) -%]
- › Build a report, step 6 of 6: Select how you want the report ordered
- [%- END -%]
+ Build a report, step 1 of 6: Choose a module › [%- ELSIF ( build2 ) -%]
+ Build a report, step 2 of 6: Pick a report type › [%- ELSIF ( build3 ) -%]
+ Build a report, step 3 of 6: Select columns for display › [%- ELSIF ( build4 ) -%]
+ Build a report, step 4 of 6: Select criteria to limit on › [%- ELSIF ( build5 ) -%]
+ Build a report, step 5 of 6: Pick which columns to total › [%- ELSIF ( build6 ) -%]
+ Build a report, step 6 of 6: Select how you want the report ordered › [%- END -%]
+ Guided reports wizard › Reports › Koha
</title>
[% INCLUDE 'doc-head-close.inc' %]
.CodeMirror {
resize: vertical;
}
- #mana_search_errortext { font-family: monospace; font-weight: bold; }
+ .cm-sqlParams {
+ color: #11917B;
+ }
+ .cm-columnPlaceholder {
+ color: #BF2D5D;
+ }
+ #mana_search_errortext {
+ font-family: monospace; font-weight: bold;
+ }
+ .data-plain {
+ display: none;
+ }
</style>
[% Asset.css("css/reports.css") | $raw %]
[% Asset.css("lib/d3c3/c3.min.css") | $raw %]
</head>
<body id="rep_guided_reports_start" class="rep">
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'circ-search.inc' %]
-
-<div id="breadcrumbs">
- <a href="/cgi-bin/koha/mainpage.pl">Home</a>
- › <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
- › <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
+[% WRAPPER 'header.inc' %]
+ [% INCLUDE 'circ-search.inc' %]
+[% END %]
- [% IF ( saved1 ) %]
- › Saved reports
- [% ELSIF ( create ) %]
- › Create from SQL
- [% ELSIF ( showsql ) %]
- › <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › SQL view
- [% ELSIF ( editsql ) %]
- › <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › Edit SQL report
- [% ELSIF ( execute ) %]
- › <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a> › <em>[% name | html %]</em> Report
- [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
- › <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
- [% IF ( build1 ) %]
- › Step 1 of 6: Choose a module
- [% ELSIF ( build2 ) %]
- › Step 2 of 6: Pick a report type
- [% ELSIF ( build3 ) %]
- › Step 3 of 6: Select columns for display
- [% ELSIF ( build4 ) %]
- › Step 4 of 6: Select criteria to limit on
- [% ELSIF ( build5 ) %]
- › Step 5 of 6: Pick which columns to total
- [% ELSIF ( build6 ) %]
- › Step 6 of 6: Select how you want the report ordered
+[% WRAPPER 'sub-header.inc' %]
+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
+ <ol>
+ <li>
+ <a href="/cgi-bin/koha/mainpage.pl">Home</a>
+ </li>
+ <li>
+ <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
+ </li>
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided reports wizard</a>
+ </li>
+
+ [% IF ( saved1 ) %]
+ <li>
+ <a href="#" aria-current="page">
+ Saved reports
+ </a>
+ </li>
+ [% ELSIF ( create ) %]
+ <li>
+ <a href="#" aria-current="page">
+ Create from SQL
+ </a>
+ </li>
+ [% ELSIF ( showsql ) %]
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+ </li>
+ <li>
+ <a href="#" aria-current="page">
+ [% reportname | html %] ([% id | html %])
+ </a>
+ </li>
+ [% ELSIF ( editsql ) %]
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+ </li>
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% reportname | html %] ([% id | html %])</a>
+ </li>
+ <li>
+ <a href="#" aria-current="page">
+ Edit
+ </a>
+ </li>
+ [% ELSIF ( execute ) %]
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Use%20saved">Saved reports</a>
+ </li>
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | uri %]&phase=Show%20SQL">[% name | html %] ([% id | html %])</a>
+ </li>
+ <li>
+ <a href="#" aria-current="page">
+ Run
+ </a>
+ </li>
+ [% ELSIF ( build1 || build2 || build3 || build4 || build5 || build6 ) %]
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">Build a report</a>
+ </li>
+ <li>
+ <a href="#" aria-current="page">
+ [% IF ( build1 ) %]
+ <span>Step 1 of 6: Choose a module</span>
+ [% ELSIF ( build2 ) %]
+ <span>Step 2 of 6: Pick a report type</span>
+ [% ELSIF ( build3 ) %]
+ <span>Step 3 of 6: Select columns for display</span>
+ [% ELSIF ( build4 ) %]
+ <span>Step 4 of 6: Select criteria to limit on</span>
+ [% ELSIF ( build5 ) %]
+ <span>Step 5 of 6: Pick which columns to total</span>
+ [% ELSIF ( build6 ) %]
+ <span>Step 6 of 6: Select how you want the report ordered</span>
+ [% END %]
+ </a>
[% END %]
- [% END %]
-</div> <!-- /#breadcrumbs -->
+ </ol>
+</nav> <!-- /#breadcrumbs -->
+[% END %]
<div id="update_sql" class="modal" tabindex="-1" role="dialog" aria-labelledby="update_sql_label" aria-hidden="true">
<div class="modal-dialog">
[% INCLUDE "reports-toolbar.inc" %]
[% IF ( start ) %]
- <h2>Guided reports</h2>
+ <h1>Guided reports</h1>
<p>Use the guided reports engine to create non standard reports. This feature aims to provide some middle ground between the built in canned reports and writing custom SQL reports.</p>
<h3>Build and run reports</h3>
[% END %]
[% IF ( saved1 ) %]
- [% IF ( savedreports ) %]
<h1>Saved reports</h1>
+ [% IF ( savedreports ) %]
[% IF ( filters.date || filters.author || filters.keyword ) %]
<p>Filtered by:
[% END %]
<div id="tabs" class="toptabs">
- <ul>
- <li><a href="#reports">All</a></li>
+ <ul class="nav nav-tabs" role="tablist">
+ <li role="presentation" class="active">
+ <a href="#reports" aria-controls="reports" role="tab" data-toggle="tab">All</a>
+ </li>
[% FOREACH group IN groups_with_subgroups %]
- <li><a id="[% group.id | html %]" href="#reports">[% group.name | html %]</a></li>
+ <li role="presentation">
+ <a id="[% group.id | html %]" href="#reports" aria-controls="reports" role="tab" data-toggle="tab">[% group.name | html %]</a>
+ </li>
[% END %]
</ul>
- <div id="reports">
- <div id="subgroup_filter_block">
- <label for="subgroup_filter">Subgroup:</label>
- <select id="subgroup_filter">
- <option value="">All</option>
- </select>
- </div>
- [% IF (Koha.Preference('Mana') == 1) %]
- [% IF manamsg %]
- <div id="mana_search_message" class="dialog message">
- <p> [% manamsg | html %] </p>
- </div>
+ <div class="tab-content">
+ <div id="reports" role="tabpanel" class="tab-pane active">
+ <div id="subgroup_filter_block">
+ <label for="subgroup_filter">Subgroup:</label>
+ <select id="subgroup_filter">
+ <option value="">All</option>
+ </select>
+ </div>
+
+ [% IF (Koha.Preference('Mana') == 1) %]
+ [% IF manamsg %]
+ <div id="mana_search_message" class="dialog message">
+ <p> [% manamsg | html %] </p>
+ </div>
+ [% END %]
[% END %]
- [% END %]
- <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
- <input type="hidden" name="phase" value="Delete Multiple" />
- <table id="table_reports">
- <thead>
- <tr>
- <th class="NoSort"> </th>
- <th>ID</th>
- <th>Report name</th>
- <th>Type</th>
- <th>Group</th>
- <th>Subgroup</th>
- <th>Notes</th>
- <th>Author</th>
- <th class="title-string">Creation date</th>
- <th class="title-string">Last edit</th>
- <th class="title-string">Last run</th>
- <th class="report_public">Public</th>
- <th class="report_json_url">JSON URL</th>
- [% IF (usecache) %]
- <th>Cache expiry (seconds)</th>
- [% ELSE %]
- <th class="hidden"> </th>
- [% END %]
- <th>Saved results</th>
- [% IF has_obsolete_reports %]
- <th>Update</th>
- [% ELSE %]
- <th class="hidden"> </th>
- [% END %]
- <th class="NoSort">Actions</th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH savedreport IN savedreports %]
- [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
- <td class="report_checkbox">
- [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
- <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
- [% END %]
- <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
- </td>
- <td class="report_id">
- <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
- </td>
- <td class="report_name">
- [% IF ( savedreport.report_name ) %]
- [% savedreport.report_name | html %]
- [% ELSE %]
- [ no name ]
- [% END %]
- </td>
- <td class="report_type">
- [% savedreport.type | html %]
- </td>
- <td class="report_group">
- [% savedreport.groupname | html %]
- </td>
- <td>
- [% savedreport.subgroupname | html %]
- </td>
- <td class="report_notes">
- [% savedreport.notes | html %]
- </td>
- <td>
- [% savedreport.borrowersurname | html %]
- [% IF ( savedreport.borrowerfirstname ) %]
- , [% savedreport.borrowerfirstname | html %]
- [% END %]
- ([% savedreport.borrowernumber | html %])
- </td>
- <td>
- <span title="[% savedreport.date_created | html %]">[% savedreport.date_created | $KohaDates %]</span>
- </td>
- <td>
- <span title="[% savedreport.last_modified | html %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span>
- </td>
- <td>
- <span title="[% savedreport.last_run | html %]">[% savedreport.last_run | $KohaDates with_hours => 1 %]</span>
- </td>
- <td class="report_public">
- [% IF (savedreport.public) %]
- Yes
- [% ELSE %]
- No
- [% END %]
- </td>
- <td class="report_json_url">
- [% IF (savedreport.public) %]
- <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>
- [% ELSE %]
- <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>
- [% END %]
- </td>
- <td>
- [% savedreport.cache_expiry | html %]
- </td>
- <td>
- [% FOR result IN savedreport.results %]
- <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
- <br/>
- [% END %]
- </td>
- <td>
- [% IF savedreport.seems_obsolete %]
- This report seems obsolete, it uses biblioitems.marcxml field.
- <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>
- [% END %]
- </td>
- <td>
- <div class="btn-group dropup">
- [%# There should be no space between these two buttons, it would render badly %]
- <a class="btn btn-default btn-xs" role="button"
- href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
- class="fa fa-play"></i> Run</a><a
- class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
- href="#"><b class="caret"></b></a>
- <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
- <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>
- [% IF ( CAN_user_reports_create_reports ) %]
- <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>
- <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
- [% END %]
- [% IF (Koha.Preference('Mana') == 1) %]
- <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>
- [% END %]
- <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
- [% IF ( CAN_user_reports_delete_reports ) %]
- <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>
- [% END %]
- </ul>
- </div>
- </td>
+ <form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post">
+ <input type="hidden" name="phase" value="Delete Multiple" />
+ <table id="table_reports">
+ <thead>
+ <tr>
+ <th class="NoSort"> </th>
+ <th>ID</th>
+ <th>Report name</th>
+ <th>Type</th>
+ <th>Group</th>
+ <th>Subgroup</th>
+ <th>Notes</th>
+ <th>Author</th>
+ <th>Creation date</th>
+ <th>Last edit</th>
+ <th>Last run</th>
+ <th class="report_public">Public</th>
+ <th class="report_json_url">JSON URL</th>
+ [% IF (usecache) %]
+ <th>Cache expiry (seconds)</th>
+ [% ELSE %]
+ <th class="NoVisible">Cache expiry (seconds)</th>
+ [% END %]
+ <th>Saved results</th>
+ [% IF has_obsolete_reports %]
+ <th>Update</th>
+ [% ELSE %]
+ <th class="NoVisible">Update</th>
+ [% END %]
+ <th class="NoSort noExport">Actions</th>
</tr>
- [% END %]
- </tbody>
- </table>
+ </thead>
+ <tbody>
+ [% FOREACH savedreport IN savedreports %]
+ [% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %]
+ <td class="report_checkbox">
+ [% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS -->
+ <input type="checkbox" name="ids" id="ids[% savedreport.id | html %]" value="[% savedreport.id | html %]" />
+ [% END %]
+ <input type="hidden" class="report_sql" value="[% savedreport.savedsql |html %]">
+ </td>
+ <td class="report_id">
+ <label for="ids[% savedreport.id | html %]">[% savedreport.id | html %]</label>
+ </td>
+ <td class="report_name">
+ [% IF ( savedreport.report_name ) %]
+ [% savedreport.report_name | html %]
+ [% ELSE %]
+ [ no name ]
+ [% END %]
+ </td>
+ <td class="report_type">
+ [% savedreport.type | html %]
+ </td>
+ <td class="report_group">
+ [% savedreport.groupname | html %]
+ </td>
+ <td>
+ [% savedreport.subgroupname | html %]
+ </td>
+ <td class="report_notes">
+ [% savedreport.notes | html %]
+ </td>
+ <td>
+ [%- savedreport.borrowersurname | html -%][%- IF ( savedreport.borrowerfirstname ) -%], [%- savedreport.borrowerfirstname | html -%][%- END -%]
+ ([% savedreport.borrowernumber | html %])
+ </td>
+ <td data-order="[% savedreport.date_created | html %]">
+ [% savedreport.date_created | $KohaDates %]
+ </td>
+ <td data-order="[% savedreport.last_modified | html %]">
+ [% savedreport.last_modified | $KohaDates with_hours => 1 %]
+ </td>
+ <td data-order="[% savedreport.last_run | html %]">
+ [% savedreport.last_run | $KohaDates with_hours => 1 %]
+ </td>
+ <td class="report_public">
+ [% IF (savedreport.public) %]
+ Yes
+ [% ELSE %]
+ No
+ [% END %]
+ </td>
+ <td class="report_json_url">
+ [% IF (savedreport.public) %]
+ <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>
+ [% ELSE %]
+ <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>
+ [% END %]
+ </td>
+ <td>
+ [% savedreport.cache_expiry | html %]
+ </td>
+ <td>
+ [% FOR result IN savedreport.results %]
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=[% result.id | uri %]">[% result.date_run | html %]</a>
+ <br/>
+ [% END %]
+ </td>
+ <td>
+ [% IF savedreport.seems_obsolete %]
+ This report seems obsolete, it uses biblioitems.marcxml field.
+ <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>
+ [% END %]
+ </td>
+ <td>
+ <div class="btn-group dropup">
+ [%# There should be no space between these two buttons, it would render badly %]
+ <a class="btn btn-default btn-xs" role="button"
+ href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | html %]&phase=Run%20this%20report"><i
+ class="fa fa-play"></i> Run</a><a
+ class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown"
+ href="#"><b class="caret"></b></a>
+ <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
+ <li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL"><i class="fa fa-search"></i> View</a></li>
+ <li>
+ <a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id | uri %]&phase=Show%20SQL" class="preview_sql" data-reportid="[% savedreport.id | html %]">
+ <i class="fa fa-eye"></i> Preview SQL
+ </a>
+ </li>
+ [% IF ( CAN_user_reports_create_reports ) %]
+ <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>
+ <li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=[% savedreport.id | uri %]"><i class="fa fa-copy"></i> Duplicate</a></li>
+ [% END %]
+ [% IF (Koha.Preference('Mana') == 1) %]
+ <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>
+ [% END %]
+ <li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id | uri %]"><i class="fa fa-clock-o"></i> Schedule</a></li>
+ [% IF ( CAN_user_reports_delete_reports ) %]
+ <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>
+ [% END %]
+ </ul>
+ </div>
+ <input type="hidden" id="previewSql[% savedreport.id | html %]" value="[% savedreport.savedsql | html %]" data-title="[% savedreport.report_name | html %]" />
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
- [% IF ( CAN_user_reports_delete_reports ) %]
- <fieldset class="action">
- <input type="submit" value="Delete selected" />
- </fieldset>
- [% END %]
- </form>
- </div>
+ [% IF ( CAN_user_reports_delete_reports ) %]
+ <fieldset class="action">
+ <input type="submit" value="Delete selected" />
+ </fieldset>
+ [% END %]
+ </form>
+ </div> <!-- /#reports -->
+ </div> <!-- /.tab-content -->
</div>
[% ELSE # IF ( savedreports ) %]
<div class="dialog message">
[% IF ( build1 ) %]
[% IF ( cache_error) %]
<div class="dialog alert">
- <b> Please choose a cache_expiry less than 30 days </b>
+ <strong> Please choose a cache_expiry less than 30 days </strong>
</div>
[% END %]
</td>
[% IF ( criteri.date ) %]
<td>
- <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="datepicker" />
+ <input type="text" size="10" id="[% criteri.name | html %]_value" name="[% criteri.name | html %]_value" value="" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</td>
</tr>
[% IF ( criteri.daterange ) %]
<td>
from
- <input type="text" size="10" id="from_[% criteri.name | html %]_value" name="from_[% criteri.name | html %]_value" value="" class="datepickerfrom" />
+ <input type="text" size="10" id="from_[% criteri.name.remove('\.') | html %]_value" name="from_[% criteri.name | html %]_value" value="" data-date_to="to_[% criteri.name.remove('\.') | html %]_value" class="flatpickr" />
to
- <input type="text" size="10" id="to_[% criteri.name | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="datepickerto" />
+ <input type="text" size="10" id="to_[% criteri.name.remove('\.') | html %]_value" name="to_[% criteri.name | html %]_value" value="" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</td>
</tr>
<input type="hidden" name="public" value="[% public | html %]" />
<input type="hidden" name="cache_expiry" value="[% cache_expiry | html %]" />
<fieldset class="rows">
- <legend>Save your custom report</legend>
+ <legend><h1>Save your custom report</h1></legend>
<ol>
<li>
<label for="reportname" class="required">Report name: </label>
<input name="param_name" value="[% sql_param.name | html %]" type="hidden" />
[% IF sql_param.input == 'date' %]
<li>
- <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" />
+ <label for="date_[% sql_param_entry | html %][% loop.count | html %]">[% sql_param.entry | html %]:</label> <input id="date_[% sql_param_entry | html %][% loop.count | html %]" type="text" value="" size="10" name="sql_params" class="flatpickr" />
</li>
[% ELSIF ( sql_param.input == 'text' ) %]
<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>
+ [% ELSIF ( sql_param.input == 'textarea' ) %]
+ <li>
+ <label for="sql_params[% loop.count | html %]">[% sql_param.entry | html %]: </label>
+ <textarea id="sql_params[% loop.count | html %]" name="sql_params" rows="5"></textarea>
+ </li>
[% ELSE %]
<li>
<label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
- <select name="[%- sql_param.input.name | html -%]" tabindex="1" size="1" id="[%- sql_param.input.id | html -%]">
+ <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]">
[% IF (sql_param.include_all) %]
<option value="%">All</option>
[% END %]
[% END # /IF ( enter_params ) %]
[% IF ( execute ) %]
- <h1>[% name | html %]</h1>
+ <h1>[% name | html %] <span class="report_heading_id"><span class="report_label">Report ID:</span> <span class="report_number">[% id | html %]</span></span></h1>
[% IF ( notes ) %]
<p><span class="label">Notes:</span> [% notes | html %]</p>
[% END %]
<p>
<span class="label">Total number of results:</span>
[% unlimited_total | html %]
- [% IF unlimited_total > limit %]
- ([% limit | html %] shown)
- [% END %].
+ [% IF unlimited_total >= limit %]
+ ([% results.size | html %] shown)
+ [% END %]
</p>
[% END %]
<input type="hidden" name="recordtype" value="biblio" />
<input type="hidden" name="op" value="list" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
- <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
+ <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
+ [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
+ </textarea>
</form>
<form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
<input type="hidden" name="recordtype" value="biblio" />
<input type="hidden" name="op" value="list" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
- <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
+ <textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
+ [%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
+ </textarea>
</form>
<form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
<form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
<input type="hidden" name="op" value="show" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
- <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %][% SET batch_cardnumbers = 1 %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
+ <textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
+ [%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
+ </textarea>
</form>
- [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
- <p>
- <div class="btn-group">
- <button class="btn btn-default dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
- Batch operations with [% IF unlimited_total > limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
- <span class="caret"></span>
- </button>
- <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
- [% FOREACH header_ro IN header_row %]
- [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
- <li class="dropdown-header">Bibliographic records</li>
- <li>
- <a href="#" data-submit="batch_record_modification" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record modification" class="batch_op send_to_record_mod">Batch record modification</a>
- </li>
- <li>
- <a href="#" data-submit="batch_record_deletion" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record deletion" class="batch_op send_to_record_del">Batch record deletion</a>
- </li>
- <li>
- <a href="#" data-submit="batch_add_to_list" data-toggle="tooltip" data-placement="right" title="Send visible records to a list" class="batch_op send_to_list">Add to list</a>
- </li>
- [% END %]
- [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
- [% IF ( batch_biblionumbers ) %]
- <li role="separator" class="divider"></li>
+ [% BLOCK batch_list %]
+ [%- FOREACH result IN results %]
+ [%- FOREACH cells IN result.cells %]
+ [%- place = loop.index %]
+ [%- IF header_row.$place.cell == batch_type || header_types.item(header_row.$place.cell) == batch_type %]
+[%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
+ [%- END %]
+ [%- END %]
+ [%- END -%]
+ [% END %]
+
+ <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
+ <input type="hidden" name="phase" value="Run this report"/>
+ <input type="hidden" name="reports" value="[% report_id | html %]"/>
+ [% FOREACH p IN sql_params %]
+ <input type="hidden" name="sql_params" value="[% p | html %]"/>
+ [% END %]
+ [% FOREACH n IN param_names %]
+ <input type="hidden" name="param_name" value="[% n | html %]"/>
+ [% END %]
+ <input type="hidden" name="limit" id="limit" value="20" />
+ </form> <!-- /#limitselect -->
+
+ [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) || ( unlimited_total > 10 && limit <= 1000 ) %]
+ <div id="toolbar" class="btn-toolbar">
+ [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
+ <div class="btn-group">
+ <button class="btn btn-default btn-sm dropdown-toggle" type="button" id="batch_mod_menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
+ Batch operations with [% IF unlimited_total >= limit %][% limit | html %][% ELSE %][% unlimited_total | html %][% END %] visible records
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" aria-labelledby="batch_mod_menu">
+ [% FOREACH header_ro IN header_row %]
+ [% IF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
+ <li class="dropdown-header">Bibliographic records</li>
+ <li>
+ <a href="#" data-submit="batch_record_modification" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record modification" class="batch_op send_to_record_mod">Batch record modification</a>
+ </li>
+ <li>
+ <a href="#" data-submit="batch_record_deletion" data-toggle="tooltip" data-placement="right" title="Send visible records to batch record deletion" class="batch_op send_to_record_del">Batch record deletion</a>
+ </li>
+ <li>
+ <a href="#" data-submit="batch_add_to_list" data-toggle="tooltip" data-placement="right" title="Send visible records to a list" class="batch_op send_to_list">Add to list</a>
+ </li>
+ [% END %]
+ [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
+ <li class="dropdown-header">Item records</li>
+ <li>
+ <a href="#" data-submit="batch_item_modification" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item modification" class="batch_op send_to_item_mod">Batch item modification</a>
+ </li>
+ <li>
+ <a href="#" data-submit="batch_item_deletion" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item deletion" class="batch_op send_to_item_del">Batch item deletion</a>
+ </li>
+ [% END %]
+ [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
+ <li class="dropdown-header">Patron records</li>
+ <li>
+ <a href="#" data-submit="batch_patron_modification" data-toggle="tooltip" data-placement="right" title="Send visible results to batch patron modification" class="batch_op send_to_patron_mod">Batch patron modification</a>
+ </li>
[% END %]
- <li class="dropdown-header">Item records</li>
- <li>
- <a href="#" data-submit="batch_item_modification" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item modification" class="batch_op send_to_item_mod">Batch item modification</a>
- </li>
- <li>
- <a href="#" data-submit="batch_item_deletion" data-toggle="tooltip" data-placement="right" title="Send visible items to batch item deletion" class="batch_op send_to_item_del">Batch item deletion</a>
- </li>
+ [% END # /FOREACH header_ro %]
+ </ul> <!-- /.dropdown-menu -->
+ </div> <!-- /.dropdown -->
+ [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
+
+ [% IF ( unlimited_total > 10 && limit <= 1000 ) %]
+ <div class="btn-group">
+ <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ [% IF ( limit ) %]
+ Rows per page: <strong>[% limit | html %]</strong>
+ [% ELSE %]
+ Rows per page
[% END %]
- [% IF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
- [% IF ( batch_biblionumbers || batch_itemnumbers ) %]
- <li role="separator" class="divider"></li>
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
+ [% FOREACH l IN limits %]
+ [% IF l == limit %]
+ <li>
+ <a class="limitselect" data-limit="[% l | html %]" href="#"><i class="fa fa-fw fa-check"></i> [% l | html %]</a>
+ </li>
+ [% ELSE %]
+ <li>
+ <a class="limitselect" data-limit="[% l | html %]" href="#"><i class="fa fa-fw"></i> [% l | html %]</a>
+ </li>
[% END %]
- <li class="dropdown-header">Patron records</li>
- <li>
- <a href="#" data-submit="batch_patron_modification" data-toggle="tooltip" data-placement="right" title="Send visible results to batch patron modification" class="batch_op send_to_patron_mod">Batch patron modification</a>
- </li>
[% END %]
- [% END %]
- </ul> <!-- /.dropdown-menu -->
- </div> <!-- /.dropdown -->
- </p>
- [% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
- [% END # UNLESS ( errors ) %]
- [% END # IF ( execute ) %]
-
- <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect">
- <input type="hidden" name="phase" value="Run this report"/>
- <input type="hidden" name="reports" value="[% report_id | html %]"/>
+ </ul>
+ </div>
+ [% END # /IF ( unlimited_total > 10 && limit <= 1000 ) %]
+
+ [% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
+ <a href="#" class="btn btn-link" id="toggle_auto_links">
+ <i class="fa fa-eye autolink" style="display:none"></i>
+ <i class="fa fa-eye-slash autolink"></i>
+ <span class="autolink" style="display:none">Show data menus</span>
+ <span class="autolink">Hide data menus</span>
+ </a>
+ [% END %]
+ </div> <!-- /#toolbar.btn-toolbar -->
+ [% END # /IF batch operations || ( unlimited_total > 10 && limit <= 1000 ) %]
- [% FOREACH p IN sql_params %]
- <input type="hidden" name="sql_params" value="[% p | html %]"/>
- [% END %]
- [% FOREACH n IN param_names %]
- <input type="hidden" name="param_name" value="[% n | html %]"/>
- [% END %]
+ <div class="pages">
+ [% pagination_bar | $raw %]
+ </div>
- <label for="limit">Rows per page: </label>
- <select name="limit" id="limit">
- [% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
- [% FOREACH l IN limits %]
- [% IF l == limit %]
- <option value="[% l | html %]" selected="selected">[% l | html %]</option>
- [% ELSE %]
- <option value="[% l | html %]">[% l | html %]</option>
- [% END %]
- [% END %]
- </select>
- </form> <!-- /#limitselect -->
+ [% END # UNLESS ( errors ) %]
+ [% END # IF ( execute ) %]
- <div class="pages">[% pagination_bar | $raw %]</div>
[% UNLESS ( errors ) %]
- <table>
- <tr>
- [% FOREACH header_ro IN header_row %]
- <th>[% header_ro.cell | html %]</th>
- [% END %]
- </tr>
- [% FOREACH result IN results %]
+ <table id="report_results">
+ <thead>
<tr>
- [% FOREACH cells IN result.cells %]
- <td>[% cells.cell | $raw %]</td>
+ [% FOREACH header_ro IN header_row %]
+ [% IF header_ro.has_itemnumbers && ( header_ro.cell == 'itemnumber' || header_types.item( header_ro.cell ) == 'itemnumber' ) %]
+ <th class="itemnumber">[% header_ro.cell | html %]</th>
+ [% ELSIF header_ro.has_biblionumbers && ( header_ro.cell == 'biblionumber' || header_types.item( header_ro.cell ) == 'biblionumber' ) %]
+ <th class="biblionumber">[% header_ro.cell | html %]</th>
+ [% ELSIF header_ro.cell == 'cardnumber' || header_types.item( header_ro.cell ) == 'cardnumber' %]
+ <th class="cardnumber">[% header_ro.cell | html %]</th>
+ [% ELSIF header_ro.cell == 'borrowernumber' || header_types.item( header_ro.cell ) == 'borrowernumber' %]
+ <th class="borrowernumber">[% header_ro.cell | html %]</th>
+ [% ELSE %]
+ <th>[% header_ro.cell | html %]</th>
+ [% END %]
[% END %]
</tr>
- [% END %]
+ </thead>
+ <tbody>
+ [% FOREACH result IN results %]
+ <tr>
+ [% FOREACH cells IN result.cells %]
+ [% place = loop.index %]
+ [%- IF header_row.$place.cell == 'itemnumber' || header_types.item(header_row.$place.cell) == 'itemnumber' %]
+ <td class="batch-op itemnumber" data-number="itemnumber">
+ <span class="data-plain">[% cells.cell | $raw %]</span>
+ <div id="itemnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a target="_blank" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-pencil"></i> Edit record</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a target="_blank" href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cells.cell | $raw %]"><i class="fa fa-fw fa-eye"></i> View record</a></li>
+ </ul>
+ </div>
+ </td>
+ [% ELSIF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %]
+ <td class="batch-op biblionumber" data-number="biblionumber">
+ <span class="data-plain">[% cells.cell | $raw %]</span>
+ <div id="biblionumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a target="_blank" href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-pencil"></i> Edit record</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View record</a></li>
+ </ul>
+ </div>
+ </td>
+ [% ELSIF header_row.$place.cell == 'borrowernumber' || header_types.item(header_row.$place.cell) == 'borrowernumber' %]
+ <td class="batch-op borrowernumber" data-number="borrowernumber">
+ <span class="data-plain">[% cells.cell | $raw %]</span>
+ <div id="borrowernumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-eye"></i> View patron</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-pencil"></i> Edit patron</a></li>
+ <li role="separator" class="divider"></li>
+ <li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li>
+ </ul>
+ </div>
+ </td>
+ [% ELSIF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %]
+ <td class="batch-op cardnumber" data-number="cardnumber">
+ <span class="data-plain">[% cells.cell | $raw %]</span>
+ <div id="cardnumber_autolink" class="btn-group dropup autolink"><a class="btn btn-link dropdown-toggle" role="button" data-toggle="dropdown" href="#">[% cells.cell | $raw %] <b class="caret"></b></a>
+ <ul class="dropdown-menu pull-right" role="menu">
+ <li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li>
+ </ul>
+ </div>
+ </td>
+ [% ELSE %]
+ <td>
+ [% cells.cell | $raw %]
+ </td>
+ [% END %]
+ [% END %]
+ </tr>
+ [% END %]
+ </tbody>
</table>
[% END %]
+ <div class="pages">[% pagination_bar | $raw %]</div>
[% INCLUDE 'chart.inc' %]
[% END #/IF ( execute ) %]
[% IF ( create ) %]
+ <h1>Create from SQL</h1>
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form">
<fieldset class="rows">
<legend>Create report from SQL</legend>
[% IF ( reportname ) %]
<input type="text" class="required" required="required" id="reportname" name="reportname" value="[% reportname | html %]" size="50"/>
[% ELSE %]
- <input type="text" class="required" required="required" id="reportname" name="reportname" size="50" />
+ <input type="text" class="required focus" required="required" id="reportname" name="reportname" size="50" />
[% END %]
<span class="required">Required</span>
</li>
<fieldset class="rows">
<legend>SQL:</legend>
<div style="margin:1em;">
+ [% PROCESS insert_runtime_parameter %]
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
<span class="required">Required</span>
</div>
[% END # /IF saved_results %]
[% IF ( showsql ) %]
+ <h1>Saved reports - SQL</h1>
<fieldset class="rows">
<legend>[% reportname | html %]</legend>
<ol>
<input type="hidden" name="phase" value="Update SQL" />
<input type="hidden" name="id" value="[% id | html %]"/>
<fieldset class="rows">
- <legend>Edit SQL report</legend>
+ <legend><h1>Edit SQL report</h1></legend>
<ol>
<li>
<label for="reportname" class="required">Report name: </label>
<fieldset class="rows">
<legend>SQL:</legend>
- <div style="margin:1em;">
+ [% PROCESS insert_runtime_parameter %]
<textarea id="sql" name="sql" class="required" required="required" cols="50" rows="10">[% sql | html %]</textarea>
- <span class="required">Required</span>
- </div>
+ <span class="required" style="margin-left:30px;">Required</span>
</fieldset>
<fieldset class="action">
[% IF ( errors ) %]
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
<div class="dialog alert">
- <b>The following error was encountered:</b><br />
+ <strong>The following error was encountered:</strong><br />
[% FOREACH error IN errors %]
[% IF ( error.sqlerr ) %]
- This report contains the SQL keyword <b>[% error.sqlerr | html %]</b>.<br />
+ This report contains the SQL keyword <strong>[% error.sqlerr | html %]</strong>.<br />
Use of this keyword is not allowed in Koha reports due to security and data integrity risks. Only SELECT queries are allowed.<br />
Please return to the "Saved Reports" screen and delete this report or retry creating a new one.
[% ELSIF ( error.queryerr ) %]
- The database returned the following error: <br />
+ <span>The database returned the following error:</span> <br />
[% error.queryerr | html %]<br />Please check the log for further details.
[% ELSIF ( error.cache_expiry ) %]
Please select a cache expiry less than 30 days.
<ol>
<li>
<label for="filter_date">Date:</label>
- <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="datepicker" />
+ <input type="text" id="filter_date" name="filter_date" size="10" value="[% filters.date | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
[% INCLUDE 'guided-reports-view.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
- </div> <!-- /.row -->
+ </div> <!-- /.row -->
+
+ <!-- Runtime Parameters Modal -->
+ <div class="modal" id="runtime_parameters" tabindex="-1" role="dialog" aria-labelledby="runtime_parametersLabel">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title" id="runtime_parametersLabel">Runtime parameter options</h4>
+ </div>
+ <form id="send_runtime_parameter">
+ <input type="hidden" name="param_category" id="param_category" />
+ <div class="modal-body">
+ <div class="form-group">
+ <label for="paramLabel" class="required">Parameter label: </label>
+ <input class="form-control required" type="text" name="paramLabel" id="paramLabel" required="required" />
+ <div class="hint">The label for the field shown when the report is run, e.g. "Select a library."</div>
+ </div>
+ <div id="authorised_value_category" class="form-group" style="display:none">
+ <label for="authorised_value">Authorized value category:</label>
+ <select class="form-control" name="authorised_value" id="authorised_value">
+ <option value=""></option>
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories() %]
+ </select>
+ <div class="hint">Select which authorized value category the user will choose from.</div>
+ </div>
+ </div> <!-- /.modal-body -->
+ <div class="modal-footer">
+ <button type="submit" id="sendParam" class="btn btn-default approve">Insert parameter</button>
+ <button type="button" class="btn btn-default deny" data-dismiss="modal">Cancel</button>
+ </div> <!-- /.modal-footer -->
+ </form> <!-- /#send_runtime_parameter -->
+ </div> <!-- /.modal-content -->
+ </div> <!-- /.modal-dialog -->
+ </div> <!-- /#runtime_parameters -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/charts.js") | $raw %]
[% INCLUDE 'columns_settings.inc' %]
[% END %]
[% Asset.js( "lib/codemirror/codemirror.min.js" ) | $raw %]
+ [% Asset.js( "lib/codemirror/overlay.min.js" ) | $raw %]
[% Asset.js( "lib/codemirror/sql.min.js" ) | $raw %]
[% Asset.js( "js/mana.js" ) | $raw %]
<script>
}
}
+ /* overlay a syntax-highlighting definition on top of the existing sql one */
+ CodeMirror.defineMode("sqlPlaceholders", function(config, parserConfig) {
+ var sqlPlaceholdersOverlay = {
+ token: function(stream, state) {
+ var ch;
+
+ if (stream.match("<<")) {
+ while ((ch = stream.next()) != null) {
+ if (ch == ">" && stream.next() == ">") {
+ stream.eat(">");
+ return "sqlParams";
+ }
+ }
+ }
+
+ if (stream.match("[[")) {
+ while ((ch = stream.next()) != null) {
+ if (ch == "]" && stream.next() == "]") {
+ stream.eat("]");
+ return "columnPlaceholder";
+ }
+ }
+ }
+
+ else if (stream.next() != null) {
+ return null;
+ }
+ }
+ };
+ return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/x-sql"), sqlPlaceholdersOverlay);
+ });
+
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone.");
var group_subgroups = {};
[% FOREACH group IN groups_with_subgroups %]
[% END %]
[% IF ( create || editsql || save ) %]
+
var editor = CodeMirror.fromTextArea(sql, {
lineNumbers: true,
- mode: "text/x-sql",
+ mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
lineWrapping: true,
smartIndent: false
});
[% IF ( showsql ) %]
var editor = CodeMirror.fromTextArea(sql, {
lineNumbers: false,
- mode: "text/x-sql",
+ mode: "sqlPlaceholders", /* text/x-sql plus custom sqlPlaceholders configuration */
lineWrapping: true,
readOnly: true
});
[% END %]
+ function showParamModal( category ){
+ var modal = $("#runtime_parameters");
+ var modalTitle = $("#runtime_parametersLabel");
+ switch ( category ){
+ case "insertAuthVal":
+ modalTitle.text( _("Insert authorized value parameter") );
+ $("#paramLabel").val( _("Authorized value") );
+ $("#authorised_value_category").show();
+ $("label[for='authorised_value']").addClass("required");
+ $("#authorised_value").prop("required", true ).attr("required", "required").addClass("required");
+ break;
+ case "insertCnSource":
+ modalTitle.text( _("Insert classification source parameter") );
+ $("#paramLabel").val( _("Source of classification or shelving scheme") );
+ $("#param_category").val("cn_source");
+ break;
+ case "insertFramework":
+ modalTitle.text( _("Insert bibliographic framework parameter") );
+ $("#paramLabel").val( _("Framework") );
+ $("#param_category").val("biblio_framework");
+ break;
+ case "insertDate":
+ modalTitle.text( _("Insert date parameter") );
+ $("#paramLabel").val( _("Date") );
+ $("#param_category").val("date");
+ break;
+ case "insertItemtypes":
+ modalTitle.text( _("Insert item types parameter") );
+ $("#paramLabel").val( _("Item type") );
+ $("#param_category").val("itemtypes");
+ break;
+ case "insertBranches":
+ modalTitle.text( _("Insert libraries parameter") );
+ $("#paramLabel").val( _("Library") );
+ $("#param_category").val("branches");
+ break;
+ case "insertCategorycode":
+ modalTitle.text( _("Insert patron category parameter") );
+ $("#paramLabel").val( _("Patron category") );
+ $("#param_category").val("categorycode");
+ break;
+ case "insertCashregister":
+ modalTitle.text( _("Insert cash register parameter") );
+ $("#paramLabel").val( _("Cash register") );
+ $("#param_category").val("cash_registers");
+ break;
+ case "insertDebittypes":
+ modalTitle.text( _("Insert debit type parameter") );
+ $("#paramLabel").val( _("Debit type") );
+ $("#param_category").val("debit_types");
+ break;
+ case "insertCredittypes":
+ modalTitle.text( _("Insert credit type parameter") );
+ $("#paramLabel").val( _("Credit type") );
+ $("#param_category").val("credit_types");
+ break;
+ case "insertList":
+ modalTitle.text( _("Insert list parameter") );
+ $("#paramLabel").val( _("List of values") );
+ $("#param_category").val("list");
+ break;
+ case "insertText":
+ modalTitle.text( _("Insert text parameter") );
+ $("#paramLabel").val( _("Text") );
+ $("#param_category").val("");
+ break;
+ }
+ $("#paramLabel").select();
+ modal.modal("show");
+ }
+
function load_group_subgroups () {
var group = $("#group_select").val();
var sg = $("#subgroup");
}
$(document).ready(function(){
+
+ var activeTab = localStorage.getItem("sql_reports_activetab");
+
$("body").on('click',".fetch_chart_data",function(){
if( [% unlimited_total || 0 | $raw %] > 1000 ){
- if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){
+ if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){
return true;
} else {
return false;
[% END %]
$('[data-toggle="tooltip"]').tooltip();
- var columns_settings = [% TablesSettings.GetColumns( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
$('#limit').change(function() {
$('#limitselect').submit();
});
[% IF (saved1) %]
+ var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %];
var rtable = KohaTable("table_reports", {
- 'iDisplayLength': [% Koha.Preference('NumSavedReports') | html %],
'bAutoWidth': false,
'sPaginationType': 'full',
'aaSorting': [[ 1, "asc" ]],
- 'aoColumnDefs': [
- { 'bSearchable': false, 'aTargets': [3] },
- { "aTargets": [ 1, 2 ], "sType": "natural" },
- { "visible": false, "aTargets" : [ "hidden" ] }
- ],
'oLanguage': {
'sZeroRecords': _("No matching reports found")
- },
- }, columns_settings);
-
- var rtabs = $("#tabs").tabs();
- rtabs.on("tabsactivate", function(e, ui) {
- $("#subgroup_filter option").each(function() {
- if($(this).val().length > 0) {
- $(this).remove();
- }
- });
- rtable.fnFilter('', 4);
- rtable.fnFilter('', 5);
- rtable.fnSetColumnVis(4, true);
- rtable.fnSetColumnVis(5, true);
-
- var g_id = $(ui.newTab).children().attr('id');
- var g_name = $(ui.newTab).text();
- if ( g_name == _("All") ) {
- g_id = "";
- g_name = "";
}
+ }, table_settings);
- if (g_id && g_id.length > 0) {
- rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
- rtable.fnSetColumnVis(4, false);
- for(var i in group_subgroups[g_id]) {
- $("#subgroup_filter").append(
- '<option value="' + group_subgroups[g_id][i][0] + '">'
- + group_subgroups[g_id][i][1] + '</option>'
- );
- }
- $("#subgroup_filter_block").show();
- } else {
- $("#subgroup_filter_block").hide();
- }
+ $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) {
+ tabsInit( $(e.target).parent(), rtable );
});
- $("#subgroup_filter_block").hide();
+
+ if( activeTab ){
+ $("#tabs li:eq(" + activeTab + ") a").tab("show");
+ }
$("#subgroup_filter").change(function() {
var selected = $(this).find('option:selected');
});
[% END %]
- $(".toggle_sql").click(function(){
- $("#sql_output").toggle();
- $("#toggle_sql_hid").toggle();
- $("#toggle_sql_vis").toggle();
+ $("#toggle_sql").click(function(){
+ var sql_output = $("#sql_output");
+ sql_output.toggle();
+ if( sql_output.is(":visible") ){
+ $(this).button('complete');
+ } else {
+ $(this).button('reset');
+ }
if( !showsql ){
showsql = CodeMirror.fromTextArea(sql, {
lineNumbers: false,
$("#group_select").on("change",function(){
load_group_subgroups();
});
+
+ $(".insertParam").on("click", function(e){
+ e.preventDefault();
+ var category = this.id;
+ showParamModal( category );
+ });
+
+ $("#runtime_parameters").on("shown.bs.modal", function(){
+ $("#paramLabel").focus();
+ });
+
+ $("#runtime_parameters").on("hide.bs.modal", function(){
+ $("#send_runtime_parameter")[0].reset();
+ $("#authorised_value_category").val("").hide();
+ $("label[for='authorised_value']").removeClass("required");
+ $("#authorised_value").prop("required", false ).removeAttr("required").removeClass("required");
+ });
+
+ $("#send_runtime_parameter").on("submit", function(e){
+ e.preventDefault();
+ /* Get form values */
+ var paramLabel = $("#paramLabel").val();
+ var param_category = $("#param_category").val();
+ var categoryLabel = $("#authorised_value").val();
+ // Get CodeMirror environment variables
+ var selection = editor.getSelection();
+ var doc = editor.getDoc();
+ var cursor = doc.getCursor();
+ var pos = {
+ line: cursor.line,
+ ch: cursor.ch
+ }
+ /* Build runtime parameter text string */
+ var text = "";
+ if( paramLabel && param_category ){
+ text += paramLabel + "|" + param_category;
+ } else if( paramLabel ) {
+ text += paramLabel;
+ } else if( param_category ){
+ text += param_category;
+ }
+ if( text != "" ){
+ text = " <<" + text + ">> ";
+ if( selection.length > 0){
+ editor.replaceSelection(text);
+ } else {
+ doc.replaceRange(text, pos);
+ }
+ }
+ $("#runtime_parameters").modal("hide");
+ });
+
+ $("#authorised_value").on("change", function(){
+ $("#param_category").val( $(this).val() );
+ });
+
[% END %]
$(".delete").on("click",function(){
e.preventDefault();
addToList();
});
+
+ $("body").on("click", ".preview_sql", function(e){
+ e.preventDefault();
+ var reportid = $(this).data("reportid");
+ previewSql( reportid );
+ });
+ $(".limitselect").on("click", function(){
+ var limit = $(this).data("limit");
+ $("#limit").val( limit );
+ $("#limitselect").submit();
+ });
+
});
+ $("#toggle_auto_links").on("click", function(e){
+ e.preventDefault();
+ if( $(".data-plain").is(":visible") ){
+ /* if a data-plain element is visible, this click hides it and shows auto-links */
+ localStorage.removeItem("reports_auto_link_off");
+ } else {
+ /* if a data-plain element is hidden, this click shows it and hides auto-links */
+ localStorage.setItem("reports_auto_link_off", 1);
+ }
+ $(".data-plain,.autolink").toggle();
+ });
+ if ( localStorage.getItem("reports_auto_link_off") == 1 ){
+ $("#toggle_auto_links").click();
+ }
+
+ function tabsInit( tab, rtable ){
+ var thisTab = tab; // ui.newTab ? ui.newTab : ui.tab;
+ var activeTab = thisTab.index();
+ localStorage.setItem("sql_reports_activetab", activeTab );
+
+ $("#subgroup_filter option").each(function() {
+ if($(this).val().length > 0) {
+ $(this).remove();
+ }
+ });
+ rtable.fnFilter('', 4);
+ rtable.fnFilter('', 5);
+ rtable.fnSetColumnVis(4, true);
+ rtable.fnSetColumnVis(5, true);
+
+ var g_id = $( tab ).children().attr('id');
+ var g_name = $( tab ).children().text();
+ if ( g_name == _("All") ) {
+ g_id = "";
+ g_name = "";
+ }
+
+ if (g_id && g_id.length > 0) {
+ rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false);
+ rtable.fnSetColumnVis(4, false);
+ for(var i in group_subgroups[g_id]) {
+ $("#subgroup_filter").append(
+ '<option value="' + group_subgroups[g_id][i][0] + '">'
+ + group_subgroups[g_id][i][1] + '</option>'
+ );
+ }
+ $("#subgroup_filter_block").show();
+ } else {
+ $("#subgroup_filter_block").hide();
+ }
+ }
+
function addColumn() {
$("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
}
],
"aoColumnDefs": [
{ 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
- { "sType": "title-string", "aTargets" : [ "title-string" ] },
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }
]
}));
window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
return false;
}
+
+ // Adapted from https://gist.github.com/jnormore/7418776
+ function previewSql(reportid) {
+ var yes_label = "";
+ var no_label = "";
+ var message = $("#previewSql" + reportid ).val();
+ var title = $("#previewSql" + reportid ).data("title");
+ if( $("#preview-sql-modal").length > 0) {
+ $("#preview-sql-modal").remove();
+ }
+ $("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\
+ <div class="modal-dialog">\
+ <div class="modal-content">\
+ <div class="modal-header" style="min-height:40px;">\
+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close">\
+ <span aria-hidden="true">×</span>\
+ </button>\
+ <h4 class="modal-title">' + title + '</h4>\
+ </div>\
+ <div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\
+ <div class="modal-footer">\
+ <a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Edit%20SQL"><i class="fa fa-pencil"></i> ' + _("Edit") + '</a>\
+ <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from existing&report_id=' + reportid + '"><i class="fa fa-copy"></i> ' + _("Duplicate") + '</a>\
+ <a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + reportid + '"><i class="fa fa-clock-o"></i> ' + _("Schedule") + '</a>\
+ <a id="preview-modal-delete" class="delete btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Delete%20Saved"><i class="fa fa-trash"></i> ' + _("Delete") + '</a>\
+ <a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=' + reportid + '&phase=Run%20this%20report"><i class="fa fa-play"></i> ' + _("Run report") + '</a>\
+ <a href="#" id="preview-sql-modal-cancel" data-dismiss="modal" class="btn btn-default"><i class="fa fa-remove" aria-hidden="true"></i> ' + _("Close") + '</a>\
+ </div>\
+ </div>\
+ </div>\
+ </div>');
+
+ $("#preview-sql-modal").modal('show');
+ CodeMirror.fromTextArea( document.getElementById("code" + reportid ), {
+ lineNumbers: false,
+ mode: "text/x-sql",
+ lineWrapping: true,
+ readOnly: true
+ });
+ }
</script>
[% END %]
<input type="text" name="subgroupdesc" id="subgroupdesc_input" title="Subgroup name" placeholder="Name" />
</li>
[% END %]
+
+[% BLOCK insert_runtime_parameter %]
+ <div class="btn-group" style="margin-left:30px;">
+ <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Insert runtime parameter <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ <li><a href="#" class="insertParam" id="insertAuthVal">Authorized values</a></li>
+ <li><a href="#" class="insertParam" id="insertFramework">Bibliographic framework</a></li>
+ <li><a href="#" class="insertParam" id="insertCnSource">Classification sources</a></li>
+ <li><a href="#" class="insertParam" id="insertDate">Date</a></li>
+ <li><a href="#" class="insertParam" id="insertItemtypes">Item types</a></li>
+ <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
+ <li><a href="#" class="insertParam" id="insertList">List</a></li>
+ <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
+ <li><a href="#" class="insertParam" id="insertCashregister">Cash registers</a></li>
+ <li><a href="#" class="insertParam" id="insertDebittypes">Debit types</a></li>
+ <li><a href="#" class="insertParam" id="insertCredittypes">Credit types</a></li>
+ <li><a href="#" class="insertParam" id="insertText">Text field</a></li>
+ </ul>
+ </div>
+[% END %]