Bugzilla – Attachment 47190 Details for
Bug 14695
Add ability to place multiple item holds on a given record per patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14695 [QA Followup] - Fix clearing of all holds by patron at checkout
Bug-14695-QA-Followup---Fix-clearing-of-all-holds-.patch (text/plain), 6.13 KB, created by
Kyle M Hall (khall)
on 2016-01-22 15:53:41 UTC
(
hide
)
Description:
Bug 14695 [QA Followup] - Fix clearing of all holds by patron at checkout
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-01-22 15:53:41 UTC
Size:
6.13 KB
patch
obsolete
>From 31e676caae92d9212116cae5ad167fe8cf50fe34 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 22 Jan 2016 15:25:20 +0000 >Subject: [PATCH] Bug 14695 [QA Followup] - Fix clearing of all holds by patron > at checkout > >--- > C4/Reserves.pm | 60 ++++++++++++++++----------------------------------- > Koha/Old/Hold.pm | 51 ++++++++++++++++++++++++++++++++++++++++++++ > Koha/Old/Holds.pm | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 133 insertions(+), 42 deletions(-) > create mode 100644 Koha/Old/Hold.pm > create mode 100644 Koha/Old/Holds.pm > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index e25d0a2..0992608 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -40,6 +40,7 @@ use Koha::DateUtils; > use Koha::Calendar; > use Koha::Database; > use Koha::Hold; >+use Koha::Old::Hold; > use Koha::Holds; > use Koha::Borrowers; > >@@ -1204,56 +1205,31 @@ whose keys are fields from the reserves table in the Koha database. > > sub ModReserveFill { > my ($res) = @_; >- my $dbh = C4::Context->dbh; >- # fill in a reserve record.... > my $reserve_id = $res->{'reserve_id'}; >- my $biblionumber = $res->{'biblionumber'}; >- my $borrowernumber = $res->{'borrowernumber'}; >- my $resdate = $res->{'reservedate'}; >+ >+ my $dbh = C4::Context->dbh; >+ >+ my $hold = Koha::Holds->find($reserve_id); > > # get the priority on this record.... >- my $priority; >- my $query = "SELECT priority >- FROM reserves >- WHERE biblionumber = ? >- AND borrowernumber = ? >- AND reservedate = ?"; >- my $sth = $dbh->prepare($query); >- $sth->execute( $biblionumber, $borrowernumber, $resdate ); >- ($priority) = $sth->fetchrow_array; >+ my $priority = $hold->priority; > >- # update the database... >- $query = "UPDATE reserves >- SET found = 'F', >- priority = 0 >- WHERE biblionumber = ? >- AND reservedate = ? >- AND borrowernumber = ? >- "; >- $sth = $dbh->prepare($query); >- $sth->execute( $biblionumber, $resdate, $borrowernumber ); >- >- # move to old_reserves >- $query = "INSERT INTO old_reserves >- SELECT * FROM reserves >- WHERE biblionumber = ? >- AND reservedate = ? >- AND borrowernumber = ? >- "; >- $sth = $dbh->prepare($query); >- $sth->execute( $biblionumber, $resdate, $borrowernumber ); >- $query = "DELETE FROM reserves >- WHERE biblionumber = ? >- AND reservedate = ? >- AND borrowernumber = ? >- "; >- $sth = $dbh->prepare($query); >- $sth->execute( $biblionumber, $resdate, $borrowernumber ); >+ # update the hold statuses, no need to store it though, we will be deleting it anyway >+ $hold->set( >+ { >+ found => 'F', >+ priority => 0, >+ } >+ ); >+ >+ my $old_hold = Koha::Old::Hold->new( $hold->unblessed() )->store(); >+ >+ $hold->delete(); > > # now fix the priority on the others (if the priority wasn't > # already sorted!).... > unless ( $priority == 0 ) { >- _FixPriority({ reserve_id => $reserve_id, biblionumber => $biblionumber }); >+ _FixPriority( { reserve_id => $reserve_id, biblionumber => $hold->biblionumber } ); > } > } > >diff --git a/Koha/Old/Hold.pm b/Koha/Old/Hold.pm >new file mode 100644 >index 0000000..ede5833 >--- /dev/null >+++ b/Koha/Old/Hold.pm >@@ -0,0 +1,51 @@ >+package Koha::Old::Hold; >+ >+# Copyright ByWater Solutions 2014 >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use base qw(Koha::Hold); >+ >+=head1 NAME >+ >+Koha::Old::Hold - Koha Old Hold object class >+ >+This object represents a hold that has been filled or canceled >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'OldReserve'; >+} >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >+ >+1; >diff --git a/Koha/Old/Holds.pm b/Koha/Old/Holds.pm >new file mode 100644 >index 0000000..16fce12 >--- /dev/null >+++ b/Koha/Old/Holds.pm >@@ -0,0 +1,64 @@ >+package Koha::Old::Holds; >+ >+# Copyright ByWater Solutions 2014 >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+ >+use Koha::Old::Hold; >+ >+use base qw(Koha::Holds); >+ >+=head1 NAME >+ >+Koha::Old::Holds - Koha Old Hold object set class >+ >+This object represents a set of holds that have been filled or canceled >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'OldReserve'; >+} >+ >+=head3 object_class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Old::Hold'; >+} >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >+ >+1; >-- >2.1.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 14695
:
44143
|
44144
|
44145
|
45058
|
45059
|
45060
|
45061
|
45063
|
45064
|
46548
|
46549
|
46550
|
46551
|
46552
|
46553
|
46554
|
46555
|
46556
|
46557
|
46914
|
46915
|
46916
|
46917
|
46918
|
46919
|
46920
|
47183
|
47184
|
47185
|
47186
|
47187
|
47188
|
47189
|
47190
|
47191
|
47196
|
47227
|
47228
|
47229
|
47230
|
47231
|
47232
|
47233
|
47234
|
47355
|
47372
|
47606
|
47607
|
47608
|
47609
|
47610
|
47611
|
47612
|
47613
|
47614
|
47615
|
48792
|
48795
|
48796
|
48797
|
48798
|
48799
|
48800
|
48801
|
48802
|
48803
|
50056
|
50057
|
50058
|
50059
|
50060
|
50061
|
50062
|
50063
|
50064
|
50065
|
50327
|
50391
|
51006
|
51007
|
51008
|
51009
|
51010
|
51011
|
51012
|
51013
|
51014
|
51015
|
51016
|
51017
|
51027
|
51030
|
51031
|
51032
|
51033
|
51034
|
51035
|
51036
|
51037
|
51038
|
51039
|
51040
|
51041
|
51042
|
51277
|
51278
|
51279
|
51280
|
51281
|
51282
|
51283
|
51284
|
51285
|
51286
|
51287
|
51288
|
51289
|
52457
|
54546
|
54547
|
54548
|
54549
|
54550
|
54551
|
54552
|
54553
|
54554
|
54555
|
54556
|
54557
|
54558
|
54559
|
55114
|
55115
|
55116
|
55117
|
55118
|
55119
|
55120
|
55121
|
55122
|
55123
|
55124
|
55125
|
55126
|
55127
|
55128
|
55148
|
55149
|
55150
|
55151
|
55152
|
55153
|
55154
|
55155
|
55156
|
55157
|
55158
|
55159
|
55160
|
55161
|
55162
|
55163
|
55299
|
55332
|
55730
|
55731