Bugzilla – Attachment 151579 Details for
Bug 23059
reserves_stats.pl: Simplify reserve status handling
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23059: reserve_stats.pl: Simplify reservestatus
Bug-23059-reservestatspl-Simplify-reservestatus.patch (text/plain), 5.58 KB, created by
Marcel de Rooy
on 2023-05-23 15:06:37 UTC
(
hide
)
Description:
Bug 23059: reserve_stats.pl: Simplify reservestatus
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-05-23 15:06:37 UTC
Size:
5.58 KB
patch
obsolete
>From fc2756dbcb8fc3fd2d5242c911812f83d855eb2d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 23 May 2023 12:41:56 +0000 >Subject: [PATCH] Bug 23059: reserve_stats.pl: Simplify reservestatus >Content-Type: text/plain; charset=utf-8 > >This patch does the following: >[1] Go back to four statuses: Cancelled, Filled, Waiting or Placed. > Placed is used as collective name for all other statuses: pending > (placed), processing (found==P) or transit (found==T). Placed before > anyway. >[2] Allow translation of these statuses in the template. Remove the sub > reservestatushuman. >[3] The output of changeifreservestatus is considerably shorter and less > ugly in the constructed sql statement. > >Test plan: >[1] Use reservestatus as row, as column and only as filter (clicking few > statuses). >[2] Verify that the shown statistics meet your expectations. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/reports/reserves_stats.tt | 26 ++++++++++---- > reports/reserves_stats.pl | 35 +++---------------- > 2 files changed, 23 insertions(+), 38 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >index b0b3298d8f..676969ab59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reserves_stats.tt >@@ -9,6 +9,19 @@ > </style> > </head> > >+[% BLOCK reservestatus %] >+ [% IF field == 'reservestatus' %] >+ [% SWITCH value %] >+ [% CASE 'C'%]Cancelled >+ [% CASE 'F'%]Filled >+ [% CASE 'P'%]Placed >+ [% CASE 'W'%]Waiting >+ [% END %] >+ [% ELSE %] >+ [% value | html %] >+ [% END %] >+[% END %] >+ > <body id="rep_reserve_stats" class="rep"> > [% WRAPPER 'header.inc' %] > [% INCLUDE 'cat-search.inc' %] >@@ -63,13 +76,13 @@ > <tr> > <th>[% mainloo.line | html %] / [% mainloo.column | html %]</th> > [% FOREACH loopco IN mainloo.loopcol %] >- <th>[% loopco.coltitle_display | html %]</th> >+ <th>[% PROCESS reservestatus field=mainloo.column value=loopco.coltitle_display %]</th> > [% END %] > <th>TOTAL</th> > </tr> > [% FOREACH loopro IN mainloo.looprow %] > <tr> >- <td>[% loopro.rowtitle_display or "UNKNOWN VALUE" | html %]</td> >+ <td>[% PROCESS reservestatus field=mainloo.line value=loopro.rowtitle_display %]</td> > [% FOREACH loopcel IN loopro.loopcell %] > <td align="center"> > [% IF ( loopcel.url_complement ) %]<a href="reserves_stats.pl?output=[% loopcel.output | uri %]&[% loopcel.url_complement | uri %]">[% loopcel.value | html %]</a>[% ELSE %][% loopcel.value | html %][% END %] >@@ -107,11 +120,10 @@ > <td><input type="radio" name="Line" value="reservestatus" /></td> > <td><input type="radio" name="Column" value="reservestatus" checked="checked" /></td> > <td> >- <input type="checkbox" name="filter_reservestatus_or_1" value="1" /> Asked >- <input type="checkbox" name="filter_reservestatus_or_2" value="2" /> Processing >- <input type="checkbox" name="filter_reservestatus_or_3" value="3" /> Waiting >- <input type="checkbox" name="filter_reservestatus_or_4" value="4" /> Satisfied >- <input type="checkbox" name="filter_reservestatus_or_5" value="5" /> Cancelled >+ <input type="checkbox" name="filter_reservestatus_or_C" value="C" /> Cancelled >+ <input type="checkbox" name="filter_reservestatus_or_F" value="F" /> Filled >+ <input type="checkbox" name="filter_reservestatus_or_P" value="P" /> Placed >+ <input type="checkbox" name="filter_reservestatus_or_W" value="W" /> Waiting > </td> > </tr> > <tr> >diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl >index af4e0ab379..103ab62356 100755 >--- a/reports/reserves_stats.pl >+++ b/reports/reserves_stats.pl >@@ -300,7 +300,6 @@ sub display_value { > : ( $crit =~ /location/ ) ? $locations->{$value} > : ( $crit =~ /itemtype/ ) ? Koha::ItemTypes->find( $value )->translated_description > : ( $crit =~ /branch/ ) ? Koha::Libraries->find($value)->branchname >- : ( $crit =~ /reservestatus/ ) ? reservestatushuman($value) > : $value; # default fallback > if ($crit =~ /sort1/) { > foreach (@$Bsort1) { >@@ -324,35 +323,9 @@ sub display_value { > return $display_value; > } > >-sub reservestatushuman{ >- my ($val)=@_; >- my %hashhuman=( >- 1=>"1- placed", >- 2=>"2- processed", >- 3=>"3- pending", >- 4=>"4- satisfied", >- 5=>"5- cancelled", >- 6=>"6- not a status" >- ); >- $hashhuman{$val}; >-} >- > sub changeifreservestatus{ >- my ($val)=@_; >- ($val=~/reservestatus/ >- ?$val=qq{ case >- when priority>0 then 1 >- when priority=0 then >- (case >- when found='f' then 4 >- when found='w' then >- (case >- when cancellationdate is null then 3 >- else 5 >- end ) >- else 2 >- end ) >- else 6 >- end } >- :$val); >+ my ( $field ) = @_; >+ return $field unless $field =~ /reservestatus/; >+ # For reservestatus we return C- Cancelled, W- Waiting, F- Filled, P- Placed (or other like processing, transit etc.) >+ return q|CASE WHEN cancellationdate IS NOT NULL THEN 'C' WHEN found='W' THEN 'W' WHEN found='F' THEN 'F' ELSE 'P' END|; > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23059
:
151579
|
152679
|
152824
|
152825
|
156548
|
156549