Bugzilla – Attachment 22877 Details for
Bug 7825
Change OPACItemHolds syspref to be of type Choice, choices being "no", "yes", "force"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7825: Changed OPACItemHolds syspref to be no|tes|force choice
Bug-7825-Changed-OPACItemHolds-syspref-to-be-notes.patch (text/plain), 17.75 KB, created by
Biblibre Sandboxes
on 2013-11-12 13:43:40 UTC
(
hide
)
Description:
Bug 7825: Changed OPACItemHolds syspref to be no|tes|force choice
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2013-11-12 13:43:40 UTC
Size:
17.75 KB
patch
obsolete
>From de3dfc9b687782c678a041a3c7255ed655a20339 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 26 Mar 2012 21:34:34 +1300 >Subject: [PATCH] Bug 7825: Changed OPACItemHolds syspref to be no|tes|force choice > >Currently, the Koha system preference OPACItemHolds allows a library >system to choose to allow patrons to place bib and item level holds from >the OPAC, or to allow patrons only to place bib level holds only from >the opac. > >This patch set adds a third option, "force", which *requires* that >patrons place item level holds from the opac, with no option of making a >bib level hold. > >This patch modifies the system preference OPACItemHolds to be of the >type "Choice", with the choices being "no", "yes", "force". The patch >does not alter the currently set value of OPACItemHolds for database >updates, only adding the additional option. > >Test Plan: >1) Set OPACItemHolds to "no". Check that OPAC holds behave as it is now >(no "Place On" column, no "Select a specific copy" table, making a >reserve is successful) >2) Set OPACItemHolds to "yes". Check that OPAC holds behave as it is now >( "Place On" column is there, "Select a specific copy" table shows when >"A specific copy" is selected, making a reserve is successful) >3) Set OPACItemHolds to "force". Check that OPAC holds behave as follows: > - no "Place On" column is present > - "Select a specific copy" table is opened > - making a reserve is successful > >This patch is a squashed patch of the 3 following patches: > >Amended opac-reserve.tt accordingly > >Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com> > >Bug 7825: Followup prevent submission without choosing an item > >+ Fix some ergonomic issues in opac-reserve > >Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com> > >Bug 7825: Updatedatabase should only change the type and options values. > >The value field should not be change. We have to keep '1' for 'yes' and '' >for 'no'. > >Original patch is from Srdjan Jankovic. > >Signed-off-by: Koha team AMU <koha.aixmarseille@gmail.com> >--- > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 8 + > .../prog/en/modules/admin/preferences/opac.pref | 5 +- > .../opac-tmpl/prog/en/modules/opac-reserve.tt | 188 +++++++++++-------- > 4 files changed, 121 insertions(+), 82 deletions(-) > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 72eead2..97f99d1 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -228,7 +228,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','Textarea'), > ('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'), > ('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'), >-('OPACItemHolds','1','','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','YesNo'), >+('OPACItemHolds','yes','no|yes|force','Allow OPAC users to place hold on specific items. If No, users can only request next available copy. If Yes, users can choose between next available and specific copy. If Force, users *must* choose a specific copy.','Choice'), > ('OpacItemLocation','callnum','callnum|ccode|location','Show the shelving location of items in the opac','Choice'), > ('OPACItemsResultsDisplay','0','','If OFF : show only the status of items in result list.If ON : show full location of items (branch+location+callnumber) as in staff interface','YesNo'), > ('OpacKohaUrl','1',NULL,'Show \'Powered by Koha\' text on OPAC footer.',NULL), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 6162bc5..33e3905 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7743,6 +7743,14 @@ if(CheckVersion($DBversion)) { > SetVersion($DBversion); > } > >+ >+$DBversion = "3.13.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("UPDATE systempreferences SET type = 'Choice', options = 'no|yes|force' WHERE variable = 'OPACItemHolds'"); >+ print "Upgrade to $DBversion done (Changed OPACItemHolds syspref to Choice)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index a75c7ef..1361c54 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -454,9 +454,10 @@ OPAC: > - > - pref: OPACItemHolds > choices: >- yes: Allow > no: "Don't allow" >- - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item. >+ yes: Allow >+ force: Force >+ - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item. If this is forced, users must put a hold on a specific item. > - > - pref: OpacRenewalAllowed > choices: >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >index 671e1f9..0d91bfd 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt >@@ -18,19 +18,36 @@ > return s.substring(index + 1); > } > >+// Select the first item available >+function select_first_available(id){ >+ var radios = $("input:radio[name='checkitem_" + id + "']"); >+ $(radios).first().attr("checked", "checked"); >+} >+ > $(document).ready(function() { > $('#hold-request-form').preventDoubleFormSubmit(); > > var copiesRowId = null; > var wasSpecific = false; > var lastCopiesRowId = null; >- $(".checkitem").parent().click(function(e){ >- if(e.target.tagName.toLowerCase() == 'td'){ >+ $(".checkitem").parent().click(function(e){ >+ if(e.target.tagName.toLowerCase() == 'td'){ > $(this).find("input.checkitem").each( function() { >- $(this).attr('checked', !$(this).attr('checked')); >- }); >- } >- }); >+ $(this).attr('checked', 'checked'); >+ }); >+ } >+ }); >+ >+ // click on a first td check the confirmjs checkbox >+ $("td.hold").click(function(e){ >+ if(e.target.tagName.toLowerCase() == 'td'){ >+ $(this).find("input.confirmjs").each( function() { >+ $(this).attr('checked', !$(this).attr('checked')); >+ $(this).change(); >+ }); >+ } >+ }); >+ > // Hides all 'specific copy' table rows on load. > $(".copiesrow").hide(); > >@@ -43,7 +60,7 @@ > } > }); > >- $("#place_on_hdr,.place_on_type,.toggle-hold-options").show(); >+ $(".toggle-hold-options").show(); > $(".hold-options").hide(); > $(".holddatefrom,.holddateto").prop("readOnly", true); > >@@ -67,65 +84,73 @@ > $(".confirmjs_hold").each(function(){ > var bib = $(this).attr("title"); > var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\""; >- html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> "; >+ html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> "; > $(this).html(html); > }); > $(".confirmjs_nohold").each(function(){ > var bib = $(this).attr("title"); > var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\""; >- html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>"; >+ html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>"; > $(this).html(html); > }); > >- // Make sure a specific item was selected where specified >- // before moving on to a new item. >- function changeSelection (newCopiesRowId, isSpecific) { >- if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) { >- var biblioNum = suffixOf(copiesRowId, "_"); >- >- // If the 'specific copy' radio button was checked >- if (wasSpecific && (copiesRowId != newCopiesRowId)) { >- // Find the selected copy >- var item = $(".checkitem_" + biblioNum + ":checked"); >- if ($(item).size() == 0) { >- alert(MSG_NO_COPY_SELECTED); >- return false; >- } >- } >- } >- copiesRowId = newCopiesRowId; >- wasSpecific = isSpecific; >- return true; >- } >- >- // When 'specific copy' radio button is clicked >- $(".selectspecific").click(function() { >- >- // Make sure all other specific copy table rows are hidden >- biblioNum = suffixOf($(this).attr("id"), "_"); >+ // expand or collapse the copiesrow tr >+ function toggle_copiesrow(biblioNum) { >+ var checkbox = $("input:checkbox[value='"+biblioNum+"']"); > newCopiesRowId = "#copiesrow_" + biblioNum; >+ var select_specific = $("#reqspecific_"+biblioNum).is(":checked"); > >- if (!changeSelection(newCopiesRowId, true)) { >- return false; >+ // If the checkbox is checked AND we want a specific item, we display the items block >+ if ( $(checkbox).is(":checked") && select_specific ) { >+ $(newCopiesRowId).show(); >+ } else { >+ $(newCopiesRowId).hide(); > } >+ }; > >- // Show the specific copy table for this radio button. >- $(newCopiesRowId).show(); >- }); >+ $("#place_on_hdr").show(); > >+ [% IF OPACItemHolds == '1' %] >+ $(".place_on_type").show(); >+ // onload, selectany is checked >+ $(".selectany").attr("checked", "checked"); >+ [% END %] > >- // When 'first available' radion button is clicked >- $(".selectany").click(function() { >- // Make sure all other specific copy table rows are hidden >- biblioNum = suffixOf($(this).attr("id"), "_"); >- newCopiesRowId = "#copiesrow_" + biblioNum; >+ // If we can choose a specific item, we preselect the first one >+ [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %] >+ $("table.copiesrow").each(function(){ >+ var id = suffixOf($(this).attr("id"), "_"); >+ select_first_available(id); >+ }); >+ [% END %] > >- if (!changeSelection(newCopiesRowId, false)) { >- return false; >+ // On confirmsjs change >+ $(".confirmjs").change(function(){ >+ var id = suffixOf($(this).attr("id"), "_"); >+ // If I m checked, I enable radio buttons >+ if ( $(this).is(":checked") ) { >+ $("#reqspecific_" + id).attr("disabled", false); >+ $("#reqany_" + id).attr("disabled", false); >+ } >+ // Else its are disabled >+ else { >+ $("#reqspecific_" + id).attr("disabled", "disabled"); >+ $("#reqany_" + id).attr("disabled", "disabled"); > } >+ // expand or collaspe the items block >+ toggle_copiesrow(id); >+ }); >+ >+ // When 'specific copy' or 'first available' radio button is clicked >+ $(".selectspecific, .selectany").click(function() { >+ var id = suffixOf($(this).attr("id"), "_"); >+ toggle_copiesrow(id); >+ }); > >- // Hide the copies table row >- $(newCopiesRowId).hide(); >+ // Show or hide holds notes >+ $(".shownotes").click(function(){ >+ biblioNum = suffixOf($(this).attr("id"), "_"); >+ $("#notesrow_"+biblioNum).toggle(); > }); > > // When 'Place Hold' button is clicked >@@ -174,7 +199,6 @@ > > $("#selections").val(selections); > $("#biblionumbers").val(biblionumbers); >- > return true; > }); > $(".toggle-hold-options").on("click",function(e){ >@@ -421,48 +445,54 @@ > > [% IF ( bibitemloo.holdable ) %] > <!-- HOLD ABLE --> >- [% IF ( OPACItemHolds ) %] >+ [% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %] > <!-- ITEM HOLDS --> > >- <li class="radio"> >- [% UNLESS ( bibitemloo.holdable ) %] >+ <li class="radio place_on_type" style="display:none;"> >+ [% IF OPACItemHolds == "1" %] > <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqany_[% bibitemloo.biblionumber %]" >- class="selectany" >- value="Any" >- disabled="disabled" >- /> >+ id="reqany_[% bibitemloo.biblionumber %]" >+ class="selectany" >+ value="Any" >+ checked="checked" >+ /> > [% ELSE %] > <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqany_[% bibitemloo.biblionumber %]" >- class="selectany" >- value="Any" >- checked="checked" >- /> >+ id="reqany_[% bibitemloo.biblionumber %]" >+ class="selectany" >+ value="Any" >+ /> > [% END %] >- > <label for="reqany_[% bibitemloo.biblionumber %]">Next available copy</label> >- [% UNLESS ( bibitemloo.holdable ) %] >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqspecific_[% bibitemloo.biblionumber %]" >- class="selectspecific" >- disabled="disabled" >- value="Specific" >- /> >+ [% IF OPACItemHolds == "force" %] >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqspecific_[% bibitemloo.biblionumber %]" >+ class="selectspecific" >+ value="Specific" >+ checked="checked" >+ /> > [% ELSE %] >- <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >- id="reqspecific_[% bibitemloo.biblionumber %]" >- class="selectspecific" >- value="Specific" >- /> >+ <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]" >+ id="reqspecific_[% bibitemloo.biblionumber %]" >+ class="selectspecific" >+ value="Specific" >+ /> > [% END %] > <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific copy</label> > </li> > >+ [% IF OPACItemHolds == 'force' %] >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ $("#copiesrow_[% bibitemloo.biblionumber %]").show(); >+ }); >+ </script> >+ [% END %] >+ > [% END %] > </ul> > [% END %] >- [% IF ( OPACItemHolds ) %] >+ [% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %] > [% IF ( bibitemloo.holdable ) %] > > <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]"> >@@ -491,7 +521,8 @@ > <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]" > value="[% itemLoo.itemnumber %]" /> > [% ELSE %] >- <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" /> >+ <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" >+ style="display:none;" /> > <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" /> > [% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %] > </td> >@@ -547,7 +578,6 @@ > > </div> > [% END %] >- > [% END %] <!-- if message --> > </div><!-- bigloop --> > >-- >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 7825
:
8641
|
8645
|
8646
|
12881
|
12883
|
12884
|
12885
|
12915
|
12920
|
12921
|
12922
|
12923
|
13305
|
13306
|
13307
|
13340
|
13341
|
13350
|
15032
|
15033
|
15034
|
15035
|
15606
|
15607
|
18435
|
18436
|
18878
|
18879
|
18903
|
18904
|
18920
|
18924
|
18925
|
18926
|
18927
|
18928
|
22635
|
22877
|
23631
|
24218
|
24270
|
24271
|
24538
|
24539
|
24540
|
24541
|
24542
|
24578
|
24579
|
24591
|
24592
|
27961
|
27962
|
27963
|
27964
|
27965
|
27966