Bugzilla – Attachment 17580 Details for
Bug 10092
Small improvements on serial missinglist and receivedlist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10092 Followup for NewIssue
Bug-10092-Followup-for-NewIssue.patch (text/plain), 4.73 KB, created by
Marcel de Rooy
on 2013-04-22 11:49:44 UTC
(
hide
)
Description:
Bug 10092 Followup for NewIssue
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-04-22 11:49:44 UTC
Size:
4.73 KB
patch
obsolete
>From 86e569f8051e2cb19fa0430351eef90a2e8559b4 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 22 Apr 2013 13:35:24 +0200 >Subject: [PATCH] Bug 10092 Followup for NewIssue >Content-Type: text/plain; charset=utf-8 > >Same logic for new issue. >Moves the shared code to a local subroutine. > >Test plan: >Add an issue via Generate Next button. No changes to missing and received. >Now add an issue via Edit Serials and Supplemental issue with status Arrived. >Check the received list. >Now add supplemental issue with status Missing or Not available. >Check the missing list. >--- > C4/Serials.pm | 65 +++++++++++++++++++++++++------------------------------- > 1 files changed, 29 insertions(+), 36 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index d2cd78b..a444db0 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1132,31 +1132,9 @@ sub ModSerialStatus { > $query = "SELECT missinglist,recievedlist FROM subscriptionhistory WHERE subscriptionid=?"; > $sth = $dbh->prepare($query); > $sth->execute($subscriptionid); >- my ( $missinglist, $recievedlist ) = $sth->fetchrow; >- >- #Arrived: add to received list, remove from missing >- if($status==2) { >- $recievedlist .= "; $serialseq" >- if $recievedlist!~/(^|;)\s*$serialseq(?=;|$)/; >- $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >- } >- #Expected,late,claimed: remove optionally from received+missing >- if (grep /$status/, (1,3,7)) { >- $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >- $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >- } >- #Missing, not available: add to missing, remove from received >- #No longer putting additional text into missing field >- if($status==4 || $status==5) { >- $missinglist .= "; $serialseq" >- if $missinglist!~/(^|;)\s*$serialseq(?=;|$)/; >- $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >- } >- >+ my ($missinglist, $recievedlist)= _update_missing_and_received_list($sth->fetchrow,$serialseq,$status); > $query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE subscriptionid=?"; > $sth = $dbh->prepare($query); >- $recievedlist =~ s/^; //; >- $missinglist =~ s/^; //; > $sth->execute( $recievedlist, $missinglist, $subscriptionid ); > } > } >@@ -1191,6 +1169,32 @@ sub ModSerialStatus { > return; > } > >+sub _update_missing_and_received_list { >+ my ($missinglist, $recievedlist, $serialseq, $status)=@_; >+ >+ #Arrived: add to received list, remove from missing >+ if($status==2) { >+ $recievedlist .= "; $serialseq" >+ if $recievedlist!~/(^|;)\s*$serialseq(?=;|$)/; >+ $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >+ } >+ #Expected,late,claimed: remove optionally from received+missing >+ if (grep /$status/, (1,3,7)) { >+ $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >+ $missinglist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >+ } >+ #Missing, not available: add to missing, remove from received >+ #No longer putting additional text into missing field >+ if($status==4 || $status==5) { >+ $missinglist .= "; $serialseq" >+ if $missinglist!~/(^|;)\s*$serialseq(?=;|$)/; >+ $recievedlist=~ s/(^|;)\s*$serialseq(?=;|$)//g; >+ } >+ $missinglist =~ s/^; //; >+ $recievedlist =~ s/^; //; >+ return ($missinglist, $recievedlist); >+} >+ > =head2 GetNextExpected > > $nextexpected = GetNextExpected($subscriptionid) >@@ -1505,25 +1509,14 @@ sub NewIssue { > |; > $sth = $dbh->prepare($query); > $sth->execute($subscriptionid); >- my ( $missinglist, $recievedlist ) = $sth->fetchrow; >- >- if ( $status == 2 ) { >- ### TODO Add a feature that improves recognition and description. >- ### As such count (serialseq) i.e. : N18,2(N19),N20 >- ### Would use substr and index But be careful to previous presence of () >- $recievedlist .= "; $serialseq" unless (index($recievedlist,$serialseq)>0); >- } >- if ( $status == 4 ) { >- $missinglist .= "; $serialseq" unless (index($missinglist,$serialseq)>0); >- } >+ my ($missinglist, $recievedlist)= _update_missing_and_received_list( >+ $sth->fetchrow, $serialseq, $status); > $query = qq| > UPDATE subscriptionhistory > SET recievedlist=?, missinglist=? > WHERE subscriptionid=? > |; > $sth = $dbh->prepare($query); >- $recievedlist =~ s/^; //; >- $missinglist =~ s/^; //; > $sth->execute( $recievedlist, $missinglist, $subscriptionid ); > return $serialid; > } >-- >1.7.7.6
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 10092
:
17576
|
17580
|
21960
|
21961
|
22246
|
22247