Bugzilla – Attachment 68228 Details for
Bug 19287
Add ability to mark an item 'Lost' from 'Holds to pull' list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19287: Add ability to mark an item ‘Lost’ from ‘Holds awaiting pickup’ list
Bug-19287-Add-ability-to-mark-an-item-Lost-from-Ho.patch (text/plain), 10.10 KB, created by
Jonathan Druart
on 2017-10-17 20:51:58 UTC
(
hide
)
Description:
Bug 19287: Add ability to mark an item ‘Lost’ from ‘Holds awaiting pickup’ list
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-17 20:51:58 UTC
Size:
10.10 KB
patch
obsolete
>From 4550bd1241b8a398c16dca3ab987ecbdc611b326 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 12 Oct 2017 15:00:06 -0300 >Subject: [PATCH] =?UTF-8?q?Bug=2019287:=20Add=20ability=20to=20mark=20an?= > =?UTF-8?q?=20item=20=E2=80=98Lost=E2=80=99=20from=20=E2=80=98Holds=20awai?= > =?UTF-8?q?ting=20pickup=E2=80=99=20list?= >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This is the main patch of this new enhancement. >The goal to this enhancement is to add the ability to mark items as lost >from the âHolds awaiting pickupâ page. >A new pref is added to control the behaviour, default is off >To enable it, you need to set the new pref CanMarkHoldsAwaitingPickupAsLost to one of these two values: >- "Allow to mark items as lost" >=> The item will be marked as lost and the hold will be cancelled >- "Allow to mark items as lost and notify the patron" >=> Same as previously but the patron will be notified as well. > >The notification is done using a new notice template (code=CANCEL_HOLD_ON_LOST). >Feel free to suggest another default wording. > >Test plan: >You need to clearly know how this page is working currently to make sure >this patch does not break existing behaviours >1/ Check 2 items out >2/ Add a hold on one of the items >3/ Add 2 holds on the other item >4/ Return the item to mark the hold as waiting >5/ From here you will be able to see entries in the "Circulation ⺠Holds >awaiting pickup" page >6/ I suggest to make a backup of this table, to avoid to repeat the >previous steps. You will need to test the following steps using the >different values of the pref >7/ Cancel the hold >8/ Mark the items as lost >=> You will receive feedback messages depending on different situations: >* The CANCEL_HOLD_ON_LOST does not exist >* The patron does not have an email address (but the notice has been >enqueued! It is the current behaviour with other notices) >* The notice has been enqueued >* The hold has been cancelled > >QA Notes: >1/ C4::Circulation::LostItem is usually called with the second parameter >set, which will mark the issue as returned. It is weird that this >behaviour cannot be controlled by a pref. >2/ From which library do we want to pick the notice? This patch use >reserves.branchcode >--- > circ/waitingreserves.pl | 41 ++++++++++++++++++++++ > installer/data/mysql/atomicupdate/bug_19287.sql | 2 ++ > .../prog/en/modules/circ/waitingreserves.tt | 36 +++++++++++++++++-- > 3 files changed, 77 insertions(+), 2 deletions(-) > >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index dfac75e5ba..6d10a2c5ec 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -72,6 +72,46 @@ my @cancel_result; > if ( $op eq 'cancel_reserve' and $item) { > my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); > push @cancel_result, $res if $res; >+} elsif ( $op =~ m|^mark_as_lost| ) { >+ my $reserve_id = $input->param('reserve_id'); >+ my $hold = Koha::Holds->find( $reserve_id ); >+ die "wrong reserve_id" unless $hold; >+ if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { >+ my $itemnumber = $hold->item->itemnumber; >+ my $patron = $hold->borrower; >+ C4::Circulation::LostItem( $itemnumber, 'MARK RETURNED' ); # FIXME Do we have to mark it returned? There is no pref for that? See other occurrences of 'LostItem(' >+ if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') eq 'yes_and_notify' ) { >+ my $library = $hold->branch; >+ my $letter = C4::Letters::GetPreparedLetter( >+ module => 'reserves', >+ letter_code => 'CANCEL_HOLD_ON_LOST', >+ branchcode => $library->branchcode, # FIXME Is it what we want? >+ lang => $patron->lang, >+ tables => { >+ branches => $library->branchcode, >+ borrowers => $patron->borrowernumber, >+ items => $itemnumber, >+ biblio => $hold->biblionumber, >+ biblioitems => $hold->biblionumber, >+ reserves => $hold->unblessed, >+ }, >+ ); >+ if ( $letter ) { >+ my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'); >+ >+ C4::Letters::EnqueueLetter( >+ { letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', >+ from_address => $admin_email_address, >+ } >+ ); >+ } >+ } >+ my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); >+ push @cancel_result, $res if $res; >+ }# else the url parameters have been modified and the user is not allowed to continue >+ > } > > if ( C4::Context->preference('IndependentBranches') ) { >@@ -103,6 +143,7 @@ foreach my $num (@getreserves) { > my %getreserv = ( > itemnumber => $itemnumber, > borrowernum => $borrowernum, >+ reserve_id => $num->{reserve_id}, > ); > > my $patron = Koha::Patrons->find( $num->{borrowernumber} ); >diff --git a/installer/data/mysql/atomicupdate/bug_19287.sql b/installer/data/mysql/atomicupdate/bug_19287.sql >index 5aad3d2f2c..7ae924b792 100644 >--- a/installer/data/mysql/atomicupdate/bug_19287.sql >+++ b/installer/data/mysql/atomicupdate/bug_19287.sql >@@ -1 +1,3 @@ > INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'); >+ >+INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('reserves', 'CANCEL_HOLD_ON_LOST', '', 'Hold has been cancelled', 0, "Hold has been cancelled", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nWe regret to inform you that the following item cannot longer be placed on hold, it has been marked as lost\n\nTitle: [% biblio.title %]\nAuthor: [% biblio.author %]\nCopy: [% item.copynumber %]\nLocation: [% branch.branchname %]", 'email', 'default'); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >index d5678a385e..f4da1e14bd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >@@ -17,7 +17,8 @@ > { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, > { "sType": "title-string", "aTargets" : [ "title-string" ] } > ], >- "sPaginationType": "four_button" >+ "sPaginationType": "four_button", >+ "autoWidth": true, > })); > }); > //]]> >@@ -127,6 +128,21 @@ > <input type="submit" value="Cancel hold" /> > [% END %] > </form> >+ [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %] >+ <form name="cancelReserve" action="waitingreserves.pl" method="post"> >+ <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" /> >+ <input type="hidden" name="fbr" value="[% reserveloo.holdingbranch %]" /> >+ <input type="hidden" name="tbr" value="[% reserveloo.homebranch %]" /> >+ <input type="hidden" name="tab" value="holdswaiting"> >+ [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %] >+ <input type="hidden" name="op" value="mark_as_lost" /> >+ <input type="submit" value="Mark item as lost" /> >+ [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %] >+ <input type="hidden" name="op" value="mark_as_lost_and_notify" /> >+ <input type="submit" value="Mark item as lost and notify the patron" /> >+ [% END %] >+ </form> >+ [% END %] > </td> > </tr> > [% END %]</tbody> >@@ -194,7 +210,23 @@ > [% ELSE %] > <input type="submit" value="Cancel hold" /> > [% END %] >- </form> >+ </form> >+ [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %] >+ <form name="cancelReserve" action="waitingreserves.pl" method="post"> >+ <input type="hidden" name="reserve_id" value="[% reserveloo.reserve_id %]" /> >+ <input type="hidden" name="fbr" value="[% reserveloo.holdingbranch %]" /> >+ <input type="hidden" name="tbr" value="[% reserveloo.homebranch %]" /> >+ <input type="hidden" name="tab" value="holdswaiting"> >+ [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %] >+ <input type="hidden" name="op" value="mark_as_lost" /> >+ <input type="submit" value="Mark item as lost" /> >+ [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %] >+ <input type="hidden" name="op" value="mark_as_lost_and_notify" /> >+ <input type="submit" value="Mark item as lost and notify the patron" /> >+ [% END %] >+ </form> >+ [% END %] >+ > </td> > </tr> > [% END %]</tbody> >-- >2.11.0
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 19287
:
68226
|
68227
|
68228
|
68229
|
68230
|
68251
|
68252
|
68253
|
68254
|
68255
|
68284
|
69746
|
70705
|
70764
|
70918
|
70919
|
73881
|
73882
|
73883
|
73884
|
73885
|
73886
|
73887
|
73888
|
73889
|
74696
|
74697
|
74698
|
74699
|
74700
|
74701
|
74702
|
74703
|
74704
|
74705
|
74749
|
75535