Bug 24907: Add 'include suspended' to holds ratio report
authorNick Clemens <nick@bywatersolutions.com>
Thu, 19 Mar 2020 13:29:50 +0000 (13:29 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 24 Mar 2020 10:59:36 +0000 (10:59 +0000)
Some libraries would like the option to ignore suspended holds when using the holds
ratio report

Note: this report fails with strict mode enabled, please disable to test

To test:
1 - Add enough holds to a record (3) to make it show on the holds ration report
2 - Browse to Circulation->Holds ratio
3 - Run with default settings and confirm the title shows up
4 - Suspend one of the holds
5 - Run report again and confirm title still shows
6 - Apply patch
7 - Reload the report
8 - Note new option
9 - Run report - title does not show
10 - Lower ratio to 2 and confirm the hold shows

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

circ/reserveratios.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/reserveratios.tt

index b4b0b81..7711793 100755 (executable)
@@ -37,6 +37,7 @@ my $startdate       = $input->param('from');
 my $enddate         = $input->param('to');
 my $ratio           = $input->param('ratio');
 my $include_ordered = $input->param('include_ordered');
+my $include_suspended = $input->param('include_suspended');
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
@@ -104,6 +105,7 @@ my $include_aqorders_qty_join =
   : q{};
 
 my $nfl_comparison = $include_ordered ? '<=' : '=';
+my $sus_comparison = $include_suspended ? '<=' : '<';
 my $strsth =
 "SELECT reservedate,
         reserves.borrowernumber as borrowernumber,
@@ -138,6 +140,7 @@ my $strsth =
  $include_aqorders_qty_join
  WHERE
  notforloan $nfl_comparison 0 AND damaged = 0 AND itemlost = 0 AND withdrawn = 0
+ AND suspend $sus_comparison 1
  $sqldatewhere
 ";
 
@@ -199,6 +202,7 @@ $template->param(
     to              => $enddate,
     ratio           => $ratio,
     include_ordered => $include_ordered,
+    include_suspended => $include_suspended,
     reserveloop     => \@reservedata,
 );
 
index 9654062..907d633 100644 (file)
     <li>
 
     <li>
+        <label for="include_suspended">Included suspended:</label>
+        [% IF include_suspended %]
+            <input id="include_suspended" name="include_suspended" type="checkbox" checked="checked"/>
+        [% ELSE %]
+            <input id="include_suspended" name="include_suspended" type="checkbox"/>
+        [% END %]
+    <li>
+
+    <li>
         <label for="from">Start date:</label>
         <input type="text" size="10" id="from" name="from" value="[% from | $KohaDates %]" class="datepickerfrom" />
     </li>