Bugzilla – Attachment 54978 Details for
Bug 17217
Allow to reserve first available item from a group of titles (OPAC)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17217: Allow to reserve first available item from a group of titles (OPAC)
Bug-17217-Allow-to-reserve-first-available-item-fr.patch (text/plain), 10.29 KB, created by
Julian Maurice
on 2016-08-29 13:34:08 UTC
(
hide
)
Description:
Bug 17217: Allow to reserve first available item from a group of titles (OPAC)
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-08-29 13:34:08 UTC
Size:
10.29 KB
patch
obsolete
>From 2db46671c4684a08764f8fa2d884256e59cc0b76 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 29 Aug 2016 14:13:05 +0200 >Subject: [PATCH] Bug 17217: Allow to reserve first available item from a group > of titles (OPAC) > >Depends on bug 15516 > >Test plan: >0. Run updatedatabase.pl and misc/devel/update_dbix_class_files.pl >1. Go to OPAC search, display some results, click on some checkboxes and > click on 'Place hold' button at the top of the results >2. Check the box with label "Place a hold on the first available..." >3. Check that more options appear (Pickup location, hold dates and > notes). >4. Click on 'Place hold' >5. Now go to intranet interface and check in an item of one of the > reserved biblios and confirm the hold >6. The hold status should have been changed to Waiting, and all other > holds should have been deleted >--- > .../opac-tmpl/bootstrap/en/modules/opac-reserve.tt | 117 +++++++++++++++------ > opac/opac-reserve.pl | 13 +++ > 2 files changed, 99 insertions(+), 31 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >index 8decae4..631c7d3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt >@@ -2,6 +2,8 @@ > [% USE KohaDates %] > [% USE Price %] > [% USE ItemTypes %] >+[% USE Branches %] >+ > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Placing a hold</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -135,6 +137,49 @@ > <!-- These values are set dynamically by js --> > <input type="hidden" name="biblionumbers" id="biblionumbers"/> > <input type="hidden" name="selecteditems" id="selections"/> >+ <label> >+ <input type="checkbox" id="requestany" name="requestany" value="1"> >+ Place a hold on the first available item among the selected titles >+ </label> >+ <div id="hold-options" class="hold-options"> >+ <fieldset class="rows"> >+ <ul> >+ <li> >+ <label for="branch">Pickup location:</label> >+ <select id="branch" name="branch"> >+ [% FOREACH branch IN Branches.all({selected = Branches.GetLoggedInBranchcode }) %] >+ [% IF branch.selected %] >+ <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ [% IF ( reserve_in_future ) %] >+ <li> >+ <label for="from">Hold starts on date:</label> >+ <input name="reserve_date" id="from" size="10" class="holddatefrom"/> >+ <span class="date-format from" data-biblionumber="all">[% INCLUDE 'date-format.inc' %]</span> >+ </li> >+ [% END %] >+ <li> >+ <label for="to">Hold not needed after:</label> >+ <input name="expiration_date" id="to" size="10" class="holddateto" /> >+ <span class="date-format to" data-biblionumber="all">[% INCLUDE 'date-format.inc' %]</span> >+ </li> >+ [% IF ( OpacHoldNotes ) %] >+ <li> >+ <div class="notesrow" id="notesrow"> >+ <label for="holdnotes">Hold notes:</label> >+ <span id="forcenotesreason" class="forcenotesreason"></span> >+ <textarea id="holdnotes" rows="2" cols="30" name="notes"></textarea> >+ </div> >+ </li> >+ [% END # / IF OpacHoldNotes %] >+ </ul> >+ </fieldset> >+ </div> > <div id="bigloop"> > > [% FOREACH bibitemloo IN bibitemloop %] >@@ -504,17 +549,16 @@ > }); > > $(".date-format").each(function(){ >- if($(this).hasClass("to")){ var op = "to"; } >- if($(this).hasClass("from")){ var op = "from"; } >- var bibNum = $(this).data("biblionumber"); >- $(this).html("<a href=\"#\" class=\"clear-date\" data-op=\"" + op + "\" id=\"clear" + bibNum + "\">" + _("Clear date") + "</a>"); >- }); >- >- $(".clear-date").on("click",function(e){ >- e.preventDefault(); >- var fieldID = this.id.replace("clear",""); >- var op = $(this).data("op"); >- $("#" + op + fieldID).val(""); >+ var input = $(this).siblings('input').first(); >+ var clearDateLink = $('<a></a>') >+ .attr('href', '#') >+ .addClass('clear-date') >+ .html(_("Clear date")) >+ .on('click', function(e) { >+ e.preventDefault(); >+ input.val(''); >+ }); >+ $(this).empty().append(clearDateLink); > }); > > // Replace non-JS single-selection with multi-selection capability. >@@ -645,27 +689,38 @@ > return true; > }); > >- [% FOREACH bibitemloo IN bibitemloop %] >- [% IF ( bibitemloo.holdable ) %] >- // http://jqueryui.com/demos/datepicker/#date-range >- var dates[% bibitemloo.biblionumber %] = $( "#from[% bibitemloo.biblionumber %], #to[% bibitemloo.biblionumber %]" ).datepicker({ >- minDate: 0, >- changeMonth: true, >- numberOfMonths: 1, >- onSelect: function( selectedDate ) { >- var option = this.id == "from[% bibitemloo.biblionumber %]" ? "minDate" : "maxDate", >- instance = $( this ).data( "datepicker" ); >- date = $.datepicker.parseDate( >- instance.settings.dateFormat || >- $.datepicker._defaults.dateFormat, >- selectedDate, instance.settings ); >- dates[% bibitemloo.biblionumber %].not( this ).datepicker( "option", option, date ); >- } >- }); >- [% END %] >- [% END %] >- >+ $('.hold-options').each(function() { >+ var dates = $(this).find('.holddatefrom, .holddateto').datepicker({ >+ minDate: 0, >+ changeMonth: true, >+ numberOfMonths: 1, >+ onSelect: function( selectedDate ) { >+ var option = $(this).hasClass('holddatefrom') ? "minDate" : "maxDate", >+ instance = $(this).data('datepicker'), >+ dateFormat = instance.settings.dateFormat >+ || $.datepicker._defaults.dateFormat, >+ date = $.datepicker.parseDate(dateFormat, >+ selectedDate, instance.settings); >+ >+ dates.not(this).datepicker('option', option, date); >+ } >+ }); >+ }); > }); > // ]]> > </script> >+ >+<script> >+ $(document).ready(function() { >+ $('#requestany').on('change', function() { >+ if ($(this).is(':checked')) { >+ $('.holdrow > fieldset').hide(); >+ $('#hold-options').show(); >+ } else { >+ $('.holdrow > fieldset').show(); >+ $('#hold-options').hide(); >+ } >+ }).trigger('change'); >+ }); >+</script> > [% END %] >diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl >index 93773d9..d2591a2 100755 >--- a/opac/opac-reserve.pl >+++ b/opac/opac-reserve.pl >@@ -135,6 +135,8 @@ my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) > > $template->param( choose_branch => $OPACChooseBranch); > >+my $requestany = $query->param('requestany'); >+ > # > # > # Build hashes of the requested biblio(item)s and items. >@@ -221,6 +223,11 @@ if ( $query->param('place_reserve') ) { > &get_out($query, $cookie, $template->output); > } > >+ my $reserve_group_id; >+ if ($requestany) { >+ $reserve_group_id = AddReserveGroup(); >+ } >+ > my $failed_holds = 0; > while (@selectedItems) { > my $biblioNum = shift(@selectedItems); >@@ -287,11 +294,17 @@ if ( $query->param('place_reserve') ) { > > # Here we actually do the reserveration. Stage 3. > if ($canreserve) { >+ if ($requestany) { >+ $startdate = $query->param('reserve_date'); >+ $expiration_date = $query->param('expiration_date'); >+ $notes = $query->param('notes'); >+ } > my $reserve_id = AddReserve( > $branch, $borrowernumber, $biblioNum, > [$biblioNum], $rank, $startdate, > $expiration_date, $notes, $biblioData->{title}, > $itemNum, $found, $itemtype, >+ $reserve_group_id, > ); > $failed_holds++ unless $reserve_id; > ++$reserve_cnt; >-- >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 17217
: 54978