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

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

Return to bug 7825