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

(-)a/C4/Reserves.pm (-1 / +43 lines)
Lines 142-148 BEGIN { Link Here
142
142
143
        IsItemOnHoldAndFound
143
        IsItemOnHoldAndFound
144
    );
144
    );
145
    @EXPORT_OK = qw( MergeHolds );
145
    @EXPORT_OK = qw( MergeHolds IsHoldNoteRequired );
146
}
146
}
147
147
148
=head2 AddReserve
148
=head2 AddReserve
Lines 2450-2455 sub IsItemOnHoldAndFound { Link Here
2450
    return $found;
2450
    return $found;
2451
}
2451
}
2452
2452
2453
=head2 IsHoldNoteRequired
2454
2455
    my $boolean = IsHoldNoteRequired( $marc );
2456
2457
    Checks if a hold note is required for a given record.
2458
    Triggered by the pref HoldNoteReasons.
2459
    This pref may contain a list of reason codes to be checked.
2460
    So, it could look like: LEADER_SERIAL|MARC300A_PARTS
2461
2462
    This routine returns true if the note is required, undef otherwise.
2463
2464
=cut
2465
2466
sub IsHoldNoteRequired {
2467
    my ( $marcrecord ) = @_;
2468
    return if !$marcrecord || !C4::Context->preference( 'OPACHoldNotes' );
2469
    my $reasons = uc C4::Context->preference( 'HoldNoteReasons' );
2470
    return if !$reasons;
2471
    my $ldr = $marcrecord->leader;
2472
2473
    # check LEADER_SERIAL
2474
    if( $reasons =~ /LEADER_SERIAL/ && substr($ldr,7,1) eq 's' ) {
2475
        return 1;
2476
    }
2477
    # check LEADER_COLLECTION
2478
    if( $reasons =~ /LEADER_COLLECTION/ && substr($ldr,7,1) eq 'c' ) {
2479
        return 1;
2480
    }
2481
    # check MARC300A_PARTS
2482
    if( $reasons =~ /MARC300A_PARTS/ &&
2483
      ( my @fld = $marcrecord->field('300') )) {
2484
        my $re = qr/(\d+)\s*(v\.|vol|dl|delen|band|bd|tle|parts|pts|t\.|tome)/i;
2485
        foreach my $f ( @fld ) {
2486
            next if !$f->subfield('a');
2487
            # Check for something like 3 parts or 22 volumes in 300$a
2488
            return 1 if $f->subfield('a') =~ /$re/ && $1 > 1;
2489
        }
2490
    }
2491
    # next reason comes here..
2492
    return;
2493
}
2494
2453
=head1 AUTHOR
2495
=head1 AUTHOR
2454
2496
2455
Koha Development Team <http://koha-community.org/>
2497
Koha Development Team <http://koha-community.org/>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt (-19 / +17 lines)
Lines 251-260 Link Here
251
                                                        [% IF ( OpacHoldNotes ) %]
251
                                                        [% IF ( OpacHoldNotes ) %]
252
                                                            <li>
252
                                                            <li>
253
                                                                <div class="notesrow" id="notesrow_[% bibitemloo.biblionumber %]">
253
                                                                <div class="notesrow" id="notesrow_[% bibitemloo.biblionumber %]">
254
                                                                    <label for="holdnotes[% bibitemloo.biblionumber %]">Hold notes:</label>
254
                                                                    <label for="holdnotes_[% bibitemloo.biblionumber %]">Hold notes:</label>
255
                                                                    <span id="forcenotesreason_[% bibitemloo.biblionumber %]" class="forcenotesreason"></span>
255
                                                                    [% IF bibitemloo.reqholdnotes %]
256
                                                                    <textarea id="holdnotes[% bibitemloo.biblionumber %]" rows="2" cols="30" name="notes_[% bibitemloo.biblionumber %]">[% bibitemloo.holdnotes %]</textarea>
256
                                                                        <span id="reqholdnotes_[% bibitemloo.biblionumber %]">Please enter additional information about the requested item:</span>
257
                                                                    <input type="hidden" id="notesmandatory_[% bibitemloo.biblionumber %]" value="[% bibitemloo.mandatorynotes %]"/>
257
                                                                    [% END %]
258
                                                                    <textarea id="holdnotes_[% bibitemloo.biblionumber %]" rows="2" cols="30" name="notes_[% bibitemloo.biblionumber %]" >[% bibitemloo.holdnotes %]</textarea>
258
                                                                </div>
259
                                                                </div>
259
                                                            </li>
260
                                                            </li>
260
                                                        [% END # / IF OpacHoldNotes %]
261
                                                        [% END # / IF OpacHoldNotes %]
Lines 406-415 Link Here
406
<script type="text/javascript">
407
<script type="text/javascript">
407
// <![CDATA[
408
// <![CDATA[
408
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
409
    var MSG_NO_ITEM_SELECTED = _("Expecting a specific item selection.");
409
    var ForceHoldNotesReasons=new Array(
410
       _("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific item information may be helpful."),
411
       "*** Add a new reason above this line ***" );
412
       // NOTE: Do not renumber reasons; this will affect use of existing ones.
413
410
414
        // Clear the contents of an input field
411
        // Clear the contents of an input field
415
        $(".clearfield").on("click",function(e){
412
        $(".clearfield").on("click",function(e){
Lines 469-485 Link Here
469
            $("#reqspecific_[% bibitemloo.biblionumber %]").click();
466
            $("#reqspecific_[% bibitemloo.biblionumber %]").click();
470
            $("#copiesrow_[% bibitemloo.biblionumber %]").show();
467
            $("#copiesrow_[% bibitemloo.biblionumber %]").show();
471
          [% END %]
468
          [% END %]
469
          [% IF bibitemloo.reqholdnotes %]
470
              $("#holdnotes_[% bibitemloo.biblionumber %]").attr( 'required', true );
471
          [% END %]
472
        [% END %]
472
        [% END %]
473
473
474
        // Insert reasons for forced hold notes
475
        $(".forcenotesreason").each(function(){
476
            biblioNum = suffixOf($(this).attr("id"), "_");
477
            var j=$("#notesmandatory_"+biblioNum).val();
478
            if(j>0) {
479
                $(this).html(ForceHoldNotesReasons[j-1]);
480
            }
481
        });
482
483
        $(".date-format").each(function(){
474
        $(".date-format").each(function(){
484
            if($(this).hasClass("to")){ var op = "to"; }
475
            if($(this).hasClass("to")){ var op = "to"; }
485
            if($(this).hasClass("from")){ var op = "from"; }
476
            if($(this).hasClass("from")){ var op = "from"; }
Lines 589-599 Link Here
589
                biblionumbers += biblioNum + "/";
580
                biblionumbers += biblioNum + "/";
590
                selections += biblioNum + "/";
581
                selections += biblioNum + "/";
591
582
583
                // If required hold note is empty, make it visible
584
                if( $("#holdnotes_"+biblioNum).attr( 'required' ) && $("#holdnotes_"+biblioNum).val() == '' ) {
585
                    if( !$("#hold-options-"+biblioNum).is(':visible')) {
586
                        $("#toggle-hold-options-"+biblioNum).click();
587
                    }
588
                }
589
592
                // If the 'specific copy' radio button is checked
590
                // If the 'specific copy' radio button is checked
593
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
591
                if ($("#reqspecific_" + biblioNum + ":checked").size() > 0) {
594
                    // Find the selected copy
592
                    // Find the selected copy
595
                    var item = $(".checkitem_" + biblioNum + ":checked");
593
                    var item = $(".checkitem_" + biblioNum + ":checked");
596
                    if ($(item).size() == 0) {
594
                    if ($(item).size() == 0) {
595
                        alert(MSG_NO_ITEM_SELECTED);
597
                        badBib = biblioNum;
596
                        badBib = biblioNum;
598
                        return false;
597
                        return false;
599
                    } else {
598
                    } else {
Lines 611-618 Link Here
611
                return true;
610
                return true;
612
            });
611
            });
613
612
614
            if (badBib) {
613
            if (badBib) { // alert has been raised already
615
                alert(MSG_NO_ITEM_SELECTED);
616
                return false;
614
                return false;
617
            }
615
            }
618
616
(-)a/opac/opac-reserve.pl (-2 / +1 lines)
Lines 408-414 foreach my $biblioNum (@biblionumbers) { Link Here
408
    $biblioLoopIter{rank} = $biblioData->{rank};
408
    $biblioLoopIter{rank} = $biblioData->{rank};
409
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
409
    $biblioLoopIter{reservecount} = $biblioData->{reservecount};
410
    $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
410
    $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
411
    $biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
411
    $biblioLoopIter{reqholdnotes} = C4::Reserves::IsHoldNoteRequired( $record );
412
412
413
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
413
    if (!$itemLevelTypes && $biblioData->{itemtype}) {
414
        $biblioLoopIter{translated_description} = $itemTypes->{$biblioData->{itemtype}}{translated_description};
414
        $biblioLoopIter{translated_description} = $itemTypes->{$biblioData->{itemtype}}{translated_description};
415
- 

Return to bug 15545