View | Details | Raw Unified | Return to bug 7825
Collapse All | Expand All

(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 237-243 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
237
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','Textarea'),
237
('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations.','Textarea'),
238
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
238
('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'),
239
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
239
('OpacHoldNotes','0','','Show hold notes on OPAC','YesNo'),
240
('OPACItemHolds','1','','Allow OPAC users to place hold on specific items. If OFF, users can only request next available copy.','YesNo'),
240
('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'),
241
('OpacItemLocation','callnum','callnum|ccode|location','Show the shelving location of items in the opac','Choice'),
241
('OpacItemLocation','callnum','callnum|ccode|location','Show the shelving location of items in the opac','Choice'),
242
('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'),
242
('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'),
243
('OpacKohaUrl','1',NULL,'Show \'Powered by Koha\' text on OPAC footer.',NULL),
243
('OpacKohaUrl','1',NULL,'Show \'Powered by Koha\' text on OPAC footer.',NULL),
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 8465-8470 if ( CheckVersion($DBversion) ) { Link Here
8465
    SetVersion($DBversion);
8465
    SetVersion($DBversion);
8466
}
8466
}
8467
8467
8468
$DBversion = "3.13.00.XXX";
8469
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
8470
    $dbh->do("UPDATE systempreferences SET type = 'Choice', options = 'no|yes|force' WHERE variable = 'OPACItemHolds'");
8471
    print "Upgrade to $DBversion done (Changed OPACItemHolds syspref to Choice)\n";
8472
    SetVersion($DBversion);
8473
}
8474
8475
8468
=head1 FUNCTIONS
8476
=head1 FUNCTIONS
8469
8477
8470
=head2 TableExists($table)
8478
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-2 / +3 lines)
Lines 474-482 OPAC: Link Here
474
        -
474
        -
475
            - pref: OPACItemHolds
475
            - pref: OPACItemHolds
476
              choices:
476
              choices:
477
                  yes: Allow
478
                  no: "Don't allow"
477
                  no: "Don't allow"
479
            - 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.
478
                  yes: Allow
479
                  force: Force
480
            - 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.
480
        -
481
        -
481
            - pref: OpacRenewalAllowed
482
            - pref: OpacRenewalAllowed
482
              choices:
483
              choices:
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (-80 / +109 lines)
Lines 20-38 Link Here
20
     return s.substring(index + 1);
20
     return s.substring(index + 1);
21
 }
21
 }
22
22
23
// Select the first item available
24
function select_first_available(id){
25
    var radios = $("input:radio[name='checkitem_" + id + "']");
26
    $(radios).first().attr("checked", "checked");
27
}
28
23
 $(document).ready(function() {
29
 $(document).ready(function() {
24
    $('#hold-request-form').preventDoubleFormSubmit();
30
    $('#hold-request-form').preventDoubleFormSubmit();
25
31
26
    var copiesRowId = null;
32
    var copiesRowId = null;
27
    var wasSpecific = false;
33
    var wasSpecific = false;
28
    var lastCopiesRowId = null;
34
    var lastCopiesRowId = null;
29
	$(".checkitem").parent().click(function(e){
35
    $(".checkitem").parent().click(function(e){
30
		if(e.target.tagName.toLowerCase() == 'td'){
36
        if(e.target.tagName.toLowerCase() == 'td'){
31
           $(this).find("input.checkitem").each( function() {
37
           $(this).find("input.checkitem").each( function() {
32
               $(this).attr('checked', !$(this).attr('checked'));
38
               $(this).attr('checked', 'checked');
33
			});
39
            });
34
		}
40
        }
35
	});
41
    });
42
43
    // click on a first td check the confirmjs checkbox
44
    $("td.hold").click(function(e){
45
      if(e.target.tagName.toLowerCase() == 'td'){
46
        $(this).find("input.confirmjs").each( function() {
47
           $(this).attr('checked', !$(this).attr('checked'));
48
           $(this).change();
49
        });
50
      }
51
    });
52
36
    // Hides all 'specific copy' table rows on load.
53
    // Hides all 'specific copy' table rows on load.
37
    $(".copiesrow").hide();
54
    $(".copiesrow").hide();
38
55
Lines 45-51 Link Here
45
        }
62
        }
46
    });
63
    });
47
64
48
    $("#place_on_hdr,.place_on_type,.toggle-hold-options").show();
65
    $(".toggle-hold-options").show();
49
    $(".hold-options").hide();
66
    $(".hold-options").hide();
50
    $(".holddatefrom,.holddateto").prop("readOnly", true);
67
    $(".holddatefrom,.holddateto").prop("readOnly", true);
51
68
Lines 69-133 Link Here
69
    $(".confirmjs_hold").each(function(){
86
    $(".confirmjs_hold").each(function(){
70
        var bib = $(this).attr("title");
87
        var bib = $(this).attr("title");
71
        var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
88
        var html = "<label><input type =\"checkbox\" class=\"confirmjs\" checked=\"checked\"";
72
        html += "value=\"" + bib + "\"/> " + _("Place a hold on") + " </label> ";
89
        html += "value=\"" + bib + "\" id=\"" + bib + "\" /> " + _("Place a hold on") + " </label> ";
73
        $(this).html(html);
90
        $(this).html(html);
74
    });
91
    });
75
    $(".confirmjs_nohold").each(function(){
92
    $(".confirmjs_nohold").each(function(){
76
        var bib = $(this).attr("title");
93
        var bib = $(this).attr("title");
77
        var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
94
        var html = "<label><input type =\"checkbox\" class=\"confirmjs\" disabled=\"disabled\"";
78
        html += "value=\"" + bib + "\"/>" + _("Place a hold on: ") + "</label>";
95
        html += "value=\"" + bib + "\" id=\"" + bib + "\" />" + _("Place a hold on: ") + "</label>";
79
        $(this).html(html);
96
        $(this).html(html);
80
    });
97
    });
81
98
82
    // Make sure a specific item was selected where specified
99
    // expand or collapse the copiesrow tr
83
    // before moving on to a new item.
100
    function toggle_copiesrow(biblioNum) {
84
    function changeSelection (newCopiesRowId, isSpecific) {
101
        var checkbox = $("input:checkbox[value='"+biblioNum+"']");
85
        if (copiesRowId && ((copiesRowId != newCopiesRowId) || (wasSpecific != isSpecific))) {
86
            var biblioNum = suffixOf(copiesRowId, "_");
87
88
            // If the 'specific copy' radio button was checked
89
              if (wasSpecific && (copiesRowId != newCopiesRowId)) {
90
                // Find the selected copy
91
                var item = $(".checkitem_" + biblioNum + ":checked");
92
                if ($(item).size() == 0) {
93
                    alert(MSG_NO_ITEM_SELECTED);
94
                    return false;
95
                }
96
            }
97
        }
98
        copiesRowId = newCopiesRowId;
99
        wasSpecific = isSpecific;
100
        return true;
101
    }
102
103
    // When 'specific copy' radio button is clicked
104
    $(".selectspecific").click(function() {
105
106
        // Make sure all other specific copy table rows are hidden
107
        biblioNum = suffixOf($(this).attr("id"), "_");
108
        newCopiesRowId = "#copiesrow_" + biblioNum;
102
        newCopiesRowId = "#copiesrow_" + biblioNum;
103
        var select_specific = $("#reqspecific_"+biblioNum).is(":checked");
109
104
110
        if (!changeSelection(newCopiesRowId, true)) {
105
        // If the checkbox is checked AND we want a specific item, we display the items block
111
            return false;
106
        if ( $(checkbox).is(":checked") && select_specific ) {
107
            $(newCopiesRowId).show();
108
        } else {
109
            $(newCopiesRowId).hide();
112
        }
110
        }
111
    };
113
112
114
        // Show the specific copy table for this radio button.
113
    $("#place_on_hdr").show();
115
        $(newCopiesRowId).show();
116
    });
117
114
115
    [% IF OPACItemHolds == '1' %]
116
        $(".place_on_type").show();
117
        // onload, selectany is checked
118
        $(".selectany").attr("checked", "checked");
119
    [% END %]
118
120
119
    // When 'first available' radion button is clicked
121
    // If we can choose a specific item, we preselect the first one
120
    $(".selectany").click(function() {
122
    [% IF OPACItemHolds =="1" or OPACItemHolds == 'force' %]
121
        // Make sure all other specific copy table rows are hidden
123
        $("table.copiesrow").each(function(){
122
        biblioNum = suffixOf($(this).attr("id"), "_");
124
            var id = suffixOf($(this).attr("id"), "_");
123
        newCopiesRowId = "#copiesrow_" + biblioNum;
125
            select_first_available(id);
126
        });
127
    [% END %]
124
128
125
        if (!changeSelection(newCopiesRowId, false)) {
129
    // On confirmsjs change
126
            return false;
130
    $(".confirmjs").change(function(){
131
        var id = suffixOf($(this).attr("id"), "_");
132
        // If I m checked, I enable radio buttons
133
        if ( $(this).is(":checked") ) {
134
            $("#reqspecific_" + id).attr("disabled", false);
135
            $("#reqany_" + id).attr("disabled", false);
136
        }
137
        // Else its are disabled
138
        else {
139
            $("#reqspecific_" + id).attr("disabled", "disabled");
140
            $("#reqany_" + id).attr("disabled", "disabled");
127
        }
141
        }
142
        // expand or collaspe the items block
143
        toggle_copiesrow(id);
144
   });
145
146
    // When 'specific copy' or 'first available' radio button is clicked
147
    $(".selectspecific, .selectany").click(function() {
148
        var id = suffixOf($(this).attr("id"), "_");
149
        toggle_copiesrow(id);
150
    });
128
151
129
        // Hide the copies table row
152
    // Show or hide holds notes
130
        $(newCopiesRowId).hide();
153
    $(".shownotes").click(function(){
154
        biblioNum = suffixOf($(this).attr("id"), "_");
155
        $("#notesrow_"+biblioNum).toggle();
131
    });
156
    });
132
157
133
    // When 'Place Hold' button is clicked
158
    // When 'Place Hold' button is clicked
Lines 176-182 Link Here
176
201
177
        $("#selections").val(selections);
202
        $("#selections").val(selections);
178
        $("#biblionumbers").val(biblionumbers);
203
        $("#biblionumbers").val(biblionumbers);
179
180
        return true;
204
        return true;
181
    });
205
    });
182
    $(".toggle-hold-options").on("click",function(e){
206
    $(".toggle-hold-options").on("click",function(e){
Lines 426-473 Link Here
426
450
427
                        [% IF ( bibitemloo.holdable ) %]
451
                        [% IF ( bibitemloo.holdable ) %]
428
                            <!-- HOLD ABLE -->
452
                            <!-- HOLD ABLE -->
429
                            [% IF ( OPACItemHolds ) %]
453
                            [% IF OPACItemHolds == '1' or OPACItemHolds == 'force' %]
430
                            <!-- ITEM HOLDS -->
454
                            <!-- ITEM HOLDS -->
431
455
432
                                <li class="radio">
456
                                <li class="radio place_on_type" style="display:none;">
433
                                  [% UNLESS ( bibitemloo.holdable ) %]
457
                                  [% IF OPACItemHolds == "1" %]
434
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
458
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
435
                                           id="reqany_[% bibitemloo.biblionumber %]"
459
                                            id="reqany_[% bibitemloo.biblionumber %]"
436
                                           class="selectany"
460
                                            class="selectany"
437
                                           value="Any"
461
                                            value="Any"
438
                                           disabled="disabled"
462
                                            checked="checked"
439
                                    />
463
                                     />
440
                                  [% ELSE %]
464
                                  [% ELSE %]
441
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
465
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
442
                                           id="reqany_[% bibitemloo.biblionumber %]"
466
                                            id="reqany_[% bibitemloo.biblionumber %]"
443
                                           class="selectany"
467
                                            class="selectany"
444
                                           value="Any"
468
                                            value="Any"
445
                                           checked="checked"
469
                                     />
446
                                    />
447
                                  [% END %]
470
                                  [% END %]
448
449
                                  <label for="reqany_[% bibitemloo.biblionumber %]">Next available item</label>
471
                                  <label for="reqany_[% bibitemloo.biblionumber %]">Next available item</label>
450
                                  [% UNLESS ( bibitemloo.holdable ) %]
472
                                  [% IF OPACItemHolds == "force" %]
451
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
473
                                      <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
452
                                           id="reqspecific_[% bibitemloo.biblionumber %]"
474
                                             id="reqspecific_[% bibitemloo.biblionumber %]"
453
                                           class="selectspecific"
475
                                             class="selectspecific"
454
                                           disabled="disabled"
476
                                             value="Specific"
455
                                           value="Specific"
477
                                             checked="checked"
456
                                    />
478
                                      />
457
                                  [% ELSE %]
479
                                  [% ELSE %]
458
                                    <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
480
                                      <input type="radio" name="reqtype_[% bibitemloo.biblionumber %]"
459
                                           id="reqspecific_[% bibitemloo.biblionumber %]"
481
                                             id="reqspecific_[% bibitemloo.biblionumber %]"
460
                                           class="selectspecific"
482
                                             class="selectspecific"
461
                                           value="Specific"
483
                                             value="Specific"
462
                                    />
484
                                      />
463
                                  [% END %]
485
                                  [% END %]
464
                                  <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label>
486
                                  <label for="reqspecific_[% bibitemloo.biblionumber %]">A specific item</label>
465
                                </li>
487
                                </li>
466
488
489
                        [% IF OPACItemHolds == 'force' %]
490
                            <script type="text/javascript">
491
                                $(document).ready(function() {
492
                                    $("#copiesrow_[% bibitemloo.biblionumber %]").show();
493
                                });
494
                            </script>
495
                        [% END %]
496
467
                            [% END %]
497
                            [% END %]
468
                </ul>
498
                </ul>
469
                        [% END %]
499
                        [% END %]
470
                  [% IF ( OPACItemHolds ) %]
500
                  [% IF OPACItemHolds == '1' || OPACItemHolds == 'force' %]
471
                  [% IF ( bibitemloo.holdable ) %]
501
                  [% IF ( bibitemloo.holdable ) %]
472
502
473
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
503
                        <table class="copiesrow" id="copiesrow_[% bibitemloo.biblionumber %]">
Lines 496-502 Link Here
496
                                  <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
526
                                  <input type="radio" class="checkitem checkitem_[% bibitemloo.biblionumber %]" name="checkitem_[% bibitemloo.biblionumber %]"
497
                                         value="[% itemLoo.itemnumber %]" />
527
                                         value="[% itemLoo.itemnumber %]" />
498
                                [% ELSE %]
528
                                [% ELSE %]
499
                                  <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]" />
529
                                  <input disabled="disabled" type="radio" class="checkitem" name="checkitem" value="[% itemLoo.itemnumber %]"
530
                                         style="display:none;" />
500
                                  <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
531
                                  <img src="/opac-tmpl/lib/famfamfam/silk/cross.png" alt="Cannot be put on hold" title="Cannot be put on hold" />
501
                                [% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %]
532
                                [% END %] [% IF ( itemLoo.copynumber ) %][% itemLoo.copynumber %][% END %]
502
                              </td>
533
                              </td>
Lines 552-558 Link Here
552
583
553
            </div>
584
            </div>
554
                [% END %]
585
                [% END %]
555
556
              [% END %] <!-- if message -->
586
              [% END %] <!-- if message -->
557
            </div><!-- bigloop -->
587
            </div><!-- bigloop -->
558
588
559
- 

Return to bug 7825