Bugzilla – Attachment 43525 Details for
Bug 14310
Add ability to suspend and resume individual holds from the patron holds table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14310 - Suspend and resume indvidual holds from patron holds table
Bug-14310---Suspend-and-resume-indvidual-holds-fro.patch (text/plain), 8.86 KB, created by
Kyle M Hall (khall)
on 2015-10-16 15:04:18 UTC
(
hide
)
Description:
Bug 14310 - Suspend and resume indvidual holds from patron holds table
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-16 15:04:18 UTC
Size:
8.86 KB
patch
obsolete
>From 0325a3a6a709d86d267c9cdb44ebae61c0690774 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 16 Oct 2015 10:44:11 -0400 >Subject: [PATCH] Bug 14310 - Suspend and resume indvidual holds from patron holds table > >This enhancment adds the ability to suspend and resume individual holds >from the holds table on circulation.pl and moremember.pl. > >The interface is inspired/cribbed from the same feature already >available in the opac. > >Test Plan: >1) Apply this patch >2) Find a patron with holds >3) Suspend a hold with no resume date >4) Resume the suspended hold >5) Suspend a hold with a resume date >6) Resume the suspended hold > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Cathi Wiggins <CWIGGINS@ci.arcadia.ca.us> > >Signed-off-by: Megan Wianecki <mwianecki@mplmain.mtpl.org> >--- > Koha/Hold.pm | 41 +++++++++ > koha-tmpl/intranet-tmpl/prog/en/js/holds.js | 87 ++++++++++++++++++-- > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/members/moremember.tt | 1 + > 4 files changed, 122 insertions(+), 8 deletions(-) > >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 518d0ae..1b1e4cc 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -41,6 +41,47 @@ Koha::Hold - Koha Hold object class > > =cut > >+=head3 suspend_hold >+ >+my $hold = $hold->suspend_hold( $suspend_until_dt ); >+ >+=cut >+ >+sub suspend_hold { >+ my ( $self, $dt ) = @_; >+ >+ if ( $self->is_waiting ) { # We can't suspend waiting holds >+ carp "Unable to suspend waiting hold!"; >+ return $self; >+ } >+ >+ $dt ||= undef; >+ >+ $self->suspend(1); >+ $self->suspend_until( $dt ); >+ >+ $self->store(); >+ >+ return $self; >+} >+ >+=head3 resume >+ >+my $hold = $hold->resume(); >+ >+=cut >+ >+sub resume { >+ my ( $self ) = @_; >+ >+ $self->suspend(0); >+ $self->suspend_until( undef ); >+ >+ $self->store(); >+ >+ return $self; >+} >+ > =head3 waiting_expires_on > > Returns a DateTime for the date a waiting holds expires on. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >index 077b3b6..bf7ea44 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >@@ -8,11 +8,12 @@ $(document).ready(function() { > if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() } > > function load_holds_table() { >+ var holds = new Array(); > if ( ! holdsTable ) { > holdsTable = $("#holds-table").dataTable({ > "bAutoWidth": false, > "sDom": "rt", >- "aoColumns": [ >+ "columns": [ > { > "mDataProp": "reservedate_formatted" > }, >@@ -119,21 +120,53 @@ $(document).ready(function() { > + "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>" > + "<input type='hidden' name='reserve_id' value='" + oObj.reserve_id + "'>"; > } >+ }, >+ { >+ "bSortable": false, >+ "mDataProp": function( oObj ) { >+ holds[oObj.reserve_id] = oObj; //Store holds for later use >+ >+ if ( oObj.found ) { >+ return ""; >+ } else if ( oObj.suspend == 1 ) { >+ return "<a class='hold-resume btn btn-link' id='resume" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>" >+ + "<i class='icon-play'></i> " + _("Resume") + "</a>"; >+ } else { >+ return "<a class='hold-suspend btn btn-link' id='suspend" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>" >+ + "<i class='icon-pause'></i> " + _("Suspend") + "</a>"; >+ } >+ } > } > ], > "bPaginate": false, > "bProcessing": true, > "bServerSide": false, >- "sAjaxSource": '/cgi-bin/koha/svc/holds', >- "fnServerData": function ( sSource, aoData, fnCallback ) { >- aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); >- >- $.getJSON( sSource, aoData, function (json) { >- fnCallback(json) >- } ); >+ "ajax": { >+ "url": '/cgi-bin/koha/svc/holds', >+ "data": function ( d ) { >+ d.borrowernumber = borrowernumber; >+ } > }, > }); > >+ $('#holds-table').on( 'draw.dt', function () { >+ $(".hold-suspend").on( "click", function() { >+ var id = $(this).attr("id").replace("suspend", ""); >+ var hold = holds[id]; >+ $("#suspend-modal-title").html( hold.title ); >+ $("#suspend-modal-reserve_id").val( hold.reserve_id ); >+ $('#suspend-modal').modal('show'); >+ }); >+ >+ $(".hold-resume").on( "click", function() { >+ var id = $(this).attr("id").replace("resume", ""); >+ var hold = holds[id]; >+ $.post('/cgi-bin/koha/svc/hold/resume', { "reserve_id": hold.reserve_id }, function( data ){ >+ holdsTable.api().ajax.reload(); >+ }); >+ }); >+ }); >+ > if ( $("#holds-table").length ) { > $("#holds-table_processing").position({ > of: $( "#holds-table" ), >@@ -142,4 +175,42 @@ $(document).ready(function() { > } > } > } >+ >+ $("body").append("\ >+ <div id='suspend-modal' class='modal hide fade' tabindex='-1' role='dialog' aria-hidden='true'>\ >+ <form id='suspend-modal-form' class='form-inline'>\ >+ <div class='modal-header'>\ >+ <button type='button' class='closebtn' data-dismiss='modal' aria-hidden='true'>Ã</button>\ >+ <h3 id='suspend-modal-label'>" + _("Suspend hold on") + " <i><span id='suspend-modal-title'></span></i></h3>\ >+ </div>\ >+\ >+ <div class='modal-body'>\ >+ <input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\ >+\ >+ <label for='suspend-modal-until'>Suspend until:</label>\ >+ <input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\ >+\ >+ <p/><a class='btn btn-link' id='suspend-modal-clear-date' >" + _("Clear date to suspend indefinitely") + "</a></p>\ >+\ >+ </div>\ >+\ >+ <div class='modal-footer'>\ >+ <button id='suspend-modal-submit' class='btn btn-primary' type='submit' name='submit'>" + _("Suspend") + "</button>\ >+ <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + _("Cancel") + "</a>\ >+ </div>\ >+ </form>\ >+ </div>\ >+ "); >+ >+ $("#suspend-modal-until").datepicker({ minDate: 1 }); // Require that "until date" be in the future >+ $("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } ); >+ >+ $("#suspend-modal-submit").on( "click", function( e ) { >+ e.preventDefault(); >+ $.post('/cgi-bin/koha/svc/hold/suspend', $('#suspend-modal-form').serialize(), function( data ){ >+ $('#suspend-modal').modal('hide'); >+ holdsTable.api().ajax.reload(); >+ }); >+ }); >+ > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index e1b8933..a8c8b2f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -932,6 +932,7 @@ No patron matched <span class="ex">[% message %]</span> > <th>Expiration</th> > <th>Priority</th> > <th>Delete?</th> >+ <th>Suspend?</th> > </tr> > </thead> > </table> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 96f51aa..0b34c23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -483,6 +483,7 @@ function validate1(date) { > <th>Expiration</th> > <th>Priority</th> > <th>Delete?</th> >+ <th>Suspend?</th> > </tr> > </thead> > </table> >-- >1.7.2.5
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 14310
:
39750
|
39751
|
39752
|
39753
|
39754
|
40024
|
40030
|
40031
|
40034
|
43525
|
43526
|
43830
|
43831
|
43832
|
43978
|
44203
|
44204
|
44205
|
44206
|
44207
|
46857
|
46858
|
46859
|
46860
|
46861
|
46862
|
46870
|
46871
|
46872
|
46873
|
46874
|
46875
|
46876