Bugzilla – Attachment 34567 Details for
Bug 11814
Serial statuses should be stored in constants
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 11814 - Use constants to describe statuses
PASSED-QA-Bug-11814---Use-constants-to-describe-st.patch (text/plain), 3.47 KB, created by
Kyle M Hall (khall)
on 2014-12-19 15:24:39 UTC
(
hide
)
Description:
[PASSED QA] Bug 11814 - Use constants to describe statuses
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-12-19 15:24:39 UTC
Size:
3.47 KB
patch
obsolete
>From 050cf9f4c69563cd8b6c37c80c9d136b84c7627f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 21 Feb 2014 09:19:09 -0500 >Subject: [PATCH] [PASSED QA] Bug 11814 - Use constants to describe statuses > >Make the code a bit more understandable by using constants to define >the status values and reference those. Adds self-documentation. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Serials.pm | 33 +++++++++++++++++++++++++++++---- > 1 files changed, 29 insertions(+), 4 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index d127066..9c21897 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -34,6 +34,29 @@ use C4::Serials::Numberpattern; > > use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); > >+# Define statuses >+use constant { >+ EXPECTED => 1, >+ ARRIVED => 2, >+ LATE => 3, >+ MISSING => 4, >+ MISSING_NEVER_RECIEVED => 41, >+ MISSING_SOLD_OUT => 42, >+ MISSING_DAMAGED => 43, >+ MISSING_LOST => 44, >+ NOT_ISSUED => 5, >+ DELETED => 6, >+ CLAIMED => 7, >+ STOPPED => 8, >+}; >+ >+use constant MISSING_STATUSES => ( >+ MISSING, MISSING_NEVER_RECIEVED, >+ MISSING_SOLD_OUT, MISSING_DAMAGED, >+ MISSING_LOST >+); >+ >+ > BEGIN { > $VERSION = 3.07.00.049; # set version for version checking > require Exporter; >@@ -95,6 +118,7 @@ the array is in name order > > sub GetSuppliersWithLateIssues { > my $dbh = C4::Context->dbh; >+ my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); > my $query = qq| > SELECT DISTINCT id, name > FROM subscription >@@ -103,7 +127,7 @@ sub GetSuppliersWithLateIssues { > WHERE id > 0 > AND ( > (planneddate < now() AND serial.status=1) >- OR serial.STATUS IN (3, 4, 41, 42, 43, 44, 7) >+ OR serial.STATUS IN ( $statuses ) > ) > AND subscription.closed = 0 > ORDER BY name|; >@@ -430,7 +454,7 @@ sub PrepareSerialsData { > } > } > $subs->{ "status" . $subs->{'status'} } = 1; >- if ( grep { $_ == $subs->{status} } qw( 1 3 4 41 42 43 44 7 ) ) { >+ if ( grep { $_ == $subs->{status} } ( EXPECTED, LATE, MISSING_STATUSES, CLAIMED ) ) { > $subs->{"checked"} = 1; > } > >@@ -772,9 +796,10 @@ sub GetSerials { > my $counter = 0; > $count = 5 unless ($count); > my @serials; >+ my $statuses = join( ',', ( ARRIVED, MISSING_STATUSES, NOT_ISSUED ) ); > my $query = "SELECT serialid,serialseq, status, publisheddate, planneddate,notes, routingnotes > FROM serial >- WHERE subscriptionid = ? AND status NOT IN (2, 4, 41, 42, 43, 44, 5) >+ WHERE subscriptionid = ? AND status NOT IN ( $statuses ) > ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC"; > my $sth = $dbh->prepare($query); > $sth->execute($subscriptionid); >@@ -795,7 +820,7 @@ sub GetSerials { > $query = "SELECT serialid,serialseq, status, planneddate, publisheddate,notes, routingnotes > FROM serial > WHERE subscriptionid = ? >- AND (status in (2, 4, 41, 42, 43, 44, 5)) >+ AND status IN ( $statuses ) > ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC > "; > $sth = $dbh->prepare($query); >-- >1.7.2.5
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 11814
:
25541
|
25542
|
27605
|
33512
|
33513
|
33514
|
33552
|
33890
|
33990
|
33991
|
33992
|
34550
|
34563
|
34564
|
34565
|
34566
| 34567 |
34568
|
34569
|
34570