Bugzilla – Attachment 25541 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]
Bug 11814 - Use constants to describe statuses
Bug-11814---Use-constants-to-describe-statuses.patch (text/plain), 3.34 KB, created by
Jonathan Druart
on 2014-02-21 15:08:54 UTC
(
hide
)
Description:
Bug 11814 - Use constants to describe statuses
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-21 15:08:54 UTC
Size:
3.34 KB
patch
obsolete
>From e73726e829d744f2a1e00dcf023159a70742c4ce 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] 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. >--- > C4/Serials.pm | 33 +++++++++++++++++++++++++++++---- > 1 file changed, 29 insertions(+), 4 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index bfbf21f..ec21e8a 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -33,6 +33,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; >@@ -94,6 +117,7 @@ the array is in name order > > sub GetSuppliersWithLateIssues { > my $dbh = C4::Context->dbh; >+ my $statuses = join(',', ( LATE, MISSING_STATUSES ) ); > my $query = qq| > SELECT DISTINCT id, name > FROM subscription >@@ -102,7 +126,7 @@ sub GetSuppliersWithLateIssues { > WHERE id > 0 > AND ( > (planneddate < now() AND serial.status=1) >- OR serial.STATUS IN (3, 4, 41, 42, 43, 44) >+ OR serial.STATUS IN ( $statuses ) > ) > AND subscription.closed = 0 > ORDER BY name|; >@@ -425,7 +449,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; > } > >@@ -770,9 +794,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); >@@ -793,7 +818,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.10.4
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