David Cook
6a451360b8
Some report wizards are missing row/column defaults, which sometimes return blank pages (borrowers_stats.pl) or results always equalling 0, which a non-discerning user may interpret incorrectly. If the DEBUG environmental variable is enabled, missing row/column choices will actually cause fatal software errors as well, which is also undesirable for users. This patch adds default choices for row and column on report wizards that had no radio buttons selected, so that a user can't submit the form without choosing a row and column. This prevents errors. To test: 1) Apply patch 2) Visit /cgi-bin/koha/reports/issues_avg_stats.pl 3) Visit /cgi-bin/koha/reports/borrowers_stats.pl 4) Visit /cgi-bin/koha/reports/catalogue_stats.pl 5) Visit /cgi-bin/koha/reports/issues_stats.pl 6) Observe that default choices for row/column are there Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
382 lines
16 KiB
Text
382 lines
16 KiB
Text
[% USE Branches %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Reports › Circulation statistics [% IF ( do_it ) %]› Results[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<style>
|
|
.sql {display:none;}
|
|
</style>
|
|
</head>
|
|
|
|
<body id="rep_issues_stats" class="rep">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-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> [% IF ( do_it ) %]› <a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation statistics</a> › Results [% ELSE %]› Circulation statistics[% END %]</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% IF ( do_it ) %]
|
|
[% FOREACH mainloo IN mainloop %]
|
|
<h1>Circulation statistics</h1>
|
|
[% IF ( mainloo.loopfilter ) %]
|
|
<p>Filtered on:</p>
|
|
<ul>
|
|
[% FOREACH loopfilte IN mainloo.loopfilter %]
|
|
[% IF ( loopfilte.err ) %]
|
|
<li class="error">Error:
|
|
[% ELSIF ( loopfilte.sql ) %]
|
|
<li class="sql">
|
|
[% ELSE %]
|
|
<li>
|
|
[% END %]
|
|
[% SWITCH loopfilte.crit %]
|
|
[% CASE 0 %]Period From
|
|
[% CASE 1 %]Period To
|
|
[% CASE 2 %]Patron Category =
|
|
[% CASE 3 %]Item Type =
|
|
[% CASE 4 %]Issuing library =
|
|
[% CASE 5 %]Collection =
|
|
[% CASE 6 %]Location =
|
|
[% CASE 7 %]Item call number >=
|
|
[% CASE 8 %]Item call number <
|
|
[% CASE 9 %]Patron sort1 =
|
|
[% CASE 10 %]Patron sort2 =
|
|
[% CASE 11 %]Home library =
|
|
[% CASE 12 %]Holding library =
|
|
[% CASE 13 %]Patron library =
|
|
[% CASE 14 %]Issuing library =
|
|
[% CASE %][% loopfilte.crit | html %] =
|
|
[% END %]
|
|
[% loopfilte.filter | html %]
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
|
|
<table>
|
|
<tr>
|
|
<th>[% mainloo.line | html %] / [% mainloo.column | html %]</th>
|
|
[% FOREACH loopco IN mainloo.loopcol %]
|
|
<th>[% loopco.coltitle_display | html %]</th>
|
|
[% END %]
|
|
<th>TOTAL</th>
|
|
</tr>
|
|
[% FOREACH loopro IN mainloo.looprow %]
|
|
<tr>
|
|
<td>[% loopro.rowtitle_display or "UNKNOWN VALUE" | html %]</td>
|
|
[% FOREACH loopcel IN loopro.loopcell %]
|
|
<td>[% loopcel.value || 0 | html %]</td>
|
|
[% END %]
|
|
<td>[% loopro.totalrow | html %]</td>
|
|
</tr>
|
|
[% END %]
|
|
<tr>
|
|
<th>TOTAL</th>
|
|
[% FOREACH loopfoote IN mainloo.loopfooter %]
|
|
<th>[% loopfoote.totalcol | html %]</th>
|
|
[% END %]
|
|
<th>[% mainloo.total | html %]</th>
|
|
</tr>
|
|
</table>
|
|
[% END %]
|
|
[% ELSE %]
|
|
|
|
<form method="post" action="/cgi-bin/koha/reports/issues_stats.pl">
|
|
<fieldset class="rows">
|
|
<legend>Circulation statistics</legend><table>
|
|
<thead>
|
|
<tr>
|
|
<th>Title</th>
|
|
<th>Row</th>
|
|
<th>Column</th>
|
|
<th>Filter</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Period</td>
|
|
<td><input type="radio" name="Line" value="datetime" /></td>
|
|
<td><input type="radio" name="Column" value="datetime" /></td>
|
|
<td><label for="from">From</label> <input type="text" size="10" id="from" name="Filter" class="datepickerfrom" />
|
|
<label for="to">To</label> <input size="10" id="to" name="Filter" value="" type="text" class="datepickerto" />
|
|
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="PeriodTypeSel">Type:</label><select name="PeriodTypeSel" id="PeriodTypeSel">
|
|
<option value ="issue">Checkout</option>
|
|
<option value ="renew">Renewal</option>
|
|
<option value ="return">Checkin</option>
|
|
<option value ="localuse">Local Use</option>
|
|
</select></td>
|
|
<td colspan="2"><label for="DisplayBy">group by</label> <select name="DisplayBy" id="DisplayBy">
|
|
<option value="">None</option>
|
|
<option value ="4">Hour</option>
|
|
<option value ="1">Day of week</option>
|
|
<option value ="2">Month</option>
|
|
<option value ="3">Year</option>
|
|
</select>
|
|
</td>
|
|
<td>
|
|
<label for="PeriodDaySel">Select day: </label><select name="PeriodDaySel" id="PeriodDaySel">
|
|
<option value =""></option>
|
|
<option value ="Monday">Monday</option>
|
|
<option value ="Tuesday">Tuesday</option>
|
|
<option value ="Wednesday">Wednesday</option>
|
|
<option value ="Thursday">Thursday</option>
|
|
<option value ="Friday">Friday</option>
|
|
<option value ="Saturday">Saturday</option>
|
|
<option value ="Sunday">Sunday</option>
|
|
</select>
|
|
<label for="PeriodMonthSel">Select month:</label> <select name="PeriodMonthSel" id="PeriodMonthSel">
|
|
<option value =""></option>
|
|
<option value ="January">January</option>
|
|
<option value ="February">February</option>
|
|
<option value ="March">March</option>
|
|
<option value ="April">April</option>
|
|
<option value ="May">May</option>
|
|
<option value ="June">June</option>
|
|
<option value ="July">July</option>
|
|
<option value ="August">August</option>
|
|
<option value ="September">September</option>
|
|
<option value ="October">October</option>
|
|
<option value ="November">November</option>
|
|
<option value ="December">December</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Patron category</td>
|
|
<td><input type="radio" name="Line" value="borrowers.categorycode" /></td>
|
|
<td><input type="radio" name="Column" value="borrowers.categorycode" /></td>
|
|
<td><select name="Filter" id="borcat">
|
|
<option value=""> </option>
|
|
[% FOREACH categoryloo IN categoryloop %]
|
|
<option value="[% categoryloo.categorycode | html %]">[% categoryloo.description | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Item type</td>
|
|
<td><input type="radio" name="Line" value="itemtype" /></td>
|
|
<td><input type="radio" checked="checked" name="Column" value="itemtype" /></td>
|
|
<td><select name="Filter" id="itemtype">
|
|
<option value=""> </option>
|
|
[% FOREACH itemtype IN itemtypes %]
|
|
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Issuing library</td>
|
|
<td><input type="radio" checked="checked" name="Line" value="branch" /></td>
|
|
<td><input type="radio" name="Column" value="branch" /></td>
|
|
<td><select name="Filter" id="branch">
|
|
<option value=""> </option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all() %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Collection</td>
|
|
<td><input type="radio" name="Line" value="items.ccode" /></td>
|
|
<td><input type="radio" name="Column" value="items.ccode" /></td>
|
|
<td><select name="Filter" id="ccode">
|
|
<option value=""> </option>
|
|
[% FOREACH ccodeloo IN ccodeloop %]
|
|
<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Shelving location</td>
|
|
<td><input type="radio" name="Line" value="items.location" /></td>
|
|
<td><input type="radio" name="Column" value="items.location" /></td>
|
|
<td><select name="Filter" id="location">
|
|
<option value=""> </option>
|
|
[% FOREACH locationloo IN locationloop %]
|
|
<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Item call number</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td>From <input type="text" name="Filter" size="10" /> (inclusive) to <input type="text" name="Filter" size="10" /> (exclusive) </td>
|
|
</tr>
|
|
[% IF ( hassort1 ) %]
|
|
<tr><td>Patron sort 1</td>
|
|
<td><input type="radio" name="Line" value="borrowers.sort1" /></td>
|
|
<td><input type="radio" name="Column" value="borrowers.sort1" /></td>
|
|
<td><select name="Filter" id="sort1">
|
|
<option value=""> </option>
|
|
[% FOREACH Bsort IN Bsort1 %]
|
|
<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% IF ( hassort2 ) %]
|
|
<tr><td>Patron sort 2</td>
|
|
<td><input type="radio" name="Line" value="borrowers.sort2" /></td>
|
|
<td><input type="radio" name="Column" value="borrowers.sort2" /></td>
|
|
<td><select name="Filter" id="sort2">
|
|
<option value=""> </option>
|
|
[% FOREACH Bsort IN Bsort2 %]
|
|
<option value="[% Bsort.authorised_value | html %]" >[% Bsort.lib | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
<tr><td>Home library</td>
|
|
<td><input type="radio" name="Line" value="items.homebranch" /></td>
|
|
<td><input type="radio" name="Column" value="items.homebranch" /></td>
|
|
<td><select name="Filter" id="homebranch">
|
|
<option value=""> </option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all() %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr><td>Holding library</td>
|
|
<td><input type="radio" name="Line" value="items.holdingbranch" /></td>
|
|
<td><input type="radio" name="Column" value="items.holdingbranch" /></td>
|
|
<td><select name="Filter" id="holdingbranch">
|
|
<option value=""> </option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all() %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Patron library</td>
|
|
<td><input type="radio" name="Line" value="borrowers.branchcode" /></td>
|
|
<td><input type="radio" name="Column" value="borrowers.branchcode" /></td>
|
|
<td>
|
|
<select name="Filter" id="patronbranch">
|
|
<option value=""> </option>
|
|
[% FOREACH branch IN branchloop %]
|
|
<option value="[% branch.value | html %]">
|
|
[% branch.branchname | html %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
[% IF (attribute_types_by_class.keys.size) %]
|
|
<tr>
|
|
<th colspan="4">Patron attributes</th>
|
|
</tr>
|
|
[% FOREACH class IN attribute_types_by_class.keys.sort %]
|
|
[% IF (class) %]
|
|
<tr>
|
|
<th>[% class | html %]</th>
|
|
<th colspan="3"></th>
|
|
</tr>
|
|
[% END %]
|
|
[% FOREACH attr_type IN attribute_types_by_class.$class %]
|
|
<tr>
|
|
<td>[% attr_type.description | html %]</td>
|
|
<td><input type="radio" name="Line" value="borrower_attributes.[% attr_type.code | html %]" /> </td>
|
|
<td><input type="radio" name="Column" value="borrower_attributes.[% attr_type.code | html %]" /> </td>
|
|
<td>
|
|
[% IF attr_type.authorised_value_category %]
|
|
<select name="Filter_borrower_attributes.[% attr_type.code | html %]">
|
|
<option value=""> </option>
|
|
[% FOREACH av IN attr_type.authorised_values %]
|
|
<option value="[% av.authorised_value | html %]">
|
|
[% av.lib | html %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
[% ELSE %]
|
|
<input type="text" name="Filter_borrower_attributes.[% attr_type.code | html %]" />
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</tbody>
|
|
</table><br /></fieldset>
|
|
|
|
<fieldset class="rows">
|
|
<legend>Cell value</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="cellvalue1">Count total items:</label>
|
|
<input type="radio" name="Cellvalue" value="1" id="cellvalue1" checked="checked" />
|
|
</li>
|
|
<li>
|
|
<label for="cellvalue3">Count unique items:</label>
|
|
<input type="radio" name="Cellvalue" id="cellvalue3" value="3" />
|
|
</li>
|
|
<li>
|
|
<label for="cellvalue5">Count unique bibliographic records:</label>
|
|
<input type="radio" name="Cellvalue" id="cellvalue5" value="5" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="rows">
|
|
<legend>Output</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
|
|
</li>
|
|
<li>
|
|
<label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
|
|
<label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
|
|
<label class="inline" for="MIME">Into an application:</label>
|
|
<select name="MIME" id="MIME" size="1">
|
|
[% FOREACH value IN CGIextChoice %]
|
|
<option value="[% value | html %]">[% value | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
<select name="sep" id="sep" size="1">
|
|
[% FOREACH value IN CGIsepChoice.values.sort() %]
|
|
[% IF ( value == CGIsepChoice.default ) %]
|
|
<option value="[% value | html %]" selected="selected">[% value | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% value | html %]">[% value | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="action">
|
|
<input type="submit" value="Submit" />
|
|
<input type="hidden" name="report_name" value="[% report_name | html %]" />
|
|
<input type="hidden" name="do_it" value="1" />
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'reports-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|