Bugzilla – Attachment 152696 Details for
Bug 23775
Claiming a serial issue doesn't create the next one
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23775: Claiming a serial issue doesn't create the next one
Bug-23775-Claiming-a-serial-issue-doesnt-create-th.patch (text/plain), 3.83 KB, created by
Sam Lau
on 2023-06-26 15:08:49 UTC
(
hide
)
Description:
Bug 23775: Claiming a serial issue doesn't create the next one
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-06-26 15:08:49 UTC
Size:
3.83 KB
patch
obsolete
>From 4297d17421ee3b17e89f09f3d43fc048b2a7ffb6 Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Mon, 4 Apr 2022 11:00:09 +0200 >Subject: [PATCH] Bug 23775: Claiming a serial issue doesn't create the next > one > >Whenever we need to generate manually a new serial we go to page >'serials-edit.pl'. With this patch it is possible to generate a new >serial on page 'serials.pl'. > >Test Plan: >-- Previously we need a serial which is in EXPECTED status & the Date >received should not be later than today -- >1) On the intra. Make sure to have at least 1 subscription for a > bibliographic record & 1 vendor linked >2) Then Home > Serials > Claims > Claims for <your_vendor_name> >3) Tick the checkbox of the row where the status is EXPECTED then >4) Click 'Send notification' >5) Notice the status of the row : it is now CLAIMED >6) To verify: Home > Serials > Serial collection information for > <your_record_name> >7) Here the status is CLAIMED too but nothing happened around >8) Apply patch >9) Repeat from 2) to 6) >10) The status is still CLAIMED & the new serial with status EXPECTED is > freshly generated > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > C4/Serials.pm | 15 ++++++++++ > t/db_dependent/Serials/updateClaim.t | 42 ++++++++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > create mode 100755 t/db_dependent/Serials/updateClaim.t > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 37f1c169a6..31a61c05fa 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1892,6 +1892,21 @@ sub updateClaim { > unless ( ref $serialids ) { > $serialids = [ $serialids ]; > } >+ >+ foreach my $serialid(@$serialids) { >+ my $serial = Koha::Serials->find($serialid); >+ >+ C4::Serials::ModSerialStatus( >+ $serialid, >+ $serial->serialseq, >+ $serial->planneddate, >+ $serial->publisheddate, >+ $serial->publisheddatetext, >+ C4::Serials->CLAIMED, >+ $serial->notes >+ ); >+ } >+ > my $dbh = C4::Context->dbh; > return $dbh->do(q| > UPDATE serial >diff --git a/t/db_dependent/Serials/updateClaim.t b/t/db_dependent/Serials/updateClaim.t >new file mode 100755 >index 0000000000..1eed7db318 >--- /dev/null >+++ b/t/db_dependent/Serials/updateClaim.t >@@ -0,0 +1,42 @@ >+use Modern::Perl; >+use Test::More tests => 3; >+ >+use C4::Serials; >+use Koha::Database; >+use Koha::DateUtils qw( dt_from_string output_pref ); >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+my $dbh = C4::Context->dbh; >+ >+$dbh->do(q|DELETE FROM issues|); >+$dbh->do(q|DELETE FROM subscription|); >+ >+my $branchcode = 'CPL'; >+my $record = MARC::Record->new(); >+my ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio($record, ''); >+ >+# Create a new subscription >+my $subscriptionid_claims = C4::Serials::NewSubscription( >+undef, $branchcode, undef, undef, undef, $biblionumber, >+'2013-01-01', undef, undef, undef, undef, >+undef, undef, undef, undef, undef, undef, >+1, "notes",undef, '9999-01-01', undef, undef, >+undef, undef, 0, "intnotes", 0, >+undef, undef, 0, undef, '2013-12-31', 0 >+); >+ >+# Verify and get the serial ID of the subscription >+my ( $totalissues, @serials ) = C4::Serials::GetSerials($subscriptionid_claims, 1); >+ >+C4::Serials::updateClaim( $serials[0]->{serialid} ); # Updating the claim >+# sort the result to separate the CLAIMED and EXPECTED status >+@serials = sort { $a->{serialid} <=> $b->{serialid} } @serials; >+ >+# Verify if serial IDs are correctly generated >+( $totalissues, @serials ) = C4::Serials::GetSerials($subscriptionid_claims); >+ >+is ( scalar(@serials), 2, "le test est terminé" ); # Gives the length of the @serials >+ >+is ( ($serials[0]->{status}), C4::Serials::CLAIMED, "test CLAIMED" ); >+is ( ($serials[1]->{status}), C4::Serials::EXPECTED, "test EXPECTED" ); >-- >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 23775
:
133119
|
133122
|
134062
|
152624
|
152696
|
152729