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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-203 / +203 lines)
Lines 284-290 Link Here
284
                                <tr>
284
                                <tr>
285
                                    <th>&nbsp;</th>
285
                                    <th>&nbsp;</th>
286
                                    <th>Title</th>
286
                                    <th>Title</th>
287
                                    [% UNLESS ( item_level_itypes ) %]
287
                                    [% UNLESS Koha.Preference('item-level_itypes') %]
288
                                        <th>Item type</th>
288
                                        <th>Item type</th>
289
                                    [% END %]
289
                                    [% END %]
290
                                    <th>Priority</th>
290
                                    <th>Priority</th>
Lines 316-324 Link Here
316
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
316
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
317
                                            [% END %]
317
                                            [% END %]
318
                                        </td>
318
                                        </td>
319
                                        [% UNLESS ( item_level_itypes ) %]
319
                                        [% UNLESS Koha.Preference('item-level_itypes') %]
320
                                            <td>
320
                                            <td>
321
                                                <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
321
                                                <img src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
322
                                            </td>
322
                                            </td>
323
                                        [% END %]
323
                                        [% END %]
324
                                        <td>[% biblioloo.rank | html %]</td>
324
                                        <td>[% biblioloo.rank | html %]</td>
Lines 572-793 Link Here
572
                                [% END %]
572
                                [% END %]
573
                            </fieldset>
573
                            </fieldset>
574
574
575
                            [% FOREACH bibitemloo IN bibitemloop %]
575
                            [% biblio = biblioloop.0 %]
576
                                <ol>
577
                                    [% UNLESS ( item_level_itypes ) %]
578
                                        <li>
579
                                            <span class="label">Item type:</span>
580
                                            [% bibitemloo.description | html %]
581
                                        </li>
582
                                    [% END %]
583
576
584
                                    [% IF ( bibitemloo.publicationyear ) %]
577
                            <ol>
585
                                        <li>
578
                                [% UNLESS Koha.Preference('item-level_itypes') %]
586
                                            <span class="label">Publication year:</span>
579
                                    <li>
587
                                            [% bibitemloo.publicationyear | html %]
580
                                        <span class="label">Item typeX:</span>
588
                                        </li>
581
                                        [% biblio.itemtype.translated_description | html %]
589
                                    [% END %]
582
                                    </li>
590
                                </ol>
583
                                [% END %]
591
584
592
                                <h2 style="padding: 0 1em;">
585
                                [% IF ( biblio.biblioitem.publicationyear ) %]
593
                                    Place a hold on a specific item
586
                                    <li>
594
                                    [% IF bibitemloo.force_hold_level == 'item' %]
587
                                        <span class="label">Publication year:</span>
595
                                         <span class="error"><em>(Required)</em></span>
588
                                        [% biblio.biblioitem.publicationyear | $KohaDates %]
596
                                    [% END %]
589
                                    </li>
597
                                </h2>
590
                                [% END %]
591
                            </ol>
598
592
599
                                <table id="requestspecific">
593
                            <h2 style="padding: 0 1em;">
600
                                    <thead>
594
                                Place a hold on a specific item
601
                                        <tr>
595
                                [% IF force_hold_level == 'item' %]
602
                                            <th>Hold</th>
596
                                     <span class="error"><em>(Required)</em></span>
603
                                            [% IF ( item_level_itypes ) %]
597
                                [% END %]
604
                                                <th>Item type</th>
598
                            </h2>
605
                                            [% END %]
599
606
                                            <th>Barcode</th>
600
                            <table id="requestspecific">
607
                                            <th>Home library</th>
601
                                <thead>
608
                                            <th>Last location</th>
602
                                    <tr>
609
                                            [% IF itemdata_ccode %]
603
                                        <th>Hold</th>
610
                                                <th>Collection</th>
604
                                        [% IF Koha.Preference('item-level_itypes') %]
611
                                            [% END %]
605
                                            <th>Item type</th>
612
                                            <th>Call number</th>
606
                                        [% END %]
613
                                            <th>Copy number</th>
607
                                        <th>Barcode</th>
614
                                            [% IF itemdata_enumchron %]
608
                                        <th>Home library</th>
615
                                                <th>Vol no.</th>
609
                                        <th>Last location</th>
616
                                            [% END %]
610
                                        [% IF itemdata_ccode %]
617
                                            <th>Information</th>
611
                                            <th>Collection</th>
618
                                            <th>Allowed pickup locations</th>
612
                                        [% END %]
619
                                        </tr>
613
                                        <th>Call number</th>
620
                                    </thead>
614
                                        <th>Copy number</th>
621
                                    <tbody>
615
                                        [% IF itemdata_enumchron %]
622
                                        [% SET selected = 0 %]
616
                                            <th>Vol no.</th>
623
                                        [% FOREACH itemloo IN bibitemloo.itemloop %]
617
                                        [% END %]
624
                                            [% UNLESS ( itemloo.hide ) %]
618
                                        <th>Information</th>
625
                                                <tr class="[% itemloo.backgroundcolor | html %]">
619
                                        <th>Allowed pickup locations</th>
626
                                                    <td>
620
                                    </tr>
627
                                                        [% IF itemloo.force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
621
                                </thead>
628
                                                            <span class="error">
622
                                <tbody>
629
                                                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
623
                                    [% SET selected = 0 %]
630
                                                                Hold must be record level
624
                                    [% FOREACH itemloo IN biblio.itemloop %]
631
                                                            </span>
625
                                        [% UNLESS ( itemloo.hide ) %]
632
                                                        [% ELSIF ( itemloo.available ) %]
626
                                            <tr class="[% itemloo.backgroundcolor | html %]">
633
                                                            <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
627
                                                <td>
634
                                                        [% ELSIF ( itemloo.override ) %]
628
                                                    [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
635
                                                            <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
629
                                                        <span class="error">
636
                                                            <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
630
                                                            <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
637
                                                        [% ELSE %]
631
                                                            Hold must be record level
638
                                                            <span class="error">
632
                                                        </span>
639
                                                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
633
                                                    [% ELSIF ( itemloo.available ) %]
640
                                                                [% IF itemloo.not_holdable %]
634
                                                        <input type="radio" name="checkitem" value="[% itemloo.itemnumber | html %]" />
641
                                                                    [% IF itemloo.not_holdable == 'damaged' %]
635
                                                    [% ELSIF ( itemloo.override ) %]
642
                                                                        Item damaged
636
                                                        <input type="radio" name="checkitem" class="needsoverride" value="[% itemloo.itemnumber | html %]" />
643
                                                                    [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
637
                                                        <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
644
                                                                        Age restricted
638
                                                    [% ELSE %]
645
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
639
                                                        <span class="error">
646
                                                                        Exceeded max holds per record
640
                                                            <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
647
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
641
                                                            [% IF itemloo.not_holdable %]
648
                                                                        Daily hold limit reached for patron
642
                                                                [% IF itemloo.not_holdable == 'damaged' %]
649
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
643
                                                                    Item damaged
650
                                                                        Too many holds
644
                                                                [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
651
                                                                    [% ELSIF itemloo.not_holdable == 'notReservable' %]
645
                                                                    Age restricted
652
                                                                        Not holdable
646
                                                                [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
653
                                                                    [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
647
                                                                    Exceeded max holds per record
654
                                                                        Patron is from different library
648
                                                                [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
655
                                                                    [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
649
                                                                    Daily hold limit reached for patron
656
                                                                        Cannot place hold from patron's library
650
                                                                [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
657
                                                                    [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
651
                                                                    Too many holds
658
                                                                        Patron already has hold for this item
652
                                                                [% ELSIF itemloo.not_holdable == 'notReservable' %]
659
                                                                    [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
653
                                                                    Not holdable
660
                                                                        Cannot be transferred to pickup library
654
                                                                [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
661
                                                                    [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
655
                                                                    Patron is from different library
662
                                                                        Only pickup locations within the same hold group are allowed
656
                                                                [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
663
                                                                    [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
657
                                                                    Cannot place hold from patron's library
664
                                                                        No reserves are allowed on this item
658
                                                                [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
665
                                                                    [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
659
                                                                    Patron already has hold for this item
666
                                                                        Library is not a pickup location
660
                                                                [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
667
                                                                    [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
661
                                                                    Cannot be transferred to pickup library
668
                                                                        No valid pickup location
662
                                                                [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
669
                                                                    [% ELSE %]
663
                                                                    Only pickup locations within the same hold group are allowed
670
                                                                        [% itemloo.not_holdable | html %]
664
                                                                [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
671
                                                                    [% END %]
665
                                                                    No reserves are allowed on this item
666
                                                                [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
667
                                                                    Library is not a pickup location
668
                                                                [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
669
                                                                    No valid pickup location
670
                                                                [% ELSE %]
671
                                                                    [% itemloo.not_holdable | html %]
672
                                                                [% END %]
672
                                                                [% END %]
673
                                                            </span>
674
                                                        [% END # /IF itemloo.force_hold_level %]
675
                                                    </td>
676
                                                    [% IF ( item_level_itypes ) %]
677
                                                        <td>
678
                                                            [% UNLESS ( noItemTypeImages ) %]
679
                                                                [% IF ( itemloo.imageurl ) %]<img src="[% itemloo.imageurl | html %]" alt="" /> <br /> [% END %]
680
                                                            [% END %]
673
                                                            [% END %]
681
                                                            [% itemloo.itypename | html %]
674
                                                        </span>
682
                                                        </td>
675
                                                    [% END # /IF force_hold_level %]
683
                                                    [% END %]
676
                                                </td>
684
                                                    <td>
677
                                                [% IF Koha.Preference('item-level_itypes') %]
685
                                                        [% itemloo.barcode | html %]
686
                                                    </td>
687
                                                    <td>
678
                                                    <td>
688
                                                        [% Branches.GetName( itemloo.homebranch ) | html %]
679
                                                        [% UNLESS ( noItemTypeImages ) %]
680
                                                            [% IF ( itemloo.itemtype.image_location) %]<img src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %]
681
                                                        [% END %]
682
                                                        [% itemloo.itemtype.translated_description | html %]
689
                                                    </td>
683
                                                    </td>
684
                                                [% END %]
685
                                                <td>
686
                                                    [% itemloo.barcode | html %]
687
                                                </td>
688
                                                <td>
689
                                                    [% Branches.GetName( itemloo.homebranch ) | html %]
690
                                                </td>
691
                                                <td>
692
                                                    [% Branches.GetName( itemloo.holdingbranch ) | html %]
693
                                                </td>
694
                                                [% IF itemdata_ccode %]
690
                                                    <td>
695
                                                    <td>
691
                                                        [% Branches.GetName( itemloo.holdingbranch ) | html %]
696
                                                        [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %]
692
                                                    </td>
697
                                                    </td>
693
                                                    [% IF itemdata_ccode %]
698
                                                [% END %]
694
                                                        <td>
699
                                                <td>
695
                                                            [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %]
700
                                                    [% itemloo.itemcallnumber | html %]
696
                                                        </td>
701
                                                </td>
697
                                                    [% END %]
702
                                                <td>
703
                                                    [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
704
                                                </td>
705
                                                [% IF itemdata_enumchron %]
698
                                                    <td>
706
                                                    <td>
699
                                                        [% itemloo.itemcallnumber | html %]
707
                                                        [% itemloo.enumchron | html %]
700
                                                    </td>
708
                                                    </td>
709
                                                [% END %]
710
                                                [% IF ( itemloo.onloan ) %]
711
                                                    <td data-order="[% itemloo.date_due | html %]">
712
                                                        <span class="checkedout">Due [% itemloo.date_due | $KohaDates  as_due_date => 1 %]</span>
713
                                                [% ELSE %]
701
                                                    <td>
714
                                                    <td>
702
                                                        [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
715
                                                        [% IF ( itemloo.transfertwhen ) %]
703
                                                    </td>
716
                                                            In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
704
                                                    [% IF itemdata_enumchron %]
717
                                                            to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
705
                                                        <td>
718
                                                        [% END %]
706
                                                            [% itemloo.enumchron | html %]
719
                                                [% END %]
707
                                                        </td>
708
                                                    [% END %]
709
                                                    [% IF ( itemloo.onloan ) %]
710
                                                        <td data-order="[% itemloo.date_due | html %]">
711
                                                            <span class="checkedout">Due [% itemloo.date_due | $KohaDates  as_due_date => 1 %]</span>
712
                                                    [% ELSE %]
713
                                                        <td>
714
                                                            [% IF ( itemloo.transfertwhen ) %]
715
                                                                In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
716
                                                                to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | html %]
717
                                                            [% END %]
718
                                                    [% END %]
719
720
720
                                                        [% IF ( itemloo.reservedate ) %]
721
                                                    [% IF ( itemloo.reservedate ) %]
721
                                                            [% IF ( itemloo.nocancel ) %]
722
                                                        [% IF ( itemloo.nocancel ) %]
722
                                                                    Can't be cancelled when item is in transit
723
                                                                Can't be cancelled when item is in transit
724
                                                        [% ELSE %]
725
                                                            [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
726
                                                            [% IF ( itemloo.canreservefromotherbranches ) %]
727
                                                                for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
728
                                                            [% END %]
729
                                                            [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
730
                                                            [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
731
                                                            [% IF ( itemloo.waitingdate ) %]
732
                                                                [% itemloo.waitingdate | $KohaDates %]
723
                                                            [% ELSE %]
733
                                                            [% ELSE %]
724
                                                                [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %]
734
                                                                [% IF ( itemloo.reservedate ) %]
725
                                                                [% IF ( itemloo.canreservefromotherbranches ) %]
735
                                                                    [% itemloo.reservedate | html %]
726
                                                                    for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% itemloo.ReservedFor.borrowernumber | uri %]">[% itemloo.ReservedFor.firstname | html %] [% itemloo.ReservedFor.surname | html %]</a>
727
                                                                [% END %]
736
                                                                [% END %]
728
                                                                [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %]
737
                                                            [% END %].
729
                                                                [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
738
                                                            <a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&amp;CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&amp;CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a>
730
                                                                [% IF ( itemloo.waitingdate ) %]
739
                                                        [% END # /IF itemloo.nocancel %]
731
                                                                    [% itemloo.waitingdate | $KohaDates %]
740
                                                    [% ELSE %]
732
                                                                [% ELSE %]
741
                                                        Not on hold
733
                                                                    [% IF ( itemloo.reservedate ) %]
742
                                                    [% END # /IF itemloo.reservedate %]
734
                                                                        [% itemloo.reservedate | html %]
735
                                                                    [% END %]
736
                                                                [% END %].
737
                                                                <a class="info cancel-hold" href="modrequest.pl?CancelBiblioNumber=[% itemloo.biblionumber | html %]&amp;CancelBorrowerNumber=[% itemloo.ReservedFor.borrowernumber | html %]&amp;CancelItemnumber=[% itemloo.itemnumber | html %]">Cancel hold</a>
738
                                                            [% END # /IF itemloo.nocancel %]
739
                                                        [% ELSE %]
740
                                                            Not on hold
741
                                                        [% END # /IF itemloo.reservedate %]
742
743
743
                                                        [% IF itemloo.item_level_holds == "N" %]
744
                                                    [% IF itemloo.item_level_holds == "N" %]
744
                                                            <br/>Item level hold not allowed from OPAC
745
                                                        <br/>Item level hold not allowed from OPAC
745
                                                        [% ELSIF itemloo.item_level_holds == "F" %]
746
                                                    [% ELSIF itemloo.item_level_holds == "F" %]
746
                                                            <br/>Item level hold forced from OPAC
747
                                                        <br/>Item level hold forced from OPAC
747
                                                        [% END %]
748
                                                    [% END %]
748
749
749
                                                        [% IF ( itemloo.itemlost ) %]
750
                                                    [% IF ( itemloo.itemlost ) %]
750
                                                           <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
751
                                                       <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
751
                                                        [% END %]
752
                                                    [% END %]
752
753
753
                                                        [% IF ( itemloo.damaged ) %]
754
                                                    [% IF ( itemloo.damaged ) %]
754
                                                            <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
755
                                                        <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
755
                                                        [% END %]
756
                                                    [% END %]
756
757
757
                                                        [% IF ( itemloo.withdrawn ) %]
758
                                                    [% IF ( itemloo.withdrawn ) %]
758
                                                           <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
759
                                                       <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
759
                                                        [% END %]
760
                                                    [% END %]
760
761
761
                                                        [% IF ( itemloo.notforloan ) %]
762
                                                    [% IF ( itemloo.notforloan ) %]
762
                                                           <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
763
                                                       <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
763
                                                        [% END %]
764
                                                    </td>
765
                                                    <td>
766
                                                    [% IF (itemloo.pickup_locations_count > 0) %]
767
                                                        <select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" style="width:100%;"
768
                                                                data-item-id="[% itemloo.itemnumber | html %]"
769
                                                                data-patron-id="[% patron.borrowernumber | html %]"
770
                                                                data-pickup-location-source="item">
771
                                                        [% IF (itemloo.default_pickup_location) %]
772
                                                            <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
773
                                                        [% END %]
774
                                                        </select>
775
                                                    [% END %]
764
                                                    [% END %]
776
                                                    </td>
765
                                                </td>
777
                                                </tr>
766
                                                <td>
778
                                            [% END # / UNLESS itemloo.hide %]
767
                                                [% IF (itemloo.pickup_locations_count > 0) %]
779
                                        [% END # /FOREACH itemloo %]
768
                                                    <select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations" style="width:100%;"
780
                                    </tbody>
769
                                                            data-item-id="[% itemloo.itemnumber | html %]"
781
                                </table> <!-- /#requestspecific -->
770
                                                            data-patron-id="[% patron.borrowernumber | html %]"
782
771
                                                            data-pickup-location-source="item">
783
                                [% IF ( bibitemloo.hiddencount ) %]
772
                                                    [% IF (itemloo.default_pickup_location) %]
784
                                    <form>
773
                                                        <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
785
                                        <p class="hiddencount">
774
                                                    [% END %]
786
                                            <a href="request.pl?biblionumber=[% bibitemloo.biblionumber | uri %]&amp;borrowernumber=[% bibitemloo.borrowernumber | uri %]&amp;showallitems=1">Show all items ([% bibitemloo.hiddencount | html %] hidden)</a>
775
                                                    </select>
787
                                        </p>
776
                                                [% END %]
788
                                    </form>
777
                                                </td>
789
                                [% END # /IF bibitemloo.hiddencount %]
778
                                            </tr>
790
                            [% END # /FOREACH bibitemloo %]
779
                                        [% END # / UNLESS itemloo.hide %]
780
                                    [% END # /FOREACH itemloo %]
781
                                </tbody>
782
                            </table> <!-- /#requestspecific -->
783
784
                            [% IF hiddencount %]
785
                                <form>
786
                                    <p class="hiddencount">
787
                                        <a href="request.pl?biblionumber=[% biblio.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% biblio.hiddencount | html %] hidden)</a>
788
                                    </p>
789
                                </form>
790
                            [% END # /IF hiddencount %]
791
791
792
                        [% ELSE # /UNLESS multi_hold %]
792
                        [% ELSE # /UNLESS multi_hold %]
793
793
Lines 795-801 Link Here
795
                                <tr>
795
                                <tr>
796
                                    <th>&nbsp;</th>
796
                                    <th>&nbsp;</th>
797
                                    <th>Title</th>
797
                                    <th>Title</th>
798
                                    [% UNLESS ( item_level_itypes ) %]
798
                                    [% UNLESS Koha.Preference('item-level_itypes') %]
799
                                        <th>Item type</th>
799
                                        <th>Item type</th>
800
                                    [% END %]
800
                                    [% END %]
801
                                    <th>Priority</th>
801
                                    <th>Priority</th>
Lines 828-836 Link Here
828
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
828
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
829
                                            [% END %]
829
                                            [% END %]
830
                                        </td>
830
                                        </td>
831
                                        [% UNLESS ( item_level_itypes ) %]
831
                                        [% UNLESS Koha.Preference('item-level_itypes') %]
832
                                            <td>
832
                                            <td>
833
                                                <img src="[% biblioloo.imageurl | html %]" alt="[% biblioloo.itypename | html %]" title="[% biblioloo.itypename | html %]" />
833
                                                <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
834
                                            </td>
834
                                            </td>
835
                                        [% END %]
835
                                        [% END %]
836
                                        <td>[% biblioloo.rank | html %]</td>
836
                                        <td>[% biblioloo.rank | html %]</td>
Lines 1144-1161 Link Here
1144
1144
1145
[% MACRO jsinclude BLOCK %]
1145
[% MACRO jsinclude BLOCK %]
1146
    [% INCLUDE 'datatables.inc' %]
1146
    [% INCLUDE 'datatables.inc' %]
1147
    [% INCLUDE 'calendar.inc' %]
1147
    [% INCLUDE 'columns_settings.inc' %]
1148
    [% INCLUDE 'columns_settings.inc' %]
1148
    [% Asset.js("lib/hc-sticky.js") | $raw %]
1149
    [% Asset.js("lib/hc-sticky.js") | $raw %]
1149
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
1150
    [% Asset.js("js/circ-patron-search-results.js") | $raw %]
1150
    [% INCLUDE 'select2.inc' %]
1151
    [% INCLUDE 'select2.inc' %]
1151
    [% Asset.js("js/holds.js") | $raw%]
1152
    [% Asset.js("js/holds.js") | $raw%]
1152
    [% INCLUDE 'calendar.inc' %]
1153
    <script>
1153
    <script>
1154
        var Sticky;
1154
        var Sticky;
1155
        var biblionumber = "[% biblionumber | $raw %]";
1155
        var biblionumber = "[% biblionumber | $raw %]";
1156
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
1156
        var borrowernumber = "[% patron.borrowernumber | $raw %]";
1157
        var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1157
        var patron_homebranch = "[% To.json( Branches.GetName( patron.branchcode ) ) | $raw %]";
1158
        var override_items = {[% FOREACH bibitemloo IN bibitemloop %][% FOREACH itemloo IN bibitemloo.itemloop %][% IF ( itemloo.override ) %]
1158
        var override_items = {[% FOREACH biblio IN biblioloop %][% FOREACH itemloo IN biblio.itemloop %][% IF ( itemloo.override ) %]
1159
        [% itemloo.itemnumber | html %]: {
1159
        [% itemloo.itemnumber | html %]: {
1160
            homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1160
            homebranch: "[% To.json( Branches.GetName( itemloo.homebranch ) ) | $raw %]",
1161
            holdallowed: "[% itemloo.holdallowed | html %]"
1161
            holdallowed: "[% itemloo.holdallowed | html %]"
(-)a/reserve/request.pl (-234 / +166 lines)
Lines 68-74 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user( Link Here
68
my $showallitems = $input->param('showallitems');
68
my $showallitems = $input->param('showallitems');
69
my $pickup = $input->param('pickup');
69
my $pickup = $input->param('pickup');
70
70
71
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
71
my $itemtypes = {
72
    map {
73
        $_->itemtype =>
74
          { %{ $_->unblessed }, image_location => $_->image_location }
75
    } Koha::ItemTypes->search_with_localization->as_list
76
};
72
77
73
# Select borrowers infos
78
# Select borrowers infos
74
my $findborrower = $input->param('findborrower');
79
my $findborrower = $input->param('findborrower');
Lines 165-177 if($findclub) { Link Here
165
    if( $club ) {
170
    if( $club ) {
166
        $club_hold = $club->id;
171
        $club_hold = $club->id;
167
    } else {
172
    } else {
168
        my @clubs = Koha::Clubs->search(
173
        my @clubs = Koha::Clubs->search( [
169
            [
174
            { name => { like => '%'.$findclub.'%' } },
170
                { name        => { like => '%' . $findclub . '%' } },
175
            { description => { like => '%'.$findclub.'%' } }
171
                { description => { like => '%' . $findclub . '%' } }
176
        ] );
172
            ]
173
        )->filter_out_empty->as_list;
174
175
        if( scalar @clubs == 1 ) {
177
        if( scalar @clubs == 1 ) {
176
            $club_hold = $clubs[0]->id;
178
            $club_hold = $clubs[0]->id;
177
        } elsif ( @clubs ) {
179
        } elsif ( @clubs ) {
Lines 306-312 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
306
    if ( $patron && $multi_hold ) {
308
    if ( $patron && $multi_hold ) {
307
        my @multi_pickup_locations =
309
        my @multi_pickup_locations =
308
          Koha::Biblios->search( { biblionumber => \@biblionumbers } )
310
          Koha::Biblios->search( { biblionumber => \@biblionumbers } )
309
          ->pickup_locations( { patron => $patron } )->as_list;
311
          ->pickup_locations( { patron => $patron } );
310
        $template->param( multi_pickup_locations => \@multi_pickup_locations );
312
        $template->param( multi_pickup_locations => \@multi_pickup_locations );
311
    }
313
    }
312
314
Lines 332-338 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
332
            last;
334
            last;
333
        }
335
        }
334
336
335
        my $force_hold_level;
336
        if ( $patron ) {
337
        if ( $patron ) {
337
            { # CanBookBeReserved
338
            { # CanBookBeReserved
338
                my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber );
339
                my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber );
Lines 376-384 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
376
                    found          => undef,
377
                    found          => undef,
377
                }
378
                }
378
            );
379
            );
379
            $force_hold_level = $holds->forced_hold_level();
380
            $template->param( force_hold_level => $holds->forced_hold_level() );
380
            $biblioloopiter{force_hold_level} = $force_hold_level;
381
            $template->param( force_hold_level => $force_hold_level );
382
381
383
            # For a librarian to be able to place multiple record holds for a patron for a record,
382
            # For a librarian to be able to place multiple record holds for a patron for a record,
384
            # we must find out what the maximum number of holds they can place for the patron is
383
            # we must find out what the maximum number of holds they can place for the patron is
Lines 389-591 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
389
            $template->param( remaining_holds_for_record => $remaining_holds_for_record );
388
            $template->param( remaining_holds_for_record => $remaining_holds_for_record );
390
        }
389
        }
391
390
392
393
        my $count = Koha::Holds->search( { biblionumber => $biblionumber } )->count();
394
        my $totalcount = $count;
395
396
        # adding a fixed value for priority options
391
        # adding a fixed value for priority options
397
        my $fixedRank = $count+1;
392
        my $fixedRank = $biblio->holds->count + 1;
398
393
399
        my %itemnumbers_of_biblioitem;
394
        my @items = $biblio->items->as_list;
400
395
401
        my @hostitems = get_hostitemnumbers_of($biblionumber);
396
        my @host_items = $biblio->host_items->as_list;
402
        my @itemnumbers;
397
        if (@host_items) {
403
        if (@hostitems){
398
            push @items, @host_items;
404
            push(@itemnumbers, @hostitems);
405
        }
399
        }
406
400
407
        my $items = Koha::Items->search({ -or => { biblionumber => $biblionumber, itemnumber => { in => \@itemnumbers } } });
401
        unless ( @items ) {
408
409
        unless ( $items->count ) {
410
            # FIXME Then why do we continue?
402
            # FIXME Then why do we continue?
411
            $template->param('noitems' => 1) unless ( $multi_hold );
403
            $template->param('noitems' => 1) unless ( $multi_hold );
412
            $biblioloopiter{noitems} = 1;
404
            $biblioloopiter{noitems} = 1;
413
        }
405
        }
414
406
415
        ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers
416
        ## this is important when we have analytic items which may be on another record
417
        my ( $iteminfos_of );
418
        while ( my $item = $items->next ) {
419
            $item = $item->unblessed;
420
            my $biblioitemnumber = $item->{biblioitemnumber};
421
            my $itemnumber = $item->{itemnumber};
422
            push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber );
423
            $iteminfos_of->{$itemnumber} = $item;
424
        }
425
426
        my @biblioitemnumbers = keys %itemnumbers_of_biblioitem;
427
428
        my $biblioiteminfos_of = {
429
            map {
430
                my $biblioitem = $_;
431
                ( $biblioitem->{biblioitemnumber} => $biblioitem )
432
              } @{ Koha::Biblioitems->search(
433
                    { biblioitemnumber => { -in => \@biblioitemnumbers } },
434
                    { select => ['biblionumber', 'biblioitemnumber', 'publicationyear', 'itemtype']}
435
                )->unblessed
436
              }
437
        };
438
439
        if ( $club_hold or $borrowernumber_hold ) {
407
        if ( $club_hold or $borrowernumber_hold ) {
440
            my @bibitemloop;
441
442
            my @available_itemtypes;
408
            my @available_itemtypes;
443
            foreach my $biblioitemnumber (@biblioitemnumbers) {
409
            my $num_available = 0;
444
                my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber};
410
            my $num_override  = 0;
445
                my $num_available = 0;
411
            my $hiddencount   = 0;
446
                my $num_override  = 0;
412
            my $num_alreadyheld = 0;
447
                my $hiddencount   = 0;
413
448
                my $num_alreadyheld = 0;
414
            # iterating through all items first to check if any of them available
449
415
            # to pass this value further inside down to IsAvailableForItemLevelRequest to
450
                $biblioitem->{force_hold_level} = $force_hold_level;
416
            # it's complicated logic to analyse.
451
417
            # (before this loop was inside that sub loop so it was O(n^2) )
452
                $biblioloopiter{description} = $biblioitem->{description};
418
            my $items_any_available;
453
                $biblioloopiter{itypename}   = $biblioitem->{description};
419
            $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblio->biblionumber, patron => $patron })
454
                if ( $biblioitem->{itemtype} ) {
420
                if $patron;
455
421
456
                    $biblioitem->{description} =
422
            for my $item_object ( @items ) {
457
                      $itemtypes->{ $biblioitem->{itemtype} }{description};
423
                my $do_check;
458
424
                my $item = $item_object->unblessed;
459
                    $biblioloopiter{imageurl} =
425
                if ( $patron ) {
460
                      getitemtypeimagelocation( 'intranet',
426
                    $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check;
461
                        $itemtypes->{ $biblioitem->{itemtype} }{imageurl} );
427
                    if ( $do_check && $wants_check ) {
462
                }
428
                        $item->{checked_previously} = $do_check;
463
429
                        if ( $multi_hold ) {
464
                # iterating through all items first to check if any of them available
430
                            $biblioloopiter{checked_previously} = $do_check;
465
                # to pass this value further inside down to IsAvailableForItemLevelRequest to
431
                        } else {
466
                # it's complicated logic to analyse.
432
                            $template->param( checked_previously => $do_check );
467
                # (before this loop was inside that sub loop so it was O(n^2) )
468
                my $items_any_available;
469
                $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioitem->{biblionumber}, patron => $patron })
470
                    if $patron;
471
472
                foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } )    {
473
                    my $item = $iteminfos_of->{$itemnumber};
474
                    my $do_check;
475
                    if ( $patron ) {
476
                        $do_check = $patron->do_check_for_previous_checkout($item) if $wants_check;
477
                        if ( $do_check && $wants_check ) {
478
                            $item->{checked_previously} = $do_check;
479
                            if ( $multi_hold ) {
480
                                $biblioloopiter{checked_previously} = $do_check;
481
                            } else {
482
                                $template->param( checked_previously => $do_check );
483
                            }
484
                        }
433
                        }
485
                    }
434
                    }
486
                    $item->{force_hold_level} = $force_hold_level;
435
                }
487
488
                    unless (C4::Context->preference('item-level_itypes')) {
489
                        $item->{itype} = $biblioitem->{itemtype};
490
                    }
491
436
492
                    $item->{itypename} = $itemtypes->{ $item->{itype} }{description};
437
                $item->{itemtype} = $itemtypes->{ $item_object->effective_itemtype };
493
                    $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
494
                    $item->{homebranch} = $item->{homebranch};
495
438
496
                    # if the holdingbranch is different than the homebranch, we show the
439
                if($item->{biblionumber} ne $biblio->biblionumber){
497
                    # holdingbranch of the document too
440
                    $item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title;
498
                    if ( $item->{homebranch} ne $item->{holdingbranch} ) {
441
                }
499
                        $item->{holdingbranch} = $item->{holdingbranch};
500
                    }
501
442
502
                    if($item->{biblionumber} ne $biblionumber){
443
                # if the item is currently on loan, we display its return date and
503
                        $item->{hosttitle} = Koha::Biblios->find( $item->{biblionumber} )->title;
444
                # change the background color
504
                    }
445
                my $issue = $item_object->checkout;
446
                if ( $issue ) { # FIXME must be moved to the template
447
                    $item->{date_due} = $issue->date_due;
448
                    $item->{backgroundcolor} = 'onloan';
449
                }
505
450
506
                    # if the item is currently on loan, we display its return date and
451
                # checking reserve
507
                    # change the background color
452
                my $holds = $item_object->current_holds;
508
                    my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } );
453
                if ( my $first_hold = $holds->next ) {
509
                    if ( $issue ) {
454
                    my $p = Koha::Patrons->find( $first_hold->borrowernumber );
510
                        $item->{date_due} = $issue->date_due;
511
                        $item->{backgroundcolor} = 'onloan';
512
                    }
513
455
514
                    # checking reserve
456
                    $item->{backgroundcolor} = 'reserved';
515
                    my $item_object = Koha::Items->find( $itemnumber );
457
                    $item->{reservedate}     = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template
516
                    my $holds = $item_object->current_holds;
458
                    $item->{ReservedFor}     = $p;
517
                    if ( my $first_hold = $holds->next ) {
459
                    $item->{ExpectedAtLibrary}     = $first_hold->branchcode;
518
                        my $p = Koha::Patrons->find( $first_hold->borrowernumber );
460
                    $item->{waitingdate} = $first_hold->waitingdate;
519
461
                }
520
                        $item->{backgroundcolor} = 'reserved';
521
                        $item->{reservedate}     = output_pref({ dt => dt_from_string( $first_hold->reservedate ), dateonly => 1 }); # FIXME Should be formatted in the template
522
                        $item->{ReservedFor}     = $p;
523
                        $item->{ExpectedAtLibrary}     = $first_hold->branchcode;
524
                        $item->{waitingdate} = $first_hold->waitingdate;
525
                    }
526
462
527
                    # Management of the notforloan document
463
                # Management of the notforloan document
528
                    if ( $item->{notforloan} ) {
464
                if ( $item->{notforloan} ) {
529
                        $item->{backgroundcolor} = 'other';
465
                    $item->{backgroundcolor} = 'other';
530
                    }
466
                }
531
467
532
                    # Management of lost or long overdue items
468
                # Management of lost or long overdue items
533
                    if ( $item->{itemlost} ) {
469
                if ( $item->{itemlost} ) {
534
                        $item->{backgroundcolor} = 'other';
470
                    $item->{backgroundcolor} = 'other';
535
                        if ($logged_in_patron->category->hidelostitems && !$showallitems) {
471
                    if ($logged_in_patron->category->hidelostitems && !$showallitems) {
536
                            $item->{hide} = 1;
472
                        $item->{hide} = 1;
537
                            $hiddencount++;
473
                        $hiddencount++;
538
                        }
539
                    }
474
                    }
475
                }
540
476
541
                    # Check the transit status
477
                # Check the transit status
542
                    my ( $transfertwhen, $transfertfrom, $transfertto ) =
478
                my ( $transfertwhen, $transfertfrom, $transfertto ) =
543
                      GetTransfers($itemnumber);
479
                  GetTransfers($item_object->itemnumber); # FIXME replace with get_transfer
544
480
545
                    if ( defined $transfertwhen && $transfertwhen ne '' ) {
481
                if ( defined $transfertwhen && $transfertwhen ne '' ) {
546
                        $item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 });
482
                    $item->{transfertwhen} = output_pref({ dt => dt_from_string( $transfertwhen ), dateonly => 1 });
547
                        $item->{transfertfrom} = $transfertfrom;
483
                    $item->{transfertfrom} = $transfertfrom;
548
                        $item->{transfertto} = $transfertto;
484
                    $item->{transfertto} = $transfertto;
549
                        $item->{nocancel} = 1;
485
                    $item->{nocancel} = 1;
550
                    }
486
                }
551
487
552
                    # If there is no loan, return and transfer, we show a checkbox.
488
                # If there is no loan, return and transfer, we show a checkbox.
553
                    $item->{notforloan} ||= 0;
489
                $item->{notforloan} ||= 0;
554
490
555
                    # if independent branches is on we need to check if the person can reserve
491
                # if independent branches is on we need to check if the person can reserve
556
                    # for branches they arent logged in to
492
                # for branches they arent logged in to
557
                    if ( C4::Context->preference("IndependentBranches") ) {
493
                if ( C4::Context->preference("IndependentBranches") ) {
558
                        if (! C4::Context->preference("canreservefromotherbranches")){
494
                    if (! C4::Context->preference("canreservefromotherbranches")){
559
                            # can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve
495
                        # can't reserve items so need to check if item homebranch and userenv branch match if not we can't reserve
560
                            my $userenv = C4::Context->userenv;
496
                        my $userenv = C4::Context->userenv;
561
                            unless ( C4::Context->IsSuperLibrarian ) {
497
                        unless ( C4::Context->IsSuperLibrarian ) {
562
                                $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
498
                            $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
563
                            }
564
                        }
499
                        }
565
                    }
500
                    }
501
                }
566
502
567
                    if ( $patron ) {
503
                if ( $patron ) {
568
                        my $patron_unblessed = $patron->unblessed;
504
                    my $patron_unblessed = $patron->unblessed;
569
                        my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed);
505
                    my $branch = C4::Circulation::_GetCircControlBranch($item, $patron_unblessed);
570
506
571
                        my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} );
507
                    my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} );
572
508
573
                        $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
509
                    $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
574
510
575
                        my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status};
511
                    my $can_item_be_reserved = CanItemBeReserved( $patron, $item_object )->{status};
576
                        $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
512
                    $item->{not_holdable} = $can_item_be_reserved unless ( $can_item_be_reserved eq 'OK' );
577
513
578
                        $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
514
                    $item->{item_level_holds} = Koha::CirculationRules->get_opacitemholds_policy( { item => $item_object, patron => $patron } );
515
516
                    if (
517
                           !$item->{cantreserve}
518
                        && !$exceeded_maxreserves
519
                        && $can_item_be_reserved eq 'OK'
520
                        # items_any_available defined outside of the current loop,
521
                        # so we avoiding loop inside IsAvailableForItemLevelRequest:
522
                        && IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available)
523
                      )
524
                    {
525
                        # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
526
                        my $pickup_locations = $item_object->pickup_locations({ patron => $patron });
527
                        $item->{pickup_locations_count} = $pickup_locations->count;
528
                        if ( $item->{pickup_locations_count} > 0 ) {
529
                            $num_available++;
530
                            $item->{available} = 1;
531
                            # pass the holding branch for use as default
532
                            my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next;
533
                            $item->{default_pickup_location} = $default_pickup_location;
534
                        }
535
                        else {
536
                            $item->{available} = 0;
537
                            $item->{not_holdable} = "no_valid_pickup_location";
538
                        }
579
539
580
                        if (
540
                        push( @available_itemtypes, $item->{itype} );
581
                               !$item->{cantreserve}
541
                    }
582
                            && !$exceeded_maxreserves
542
                    elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
583
                            && $can_item_be_reserved eq 'OK'
543
                        # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
584
                            # items_any_available defined outside of the current loop,
544
                        # with the exception of itemAlreadyOnHold because, you know, the item is already on hold
585
                            # so we avoiding loop inside IsAvailableForItemLevelRequest:
545
                        if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) {
586
                            && IsAvailableForItemLevelRequest($item_object, $patron, undef, $items_any_available)
587
                          )
588
                        {
589
                            # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
546
                            # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
590
                            my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list;
547
                            my @pickup_locations = $item_object->pickup_locations({ patron => $patron })->as_list;
591
                            $item->{pickup_locations_count} = scalar @pickup_locations;
548
                            $item->{pickup_locations_count} = scalar @pickup_locations;
Lines 607-673 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
607
                                $item->{available} = 0;
564
                                $item->{available} = 0;
608
                                $item->{not_holdable} = "no_valid_pickup_location";
565
                                $item->{not_holdable} = "no_valid_pickup_location";
609
                            }
566
                            }
567
                        } else { $num_alreadyheld++ }
610
568
611
                            push( @available_itemtypes, $item->{itype} );
569
                        push( @available_itemtypes, $item->{itype} );
612
                        }
570
                    }
613
                        elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
614
                            # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
615
                            # with the exception of itemAlreadyOnHold because, you know, the item is already on hold
616
                            if ( $can_item_be_reserved ne 'itemAlreadyOnHold' ) {
617
                                # Send the pickup locations count to the UI, the pickup locations will be pulled using the API
618
                                my $pickup_locations = $item_object->pickup_locations({ patron => $patron });
619
                                $item->{pickup_locations_count} = $pickup_locations->count;
620
                                if ( $item->{pickup_locations_count} > 0 ) {
621
                                    $item->{override} = 1;
622
                                    $num_override++;
623
                                    # pass the holding branch for use as default
624
                                    my $default_pickup_location = $pickup_locations->search({ branchcode => $item->{holdingbranch} })->next;
625
                                    $item->{default_pickup_location} = $default_pickup_location;
626
                                }
627
                                else {
628
                                    $item->{available} = 0;
629
                                    $item->{not_holdable} = "no_valid_pickup_location";
630
                                }
631
                            } else { $num_alreadyheld++ }
632
633
                            push( @available_itemtypes, $item->{itype} );
634
                        }
635
571
636
                        # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
572
                    # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
637
573
638
                        # Show serial enumeration when needed
574
                    # Show serial enumeration when needed
639
                        if ($item->{enumchron}) {
575
                    if ($item->{enumchron}) {
640
                            $itemdata_enumchron = 1;
576
                        $itemdata_enumchron = 1;
641
                        }
577
                    }
642
                        # Show collection when needed
578
                    # Show collection when needed
643
                        if ($item->{ccode}) {
579
                    if ($item->{ccode}) {
644
                            $itemdata_ccode = 1;
580
                        $itemdata_ccode = 1;
645
                        }
646
                    }
581
                    }
647
648
                    push @{ $biblioitem->{itemloop} }, $item;
649
                }
582
                }
650
583
651
                # While we can't override an alreay held item, we should be able to override the others
584
                push @{ $biblioloopiter{itemloop} }, $item;
652
                # Unless all items are already held
585
            }
653
                if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioitem->{itemloop} } ) ) {
654
                # That is, if all items require an override
655
                    $template->param( override_required => 1 );
656
                } elsif ( $num_available == 0 ) {
657
                    $template->param( none_available => 1 );
658
                    $biblioloopiter{warn} = 1;
659
                    $biblioloopiter{none_avail} = 1;
660
                }
661
                $template->param( hiddencount => $hiddencount);
662
586
663
                push @bibitemloop, $biblioitem;
587
            $biblioloopiter{biblioitem} = $biblio->biblioitem;
588
589
            # While we can't override an alreay held item, we should be able to override the others
590
            # Unless all items are already held
591
            if ( $num_override > 0 && ($num_override + $num_alreadyheld) == scalar( @{ $biblioloopiter{itemloop} } ) ) {
592
            # That is, if all items require an override
593
                $template->param( override_required => 1 );
594
            } elsif ( $num_available == 0 ) {
595
                $template->param( none_available => 1 );
596
                $biblioloopiter{warn} = 1;
597
                $biblioloopiter{none_avail} = 1;
664
            }
598
            }
599
            $template->param( hiddencount => $hiddencount);
665
600
666
            @available_itemtypes = uniq( @available_itemtypes );
601
            @available_itemtypes = uniq( @available_itemtypes );
667
            $template->param(
602
            $template->param( available_itemtypes => \@available_itemtypes );
668
                bibitemloop         => \@bibitemloop,
669
                available_itemtypes => \@available_itemtypes
670
            );
671
        }
603
        }
672
604
673
        # existingreserves building
605
        # existingreserves building
Lines 761-767 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
761
693
762
        if ( $patron ) {
694
        if ( $patron ) {
763
            # Add the valid pickup locations
695
            # Add the valid pickup locations
764
            my @pickup_locations = $biblio->pickup_locations({ patron => $patron })->as_list;
696
            my @pickup_locations = $biblio->pickup_locations({ patron => $patron });
765
            $biblioloopiter{pickup_locations} = \@pickup_locations;
697
            $biblioloopiter{pickup_locations} = \@pickup_locations;
766
            $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ];
698
            $biblioloopiter{pickup_locations_codes} = [ map { $_->branchcode } @pickup_locations ];
767
        }
699
        }
Lines 795-800 if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) { Link Here
795
$template->param(
727
$template->param(
796
    SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
728
    SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
797
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
729
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
730
    borrowernumber => $borrowernumber_hold,
798
);
731
);
799
732
800
# printout the page
733
# printout the page
801
- 

Return to bug 29660