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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-31 / +86 lines)
Lines 2-7 Link Here
2
[% USE KohaDates %]
2
[% USE KohaDates %]
3
[% USE Price %]
3
[% USE Price %]
4
[% USE ItemTypes %]
4
[% USE ItemTypes %]
5
[% USE Branches %]
6
5
[% INCLUDE 'doc-head-open.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
6
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Placing a hold</title>
8
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Placing a hold</title>
7
[% INCLUDE 'doc-head-close.inc' %]
9
[% INCLUDE 'doc-head-close.inc' %]
Lines 135-140 Link Here
135
                            <!-- These values are set dynamically by js -->
137
                            <!-- These values are set dynamically by js -->
136
                            <input type="hidden" name="biblionumbers" id="biblionumbers"/>
138
                            <input type="hidden" name="biblionumbers" id="biblionumbers"/>
137
                            <input type="hidden" name="selecteditems" id="selections"/>
139
                            <input type="hidden" name="selecteditems" id="selections"/>
140
                            <label>
141
                                <input type="checkbox" id="requestany" name="requestany" value="1">
142
                                Place a hold on the first available item among the selected titles
143
                            </label>
144
                            <div id="hold-options" class="hold-options">
145
                                <fieldset class="rows">
146
                                    <ul>
147
                                        <li>
148
                                            <label for="branch">Pickup location:</label>
149
                                            <select id="branch" name="branch">
150
                                                [% FOREACH branch IN Branches.all({selected = Branches.GetLoggedInBranchcode }) %]
151
                                                    [% IF branch.selected %]
152
                                                        <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
153
                                                    [% ELSE %]
154
                                                        <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
155
                                                    [% END %]
156
                                                [% END %]
157
                                            </select>
158
                                        </li>
159
                                        [% IF ( reserve_in_future ) %]
160
                                            <li>
161
                                                <label for="from">Hold starts on date:</label>
162
                                                <input name="reserve_date" id="from" size="10" class="holddatefrom"/>
163
                                                <span class="date-format from" data-biblionumber="all">[% INCLUDE 'date-format.inc' %]</span>
164
                                            </li>
165
                                        [% END %]
166
                                        <li>
167
                                            <label for="to">Hold not needed after:</label>
168
                                            <input name="expiration_date" id="to" size="10" class="holddateto" />
169
                                            <span class="date-format to" data-biblionumber="all">[% INCLUDE 'date-format.inc' %]</span>
170
                                        </li>
171
                                        [% IF ( OpacHoldNotes ) %]
172
                                            <li>
173
                                                <div class="notesrow" id="notesrow">
174
                                                    <label for="holdnotes">Hold notes:</label>
175
                                                    <span id="forcenotesreason" class="forcenotesreason"></span>
176
                                                    <textarea id="holdnotes" rows="2" cols="30" name="notes"></textarea>
177
                                                </div>
178
                                            </li>
179
                                        [% END # / IF OpacHoldNotes %]
180
                                    </ul>
181
                                </fieldset>
182
                            </div>
138
                            <div id="bigloop">
183
                            <div id="bigloop">
139
184
140
                                [% FOREACH bibitemloo IN bibitemloop %]
185
                                [% FOREACH bibitemloo IN bibitemloop %]
Lines 504-520 Link Here
504
        });
549
        });
505
550
506
        $(".date-format").each(function(){
551
        $(".date-format").each(function(){
507
            if($(this).hasClass("to")){ var op = "to"; }
552
            var input = $(this).siblings('input').first();
508
            if($(this).hasClass("from")){ var op = "from"; }
553
            var clearDateLink = $('<a></a>')
509
            var bibNum = $(this).data("biblionumber");
554
              .attr('href', '#')
510
            $(this).html("<a href=\"#\" class=\"clear-date\" data-op=\"" + op + "\" id=\"clear" + bibNum + "\">" + _("Clear date") + "</a>");
555
              .addClass('clear-date')
511
        });
556
              .html(_("Clear date"))
512
557
              .on('click', function(e) {
513
        $(".clear-date").on("click",function(e){
558
                  e.preventDefault();
514
            e.preventDefault();
559
                  input.val('');
515
            var fieldID = this.id.replace("clear","");
560
              });
516
            var op = $(this).data("op");
561
            $(this).empty().append(clearDateLink);
517
            $("#" + op + fieldID).val("");
518
        });
562
        });
519
563
520
        // Replace non-JS single-selection with multi-selection capability.
564
        // Replace non-JS single-selection with multi-selection capability.
Lines 645-671 Link Here
645
            return true;
689
            return true;
646
        });
690
        });
647
691
648
        [% FOREACH bibitemloo IN bibitemloop %]
692
        $('.hold-options').each(function() {
649
            [% IF ( bibitemloo.holdable ) %]
693
            var dates = $(this).find('.holddatefrom, .holddateto').datepicker({
650
                // http://jqueryui.com/demos/datepicker/#date-range
694
                minDate: 0,
651
                var dates[% bibitemloo.biblionumber %] = $( "#from[% bibitemloo.biblionumber %], #to[% bibitemloo.biblionumber %]" ).datepicker({
695
                changeMonth: true,
652
                    minDate: 0,
696
                numberOfMonths: 1,
653
                    changeMonth: true,
697
                onSelect: function( selectedDate ) {
654
                    numberOfMonths: 1,
698
                    var option = $(this).hasClass('holddatefrom') ? "minDate" : "maxDate",
655
                    onSelect: function( selectedDate ) {
699
                        instance = $(this).data('datepicker'),
656
                        var option = this.id == "from[% bibitemloo.biblionumber %]" ? "minDate" : "maxDate",
700
                        dateFormat = instance.settings.dateFormat
657
                            instance = $( this ).data( "datepicker" );
701
                            || $.datepicker._defaults.dateFormat,
658
                            date = $.datepicker.parseDate(
702
                        date = $.datepicker.parseDate(dateFormat,
659
                                instance.settings.dateFormat ||
703
                            selectedDate, instance.settings);
660
                                $.datepicker._defaults.dateFormat,
704
661
                                selectedDate, instance.settings );
705
                    dates.not(this).datepicker('option', option, date);
662
                        dates[% bibitemloo.biblionumber %].not( this ).datepicker( "option", option, date );
706
                }
663
                    }
707
            });
664
                });
708
        });
665
            [% END %]
666
        [% END %]
667
668
 });
709
 });
669
// ]]>
710
// ]]>
670
</script>
711
</script>
712
713
<script>
714
    $(document).ready(function() {
715
        $('#requestany').on('change', function() {
716
            if ($(this).is(':checked')) {
717
                $('.holdrow > fieldset').hide();
718
                $('#hold-options').show();
719
            } else {
720
                $('.holdrow > fieldset').show();
721
                $('#hold-options').hide();
722
            }
723
        }).trigger('change');
724
    });
725
</script>
671
[% END %]
726
[% END %]
(-)a/opac/opac-reserve.pl (-1 / +13 lines)
Lines 135-140 my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) Link Here
135
135
136
$template->param( choose_branch => $OPACChooseBranch);
136
$template->param( choose_branch => $OPACChooseBranch);
137
137
138
my $requestany = $query->param('requestany');
139
138
#
140
#
139
#
141
#
140
# Build hashes of the requested biblio(item)s and items.
142
# Build hashes of the requested biblio(item)s and items.
Lines 221-226 if ( $query->param('place_reserve') ) { Link Here
221
        &get_out($query, $cookie, $template->output);
223
        &get_out($query, $cookie, $template->output);
222
    }
224
    }
223
225
226
    my $reserve_group_id;
227
    if ($requestany) {
228
        $reserve_group_id = AddReserveGroup();
229
    }
230
224
    my $failed_holds = 0;
231
    my $failed_holds = 0;
225
    while (@selectedItems) {
232
    while (@selectedItems) {
226
        my $biblioNum = shift(@selectedItems);
233
        my $biblioNum = shift(@selectedItems);
Lines 287-297 if ( $query->param('place_reserve') ) { Link Here
287
294
288
        # Here we actually do the reserveration. Stage 3.
295
        # Here we actually do the reserveration. Stage 3.
289
        if ($canreserve) {
296
        if ($canreserve) {
297
            if ($requestany) {
298
                $startdate = $query->param('reserve_date');
299
                $expiration_date = $query->param('expiration_date');
300
                $notes = $query->param('notes');
301
            }
290
            my $reserve_id = AddReserve(
302
            my $reserve_id = AddReserve(
291
                $branch,          $borrowernumber, $biblioNum,
303
                $branch,          $borrowernumber, $biblioNum,
292
                [$biblioNum],     $rank,           $startdate,
304
                [$biblioNum],     $rank,           $startdate,
293
                $expiration_date, $notes,          $biblioData->{title},
305
                $expiration_date, $notes,          $biblioData->{title},
294
                $itemNum,         $found,          $itemtype,
306
                $itemNum,         $found,          $itemtype,
307
                $reserve_group_id,
295
            );
308
            );
296
            $failed_holds++ unless $reserve_id;
309
            $failed_holds++ unless $reserve_id;
297
            ++$reserve_cnt;
310
            ++$reserve_cnt;
298
- 

Return to bug 17217