Bugzilla – Attachment 168198 Details for
Bug 34756
Cancelling a hold does not cancel the related transfer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34756: Cancelling a hold does not cancel the related transfer
Bug-34756-Cancelling-a-hold-does-not-cancel-the-re.patch (text/plain), 6.02 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-06-27 14:27:19 UTC
(
hide
)
Description:
Bug 34756: Cancelling a hold does not cancel the related transfer
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-06-27 14:27:19 UTC
Size:
6.02 KB
patch
obsolete
>From 7270703b3555810aa5ed5863c848085733d0c373 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com> >Date: Thu, 27 Jun 2024 16:11:03 +0200 >Subject: [PATCH] Bug 34756: Cancelling a hold does not cancel the related > transfer > >When a hold is confirmed and its pickup location is different from the item's location, a transfer is initiated. >If the hold is cancelled, the item remains in transfer whereas it is no longer needed at the transfer destination. > >Is this normal behaviour ? It seems that staff users should at least see a message about the transfer and maybe have the ability to cancel it. > >Steps to reproduce: >1. Create an item at library A >2. Place a hold on this item with a pickup location at library B >3. Check in the item at library A >4. Confirm the hold. The item should now be in transit to library B >5. Cancel the hold. There is no message about the probably useless transfer. > >NEW TEST PLAN >1. Create an item at library A >2. Place a hold on this item with a pickup location at library B >3. Check in the item at library A >3-bis. Try to cancel the hold: notice there is no message >4. Confirm the hold. The item should now be in transit to library B >5. Cancel the hold. There is now a message to propose you to cancel the > related transfer >6. Do not check the checkbox. There is no hold but still a transfer >7. Repeat the whole process checking the checkbox. Thers is no hold and > the transfer has been cancelled. >--- > koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc | 2 +- > .../intranet-tmpl/prog/en/modules/reserve/request.tt | 8 ++++++++ > reserve/request.pl | 7 +++++++ > 3 files changed, 16 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index af0e79c..0356084 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -237,7 +237,7 @@ > [%- END -%] > [%- END -%] > <td> >- <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?op=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> >+ <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" data-transfer="[% hold.transfer | html %]" href="request.pl?op=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]&transfer=[% hold.transfer %]"> > <i class="fa fa-trash" aria-label="Cancel hold"></i> > </a> > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index 335aa63..67b8af5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1457,6 +1457,8 @@ > [% END %] > </select> > [% END %] >+ <div id="transfer-cancellation"> </div> >+ > </fieldset> > </div> > >@@ -1852,9 +1854,15 @@ > $("#cancel_modal_form #inputs").empty(); > let reserve_id = cancel_link.data('id'); > let biblionumber = cancel_link.data('biblionumber'); >+ let transfer = cancel_link.data('transfer'); > $("#cancel_modal_form #inputs").append('<input type="hidden" name="reserve_id" value="' + reserve_id + '">'); > $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="' + biblionumber + '">'); > $("#cancel_modal_form #inputs").append('<input type="hidden" name="op" value="cud-cancel">'); >+ if(transfer){ >+ $("#transfer-cancellation").empty() >+ $("#transfer-cancellation").append('<label for="transfer-cancel">A transfer related to this hold has been detected, do you want to cancel it ?</label>'); >+ $("#transfer-cancellation").append('<input type="checkbox" id="transfer-cancel" name="transfer-cancel"> </input>'); >+ } > $('#cancelModal').modal(); > return false; > }); >diff --git a/reserve/request.pl b/reserve/request.pl >index 5d08877..75456bc 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -113,7 +113,13 @@ if ( $op eq 'cud-move' ) { > elsif ( $op eq 'cud-cancel' ) { > my $reserve_id = $input->param('reserve_id'); > my $cancellation_reason = $input->param("cancellation-reason"); >+ my $transfer = $input->param("transfer-cancel") ? "1" : "0"; > my $hold = Koha::Holds->find($reserve_id); >+ >+ if( $transfer ) { >+ warn($hold->item()->get_transfer); >+ $hold->item()->get_transfer->cancel( { reason => 'Manual', 'force' => '1' } ); >+ } > $hold->cancel( { cancellation_reason => $cancellation_reason } ) if $hold; > } > elsif ( $op eq 'cud-setLowestPriority' ) { >@@ -627,6 +633,7 @@ if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) > $reserve{'found'} = $res->is_found(); > $reserve{'inprocessing'} = $res->is_in_processing(); > $reserve{'intransit'} = $res->is_in_transit(); >+ $reserve{'transfer'} = $res->item()->get_transfer() ? '1' : '0'; > } > elsif ( $res->priority() > 0 ) { > if ( my $item = $res->item() ) { >-- >2.43.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 34756
:
168198
|
168313
|
173138