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

(-)a/C4/Reserves.pm (-74 / +200 lines)
Lines 373-391 sub CanBookBeReserved { Link Here
373
        return { status => 'alreadypossession' };
373
        return { status => 'alreadypossession' };
374
    }
374
    }
375
375
376
    my @circulation_rules;
377
376
    if ( $params->{itemtype} ) {
378
    if ( $params->{itemtype} ) {
377
379
378
        # biblio-level, item type-contrained
380
        # biblio-level, item type-contrained
379
        my $patron          = Koha::Patrons->find($borrowernumber);
381
        my $patron               = Koha::Patrons->find($borrowernumber);
380
        my $reservesallowed = Koha::CirculationRules->get_effective_rule(
382
        my $reservesallowed_rule = Koha::CirculationRules->get_effective_rule(
381
            {
383
            {
382
                itemtype     => $params->{itemtype},
384
                itemtype     => $params->{itemtype},
383
                categorycode => $patron->categorycode,
385
                categorycode => $patron->categorycode,
384
                branchcode   => $pickup_branchcode,
386
                branchcode   => $pickup_branchcode,
385
                rule_name    => 'reservesallowed',
387
                rule_name    => 'reservesallowed',
386
            }
388
            }
387
        )->rule_value;
389
        );
390
        push @circulation_rules, $reservesallowed_rule if $reservesallowed_rule;
388
391
392
        my $reservesallowed = $reservesallowed_rule ? $reservesallowed_rule->rule_value : undef;
389
        $reservesallowed = ( $reservesallowed eq '' ) ? undef : $reservesallowed;
393
        $reservesallowed = ( $reservesallowed eq '' ) ? undef : $reservesallowed;
390
394
391
        my $count = $patron->holds->search(
395
        my $count = $patron->holds->search(
Lines 398-404 sub CanBookBeReserved { Link Here
398
            { join => ['item'] }
402
            { join => ['item'] }
399
        )->count;
403
        )->count;
400
404
401
        return { status => '' }
405
        return { status => '', circulation_rules => \@circulation_rules }
402
            if defined $reservesallowed and $reservesallowed < $count + 1;
406
            if defined $reservesallowed and $reservesallowed < $count + 1;
403
    }
407
    }
404
408
Lines 419-454 sub CanBookBeReserved { Link Here
419
        $items = Koha::Items->search( { biblionumber => $biblionumber } );
423
        $items = Koha::Items->search( { biblionumber => $biblionumber } );
420
    }
424
    }
421
425
422
    my $canReserve = { status => '' };
426
    my $response = { status => '', item_responses => [] };
423
    my $patron     = Koha::Patrons->find($borrowernumber);
427
    my $patron   = Koha::Patrons->find($borrowernumber);
424
    while ( my $item = $items->next ) {
428
    while ( my $item = $items->next ) {
425
        $canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params );
429
        my $itemResponse = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params );
426
        return { status => 'OK' } if $canReserve->{status} eq 'OK';
430
        push @{ $response->{item_responses} }, { %$itemResponse, item => $item };
431
432
        if ( $itemResponse->{status} eq 'OK' ) {
433
            $response->{status} = 'OK';
434
435
            return $response;
436
        }
427
    }
437
    }
428
    return $canReserve;
438
439
    return $response;
429
}
440
}
430
441
431
=head2 CanItemBeReserved
442
=head2 CanItemBeReserved
432
443
433
  $canReserve = &CanItemBeReserved($patron, $item, $branchcode, $params)
444
  $canReserve = CanItemBeReserved($patron, $item, $branchcode, $params)
434
  if ($canReserve->{status} eq 'OK') { #We can reserve this Item! }
445
  if ($canReserve->{status} eq 'OK') { #We can reserve this Item! }
435
446
436
  current params are:
447
Current params are:
437
  'ignore_hold_counts' - we use this routine to check if an item can fill a hold - on this case we
448
438
  should not check if there are too many holds as we only care about reservability
449
=over
439
450
440
@RETURNS { status => OK },              if the Item can be reserved.
451
=item * C<ignore_hold_counts>
441
         { status => ageRestricted },   if the Item is age restricted for this borrower.
452
442
         { status => damaged },         if the Item is damaged.
453
we use this routine to check if an item can
443
         { status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK.
454
fill a hold - on this case we should not check if there are too many holds as
444
         { status => branchNotInHoldGroup }, if borrower home library is not in hold group, and holds are only allowed from hold groups.
455
we only care about reservability
445
         { status => tooManyReserves, limit => $limit }, if the borrower has exceeded their maximum reserve amount.
456
446
         { status => notReservable },   if holds on this item are not allowed
457
=back
447
         { status => libraryNotFound },   if given branchcode is not an existing library
458
448
         { status => libraryNotPickupLocation },   if given branchcode is not configured to be a pickup location
459
Returns a hashref with the following keys:
449
         { status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode
460
450
         { status => pickupNotInHoldGroup }, pickup location is not in hold group, and pickup locations are only allowed from hold groups.
461
=over
451
         { status => recall }, if the borrower has already placed a recall on this item
462
463
=item * C<status>
464
465
A string that can have the following values:
466
467
=over
468
469
=item * C<OK> if the item can be reserved
470
471
=item * C<ageRestricted> if the item is aged restricted for this borrower
472
473
=item * C<damaged> if the item is damaged
474
475
=item * C<cannotReserveFromOtherBranches> if syspref
476
'canreservefromotherbranches' is OK
477
478
=item * C<branchNotInHoldGroup> if borrower home library is not in hold group,
479
and holds are only allowed from hold groups.
480
481
=item * C<tooManyReserves> if the borrower has exceeded their maximum reserve
482
amount.
483
484
=item * C<tooManyHoldsForThisRecord> if the borrower has exceeded their maximum
485
reserve amount for this biblio record
486
487
=item * C<tooManyReservesToday> if the borrower has exceeded their maximum
488
reserve amount for today
489
490
=item * C<notReservable> if holds on this item are not allowed
491
492
=item * C<libraryNotFound> if given branchcode is not an existing library
493
494
=item * C<libraryNotPickupLocation> if given branchcode is not configured to be
495
a pickup location
496
497
=item * C<cannotBeTransferred> if branch transfer limit applies on given item
498
and branchcode
499
500
=item * C<pickupNotInHoldGroup> if pickup location is not in hold group, and
501
pickup locations are only allowed from hold groups.
502
503
=item * C<recall> if the borrower has already placed a recall on this item
504
505
=back
506
507
=item * C<limit>
508
509
Only if C<status> is equal to C<tooManyReserves>, C<tooManyHoldsForThisRecord>,
510
or C<tooManyReservesToday>.
511
512
It contains the number of reserves allowed.
513
514
=item * C<circulation_rules>
515
516
An arrayref containing all circulations rules (L<Koha::CirculationRule>) that
517
have been checked
518
519
=back
452
520
453
=cut
521
=cut
454
522
Lines 473-480 sub CanItemBeReserved { Link Here
473
    }
541
    }
474
542
475
    my $dbh = C4::Context->dbh;
543
    my $dbh = C4::Context->dbh;
476
    my $ruleitemtype;           # itemtype of the matching issuing rule
477
    my $allowedreserves = 0;    # Total number of holds allowed across all records, default to none
478
544
479
    # We check item branch if IndependentBranches is ON
545
    # We check item branch if IndependentBranches is ON
480
    # and canreservefromotherbranches is OFF
546
    # and canreservefromotherbranches is OFF
Lines 530-567 sub CanItemBeReserved { Link Here
530
        $reserves_control_branch = $patron->branchcode;
596
        $reserves_control_branch = $patron->branchcode;
531
    }
597
    }
532
598
533
    # we retrieve rights
599
    my @circulation_rules;
534
    if (
535
        my $reservesallowed = Koha::CirculationRules->get_effective_rule(
536
            {
537
                itemtype     => $item->effective_itemtype,
538
                categorycode => $patron->categorycode,
539
                branchcode   => $reserves_control_branch,
540
                rule_name    => 'reservesallowed',
541
            }
542
        )
543
        )
544
    {
545
        $ruleitemtype    = $reservesallowed->itemtype;
546
        $allowedreserves = $reservesallowed->rule_value // 0;    #undefined is 0, blank is unlimited
547
    } else {
548
        $ruleitemtype = undef;
549
    }
550
600
551
    my $rights = Koha::CirculationRules->get_effective_rules(
601
    my $holds_per_record_rule = Koha::CirculationRules->get_effective_rule(
552
        {
602
        {
553
            categorycode => $patron->categorycode,
603
            categorycode => $patron->categorycode,
554
            itemtype     => $item->effective_itemtype,
604
            itemtype     => $item->effective_itemtype,
555
            branchcode   => $reserves_control_branch,
605
            branchcode   => $reserves_control_branch,
556
            rules        => [ 'holds_per_record', 'holds_per_day' ]
606
            rule_name    => 'holds_per_record',
557
        }
607
        }
558
    );
608
    );
559
    my $holds_per_record = $rights->{holds_per_record} // 1;
609
    push @circulation_rules, $holds_per_record_rule if $holds_per_record_rule;
560
    my $holds_per_day    = $rights->{holds_per_day};
610
611
    my $holds_per_record = $holds_per_record_rule ? $holds_per_record_rule->rule_value : 1;
561
612
562
    if ( defined $holds_per_record && $holds_per_record ne '' ) {
613
    if ( defined $holds_per_record && $holds_per_record ne '' ) {
563
        if ( $holds_per_record == 0 ) {
614
        if ( $holds_per_record == 0 ) {
564
            return _cache { status => "noReservesAllowed" };
615
            return _cache { status => "noReservesAllowed", circulation_rules => \@circulation_rules };
565
        }
616
        }
566
        if ( !$params->{ignore_hold_counts} ) {
617
        if ( !$params->{ignore_hold_counts} ) {
567
            my $search_params = {
618
            my $search_params = {
Lines 569-579 sub CanItemBeReserved { Link Here
569
                biblionumber   => $item->biblionumber,
620
                biblionumber   => $item->biblionumber,
570
            };
621
            };
571
            my $holds = Koha::Holds->search($search_params);
622
            my $holds = Koha::Holds->search($search_params);
572
            return _cache { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }
623
573
                if $holds->count() >= $holds_per_record;
624
            if ( $holds->count() >= $holds_per_record ) {
625
                return _cache {
626
                    status            => "tooManyHoldsForThisRecord",
627
                    limit             => $holds_per_record,
628
                    circulation_rules => \@circulation_rules,
629
                };
630
            }
574
        }
631
        }
575
    }
632
    }
576
633
634
    my $holds_per_day_rule = Koha::CirculationRules->get_effective_rule(
635
        {
636
            categorycode => $patron->categorycode,
637
            itemtype     => $item->effective_itemtype,
638
            branchcode   => $reserves_control_branch,
639
            rule_name    => 'holds_per_day',
640
        }
641
    );
642
    push @circulation_rules, $holds_per_day_rule if $holds_per_day_rule;
643
644
    my $holds_per_day = $holds_per_day_rule ? $holds_per_day_rule->rule_value : undef;
577
    if ( !$params->{ignore_hold_counts} && defined $holds_per_day && $holds_per_day ne '' ) {
645
    if ( !$params->{ignore_hold_counts} && defined $holds_per_day && $holds_per_day ne '' ) {
578
        my $today_holds = Koha::Holds->search(
646
        my $today_holds = Koha::Holds->search(
579
            {
647
            {
Lines 581-595 sub CanItemBeReserved { Link Here
581
                reservedate    => dt_from_string->date
649
                reservedate    => dt_from_string->date
582
            }
650
            }
583
        );
651
        );
584
        return _cache { status => 'tooManyReservesToday', limit => $holds_per_day }
652
585
            if $today_holds->count() >= $holds_per_day;
653
        if ( $today_holds->count() >= $holds_per_day ) {
654
            return _cache {
655
                status            => 'tooManyReservesToday',
656
                limit             => $holds_per_day,
657
                circulation_rules => \@circulation_rules,
658
            };
659
        }
660
    }
661
662
    my $reservesallowed_rule = Koha::CirculationRules->get_effective_rule(
663
        {
664
            itemtype     => $item->effective_itemtype,
665
            categorycode => $patron->categorycode,
666
            branchcode   => $reserves_control_branch,
667
            rule_name    => 'reservesallowed',
668
        }
669
    );
670
    push @circulation_rules, $reservesallowed_rule if $reservesallowed_rule;
671
672
    my $ruleitemtype;           # itemtype of the matching issuing rule
673
    my $allowedreserves = 0;    # Total number of holds allowed across all records, default to none
674
    if ($reservesallowed_rule) {
675
        $ruleitemtype    = $reservesallowed_rule->itemtype;
676
        $allowedreserves = $reservesallowed_rule->rule_value // 0;    #undefined is 0, blank is unlimited
586
    }
677
    }
587
678
588
    # we check if it's ok or not
679
    # we check if it's ok or not
589
    if ( defined $allowedreserves && $allowedreserves ne '' ) {
680
    if ( defined $allowedreserves && $allowedreserves ne '' ) {
590
        if ( $allowedreserves == 0 ) {
681
        if ( $allowedreserves == 0 ) {
591
            return _cache { status => 'noReservesAllowed' };
682
            return _cache {
683
                status            => 'noReservesAllowed',
684
                circulation_rules => \@circulation_rules,
685
            };
592
        }
686
        }
687
593
        if ( !$params->{ignore_hold_counts} ) {
688
        if ( !$params->{ignore_hold_counts} ) {
594
689
595
            # we retrieve count
690
            # we retrieve count
Lines 632-667 sub CanItemBeReserved { Link Here
632
                $reservecount = $rowcount->{count};
727
                $reservecount = $rowcount->{count};
633
            }
728
            }
634
729
635
            return _cache { status => 'tooManyReserves', limit => $allowedreserves }
730
            if ( $reservecount >= $allowedreserves ) {
636
                if $reservecount >= $allowedreserves;
731
                return _cache {
732
                    status            => 'tooManyReserves',
733
                    limit             => $allowedreserves,
734
                    circulation_rules => \@circulation_rules,
735
                };
736
            }
637
        }
737
        }
638
    }
738
    }
639
739
640
    # Now we need to check hold limits by patron category
740
    # Now we need to check hold limits by patron category
641
    my $rule = Koha::CirculationRules->get_effective_rule(
741
    my $max_holds_rule = Koha::CirculationRules->get_effective_rule(
642
        {
742
        {
643
            categorycode => $patron->categorycode,
743
            categorycode => $patron->categorycode,
644
            branchcode   => $reserves_control_branch,
744
            branchcode   => $reserves_control_branch,
645
            rule_name    => 'max_holds',
745
            rule_name    => 'max_holds',
646
        }
746
        }
647
    );
747
    );
648
    if ( !$params->{ignore_hold_counts} && $rule && defined( $rule->rule_value ) && $rule->rule_value ne '' ) {
748
    push @circulation_rules, $max_holds_rule if $max_holds_rule;
749
750
    if (  !$params->{ignore_hold_counts}
751
        && $max_holds_rule
752
        && defined( $max_holds_rule->rule_value )
753
        && $max_holds_rule->rule_value ne '' )
754
    {
649
        my $total_holds_count = Koha::Holds->search( { borrowernumber => $patron->borrowernumber } )->count();
755
        my $total_holds_count = Koha::Holds->search( { borrowernumber => $patron->borrowernumber } )->count();
650
756
651
        return _cache { status => 'tooManyReserves', limit => $rule->rule_value }
757
        if ( $total_holds_count >= $max_holds_rule->rule_value ) {
652
            if $total_holds_count >= $rule->rule_value;
758
            return _cache {
759
                status            => 'tooManyReserves',
760
                limit             => $max_holds_rule->rule_value,
761
                circulation_rules => \@circulation_rules,
762
            };
763
        }
653
    }
764
    }
654
765
766
    my $holdallowed_rule = Koha::CirculationRules->get_effective_rule(
767
        {
768
            branchcode => $reserves_control_branch,
769
            itemtype   => $item->effective_itemtype,
770
            rule_name  => 'holdallowed',
771
        }
772
    );
773
    push @circulation_rules, $holdallowed_rule if $holdallowed_rule;
774
655
    my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype );
775
    my $branchitemrule = C4::Circulation::GetBranchItemRule( $reserves_control_branch, $item->effective_itemtype );
656
776
657
    if ( $branchitemrule->{holdallowed} eq 'not_allowed' ) {
777
    if ( $branchitemrule->{holdallowed} eq 'not_allowed' ) {
658
        return _cache { status => 'notReservable' };
778
        return _cache { status => 'notReservable', circulation_rules => \@circulation_rules };
659
    }
779
    }
660
780
661
    if (   $branchitemrule->{holdallowed} eq 'from_home_library'
781
    if (   $branchitemrule->{holdallowed} eq 'from_home_library'
662
        && $patron->branchcode ne $item->homebranch )
782
        && $patron->branchcode ne $item->homebranch )
663
    {
783
    {
664
        return _cache { status => 'cannotReserveFromOtherBranches' };
784
        return _cache { status => 'cannotReserveFromOtherBranches', circulation_rules => \@circulation_rules };
665
    }
785
    }
666
786
667
    my $item_library = Koha::Libraries->find( { branchcode => $item->homebranch } );
787
    my $item_library = Koha::Libraries->find( { branchcode => $item->homebranch } );
Lines 669-675 sub CanItemBeReserved { Link Here
669
        if ( $patron->branchcode ne $item->homebranch
789
        if ( $patron->branchcode ne $item->homebranch
670
            && !$item_library->validate_hold_sibling( { branchcode => $patron->branchcode } ) )
790
            && !$item_library->validate_hold_sibling( { branchcode => $patron->branchcode } ) )
671
        {
791
        {
672
            return _cache { status => 'branchNotInHoldGroup' };
792
            return _cache { status => 'branchNotInHoldGroup', circulation_rules => \@circulation_rules };
673
        }
793
        }
674
    }
794
    }
675
795
Lines 689-708 sub CanItemBeReserved { Link Here
689
        unless ( $item->can_be_transferred( { to => $destination } ) ) {
809
        unless ( $item->can_be_transferred( { to => $destination } ) ) {
690
            return _cache { status => 'cannotBeTransferred' };
810
            return _cache { status => 'cannotBeTransferred' };
691
        }
811
        }
812
813
        my $hold_fulfillment_policy_rule = Koha::CirculationRules->get_effective_rule(
814
            {
815
                branchcode => $reserves_control_branch,
816
                itemtype   => $item->effective_itemtype,
817
                rule_name  => 'hold_fulfillment_policy',
818
            }
819
        );
820
        push @circulation_rules, $hold_fulfillment_policy_rule if $hold_fulfillment_policy_rule;
821
692
        if ( $branchitemrule->{hold_fulfillment_policy} eq 'holdgroup'
822
        if ( $branchitemrule->{hold_fulfillment_policy} eq 'holdgroup'
693
            && !$item_library->validate_hold_sibling( { branchcode => $pickup_branchcode } ) )
823
            && !$item_library->validate_hold_sibling( { branchcode => $pickup_branchcode } ) )
694
        {
824
        {
695
            return _cache { status => 'pickupNotInHoldGroup' };
825
            return _cache { status => 'pickupNotInHoldGroup', circulation_rules => \@circulation_rules };
696
        }
826
        }
697
        if ( $branchitemrule->{hold_fulfillment_policy} eq 'patrongroup'
827
        if ( $branchitemrule->{hold_fulfillment_policy} eq 'patrongroup'
698
            && !Koha::Libraries->find( { branchcode => $patron->branchcode } )
828
            && !Koha::Libraries->find( { branchcode => $patron->branchcode } )
699
            ->validate_hold_sibling( { branchcode => $pickup_branchcode } ) )
829
            ->validate_hold_sibling( { branchcode => $pickup_branchcode } ) )
700
        {
830
        {
701
            return _cache { status => 'pickupNotInHoldGroup' };
831
            return _cache { status => 'pickupNotInHoldGroup', circulation_rules => \@circulation_rules };
702
        }
832
        }
703
    }
833
    }
704
834
705
    return _cache { status => 'OK' };
835
    return _cache { status => 'OK', circulation_rules => \@circulation_rules };
706
}
836
}
707
837
708
=head2 ChargeReserveFee
838
=head2 ChargeReserveFee
Lines 1831-1839 sub _koha_notify_reserve { Link Here
1831
        }
1961
        }
1832
    );
1962
    );
1833
1963
1834
    my $library             = Koha::Libraries->find( $hold->branchcode );
1964
    my $library            = Koha::Libraries->find( $hold->branchcode );
1835
    my $from_email_address  = $library->from_email_address;
1965
    my $from_email_address = $library->from_email_address;
1836
    my $reply_email_address = $library->inbound_email_address;
1837
1966
1838
    my %letter_params = (
1967
    my %letter_params = (
1839
        module     => 'reserves',
1968
        module     => 'reserves',
Lines 1869-1875 sub _koha_notify_reserve { Link Here
1869
                    letter                 => $letter,
1998
                    letter                 => $letter,
1870
                    borrowernumber         => $borrowernumber,
1999
                    borrowernumber         => $borrowernumber,
1871
                    from_address           => $from_email_address,
2000
                    from_address           => $from_email_address,
1872
                    reply_address          => $reply_email_address,
1873
                    message_transport_type => $mtt,
2001
                    message_transport_type => $mtt,
1874
                }
2002
                }
1875
            );
2003
            );
Lines 2128-2135 sub RevertWaitingStatus { Link Here
2128
        }
2256
        }
2129
    )->next;
2257
    )->next;
2130
2258
2131
    my $original = C4::Context->preference('HoldsLog') ? $hold->unblessed : undef;
2132
2133
    ## Increment the priority of all other non-waiting
2259
    ## Increment the priority of all other non-waiting
2134
    ## reserves for this bib record
2260
    ## reserves for this bib record
2135
    my $holds = Koha::Holds->search( { biblionumber => $hold->biblionumber, priority => { '>' => 0 } } )
2261
    my $holds = Koha::Holds->search( { biblionumber => $hold->biblionumber, priority => { '>' => 0 } } )
Lines 2146-2152 sub RevertWaitingStatus { Link Here
2146
        }
2272
        }
2147
    )->store( { hold_reverted => 1 } );
2273
    )->store( { hold_reverted => 1 } );
2148
2274
2149
    logaction( 'HOLDS', 'MODIFY', $hold->id, $hold, undef, $original )
2275
    logaction( 'HOLDS', 'MODIFY', $hold->id, $hold )
2150
        if C4::Context->preference('HoldsLog');
2276
        if C4::Context->preference('HoldsLog');
2151
2277
2152
    _FixPriority( { biblionumber => $hold->biblionumber } );
2278
    _FixPriority( { biblionumber => $hold->biblionumber } );
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-1094 / +1300 lines)
Lines 22-47 Link Here
22
[% SET categories = Categories.all.unblessed %]
22
[% SET categories = Categories.all.unblessed %]
23
[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %]
23
[% SET columns = ['name', 'cardnumber', 'dateofbirth', 'category', 'branch', 'address', 'phone'] %]
24
[% PROCESS "patron-search.inc" %]
24
[% PROCESS "patron-search.inc" %]
25
<title
25
<title>[% FILTER collapse %]
26
    >[% FILTER collapse %]
26
    [% UNLESS ( multi_hold ) %]
27
        [% UNLESS ( multi_hold ) %]
27
        [% title_in_title = INCLUDE 'biblio-title-head.inc' %]
28
            [% title_in_title = INCLUDE 'biblio-title-head.inc' %]
28
        [% tx("Place a hold on {title}", { title = title_in_title }) | html %] &rsaquo;
29
            [% tx("Place a hold on {title}", { title = title_in_title }) | html %]
29
    [% ELSE %]
30
            &rsaquo;
30
        [% t("Confirm holds") | html %] &rsaquo;
31
        [% ELSE %]
31
    [% END %]
32
            [% t("Confirm holds") | html %]
32
    [% t("Holds") | html %] &rsaquo;
33
            &rsaquo;
33
    [% t("Circulation") | html %] &rsaquo;
34
        [% END %]
34
    [% t("Koha") | html %]
35
        [% t("Holds") | html %]
35
[% END %]</title>
36
        &rsaquo; [% t("Circulation") | html %] &rsaquo; [% t("Koha") | html %]
37
    [% END %]</title
38
>
39
[% INCLUDE 'doc-head-close.inc' %]
36
[% INCLUDE 'doc-head-close.inc' %]
40
[% FILTER collapse %]
37
[% FILTER collapse %]
41
    <style>
38
    <style>
42
        a.hold-arrow {
39
        a.hold-arrow {
43
            display: inline-block;
40
            display:inline-block;
44
            padding: 3px;
41
            padding:3px;
45
        }
42
        }
46
        a.hold-arrow:link,
43
        a.hold-arrow:link,
47
        a.hold-arrow:visited {
44
        a.hold-arrow:visited {
Lines 49-55 Link Here
49
        }
46
        }
50
47
51
        a.hold-arrow:hover,
48
        a.hold-arrow:hover,
52
        a.hold-arrow:active {
49
        a.hold-arrow:active{
53
            color: #75b700;
50
            color: #75b700;
54
        }
51
        }
55
52
Lines 59-72 Link Here
59
        }
56
        }
60
57
61
        a.cancel-hold {
58
        a.cancel-hold {
62
            display: inline-block;
59
            display:inline-block;
63
            padding: 3px;
60
            padding:3px;
64
        }
61
        }
65
62
66
        a.cancel-hold:link,
63
        a.cancel-hold:link,
67
        a.cancel-hold:visited {
64
        a.cancel-hold:visited{
68
            color: #c00;
65
            color:#c00;
69
            font-size: 130%;
66
            font-size:130%
70
        }
67
        }
71
68
72
        .icon-move-hold-up::before {
69
        .icon-move-hold-up::before {
Lines 102-109 Link Here
102
        .icon-set-lowest::before {
99
        .icon-set-lowest::before {
103
            content: "\f04e";
100
            content: "\f04e";
104
        }
101
        }
105
        :disabled {
102
        :disabled{
106
            opacity: 0.5;
103
            opacity:0.5
107
        }
104
        }
108
    </style>
105
    </style>
109
[% END %]
106
[% END %]
Lines 147-182 Link Here
147
    [% END #/ WRAPPER breadcrumbs %]
144
    [% END #/ WRAPPER breadcrumbs %]
148
[% END #/ WRAPPER sub-header.inc %]
145
[% END #/ WRAPPER sub-header.inc %]
149
146
150
[%# No sidebar menu when placing multiple holds or biblio not found %]
147
<div class="main container-fluid">
151
[% SET aside = (multi_hold || nobiblio) ? '' : 'biblio-view-menu' %]
148
    <div class="row">
152
[% WRAPPER 'main-container.inc' aside=aside wide_centered=1 %]
149
        [% IF ( multi_hold || nobiblio ) # No sidebar menu when placing multiple holds or biblio not found %]
153
    <h1>Holds</h1>
150
            <div class="col-md-10 offset-md-1">
151
        [% ELSE %]
152
            <div class="col-md-10 order-md-2 order-sm-1">
153
        [% END %]
154
154
155
    [% IF ( nobiblio ) %]
155
        <main>
156
        <div class="alert alert-warning">
156
            [% INCLUDE 'messages.inc' %]
157
            [% IF (multi_hold) %]
157
            <h1>Holds</h1>
158
                <strong>Cannot place hold:</strong> one or more records don't exist.
158
159
            [% ELSE %]
159
            [% IF ( nobiblio ) %]
160
                <strong>Cannot place hold:</strong> this record doesn't exist.
160
                <div class="alert alert-warning">
161
                [%IF (multi_hold) %]
162
                    <strong>Cannot place hold:</strong> one or more records don't exist.
163
                [% ELSE %]
164
                    <strong>Cannot place hold:</strong> this record doesn't exist.
165
                [% END %]
166
                </div>
161
            [% END %]
167
            [% END %]
162
        </div>
168
            [% IF ( noitems ) %]
163
    [% END %]
169
                <div class="alert alert-warning">
164
    [% IF ( noitems ) %]
170
                [%IF (multi_hold) %]
165
        <div class="alert alert-warning">
171
                    <strong>Cannot place hold:</strong> one or more records without items attached.
166
            [% IF (multi_hold) %]
172
                [% ELSE %]
167
                <strong>Cannot place hold:</strong> one or more records without items attached.
173
                    <strong>Cannot place hold:</strong> this record has no items attached.
168
            [% ELSE %]
174
                [% END %]
169
                <strong>Cannot place hold:</strong> this record has no items attached.
175
                </div>
170
            [% END %]
176
            [% END %]
171
        </div>
172
    [% END %]
173
177
174
    [% IF ( failed_holds ) %]
178
            [% IF ( failed_holds ) %]
175
        <div class="alert alert-warning">
179
                <div class="alert alert-warning">
176
            <strong>One or more holds were not placed due to following errors:</strong>
180
                    <strong>One or more holds were not placed due to following errors:</strong>
177
            <ul>
181
                    <ul>
178
                [% FOREACH fail IN failed_holds %]
182
                    [% FOREACH fail IN failed_holds %]
179
                    <li>
183
                        <li>
180
                        [% SWITCH fail %]
184
                        [% SWITCH fail %]
181
                        [% CASE 'damaged' %]
185
                        [% CASE 'damaged' %]
182
                            <span>Item is damaged</span>
186
                            <span>Item is damaged</span>
Lines 215-650 Link Here
215
                        [% CASE %]
219
                        [% CASE %]
216
                            <span>Error: [% fail | html %]</span>
220
                            <span>Error: [% fail | html %]</span>
217
                        [% END %]
221
                        [% END %]
218
                    </li>
222
                        </li>
219
                [% END %]
223
                    [% END %]
220
            </ul>
224
                    </ul>
221
        </div>
225
                </div>
222
    [% END %]
226
            [% END %]
223
227
224
    [% UNLESS ( multi_hold ) %]
228
            [% UNLESS ( multi_hold ) %]
225
        <h2>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %]by [% biblio.author | html %][% END %]</h2>
229
                <h2>Place a hold on [% INCLUDE 'biblio-title.inc' link = 1 %] [% IF biblio.author %] by [% biblio.author | html %][% END %]</h2>
226
    [% ELSE %]
227
        <h2>
228
            [% IF ( patron ) %]
229
                <span>Place holds</span>
230
            [% ELSE %]
230
            [% ELSE %]
231
                [% IF clubcount %]
231
                <h2>
232
                    <span>Search patrons or clubs</span>
232
                    [% IF ( patron ) %]
233
                [% ELSE %]
233
                        <span>Place holds</span>
234
                    <span>Search patrons</span>
234
                    [% ELSE %]
235
                [% END %]
235
                        [% IF clubcount %]
236
                            <span>Search patrons or clubs</span>
237
                        [% ELSE %]
238
                            <span>Search patrons</span>
239
                        [% END %]
240
                    [% END %]
241
                </h2>
236
            [% END %]
242
            [% END %]
237
        </h2>
238
    [% END %]
239
243
240
    [% UNLESS club OR patron OR patron.borrowernumber OR noitems OR nobiblio %]
244
            [% IF canbookbereserved_responses %]
241
        [% IF ( messageborrower ) %]
245
                <button type="button" class="btn btn-sm" data-toggle="modal" data-target="#holdruleschecker">[% t('Show circulation rules') | html %]</button>
242
            <div class="alert alert-warning">
246
            [% END %]
243
                <h3>Patron not found</h3>
244
                <p>No patron with this name, please, try another</p>
245
            </div>
246
        [% END %]
247
247
248
        [% IF ( messageclub ) %]
248
            [% UNLESS club OR patron OR patron.borrowernumber OR noitems OR nobiblio %]
249
            <div class="alert alert-warning">
249
                [% IF ( messageborrower ) %]
250
                <h3>Club not found</h3>
250
                    <div class="alert alert-warning">
251
                <p>No club with this name, please, try another</p>
251
                        <h3>Patron not found</h3>
252
            </div>
252
                        <p>No patron with this name, please, try another</p>
253
        [% END %]
253
                    </div>
254
        <fieldset>
255
            [% UNLESS multi_hold %]
256
                [% IF clubcount %]
257
                    <h2>Search patrons or clubs</h2>
258
                [% ELSE %]
259
                    <h2>Search patrons</h2>
260
                [% END %]
254
                [% END %]
261
            [% END %]
262
255
263
            [% WRAPPER tabs id= "circ_holds_select" %]
256
                [% IF ( messageclub ) %]
264
                [% WRAPPER tabs_nav %]
257
                    <div class="alert alert-warning">
265
                    [% WRAPPER tab_item tabname= "holds_patronsearch_pane" bt_active= 1 %]<span>Patrons</span>[% END %]
258
                        <h3>Club not found</h3>
266
                    [% IF clubcount %]
259
                        <p>No club with this name, please, try another</p>
267
                        [% WRAPPER tab_item tabname= "holds_clubsearch_pane" %]<span>Clubs</span>[% END %]
260
                    </div>
268
                    [% END %]
261
                [% END %]
269
                [% END # /WRAPPER tabs_nav %]
262
                <fieldset>
270
263
                    [% UNLESS multi_hold %]
271
                [% WRAPPER tab_panels %]
264
                        [% IF clubcount %]
272
                    [% WRAPPER tab_panel tabname="holds_patronsearch_pane" bt_active= 1 %]
265
                            <h2>Search patrons or clubs</h2>
273
                        [% PROCESS patron_search_filters_simple %]
266
                        [% ELSE %]
274
267
                            <h2>Search patrons</h2>
275
                        [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
276
                    [% END # /tab_panel# %]
277
                    [% IF clubcount %]
278
                        [% WRAPPER tab_panel tabname="holds_clubsearch_pane" %]
279
                            <form id="holds_clubsearch" action="request.pl" method="get">
280
                                <div class="hint">Enter club ID or partial name:</div>
281
                                <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
282
                                <input type="hidden" name="form_submitted" value="1" />
283
                                <input type="submit" class="btn btn-primary" value="Search" />
284
                                [% FOREACH biblionumber IN biblionumbers %]
285
                                    <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
286
                                [% END %]
287
                            </form>
288
                            <!-- /#holds_patronsearch -->
289
                            [% IF clubs %]
290
                                [% INCLUDE 'clubs-table.inc' destination = "holds" %]
291
                            [% END %]
292
                        [% END # /tab_panel# %]
293
                    [% END # /IF clubcount %]
294
                [% END # /WRAPPER tab_panels %]
295
            [% END # /WRAPPER tabs %]
296
        </fieldset>
297
    [% ELSIF club %]
298
        <div class="alert alert-warning visually-hidden clubalert"> </div>
299
        <fieldset class="rows">
300
            <legend>Hold details</legend>
301
            <form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
302
                [% INCLUDE 'csrf-token.inc' %]
303
                <input type="hidden" name="op" value="cud-noop" />
304
305
                [% IF ( multi_hold ) %]
306
                    <input type="hidden" name="request" value="any" />
307
                    [% FOREACH biblioloo IN biblioloop %]
308
                        [% UNLESS biblioloo.none_avail %]
309
                            <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblioloo.biblionumber | html %]" />
310
                            <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]" />
311
                            <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]" />
312
                        [% END %]
268
                        [% END %]
313
                    [% END %]
269
                    [% END %]
314
                [% ELSE %]
315
                    <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]" />
316
                    <input type="hidden" name="title" value="[% biblio.title | html %]" />
317
                    <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
318
                [% END # /IF multi_hold %]
319
                <ol>
320
                    <li> <span class="label">Club: </span> [% club.name | html %] </li>
321
                    <li> <span class="label">Description: </span> [% club.description | html %] </li>
322
                    <li>
323
                        <label for="pickup">Pickup at:</label>
324
                        <select name="pickup" id="pickup_club">
325
                            [% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
326
                        </select>
327
                    </li>
328
                    <li>
329
                        <label for="default_patron_home">Pickup at patron's home library when possible:</label>
330
                        <input type="checkbox" id="default_patron_home" name="default_patron_home" />
331
                    </li>
332
                </ol>
333
                <h2 style="padding: 0 1em;">Members</h2>
334
                <ol>
335
                    [% FOREACH member IN members %]
336
                        [% SET patron = member.patron %]
337
                        <li style="padding: 0.5em 1em;">
338
                            <div>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]</div>
339
                            [% IF member.exceeded_maxreserves %]
340
                                <div>
341
                                    <i class="fa fa-error"></i>
342
                                    <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
343
                                </div>
344
                            [% END %]
345
                            [% IF ( patron.is_expired ) %]
346
                                <div>
347
                                    <i class="fa-solid fa-triangle-exclamation"></i>
348
                                    <strong>Account has expired</strong>
349
                                </div>
350
                            [% END %]
351
                            [% IF patron.is_debarred %]
352
                                <div>
353
                                    <i class="fa-solid fa-triangle-exclamation"></i>
354
                                    <strong>Patron has restrictions</strong>
355
                                </div>
356
                            [% END %]
357
                            [% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
358
                                <div>
359
                                    <i class="fa-solid fa-triangle-exclamation"></i>
360
                                    <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
361
                                </div>
362
                            [% END %]
363
270
364
                            [% IF ( member.diffbranch ) %]
271
                    [% WRAPPER tabs id= "circ_holds_select" %]
365
                                <div>
272
                        [% WRAPPER tabs_nav %]
366
                                    <i class="fa-solid fa-triangle-exclamation"></i>
273
                            [% WRAPPER tab_item tabname= "holds_patronsearch_pane" bt_active= 1 %] <span>Patrons</span> [% END %]
367
                                    <strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
274
                            [% IF clubcount %]
368
                                </div>
275
                                [% WRAPPER tab_item tabname= "holds_clubsearch_pane" %] <span>Clubs</span> [% END %]
369
                            [% END %]
276
                            [% END %]
370
                        </li>
277
                        [% END # /WRAPPER tabs_nav %]
371
                    [% END %]
278
372
                </ol>
279
                        [% WRAPPER tab_panels %]
373
                [% UNLESS ( multi_hold ) %]
280
                            [% WRAPPER tab_panel tabname="holds_patronsearch_pane" bt_active= 1 %]
374
                    <fieldset class="action">
281
                                [% PROCESS patron_search_filters_simple %]
375
                        <input type="submit" class="btn btn-primary" value="Place hold" />
282
376
                    </fieldset>
283
                                [% PROCESS patron_search_table table_id => 'table_borrowers', open_on_row_click => 1 %]
377
                [% ELSE %]
284
                            [% END # /tab_panel# %]
378
                    <table id="requesttitles">
285
                            [% IF clubcount %]
379
                        <tr>
286
                                [% WRAPPER tab_panel tabname="holds_clubsearch_pane" %]
380
                            <th>&nbsp;</th>
287
                                    <form id="holds_clubsearch" action="request.pl" method="get">
381
                            <th>Title</th>
288
                                        <div class="hint">Enter club ID or partial name:</div>
382
                            [% UNLESS Koha.Preference('item-level_itypes') %]
289
                                        <input type="text" size="40" id="club" class="focus" name="findclub" autocomplete="off" />
383
                                <th>Item type</th>
290
                                        <input type="submit" class="btn btn-primary" value="Search" />
384
                            [% END %]
291
                                        [% FOREACH biblionumber IN biblionumbers %]
385
                            <th>Priority</th>
292
                                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
386
                            <th>Information</th>
387
                        </tr>
388
                        [% FOREACH biblioloo IN biblioloop %]
389
                            <tr [% IF biblioloo.warn %]class="onissue"[% END %]>
390
                                <td>
391
                                    [% UNLESS ( biblioloo.warn ) %]
392
                                        <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]" />
393
                                    [% END %]
394
                                </td>
395
                                <td>
396
                                    <ul>
397
                                        <li>
398
                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
399
                                            [% IF biblioloo.author %]by [% biblioloo.author | html %][% END %]
400
                                        </li>
401
                                        [% IF ( biblioloo.publicationyear ) %]
402
                                            <li> <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %] </li>
403
                                        [% END %]
293
                                        [% END %]
404
                                    </ul>
294
405
                                    [% IF ( biblioloo.warn ) %]
295
                                    </form> <!-- /#holds_patronsearch -->
406
                                        <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
296
                                    [% IF clubs %]
297
                                        [% INCLUDE 'clubs-table.inc' destination = "holds" %]
407
                                    [% END %]
298
                                    [% END %]
408
                                </td>
299
                                [% END # /tab_panel# %]
409
                                [% UNLESS Koha.Preference('item-level_itypes') %]
300
                            [% END # /IF clubcount %]
410
                                    <td>
301
                        [% END # /WRAPPER tab_panels %]
411
                                        <img
302
                    [% END # /WRAPPER tabs %]
412
                                            class="itemtype-image"
303
                </fieldset>
413
                                            src="[% biblioloo.itemtype.image_location| html %]"
304
            [% ELSIF club %]
414
                                            alt="[% biblioloo.itemtype.translated_description | html %]"
305
                <div class="alert alert-warning visually-hidden clubalert">
415
                                            title="[% biblioloo.itemtype.translated_description | html %]"
306
                </div>
416
                                        />
307
                <fieldset class="rows">
417
                                    </td>
308
                    <legend>Hold details</legend>
309
                    <form action="/api/v1/clubs/[% club.id | html %]/holds" method="post" name="form" id="club-request-form">
310
                        [% INCLUDE 'csrf-token.inc' %]
311
                        <input type="hidden" name="op" value="cud-noop" />
312
313
                        [% IF ( multi_hold ) %]
314
                            <input type="hidden" name="request" value="any"/>
315
                            [% FOREACH biblioloo IN biblioloop %]
316
                                [% UNLESS biblioloo.none_avail %]
317
                                    <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblioloo.biblionumber | html %]"/>
318
                                    <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
319
                                    <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
418
                                [% END %]
320
                                [% END %]
419
                                <td>[% biblioloo.rank | html %]</td>
321
                            [% END %]
420
                                <td>
322
                        [% ELSE %]
421
                                    [% IF ( biblioloo.checked_previously ) %]
323
                            <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]"/>
422
                                        <span>Patron has previously checked out this title</span><br />
324
                            <input type="hidden" name="title" value="[% biblio.title | html %]" />
325
                            <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
326
                        [% END # /IF multi_hold %]
327
                        <ol>
328
                            <li>
329
                                <span class="label">Club: </span> [% club.name | html %]
330
                            </li>
331
                            <li>
332
                                <span class="label">Description: </span> [% club.description | html %]
333
                            </li>
334
                            <li>
335
                                <label for="pickup">Pickup at:</label>
336
                                <select name="pickup" id="pickup_club">
337
                                    [% PROCESS options_for_libraries libraries => Branches.all({ selected => club.branchcode, search_params => { pickup_location => 1 } }) %]
338
                                </select>
339
                            </li>
340
                            <li>
341
                                <label for="default_patron_home">Pickup at patron's home library when possible:</label>
342
                                <input type="checkbox" id="default_patron_home" name="default_patron_home"/>
343
                            </li>
344
                        </ol>
345
                        <h2 style="padding: 0 1em;">Members</h2>
346
                        <ol>
347
                            [% FOREACH member IN members %]
348
                                [% SET patron = member.patron %]
349
                                <li style="padding: 0.5em 1em;">
350
                                    <div>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]</div>
351
                                    [% IF member.exceeded_maxreserves %]
352
                                        <div>
353
                                            <i class="fa fa-error"></i>
354
                                            <strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
355
                                        </div>
423
                                    [% END %]
356
                                    [% END %]
424
                                    [% IF ( biblioloo.alreadyres ) %]
357
                                    [% IF ( patron.is_expired ) %]
425
                                        <ul>
358
                                        <div>
426
                                            <li> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item </li>
359
                                            <i class="fa-solid fa-triangle-exclamation"></i>
427
                                        </ul>
360
                                            <strong>Account has expired</strong>
361
                                        </div>
428
                                    [% END %]
362
                                    [% END %]
429
                                    [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
363
                                    [% IF patron.is_debarred %]
430
                                        <ul
364
                                        <div>
431
                                            ><li> <strong>No items are available</strong> to be placed on hold</li></ul
365
                                            <i class="fa-solid fa-triangle-exclamation"></i>
432
                                        >
366
                                            <strong>Patron has restrictions</strong>
367
                                        </div>
368
                                    [% END %]
369
                                    [% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
370
                                        <div>
371
                                            <i class="fa-solid fa-triangle-exclamation"></i>
372
                                            <strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>
373
                                        </div>
433
                                    [% END %]
374
                                    [% END %]
434
                                </td>
435
                            </tr>
436
                        [% END # /FOREACH biblioloo %]
437
                    </table>
438
                    <!-- /#requesttitles -->
439
                [% END %]
440
            </form>
441
        </fieldset>
442
    [% ELSIF NOT ( noitems || nobiblio ) # /UNLESS patron %]
443
444
        [% IF ( checked_previously && !multi_hold ) %]
445
            <div class="alert alert-warning">
446
                <ul>
447
                    <li>Patron has previously checked out this title</li>
448
                </ul>
449
            </div>
450
        [% END %]
451
375
452
        [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %]
376
                                    [% IF ( member.diffbranch ) %]
453
            <div class="alert alert-warning">
377
                                        <div>
454
                [% UNLESS ( multi_hold ) %]
378
                                            <i class="fa-solid fa-triangle-exclamation"></i>
455
                    <h3>Cannot place hold</h3>
379
                                            <strong>Pickup library is different.</strong> Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )
456
                    <ul>
380
                                        </div>
457
                        [% IF ( no_reserves_allowed ) %]
381
                                    [% END %]
458
                            <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place a hold on any of these items.</li>
382
                                </li>
459
                        [% ELSIF ( exceeded_maxreserves ) %]
460
                            <li
461
                                ><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total
462
                                holds.</li
463
                            >
464
                        [% ELSIF ( exceeded_holds_per_record ) %]
465
                            <li
466
                                ><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of
467
                                [% max_holds_for_record | html %] hold(s) on this record.</li
468
                            >
469
                        [% ELSIF ( alreadypossession ) %]
470
                            <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li>
471
                        [% ELSIF ( alreadyreserved ) %]
472
                            <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
473
                        [% ELSIF ( ageRestricted ) %]
474
                            <li><strong>Age restricted</strong></li>
475
                        [% ELSIF ( none_available ) %]
476
                            <li> <strong>No items are available</strong> to be placed on hold.</li>
477
                        [% ELSIF ( maxreserves ) %]
478
                            <li
479
                                ><strong>Too many holds:</strong>
480
                                [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has too many holds.</li
481
                            >
482
                        [% ELSIF ( recall ) %]
483
                            <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has <strong>already placed a recall</strong> on this item.</li>
484
                        [% END # /IF exceeded_maxreserves %]
485
                    </ul>
486
                [% ELSE # UNLESS multi_hold %]
487
                    <h3>Cannot place hold on some items</h3>
488
                    [% IF (no_reserves_allowed ) %]
489
                        <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place holds on some of these title's items.</li>
490
                    [% ELSIF ( exceeded_maxreserves ) %]
491
                        <li
492
                            ><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can place [% new_reserves_allowed | html %] of the requested
493
                            [% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li
494
                        >
495
                    [% ELSIF ( exceeded_holds_per_record ) %]
496
                        [% FOREACH biblioloo IN biblioloop %]
497
                            [% IF (biblioloo.tooManyHoldsForThisRecord) %]
498
                                <li
499
                                    ><strong>Too many holds for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %]</a>:</strong>
500
                                    [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this
501
                                    record.</li
502
                                >
503
                            [% END %]
383
                            [% END %]
504
                        [% END %]
384
                        [% UNLESS ( multi_hold ) %]
505
                    [% ELSIF ( none_available ) %]
385
                            <fieldset class="action">
506
                        <li><strong>No items available: </strong>One or more records have no items that can be held</li>
386
                                <input type="submit" class="btn btn-primary" value="Place hold" />
507
                    [% END # /IF exceeded_maxreserves %]
387
                            </fieldset>
508
                [% END # /UNLESS multi_hold %]
388
                        [% ELSE %]
509
            </div>
389
                            <table id="requesttitles">
510
        [% END # /IF ( exceeded_maxreserves || ... %]
390
                                <tr>
391
                                    <th>&nbsp;</th>
392
                                    <th>Title</th>
393
                                    [% UNLESS Koha.Preference('item-level_itypes') %]
394
                                        <th>Item type</th>
395
                                    [% END %]
396
                                    <th>Priority</th>
397
                                    <th>Information</th>
398
                                </tr>
399
                                [% FOREACH biblioloo IN biblioloop %]
400
                                    [% IF ( biblioloo.warn ) %]
401
                                        <tr class="onissue">
402
                                    [% ELSE %]
403
                                        <tr>
404
                                    [% END %]
405
                                        <td>
406
                                            [% UNLESS ( biblioloo.warn ) %]
407
                                                    <input class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]"/>
408
                                                </td>
409
                                            [% END %]
410
                                        <td>
411
                                            <ul>
412
                                                <li>
413
                                                    <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
414
                                                    [% IF biblioloo.author %] by [% biblioloo.author | html %][% END %]
415
                                                </li>
416
                                                [% IF ( biblioloo.publicationyear ) %]
417
                                                    <li>
418
                                                        <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
419
                                                    </li>
420
                                                [% END %]
421
                                            </ul>
422
                                            [% IF ( biblioloo.warn ) %]
423
                                                <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
424
                                            [% END %]
425
                                        </td>
426
                                        [% UNLESS Koha.Preference('item-level_itypes') %]
427
                                            <td>
428
                                                <img class="itemtype-image" src="[% biblioloo.itemtype.image_location| html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
429
                                            </td>
430
                                        [% END %]
431
                                        <td>[% biblioloo.rank | html %]</td>
432
                                        <td>
433
                                            [% IF ( biblioloo.checked_previously ) %]
434
                                                <span>Patron has previously checked out this title</span><br/>
435
                                            [% END %]
436
                                            [% IF ( biblioloo.alreadyres ) %]
437
                                                <ul>
438
                                            [% ELSE %]
439
                                                [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
440
                                                    <ul>
441
                                                [% END %]
442
                                            [% END %]
511
443
512
        [% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
444
                                            [% IF ( biblioloo.alreadyres ) %]
513
            <div class="alert alert-info">
445
                                                <li>
514
                <ul>
446
                                                    [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item
515
                    [% IF ( patron.is_expired ) %]
447
                                                </li>
516
                        <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Account has expired</strong></li>
448
                                            [% END %]
517
                    [% END %]
449
                                            [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
450
                                                <li> <strong>No items are available</strong> to be placed on hold</li>
451
                                            [% END %]
518
452
519
                    [% IF patron.is_debarred %]
453
                                            [% IF ( biblioloo.alreadyres ) %]
520
                        <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Patron has restrictions</strong></li>
454
                                                </ul>
521
                    [% END %]
455
                                            [% ELSE %]
456
                                                [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
457
                                                    </ul>
458
                                                [% END %]
459
                                            [% END %]
460
                                        </td>
461
                                    </tr>
462
                                [% END # /FOREACH biblioloo %]
463
                            </table> <!-- /#requesttitles -->
464
                        [% END %]
465
                    </form>
466
                </fieldset>
467
            [% ELSIF NOT ( noitems || nobiblio ) # /UNLESS patron %]
522
468
523
                    [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
469
                [% IF ( checked_previously && !multi_hold ) %]
524
                        <li
470
                    <div class="alert alert-warning">
525
                            >[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]:
471
                        <ul>
526
                            <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li
472
                            <li>Patron has previously checked out this title</li>
527
                        >
473
                        </ul>
528
                    [% END %]
474
                    </div>
475
                [% END %]
529
476
530
                    [% IF ( diffbranch ) %]
477
                [% IF ( no_reserves_allowed || exceeded_maxreserves || exceeded_holds_per_record || alreadyreserved || none_available || alreadypossession || ageRestricted || recall ) %]
531
                        <li
478
                    <div class="alert alert-warning">
532
                            ><strong>Pickup library is different. </strong>Patron: [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] Patron's home library:
479
533
                            ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )</li
480
                        [% UNLESS ( multi_hold ) %]
534
                        >
481
                            <h3>Cannot place hold</h3>
535
                    [% END %]
482
                            <ul>
536
                </ul>
483
                                [% IF ( no_reserves_allowed ) %]
537
                <!-- /.dialog.message -->
484
                                    <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place a hold on any of these items.</li>
538
            </div>
485
                                [% ELSIF ( exceeded_maxreserves ) %]
539
        [% END # /IF patron.is_expired || diffbranch ... %]
486
                                    <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% maxreserves | html %] total holds.</li>
487
                                [% ELSIF ( exceeded_holds_per_record ) %]
488
                                    <li><strong>Too many holds for this record:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
489
                                [% ELSIF ( alreadypossession ) %]
490
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 hide_patron_infos_if_needed => 1 %] <strong>is already in possession</strong> of one item.</li>
491
                                [% ELSIF ( alreadyreserved ) %]
492
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item.</li>
493
                                [% ELSIF ( ageRestricted ) %]
494
                                    <li><strong>Age restricted</strong></li>
495
                                [% ELSIF ( none_available ) %]
496
                                    <li> <strong>No items are available</strong> to be placed on hold.</li>
497
                                [% ELSIF ( maxreserves ) %]
498
                                    <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has too many holds.</li>
499
                                [% ELSIF ( recall ) %]
500
                                    <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] has <strong>already placed a recall</strong> on this item.</li>
501
                                [% END # /IF exceeded_maxreserves %]
502
                            </ul>
503
                        [% ELSE # UNLESS multi_hold %]
504
                            <h3>Cannot place hold on some items</h3>
505
                            [% IF (no_reserves_allowed ) %]
506
                                <li><strong>No holds allowed:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] cannot place holds on some of these title's items.</li>
507
                            [% ELSIF ( exceeded_maxreserves ) %]
508
                                <li><strong>Too many holds:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can place [% new_reserves_allowed | html %] of the requested [% new_reserves_count | html %] holds for a maximum of [% maxreserves | html %] total holds.</li>
509
                            [% ELSIF ( exceeded_holds_per_record ) %]
510
                                [% FOREACH biblioloo IN biblioloop %]
511
                                    [% IF (biblioloo.tooManyHoldsForThisRecord) %]
512
                                        <li><strong>Too many holds for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %]</a>:</strong> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] can only place a maximum of [% max_holds_for_record | html %] hold(s) on this record.</li>
513
                                    [% END %]
514
                                [% END %]
515
                            [% ELSIF ( none_available ) %]
516
                                <li><strong>No items available: </strong>One or more records have no items that can be held</li>
517
                            [% END # /IF exceeded_maxreserves %]
518
                        [% END # /UNLESS multi_hold %]
540
519
541
        [% IF ( messageborrower ) %]
520
                    </div>
542
            <div class="alert alert-warning">
521
                [% END # /IF ( exceeded_maxreserves || ... %]
543
                <h3>Patron not found:</h3>
544
                <p>Name or barcode not found. Please try an other </p>
545
            </div>
546
        [% END %]
547
522
548
        <div class="alert alert-warning visually-hidden holdalert"> </div>
523
                [% IF ( patron.is_expired || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
524
                    <div class="alert alert-info">
525
                        <ul>
526
                            [% IF ( patron.is_expired ) %]
527
                                <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Account has expired</strong></li>
528
                            [% END %]
549
529
550
        [% UNLESS ( multi_hold ) %]
530
                            [% IF patron.is_debarred %]
551
            <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
531
                                <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %]: <strong>Patron has restrictions</strong></li>
552
                [% INCLUDE 'csrf-token.inc' %]
532
                            [% END %]
553
                <input type="hidden" name="op" value="cud-placerequest" />
554
                <fieldset class="rows">
555
                    <legend>Hold details</legend>
556
533
557
                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
534
                            [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
558
                    [% FOREACH biblionumber IN biblionumbers %]
535
                                <li>[% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 link_to => 'members_pay' %]: <strong>Patron has outstanding fines: [% amount_outstanding | $Price %]</strong></li>
559
                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
536
                            [% END %]
560
                    [% END %]
561
                    <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]" />
562
                    <input type="hidden" name="title" value="[% biblio.title | html %]" />
563
                    <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
564
537
565
                    <ol>
538
                            [% IF ( diffbranch ) %]
566
                        <li>
539
                                <li><strong>Pickup library is different. </strong>Patron: [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] Patron's home library: ([% Branches.GetName(patron.branchcode) | html %] / [% patron.branchcode | html %] )</li>
567
                            <span class="label">Patron:</span>
568
                            [% IF ( patron.borrowernumber ) %]
569
                                [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
570
                            [% ELSE %]
571
                                Not defined yet
572
                            [% END %]
540
                            [% END %]
573
                        </li>
541
                        </ul> <!-- /.dialog.message -->
542
                    </div>
543
                [% END # /IF patron.is_expired || diffbranch ... %]
574
544
575
                        <li>
545
                [% IF ( messageborrower ) %]
576
                            <span class="label">Estimated priority:</span>
546
                    <div class="alert alert-warning">
577
                            <strong>[% fixedRank | html %]</strong>
547
                        <h3>Patron not found:</h3>
578
                        </li>
548
                        <p>Name or barcode not found. Please try an other </p>
549
                    </div>
550
                [% END %]
579
551
580
                        <li>
552
                <div class="alert alert-warning visually-hidden holdalert">
581
                            <label for="holdnotes">Notes:</label>
553
                </div>
582
                            <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
583
                        </li>
584
554
585
                        [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
555
                [% UNLESS ( multi_hold ) %]
586
                            <li>
556
                    <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
587
                                <label for="itemtype">Request specific item type:</label>
557
                        [% INCLUDE 'csrf-token.inc' %]
588
                                <select name="itemtype" id="itemtype">
558
                        <input type="hidden" name="op" value="cud-placerequest" />
589
                                    <option value="">Any item type</option>
559
                        <fieldset class="rows">
590
                                    [%- FOREACH itemtype IN available_itemtypes %]
560
                            <legend>Hold details</legend>
591
                                        <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
561
592
                                    [%- END %]
562
                            <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
593
                                </select>
563
                            [% FOREACH biblionumber IN biblionumbers %]
594
                            </li>
564
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
595
                        [% END %]
565
                            [% END %]
566
                                <input type="hidden" name="holdable_bibs" id="holdable_bibs" value="[% biblio.biblionumber | html %]"/>
567
                                <input type="hidden" name="title" value="[% biblio.title | html %]" />
568
                                <input type="hidden" name="rank-request" value="[% fixedRank | html %]" />
596
569
597
                        [% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
570
                            <ol>
598
                            <li>
571
                                <li>
599
                                <label for="from">Hold starts on date:</label>
572
                                    <span class="label">Patron:</span>
600
                                <input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
573
                                    [% IF ( patron.borrowernumber ) %]
601
                            </li>
574
                                        [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
602
                        [% END %]
575
                                    [% ELSE %]
576
                                        Not defined yet
577
                                    [% END %]
578
                                </li>
603
579
604
                        <li>
580
                                <li>
605
                            <label for="to">Hold expires on date:</label>
581
                                    <span class="label">Estimated priority:</span>
606
                            <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
582
                                    <strong>[% fixedRank | html %]</strong>
607
                        </li>
583
                                </li>
608
584
609
                        <li id="non_priority_list_item">
610
                            <label for="non_priority">Non priority hold:</label>
611
                            <input name="non_priority" id="non_priority" type="checkbox" />
612
                            <span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
613
                        </li>
614
                    </ol>
615
                </fieldset>
616
                <fieldset class="rows any_specific">
617
                    <legend>
618
                        [% IF force_hold_level == 'item' || force_hold_level == 'item_group' %]
619
                            <input type="radio" id="requestany" name="request" disabled="true" />
620
                        [% ELSIF force_hold_level == 'record' %]
621
                            <input type="radio" id="requestany" checked="checked" value="Any" disabled="true" />
622
                            <input type="hidden" name="request" value="Any" />
623
                            <span class="error"><i>(Required)</i></span>
624
                        [% ELSE %]
625
                            <input type="radio" id="requestany" name="request" checked="checked" value="Any" />
626
                        [% END %]
627
                        <label for="requestany" class="inline"> Hold next available item </label>
628
                    </legend>
629
                    <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
630
                    <fieldset class="enable_request_any disable_request_group disable_request_specific">
631
                        [% IF force_hold_level == 'item' # Patron has placed a item level hold previously for this record %]
632
                            <span class="error">
633
                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
634
                                Hold must be item level
635
                            </span>
636
                        [% ELSIF force_hold_level == 'item_group' # Patron has placed an item group level hold previously for this record %]
637
                            <span class="error">
638
                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
639
                                Hold must be item group level
640
                            </span>
641
                        [% ELSE %]
642
                            <ol>
643
                                <li>
585
                                <li>
644
                                    <label for="pickup">Pickup at:</label>
586
                                    <label for="holdnotes">Notes:</label>
645
                                    <select name="pickup" id="pickup-next-avail" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]" data-pickup-location-source="biblio">
587
                                    <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
646
                                        [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
647
                                    </select>
648
                                </li>
588
                                </li>
649
589
650
                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
590
                                [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
Lines 658-707 Link Here
658
                                        </select>
598
                                        </select>
659
                                    </li>
599
                                    </li>
660
                                [% END %]
600
                                [% END %]
661
                                [% UNLESS remaining_holds_for_record == 1 %]
662
                                    <li>
663
                                        <label for="holds_to_place_count">Holds to place (count)</label>
664
                                        <input type="text" inputmode="numeric" pattern="[0-9]*" id="holds_to_place_count" name="holds_to_place_count" value="1" />
665
                                    </li>
666
                                [% ELSE %]
667
                                    <input type="hidden" name="holds_to_place_count" value="1" />
668
                                [% END %]
669
                            </ol>
670
                        [% END %]
671
601
672
                        <fieldset class="action">
602
                            [% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
673
                            [% IF ( patron.borrowernumber ) %]
603
                                <li>
674
                                [% IF ( override_required ) %]
604
                                    <label for="from">Hold starts on date:</label>
675
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
605
                                    <input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
676
                                [% ELSIF ( none_available ) %]
606
                                </li>
677
                                    <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
607
                            [% END %]
608
609
                            <li>
610
                                <label for="to">Hold expires on date:</label>
611
                                <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
612
                            </li>
613
614
                                <li id="non_priority_list_item">
615
                                    <label for="non_priority">Non priority hold:</label>
616
                                    <input name="non_priority" id="non_priority" type="checkbox" />
617
                                    <span class="hint">A non priority hold doesn't prevent a current checkout from renewing</span>
618
                                </li>
619
                            </ol>
620
                            </fieldset>
621
                            <fieldset class="rows any_specific">
622
                                <legend>
623
                                    [% IF force_hold_level == 'item' || force_hold_level == 'item_group' %]
624
                                        <input type="radio" id="requestany" name="request" disabled="true" />
625
                                    [% ELSIF force_hold_level == 'record' %]
626
                                        <input type="radio" id="requestany" checked="checked" value="Any" disabled="true"/>
627
                                        <input type="hidden" name="request" value="Any"/>
628
                                        <span class="error"><i>(Required)</i></span>
629
                                    [% ELSE %]
630
                                        <input type="radio" id="requestany" name="request" checked="checked" value="Any" />
631
                                    [% END %]
632
                                    <label for="requestany" class="inline">
633
                                        Hold next available item
634
                                    </label>
635
                                </legend>
636
                                <input type="hidden" name="alreadyreserved" value="[% alreadyreserved | html %]" />
637
                                <fieldset class="enable_request_any disable_request_group disable_request_specific">
638
                                [% IF force_hold_level == 'item' # Patron has placed a item level hold previously for this record %]
639
                                    <span class="error">
640
                                        <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
641
                                        Hold must be item level
642
                                    </span>
643
                                [% ELSIF force_hold_level == 'item_group' # Patron has placed an item group level hold previously for this record %]
644
                                    <span class="error">
645
                                        <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
646
                                        Hold must be item group level
647
                                    </span>
678
                                [% ELSE %]
648
                                [% ELSE %]
679
                                    <button type="submit" id="hold_grp_btn" class="btn btn-primary">Place hold</button>
649
                                    <ol>
650
651
                                        <li>
652
                                            <label for="pickup">Pickup at:</label>
653
                                            <select name="pickup" id="pickup-next-avail"
654
                                                    data-biblio-id="[% biblio.biblionumber | html %]"
655
                                                    data-patron-id="[% patron.borrowernumber | html %]"
656
                                                    data-pickup-location-source="biblio">
657
                                                [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
658
                                            </select>
659
                                        </li>
660
661
                                        [% IF Koha.Preference('AllowHoldItemTypeSelection') %]
662
                                            <li>
663
                                                <label for="itemtype">Request specific item type:</label>
664
                                                <select name="itemtype" id="itemtype">
665
                                                    <option value="">Any item type</option>
666
                                                    [%- FOREACH itemtype IN available_itemtypes %]
667
                                                        <option value="[% itemtype | html %]">[% ItemTypes.GetDescription( itemtype ) | html %]</option>
668
                                                    [%- END %]
669
                                                </select>
670
                                            </li>
671
                                        [% END %]
672
                                        [% UNLESS remaining_holds_for_record == 1 %]
673
                                            <li>
674
                                                <label for="holds_to_place_count">Holds to place (count)</label>
675
                                                <input type="text" inputmode="numeric" pattern="[0-9]*" id="holds_to_place_count" name="holds_to_place_count" value="1" />
676
                                            </li>
677
                                        [% ELSE %]
678
                                            <input type="hidden" name="holds_to_place_count" value="1" />
679
                                        [% END %]
680
                                    </ol>
680
                                [% END %]
681
                                [% END %]
681
                            [% END %]
682
683
684
                                <fieldset class="action">
685
                                    [% IF ( patron.borrowernumber ) %]
686
                                        [% IF ( override_required ) %]
687
                                            <button type="submit" id="hold_grp_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
688
                                        [% ELSIF ( none_available ) %]
689
                                            <button type="submit" id="hold_grp_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
690
                                        [% ELSE %]
691
                                            <button type="submit" id="hold_grp_btn" class="btn btn-primary">Place hold</button>
692
                                        [% END %]
693
                                    [% END %]
694
                                </fieldset>
695
                            </fieldset>
682
                        </fieldset>
696
                        </fieldset>
683
                    </fieldset>
684
                </fieldset>
685
697
686
                <hr />
698
                        <hr/>
687
699
688
                [% biblio_info = biblioloop.0 %]
700
                        [% biblio_info = biblioloop.0 %]
689
                <!-- ItemGroup level holds -->
701
                        <!-- ItemGroup level holds -->
690
                [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
702
                        [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
691
                    <fieldset class="rows any_specific">
703
                        <fieldset class="rows any_specific">
692
                        <legend>
704
                            <legend>
693
                            [% IF force_hold_level == 'item_group' %]
705
                                [% IF force_hold_level == 'item_group' %]
694
                                <input type="radio" class="requestgrp" id="requestgrp" name="request" checked="checked" disabled="true" />
706
                                    <input type="radio" class="requestgrp" id="requestgrp" name="request" checked="checked" disabled="true" />
695
                                <span class="error"><i>(Required)</i></span>
707
                                    <span class="error"><i>(Required)</i></span>
696
                            [% ELSIF force_hold_level == 'item' || force_hold_level == 'record' %]
708
                                [% ELSIF force_hold_level == 'item' || force_hold_level == 'record' %]
697
                                <input type="radio" class="requestgrp" id="requestgrp" name="request" disabled="true" />
709
                                    <input type="radio" class="requestgrp" id="requestgrp" name="request" disabled="true" />
698
                            [% ELSE %]
710
                                [% ELSE %]
699
                                <input type="radio" class="requestgrp" id="requestgrp" name="request" />
711
                                    <input type="radio" class="requestgrp" id="requestgrp" name="request" />
700
                            [% END %]
712
                                [% END %]
701
                            <label for="requestgrp" class="inline"> Hold next available item from an item group </label>
713
                                <label for="requestgrp" class="inline">
702
                        </legend>
714
                                    Hold next available item from an item group
715
                                </label>
716
                            </legend>
703
717
704
                        <fieldset class="enable_request_group disable_request_any disable_request_specific">
718
                            <fieldset class="enable_request_group disable_request_any disable_request_specific">
705
                            [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
719
                            [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
706
                                <span class="error">
720
                                <span class="error">
707
                                    <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
721
                                    <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
Lines 716-722 Link Here
716
                                <ul>
730
                                <ul>
717
                                    <li>
731
                                    <li>
718
                                        <label for="pickup">Pickup at:</label>
732
                                        <label for="pickup">Pickup at:</label>
719
                                        <select name="pickup" id="pickup-item-group" data-biblio-id="[% biblio.biblionumber | html %]" data-patron-id="[% patron.borrowernumber | html %]" data-pickup-location-source="biblio">
733
                                        <select name="pickup" id="pickup-item-group"
734
                                                data-biblio-id="[% biblio.biblionumber | html %]"
735
                                                data-patron-id="[% patron.borrowernumber | html %]"
736
                                                data-pickup-location-source="biblio">
720
                                            [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
737
                                            [% PROCESS options_for_libraries libraries => Branches.pickup_locations({ search_params => { biblio => biblionumber, patron => patron }, selected => pickup }) %]
721
                                        </select>
738
                                        </select>
722
                                    </li>
739
                                    </li>
Lines 764-1436 Link Here
764
                                    </li>
781
                                    </li>
765
                                </ul>
782
                                </ul>
766
                            [% END %]
783
                            [% END %]
767
                            <fieldset class="action">
784
                                <fieldset class="action">
768
                                [% IF ( patron.borrowernumber ) %]
785
                                    [% IF ( patron.borrowernumber ) %]
769
                                    [% IF ( override_required ) %]
786
                                        [% IF ( override_required ) %]
770
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
787
                                            <button type="submit" id="hold_any_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
771
                                    [% ELSIF ( none_available ) %]
788
                                        [% ELSIF ( none_available ) %]
772
                                        <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
789
                                            <button type="submit" id="hold_any_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
773
                                    [% ELSE %]
790
                                        [% ELSE %]
774
                                        <button type="submit" id="hold_any_btn" class="btn btn-primary">Place hold</button>
791
                                            <button type="submit" id="hold_any_btn" class="btn btn-primary">Place hold</button>
792
                                        [% END %]
775
                                    [% END %]
793
                                    [% END %]
776
                                [% END %]
794
                                </fieldset>
777
                            </fieldset>
795
                            </fieldset>
778
                        </fieldset>
796
                        </fieldset>
779
                    </fieldset>
780
                [% END %]
781
                <!-- /ItemGroup level holds -->
782
783
                <fieldset class="rows any_specific">
784
                    <legend>
785
                        [% IF force_hold_level == 'item' %]
786
                            <input type="radio" id="requestspecificitem" name="request" class="requestspecific" checked="checked" disabled="disabled" />
787
                            <span class="error"><em>(Required)</em></span>
788
                        [% ELSIF force_hold_level == 'record' || force_hold_level == 'item_group' %]
789
                            <input type="radio" id="requestspecificitem" name="request" class="requestspecific" disabled="disabled" />
790
                        [% ELSE %]
791
                            <input type="radio" id="requestspecificitem" name="request" class="requestspecific" />
792
                        [% END %]
797
                        [% END %]
793
                        <label for="requestspecificitem" class="inline"> Hold a specific item </label>
798
                        <!-- /ItemGroup level holds -->
794
                    </legend>
799
800
                        <fieldset class="rows any_specific">
801
                            <legend>
802
                                [% IF force_hold_level == 'item' %]
803
                                     <input type="radio" id="requestspecificitem" name="request" class="requestspecific" checked="checked" disabled='disabled'/>
804
                                     <span class="error"><em>(Required)</em></span>
805
                                [% ELSIF force_hold_level == 'record' || force_hold_level == 'item_group' %]
806
                                     <input type="radio" id="requestspecificitem" name="request" class="requestspecific" disabled='disabled'/>
807
                                [% ELSE %]
808
                                     <input type="radio" id="requestspecificitem" name="request" class="requestspecific"/>
809
                                [% END %]
810
                                <label for="requestspecificitem" class="inline">
811
                                    Hold a specific item
812
                                </label>
813
                            </legend>
814
815
                            <fieldset class="enable_request_specific disable_request_any disable_request_group">
816
                                <ol>
817
                                    [% UNLESS Koha.Preference('item-level_itypes') %]
818
                                        <li>
819
                                            <span class="label">Item type:</span>
820
                                            [% biblio_info.itemtype.translated_description | html %]
821
                                        </li>
822
                                    [% END %]
795
823
796
                    <fieldset class="enable_request_specific disable_request_any disable_request_group">
824
                                    [% IF ( biblio_info.biblioitem.publicationyear ) %]
797
                        <ol>
825
                                        <li>
798
                            [% UNLESS Koha.Preference('item-level_itypes') %]
826
                                            <span class="label">Publication year:</span>
799
                                <li>
827
                                            [% biblio_info.biblioitem.publicationyear | html %]
800
                                    <span class="label">Item type:</span>
828
                                        </li>
801
                                    [% biblio_info.itemtype.translated_description | html %]
829
                                    [% END %]
802
                                </li>
830
                                </ol>
803
                            [% END %]
804
831
805
                            [% IF ( biblio_info.biblioitem.publicationyear ) %]
832
                                <table id="requestspecific">
806
                                <li>
833
                                    <thead>
807
                                    <span class="label">Publication year:</span>
834
                                        <tr>
808
                                    [% biblio_info.biblioitem.publicationyear | html %]
835
                                            <th>Hold</th>
809
                                </li>
836
                                            <th>Allowed pickup locations</th>
810
                            [% END %]
837
                                            [% IF Koha.Preference('item-level_itypes') %]
811
                        </ol>
838
                                                <th>Item type</th>
839
                                            [% END %]
840
                                            <th>Barcode</th>
841
                                            [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
842
                                                <th>Item group</th>
843
                                            [% END %]
844
                                            <th>Home library</th>
845
                                            <th>Last location</th>
846
                                            [% IF itemdata_ccode %]
847
                                                <th>Collection</th>
848
                                            [% END %]
849
                                            <th>Call number</th>
850
                                            <th>Copy number</th>
851
                                            [% IF itemdata_enumchron %]
852
                                                <th>Vol no.</th>
853
                                            [% END %]
854
                                            <th>Information</th>
855
                                        </tr>
856
                                    </thead>
857
                                    <tbody>
858
                                        [% SET selected = 0 %]
859
                                        [% FOREACH itemloo IN biblio_info.itemloop %]
860
                                            [% UNLESS ( itemloo.hide ) %]
861
                                                <tr class="[% itemloo.backgroundcolor | html %]">
862
                                                    <td>
863
                                                        [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
864
                                                            <span class="error">
865
                                                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
866
                                                                Hold must be record level
867
                                                            </span>
868
                                                        [% ELSIF force_hold_level == 'item_group' %]
869
                                                            <span class="error">
870
                                                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
871
                                                                Hold must be item group level
872
                                                            </span>
873
                                                        [% ELSIF ( itemloo.available ) %]
874
                                                            <input type="[% reserve_input_type | html %]" name="checkitem" class="requestspecific" value="[% itemloo.itemnumber | html %]" />
875
                                                        [% ELSIF ( itemloo.override ) %]
876
                                                            <input type="[% reserve_input_type | html %]" name="checkitem" class="needsoverride requestspecific" value="[% itemloo.itemnumber | html %]" />
877
                                                            <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"/></i>
878
                                                        [% ELSE %]
879
                                                            <span class="error">
880
                                                                <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
881
                                                                [% IF itemloo.not_holdable %]
882
                                                                    [% IF itemloo.not_holdable == 'damaged' %]
883
                                                                        <span>Item damaged</span>
884
                                                                    [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
885
                                                                        <span>Age restricted</span>
886
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
887
                                                                        <span>Exceeded max holds per record</span>
888
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
889
                                                                        <span>Daily hold limit reached for patron</span>
890
                                                                    [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
891
                                                                        <span>Too many holds</span>
892
                                                                    [% ELSIF itemloo.not_holdable == 'notReservable' %]
893
                                                                        <span>Not holdable</span>
894
                                                                    [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
895
                                                                        <span>Patron is from different library</span>
896
                                                                    [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
897
                                                                        <span>Cannot place hold from patron's library</span>
898
                                                                    [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
899
                                                                        <span>Patron already has hold for this item</span>
900
                                                                    [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
901
                                                                        <span>Cannot be transferred to pickup library</span>
902
                                                                    [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
903
                                                                        <span>Only pickup locations within the same hold group are allowed</span>
904
                                                                    [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
905
                                                                        <span>No holds are allowed on this item</span>
906
                                                                    [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
907
                                                                        <span>Library is not a pickup location</span>
908
                                                                    [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
909
                                                                        <span>No valid pickup location</span>
910
                                                                    [% ELSIF itemloo.not_holdable == 'notforloan' %]
911
                                                                        <span>Not for loan</span>
912
                                                                    [% ELSE %]
913
                                                                        <span>[% itemloo.not_holdable | html %]</span>
914
                                                                    [% END %]
915
                                                                [% END %]
916
                                                            </span>
917
                                                        [% END # /IF force_hold_level %]
918
                                                    </td>
919
                                                    <td>
920
                                                    [% IF (itemloo.pickup_locations_count > 0) || Koha.Preference('AllowHoldPolicyOverride') %]
921
                                                        <select name="item_pickup_[% itemloo.itemnumber | html %]" class="pickup_locations requestspecific" style="width:100%;"
922
                                                                data-item-id="[% itemloo.itemnumber | html %]"
923
                                                                data-patron-id="[% patron.borrowernumber | html %]"
924
                                                                data-pickup-location-source="item">
925
                                                        [% IF (itemloo.default_pickup_location) %]
926
                                                            <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
927
                                                        [% END %]
928
                                                        </select>
929
                                                    [% END %]
930
                                                    </td>
931
                                                    [% IF Koha.Preference('item-level_itypes') %]
932
                                                        <td>
933
                                                            [% UNLESS ( noItemTypeImages ) %]
934
                                                                [% IF ( itemloo.itemtype.image_location) %]<img class="itemtype-image" src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br /> [% END %]
935
                                                            [% END %]
936
                                                            <span class="itypetext">[% itemloo.itemtype.translated_description | html %]</span>
937
                                                        </td>
938
                                                    [% END %]
939
                                                    <td>
940
                                                        [% itemloo.barcode | html %]
941
                                                    </td>
942
                                                    [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
943
                                                        <td>
944
                                                            [% itemloo.object.item_group.description | html %]
945
                                                        </td>
946
                                                    [% END %]
947
                                                    <td>
948
                                                        [% Branches.GetName( itemloo.homebranch ) | html %]
949
                                                    </td>
950
                                                    <td>
951
                                                        [% Branches.GetName( itemloo.holdingbranch ) | html %]
952
                                                    </td>
953
                                                    [% IF itemdata_ccode %]
954
                                                        <td>
955
                                                            [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %]
956
                                                        </td>
957
                                                    [% END %]
958
                                                    <td>
959
                                                        [% itemloo.itemcallnumber | html %]
960
                                                    </td>
961
                                                    <td>
962
                                                        [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %]
963
                                                    </td>
964
                                                    [% IF itemdata_enumchron %]
965
                                                        <td>
966
                                                            [% itemloo.enumchron | html %]
967
                                                        </td>
968
                                                    [% END %]
969
                                                    [% IF ( itemloo.onloan ) %]
970
                                                        <td data-order="[% itemloo.date_due | html %]">
971
                                                            <span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span>
972
                                                    [% ELSE %]
973
                                                        <td>
974
                                                            [% IF ( itemloo.transfertwhen ) %]
975
                                                                <span>In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %],
976
                                                                to [% Branches.GetName( itemloo.transfertto ) | html %], since [% itemloo.transfertwhen | $KohaDates %]</span>
977
                                                            [% END %]
978
                                                    [% END %]
812
979
813
                        <table id="requestspecific">
980
                                                        [% IF ( itemloo.reservedate ) %]
814
                            <thead>
981
                                                            [% IF ( itemloo.nocancel ) %]
815
                                <tr>
982
                                                                    <span>Can't be cancelled when item is in transit</span>
816
                                    <th>Hold</th>
817
                                    <th>Allowed pickup locations</th>
818
                                    [% IF Koha.Preference('item-level_itypes') %]
819
                                        <th>Item type</th>
820
                                    [% END %]
821
                                    <th>Barcode</th>
822
                                    [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
823
                                        <th>Item group</th>
824
                                    [% END %]
825
                                    <th>Home library</th>
826
                                    <th>Last location</th>
827
                                    [% IF itemdata_ccode %]
828
                                        <th>Collection</th>
829
                                    [% END %]
830
                                    <th>Call number</th>
831
                                    <th>Copy number</th>
832
                                    [% IF itemdata_enumchron %]
833
                                        <th>Vol no.</th>
834
                                    [% END %]
835
                                    <th>Information</th>
836
                                </tr>
837
                            </thead>
838
                            <tbody>
839
                                [% SET selected = 0 %]
840
                                [% FOREACH itemloo IN biblio_info.itemloop %]
841
                                    [% UNLESS ( itemloo.hide ) %]
842
                                        <tr class="[% itemloo.backgroundcolor | html %]">
843
                                            <td>
844
                                                [% IF force_hold_level == 'record' # Patron has placed a record level hold previously for this record %]
845
                                                    <span class="error">
846
                                                        <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
847
                                                        Hold must be record level
848
                                                    </span>
849
                                                [% ELSIF force_hold_level == 'item_group' %]
850
                                                    <span class="error">
851
                                                        <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
852
                                                        Hold must be item group level
853
                                                    </span>
854
                                                [% ELSIF ( itemloo.available ) %]
855
                                                    <input type="[% reserve_input_type | html %]" name="checkitem" class="requestspecific" value="[% itemloo.itemnumber | html %]" />
856
                                                [% ELSIF ( itemloo.override ) %]
857
                                                    <input type="[% reserve_input_type | html %]" name="checkitem" class="needsoverride requestspecific" value="[% itemloo.itemnumber | html %]" />
858
                                                    <i class="fa fa-exclamation-triangle fa-lg" style="color:gold" title="Requires override of hold policy"></i>
859
                                                [% ELSE %]
860
                                                    <span class="error">
861
                                                        <i class="fa fa-times fa-lg" title="Cannot be put on hold"></i>
862
                                                        [% IF itemloo.not_holdable %]
863
                                                            [% IF itemloo.not_holdable == 'damaged' %]
864
                                                                <span>Item damaged</span>
865
                                                            [% ELSIF itemloo.not_holdable == 'ageRestricted' %]
866
                                                                <span>Age restricted</span>
867
                                                            [% ELSIF itemloo.not_holdable == 'tooManyHoldsForThisRecord' %]
868
                                                                <span>Exceeded max holds per record</span>
869
                                                            [% ELSIF itemloo.not_holdable == 'tooManyReservesToday' %]
870
                                                                <span>Daily hold limit reached for patron</span>
871
                                                            [% ELSIF itemloo.not_holdable == 'tooManyReserves' %]
872
                                                                <span>Too many holds</span>
873
                                                            [% ELSIF itemloo.not_holdable == 'notReservable' %]
874
                                                                <span>Not holdable</span>
875
                                                            [% ELSIF itemloo.not_holdable == 'cannotReserveFromOtherBranches' %]
876
                                                                <span>Patron is from different library</span>
877
                                                            [% ELSIF itemloo.not_holdable == 'branchNotInHoldGroup' %]
878
                                                                <span>Cannot place hold from patron's library</span>
879
                                                            [% ELSIF itemloo.not_holdable == 'itemAlreadyOnHold' %]
880
                                                                <span>Patron already has hold for this item</span>
881
                                                            [% ELSIF itemloo.not_holdable == 'cannotBeTransferred' %]
882
                                                                <span>Cannot be transferred to pickup library</span>
883
                                                            [% ELSIF itemloo.not_holdable == 'pickupNotInHoldGroup' %]
884
                                                                <span>Only pickup locations within the same hold group are allowed</span>
885
                                                            [% ELSIF itemloo.not_holdable == 'noReservesAllowed' %]
886
                                                                <span>No holds are allowed on this item</span>
887
                                                            [% ELSIF itemloo.not_holdable == 'libraryNotPickupLocation' %]
888
                                                                <span>Library is not a pickup location</span>
889
                                                            [% ELSIF itemloo.not_holdable == 'no_valid_pickup_location' %]
890
                                                                <span>No valid pickup location</span>
891
                                                            [% ELSIF itemloo.not_holdable == 'notforloan' %]
892
                                                                <span>Not for loan</span>
893
                                                            [% ELSE %]
983
                                                            [% ELSE %]
894
                                                                <span>[% itemloo.not_holdable | html %]</span>
984
                                                                [% IF ( itemloo.waitingdate ) %]
895
                                                            [% END %]
985
                                                                    [% IF ( itemloo.canreservefromotherbranches ) %]
986
                                                                        <span>Waiting for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
987
                                                                    [% ELSE %]
988
                                                                        <span>Waiting at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
989
                                                                    [% END %]
990
                                                                [% ELSE %]
991
                                                                    [% IF ( itemloo.canreservefromotherbranches ) %]
992
                                                                        [% IF itemloo.reservedate %]
993
                                                                            <span>On hold for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since</span>
994
                                                                        [% ELSE %]
995
                                                                            <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
996
                                                                        [% END %]
997
                                                                    [% ELSIF itemloo.reservedate %]
998
                                                                        <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.reservedate | $KohaDates %]</span>
999
                                                                    [% ELSE %]
1000
                                                                        <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
1001
                                                                    [% END %]
1002
                                                                [% END %]
1003
                                                            [% END # /IF itemloo.nocancel %]
1004
                                                        [% ELSE %]
1005
                                                            Not on hold
1006
                                                        [% END # /IF itemloo.reservedate %]
1007
1008
                                                        [% IF itemloo.item_level_holds == "N" %]
1009
                                                            <br/>Item level hold not allowed from OPAC
1010
                                                        [% ELSIF itemloo.item_level_holds == "F" %]
1011
                                                            <br/>Item level hold forced from OPAC
896
                                                        [% END %]
1012
                                                        [% END %]
897
                                                    </span>
1013
898
                                                [% END # /IF force_hold_level %]
1014
                                                        [% IF ( itemloo.itemlost ) %]
899
                                            </td>
1015
                                                           <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
900
                                            <td>
1016
                                                        [% END %]
901
                                                [% IF (itemloo.pickup_locations_count > 0) || Koha.Preference('AllowHoldPolicyOverride') %]
1017
902
                                                    <select
1018
                                                        [% IF ( itemloo.damaged ) %]
903
                                                        name="item_pickup_[% itemloo.itemnumber | html %]"
1019
                                                            <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
904
                                                        class="pickup_locations requestspecific"
905
                                                        style="width:100%;"
906
                                                        data-item-id="[% itemloo.itemnumber | html %]"
907
                                                        data-patron-id="[% patron.borrowernumber | html %]"
908
                                                        data-pickup-location-source="item"
909
                                                    >
910
                                                        [% IF (itemloo.default_pickup_location) %]
911
                                                            <option value="[% itemloo.default_pickup_location.branchcode | html %]" selected="selected">[% itemloo.default_pickup_location.branchname | html %]</option>
912
                                                        [% END %]
1020
                                                        [% END %]
913
                                                    </select>
1021
1022
                                                        [% IF ( itemloo.withdrawn ) %]
1023
                                                           <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
1024
                                                        [% END %]
1025
1026
                                                        [% IF ( itemloo.notforloan ) %]
1027
                                                           <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
1028
                                                        [% ELSIF ( itemloo.notforloanitype ) %]
1029
                                                           <span class="nfl">Not for loan (Itemtype not for loan)</span>
1030
                                                        [% END %]
1031
                                                    </td>
1032
                                                </tr>
1033
                                            [% END # / UNLESS itemloo.hide %]
1034
                                        [% END # /FOREACH itemloo %]
1035
                                    </tbody>
1036
                                </table> <!-- /#requestspecific -->
1037
1038
                                [% IF hiddencount %]
1039
                                        <p class="hiddencount">
1040
                                            <a href="request.pl?biblionumber=[% biblio_info.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% hiddencount | html %] hidden)</a>
1041
                                        </p>
1042
                                [% END # /IF hiddencount %]
1043
                                <fieldset class="action">
1044
                                    [% IF ( patron.borrowernumber ) %]
1045
                                        [% IF ( override_required ) %]
1046
                                            <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1047
                                        [% ELSIF ( none_available ) %]
1048
                                            <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
1049
                                        [% ELSE %]
1050
                                            <button type="submit" id="hold_item_btn" class="btn btn-primary">Place hold</button>
1051
                                        [% END %]
1052
                                    [% END %]
1053
                                </fieldset>
1054
1055
                            [% ELSE # /UNLESS multi_hold %]
1056
                                <fieldset class="rows">
1057
                                    <legend>Hold details</legend>
1058
                                    <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
1059
                                        [% INCLUDE 'csrf-token.inc' %]
1060
                                        <input type="hidden" name="op" value="cud-placerequest" />
1061
                                        <input type="hidden" name="multi_holds" id="multi_holds" value="1" />
1062
                                        <input type="hidden" name="request" value="any"/>
1063
                                        <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
1064
                                            [% FOREACH biblioloo IN biblioloop %]
1065
                                                <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblioloo.biblionumber | html %]"/>
1066
                                                [% UNLESS biblioloo.none_avail %]
1067
                                                    <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]"/>
1068
                                                    <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]"/>
914
                                                [% END %]
1069
                                                [% END %]
915
                                            </td>
916
                                            [% IF Koha.Preference('item-level_itypes') %]
917
                                                <td>
918
                                                    [% UNLESS ( noItemTypeImages ) %]
919
                                                        [% IF ( itemloo.itemtype.image_location) %]<img class="itemtype-image" src="[% itemloo.itemtype.image_location | html %]" alt="" /> <br />[% END %]
920
                                                    [% END %]
921
                                                    <span class="itypetext">[% itemloo.itemtype.translated_description | html %]</span>
922
                                                </td>
923
                                            [% END %]
1070
                                            [% END %]
924
                                            <td> [% itemloo.barcode | html %] </td>
1071
925
                                            [% IF Koha.Preference('EnableItemGroupHolds') && biblio_info.object.item_groups.count %]
1072
                                        <ol>
926
                                                <td> [% itemloo.object.item_group.description | html %] </td>
1073
1074
                                            <li>
1075
                                                <span class="label">Patron:</span>
1076
                                                [% IF ( patron.borrowernumber ) %]
1077
                                                    [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
1078
                                                [% ELSE %]
1079
                                                    Not defined yet
1080
                                                [% END %]
1081
                                            </li>
1082
1083
1084
                                            <li>
1085
                                                <label for="holdnotes">Notes:</label>
1086
                                                <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
1087
                                            </li>
1088
                                            <li>
1089
                                                <label for="pickup">Pickup at:</label>
1090
                                                <select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]">
1091
                                                    <option value="" selected="selected"></option>
1092
                                                [% FOREACH pickup_location IN multi_pickup_locations %]
1093
                                                    <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
1094
                                                [% END %]
1095
                                                </select>
1096
                                            </li>
1097
                                            [% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
1098
                                                <li>
1099
                                                    <label for="from">Hold starts on date:</label>
1100
                                                    <input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
1101
                                                </li>
927
                                            [% END %]
1102
                                            [% END %]
928
                                            <td> [% Branches.GetName( itemloo.homebranch ) | html %] </td>
1103
929
                                            <td> [% Branches.GetName( itemloo.holdingbranch ) | html %] </td>
1104
                                            <li>
930
                                            [% IF itemdata_ccode %]
1105
                                                <label for="to">Hold expires on date:</label>
931
                                                <td> [% IF ( itemloo.ccode ) %][% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => itemloo.ccode ) | html %][% END %] </td>
1106
                                                <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
1107
                                            </li>
1108
1109
                                        </ol>
1110
                                    <table id="requesttitles">
1111
                                        <tr>
1112
                                            <th>&nbsp;</th>
1113
                                            <th>Pickup location</th>
1114
                                            <th>Title</th>
1115
                                            [% UNLESS Koha.Preference('item-level_itypes') %]
1116
                                                <th>Item type</th>
932
                                            [% END %]
1117
                                            [% END %]
933
                                            <td> [% itemloo.itemcallnumber | html %] </td>
1118
                                            <th>Priority</th>
934
                                            <td> [% IF ( itemloo.copynumber ) %][% itemloo.copynumber | html %][% ELSE %]&nbsp;[% END %] </td>
1119
                                            <th>Information</th>
935
                                            [% IF itemdata_enumchron %]
1120
                                        </tr>
936
                                                <td> [% itemloo.enumchron | html %] </td>
1121
                                        [% FOREACH biblioloo IN biblioloop %]
1122
                                            [% IF ( biblioloo.warn ) %]
1123
                                                <tr class="onissue">
1124
                                            [% ELSE %]
1125
                                                <tr>
937
                                            [% END %]
1126
                                            [% END %]
938
                                            <td [% IF itemloo.onloan %]data-order="[% itemloo.date_due | html %]"[% END %]>
1127
                                                <td>
939
                                                [% IF ( itemloo.onloan ) %]
1128
                                                    [% UNLESS ( biblioloo.warn ) %]
940
                                                    <span class="checkedout">Due [% itemloo.date_due | $KohaDates as_due_date => 1 %]</span>
1129
                                                        <input id="holdable_bibs" name="holdable_bibs" class="multi_hold_item_checkbox" type="checkbox" checked="checked" title="[% biblioloo.biblionumber | html %]" value="[% biblioloo.biblionumber | html %]"/>
941
                                                [% ELSE %]
1130
                                                    [% END %]
942
                                                    [% IF ( itemloo.transfertwhen ) %]
1131
                                                </td>
943
                                                        <span
1132
                                                <td>
944
                                                            >In transit from [% Branches.GetName( itemloo.transfertfrom ) | html %], to [% Branches.GetName( itemloo.transfertto ) | html %], since
1133
                                                    [% UNLESS ( biblioloo.none_avail || biblioloo.noitems ) %]
945
                                                            [% itemloo.transfertwhen | $KohaDates %]</span
1134
                                                        <select name="pickup_[% biblioloo.biblionumber | html %]"
946
                                                        >
1135
                                                                class="multi_pickup_select"
1136
                                                                data-biblio-id="[% biblioloo.biblionumber | html %]"
1137
                                                                data-patron-id="[% patron.borrowernumber | html %]"
1138
                                                                data-pickup-locations='[% biblioloo.pickup_locations_codes.json | $raw %]'>
1139
                                                            <option value=""></option>
1140
                                                            [% FOREACH pickup_location IN biblioloo.pickup_locations %]
1141
                                                                <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
1142
                                                            [% END %]
1143
                                                        </select>
1144
                                                    [% END %]
1145
                                                </td>
1146
                                                <td>
1147
                                                    <ul>
1148
                                                        <li>
1149
                                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
1150
                                                            [% IF biblioloo.author %] by [% biblioloo.author | html %][% END %]
1151
                                                        </li>
1152
                                                        [% IF ( biblioloo.publicationyear ) %]
1153
                                                            <li>
1154
                                                                <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %]
1155
                                                            </li>
1156
                                                        [% END %]
1157
                                                    </ul>
1158
                                                    [% IF ( biblioloo.warn ) %]
1159
                                                        <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
947
                                                    [% END %]
1160
                                                    [% END %]
1161
                                                </td>
1162
                                                [% UNLESS Koha.Preference('item-level_itypes') %]
1163
                                                    <td>
1164
                                                        <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
1165
                                                    </td>
948
                                                [% END %]
1166
                                                [% END %]
949
1167
                                                <td>[% biblioloo.rank | html %]</td>
950
                                                [% IF ( itemloo.reservedate ) %]
1168
                                                <td>
951
                                                    [% IF ( itemloo.nocancel ) %]
1169
                                                    [% IF ( biblioloo.checked_previously ) %]
952
                                                        <span>Can't be cancelled when item is in transit</span>
1170
                                                        <span>Patron has previously checked out this title</span><br/>
1171
                                                    [% END %]
1172
                                                    [% IF ( biblioloo.alreadyres ) %]
1173
                                                        <ul>
953
                                                    [% ELSE %]
1174
                                                    [% ELSE %]
954
                                                        [% IF ( itemloo.waitingdate ) %]
1175
                                                        [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
955
                                                            [% IF ( itemloo.canreservefromotherbranches ) %]
1176
                                                            <ul>
956
                                                                <span
957
                                                                    >Waiting for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since
958
                                                                    [% itemloo.waitingdate | $KohaDates %]</span
959
                                                                >
960
                                                            [% ELSE %]
961
                                                                <span>Waiting at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.waitingdate | $KohaDates %]</span>
962
                                                            [% END %]
963
                                                        [% ELSE %]
964
                                                            [% IF ( itemloo.canreservefromotherbranches ) %]
965
                                                                [% IF itemloo.reservedate %]
966
                                                                    <span>On hold for [% INCLUDE 'patron-title.inc' patron=itemloo.ReservedFor %] expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since</span>
967
                                                                [% ELSE %]
968
                                                                    <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
969
                                                                [% END %]
970
                                                            [% ELSIF itemloo.reservedate %]
971
                                                                <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %] since [% itemloo.reservedate | $KohaDates %]</span>
972
                                                            [% ELSE %]
973
                                                                <span>On hold expected at [% Branches.GetName( itemloo.ExpectedAtLibrary ) | html %]</span>
974
                                                            [% END %]
975
                                                        [% END %]
1177
                                                        [% END %]
976
                                                    [% END # /IF itemloo.nocancel %]
1178
                                                    [% END %]
977
                                                [% ELSE %]
978
                                                    Not on hold
979
                                                [% END # /IF itemloo.reservedate %]
980
1179
981
                                                [% IF itemloo.item_level_holds == "N" %]
1180
                                                    [% IF ( biblioloo.alreadyres ) %]
982
                                                    <br />Item level hold not allowed from OPAC
1181
                                                    <li>
983
                                                [% ELSIF itemloo.item_level_holds == "F" %]
1182
                                                        [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item
984
                                                    <br />Item level hold forced from OPAC
1183
                                                    </li>
985
                                                [% END %]
1184
                                                    [% END %]
1185
                                                    [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
1186
                                                        <li> <strong>No items are available</strong> to be placed on hold</li>
1187
                                                    [% END %]
986
1188
987
                                                [% IF ( itemloo.itemlost ) %]
1189
                                                    [% IF ( biblioloo.alreadyres ) %]
988
                                                    <span class="lost">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => itemloo.itemlost ) | html %]</span>
1190
                                                        </ul>
989
                                                [% END %]
1191
                                                    [% ELSE %]
1192
                                                        [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
1193
                                                            </ul>
1194
                                                        [% END %]
1195
                                                    [% END %]
1196
                                                </td>
1197
                                            </tr>
1198
                                        [% END # /FOREACH biblioloo %]
1199
                                    </table> <!-- /#requesttitles -->
1200
                                </fieldset>
1201
                                <fieldset class="action">
1202
                                    [% IF ( patron AND patron.borrowernumber ) %]
1203
                                            [% IF ( override_required ) %]
1204
                                                <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1205
                                            [% ELSIF ( no_bibs_available ) %]
1206
                                                <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1207
                                            [% ELSIF ( none_available ) %]
1208
                                                <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1209
                                            [% ELSE %]
1210
                                                <button type="submit" id="hold_multi_btn" class="btn btn-primary" id="multi_hold_submit">Place holds</button>
1211
                                            [% END %]
1212
                                    [% END # /IF patron %]
1213
                                </fieldset> <!-- /.action -->
990
1214
991
                                                [% IF ( itemloo.damaged ) %]
1215
                            [% END # /UNLESS multi_hold %]
992
                                                    <span class="dmg">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => itemloo.damaged ) | html %]</span>
993
                                                [% END %]
994
1216
995
                                                [% IF ( itemloo.withdrawn ) %]
1217
                        </fieldset>
996
                                                    <span class="wdn">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => itemloo.withdrawn ) | html %]</span>
1218
                    </fieldset> <!-- /.rows -->
997
                                                [% END %]
1219
                </form> <!-- /#hold-request-form -->
1220
            [% END %]
998
1221
999
                                                [% IF ( itemloo.notforloan ) %]
1222
            [% UNLESS ( patron ) %]
1000
                                                    <span class="nfl">Not for loan ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => itemloo.notforloan ) | html %])</span>
1223
                [% UNLESS borrowers %]
1001
                                                [% ELSIF ( itemloo.notforloanitype ) %]
1224
                    [% SET hold_count = biblio.holds.count | html %]
1002
                                                    <span class="nfl">Not for loan (Itemtype not for loan)</span>
1225
                    [% IF hold_count %]
1003
                                                [% END %]
1226
                        <label for ="always_show_holds">Always show holds</label>
1004
                                            </td>
1227
                        [% IF always_show_holds == 'DONT' %]
1005
                                        </tr>
1228
                            <input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO">
1006
                                    [% END # / UNLESS itemloo.hide %]
1229
                            [% UNLESS reserveloop %]
1007
                                [% END # /FOREACH itemloo %]
1230
                                <a class="btn btn-default" value="Show holds" id="show_holds_now" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]&show_holds_now=1">Show holds ([% hold_count | html %])</a>
1008
                            </tbody>
1009
                        </table>
1010
                        <!-- /#requestspecific -->
1011
1012
                        [% IF hiddencount %]
1013
                            <p class="hiddencount">
1014
                                <a href="request.pl?biblionumber=[% biblio_info.biblionumber | uri %]&amp;borrowernumber=[% borrowernumber | uri %]&amp;showallitems=1">Show all items ([% hiddencount | html %] hidden)</a>
1015
                            </p>
1016
                        [% END # /IF hiddencount %]
1017
                        <fieldset class="action">
1018
                            [% IF ( patron.borrowernumber ) %]
1019
                                [% IF ( override_required ) %]
1020
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place hold</button>
1021
                                [% ELSIF ( none_available ) %]
1022
                                    <button type="submit" id="hold_item_btn" disabled="disabled" class="btn btn-primary btn-disabled">Place hold</button>
1023
                                [% ELSE %]
1024
                                    <button type="submit" id="hold_item_btn" class="btn btn-primary">Place hold</button>
1025
                                [% END %]
1026
                            [% END %]
1231
                            [% END %]
1027
                        </fieldset>
1232
                        [% ELSE %]
1028
                    </fieldset>
1233
                            <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked">
1029
                </fieldset>
1030
                <!-- /.rows any_specific -->
1031
            </form>
1032
            <!-- /#hold-request-form -->
1033
        [% ELSE # /UNLESS multi_hold %]
1034
            <form action="placerequest.pl" method="post" name="form" id="hold-request-form">
1035
                <fieldset class="rows">
1036
                    <legend>Hold details</legend>
1037
                    [% INCLUDE 'csrf-token.inc' %]
1038
                    <input type="hidden" name="op" value="cud-placerequest" />
1039
                    <input type="hidden" name="multi_holds" id="multi_holds" value="1" />
1040
                    <input type="hidden" name="request" value="any" />
1041
                    <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]" />
1042
                    [% FOREACH biblioloo IN biblioloop %]
1043
                        <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblioloo.biblionumber | html %]" />
1044
                        [% UNLESS biblioloo.none_avail %]
1045
                            <input type="hidden" name="title_[% biblioloo.biblionumber | html %]" value="[% biblioloo.title | html %]" />
1046
                            <input type="hidden" name="rank_[% biblioloo.biblionumber | html %]" value="[% biblioloo.rank | html %]" />
1047
                        [% END %]
1234
                        [% END %]
1048
                    [% END %]
1235
                    [% END %]
1049
1236
                [% END %]
1050
                    <ol>
1237
                [% IF ( reserveloop ) %]
1051
                        <li>
1238
                    <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
1052
                            <span class="label">Patron:</span>
1239
                        [% INCLUDE 'csrf-token.inc' %]
1053
                            [% IF ( patron.borrowernumber ) %]
1240
                        [% IF ( multi_hold ) %]
1054
                                [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 hide_patron_infos_if_needed => 1 %]
1241
                            [% FOREACH biblionumber IN biblionumbers %]
1055
                            [% ELSE %]
1242
                            <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
1056
                                Not defined yet
1057
                            [% END %]
1243
                            [% END %]
1058
                        </li>
1244
                        [% END %]
1059
1245
1060
                        <li>
1246
                        [% IF enqueued %]
1061
                            <label for="holdnotes">Notes:</label>
1247
                            <div class="alert alert-info">
1062
                            <textarea id="holdnotes" name="notes" cols="30" rows="1"></textarea>
1248
                                <p>The job has been enqueued! It will be processed as soon as possible.</p>
1063
                        </li>
1249
                                <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a></p>
1064
                        <li>
1250
                            </div>
1065
                            <label for="pickup">Pickup at:</label>
1066
                            <select name="pickup" id="pickup_multi" data-patron-id="[% patron.borrowernumber | html %]">
1067
                                <option value="" selected="selected"></option>
1068
                                [% FOREACH pickup_location IN multi_pickup_locations %]
1069
                                    <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
1070
                                [% END %]
1071
                            </select>
1072
                        </li>
1073
                        [% IF ( Koha.Preference('AllowHoldDateInFuture') ) %]
1074
                            <li>
1075
                                <label for="from">Hold starts on date:</label>
1076
                                <input id="reserve_date" name="reserve_date" id="from" size="10" type="text" data-date_to="expiration_date" class="flatpickr" data-flatpickr-futureinclusive="true" />
1077
                            </li>
1078
                        [% END %]
1251
                        [% END %]
1079
1252
1080
                        <li>
1253
                        <h2>Existing holds</h2>
1081
                            <label for="to">Hold expires on date:</label>
1254
                        <div id="toolbar" class="btn-toolbar sticky">
1082
                            <input id="expiration_date" name="expiration_date" id="to" size="10" type="text" class="flatpickr" data-flatpickr-futuredate="true" />
1255
                            <div class="btn-group">
1083
                        </li>
1256
                                <input type="hidden" name="op" value="cud-modifyall">
1084
                    </ol>
1257
                                <input type="submit" class="btn btn-primary" name="submit" value="Update hold(s)" />
1085
                    <table id="requesttitles">
1258
                            </div>
1086
                        <tr>
1259
                            <div class="btn-group">
1087
                            <th>&nbsp;</th>
1260
                                <button class="btn cancel_selected_holds" data-bulk="true"></button>
1088
                            <th>Pickup location</th>
1261
                            </div>
1089
                            <th>Title</th>
1262
                        <fieldset id="cancellation-reason-fieldset" class="action" style="display:none">
1090
                            [% UNLESS Koha.Preference('item-level_itypes') %]
1263
                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1091
                                <th>Item type</th>
1264
                            [% IF hold_cancellation.count %]
1265
                                <label for="cancellation-reason">Cancellation reason: </label>
1266
                                <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
1267
                                    <option value="">No reason given</option>
1268
                                    [% FOREACH reason IN hold_cancellation %]
1269
                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1270
                                    [% END %]
1271
                                </select>
1092
                            [% END %]
1272
                            [% END %]
1093
                            <th>Priority</th>
1273
                        </fieldset>
1094
                            <th>Information</th>
1274
                        </div>
1095
                        </tr>
1275
                        <div class="page-section">
1276
1096
                        [% FOREACH biblioloo IN biblioloop %]
1277
                        [% FOREACH biblioloo IN biblioloop %]
1097
                            <tr [% IF biblioloo.warn %]class="onissue"[% END %]>
1278
                            [% IF ( biblioloo.reserveloop ) %]
1098
                                <td>
1279
                                <div class="hold_title" id="hold_title_[% biblioloo.biblionumber | html %]">
1099
                                    [% UNLESS ( biblioloo.warn ) %]
1280
                                    [% IF ( multi_hold ) %]
1100
                                        <input
1281
                                        <h3>
1101
                                            id="holdable_bibs"
1282
                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">
1102
                                            name="holdable_bibs"
1283
                                                [% biblioloo.title | html %]
1103
                                            class="multi_hold_item_checkbox"
1284
                                            </a> <span class="badge text-bg-info"><span>[% biblioloo.reserveloop.size | html %] [% tn('Hold', 'Holds', biblioloo.reserveloop.size) | $raw %]</span></span>
1104
                                            type="checkbox"
1285
                                        </h3>
1105
                                            checked="checked"
1106
                                            title="[% biblioloo.biblionumber | html %]"
1107
                                            value="[% biblioloo.biblionumber | html %]"
1108
                                        />
1109
                                    [% END %]
1110
                                </td>
1111
                                <td>
1112
                                    [% UNLESS ( biblioloo.none_avail || biblioloo.noitems ) %]
1113
                                        <select
1114
                                            name="pickup_[% biblioloo.biblionumber | html %]"
1115
                                            class="multi_pickup_select"
1116
                                            data-biblio-id="[% biblioloo.biblionumber | html %]"
1117
                                            data-patron-id="[% patron.borrowernumber | html %]"
1118
                                            data-pickup-locations="[% biblioloo.pickup_locations_codes.json | $raw %]"
1119
                                        >
1120
                                            <option value=""></option>
1121
                                            [% FOREACH pickup_location IN biblioloo.pickup_locations %]
1122
                                                <option value="[% pickup_location.branchcode | html %]">[% pickup_location.branchname | html %]</option>
1123
                                            [% END %]
1124
                                        </select>
1125
                                    [% END %]
1126
                                </td>
1127
                                <td>
1128
                                    <ul>
1129
                                        <li>
1130
                                            <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]">[% biblioloo.title | html %]</a>
1131
                                            [% IF biblioloo.author %]by [% biblioloo.author | html %][% END %]
1132
                                        </li>
1133
                                        [% IF ( biblioloo.publicationyear ) %]
1134
                                            <li> <span class="label">Publication year:</span> [% biblioloo.publicationyear | html %] </li>
1135
                                        [% END %]
1136
                                    </ul>
1137
                                    [% IF ( biblioloo.warn ) %]
1138
                                        <span class="not_holdable" title="[% biblioloo.biblionumber | html %]"></span>
1139
                                    [% END %]
1140
                                </td>
1141
                                [% UNLESS Koha.Preference('item-level_itypes') %]
1142
                                    <td>
1143
                                        <img src="[% biblioloo.itemtype.image_location | html %]" alt="[% biblioloo.itemtype.translated_description | html %]" title="[% biblioloo.itemtype.translated_description | html %]" />
1144
                                    </td>
1145
                                [% END %]
1146
                                <td>[% biblioloo.rank | html %]</td>
1147
                                <td>
1148
                                    [% IF ( biblioloo.checked_previously ) %]
1149
                                        <span>Patron has previously checked out this title</span><br />
1150
                                    [% END %]
1286
                                    [% END %]
1151
                                    [% IF ( biblioloo.alreadyres ) %]
1152
                                        <ul>
1153
                                            <li> [% INCLUDE 'patron-title.inc' patron => patron no_title => 1 no_cardnumber => 1 hide_patron_infos_if_needed => 1 %] <strong>already has a hold</strong> on this item </li>
1154
                                        </ul>
1155
                                    [% END %]
1156
                                    [% IF ( biblioloo.none_avail || biblioloo.noitems ) %]
1157
                                        <ul
1158
                                            ><li> <strong>No items are available</strong> to be placed on hold</li></ul
1159
                                        >
1160
                                    [% END %]
1161
                                </td>
1162
                            </tr>
1163
                        [% END # /FOREACH biblioloo %]
1164
                    </table>
1165
                    <!-- /#requesttitles -->
1166
                </fieldset>
1167
                <fieldset class="action">
1168
                    [% IF ( patron AND patron.borrowernumber ) %]
1169
                        [% IF ( override_required ) %]
1170
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary warning"><i class="fa fa-exclamation-triangle "></i> Place holds</button>
1171
                        [% ELSIF ( no_bibs_available ) %]
1172
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary btn-disabled" disabled="disabled">Place holds</button>
1173
                        [% ELSIF ( none_available ) %]
1174
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary">Place holds</button>
1175
                        [% ELSE %]
1176
                            <button type="submit" id="hold_multi_btn" class="btn btn-primary" id="multi_hold_submit">Place holds</button>
1177
                        [% END %]
1178
                    [% END # /IF patron %]
1179
                </fieldset>
1180
                <!-- /.action -->
1181
            </form>
1182
            <!-- /#hold-request-form -->
1183
        [% END # /UNLESS multi_hold %]
1184
    [% END %]
1185
1287
1186
    [% UNLESS ( patron ) %]
1288
                                    [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
1187
        [% UNLESS borrowers %]
1188
            [% SET hold_count = biblio.holds.count | html %]
1189
            [% IF hold_count %]
1190
                <label for="always_show_holds">Always show holds</label>
1191
                [% IF always_show_holds == 'DONT' %]
1192
                    <input type="checkbox" name="always_show_holds" id="always_show_holds" value="DO" />
1193
                    [% UNLESS reserveloop %]
1194
                        <a class="btn btn-default" value="Show holds" id="show_holds_now" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber | uri %]&show_holds_now=1">Show holds ([% hold_count | html %])</a>
1195
                    [% END %]
1196
                [% ELSE %]
1197
                    <input type="checkbox" name="always_show_holds" value="DO" id="always_show_holds" checked="checked" />
1198
                [% END %]
1199
            [% END %]
1200
        [% END %]
1201
        [% IF ( reserveloop ) %]
1202
            <form id="existing_holds" name="T[% time | html %]" action="modrequest.pl" method="post" style="display:block">
1203
                [% INCLUDE 'csrf-token.inc' %]
1204
                [% IF ( multi_hold ) %]
1205
                    [% FOREACH biblionumber IN biblionumbers %]
1206
                        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
1207
                    [% END %]
1208
                [% END %]
1209
1289
1210
                [% IF enqueued %]
1290
                                        [% SET branchcodes = [] %]
1211
                    <div class="alert alert-info">
1212
                        <p>The job has been enqueued! It will be processed as soon as possible.</p>
1213
                        <p><a href="/cgi-bin/koha/admin/background_jobs.pl?op=view&id=[% job_id | uri %]" title="View detail of the enqueued job">View detail of the enqueued job</a></p>
1214
                    </div>
1215
                [% END %]
1216
1291
1217
                <h2>Existing holds</h2>
1292
                                        [% FOREACH h IN biblioloo.reserveloop %]
1218
                <div id="toolbar" class="btn-toolbar sticky">
1293
                                            [% branchcodes.push( h.branchcode ) %]
1219
                    <div class="btn-group">
1294
                                        [% END %]
1220
                        <input type="hidden" name="op" value="cud-modifyall" />
1295
                                        [% branchcodes = branchcodes.unique %]
1221
                        <input type="submit" class="btn btn-primary" name="submit" value="Update hold(s)" />
1296
                                        [% IF ( branchcodes.empty ) %]
1222
                    </div>
1297
                                            <div class="note">
1223
                    <div class="btn-group">
1298
                                                There are no holds on this title.
1224
                        <button class="btn cancel_selected_holds" data-bulk="true"></button>
1299
                                            </div>
1225
                    </div>
1300
                                        [% ELSE %]
1226
                    <fieldset id="cancellation-reason-fieldset" class="action" style="display:none">
1227
                        [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1228
                        [% IF hold_cancellation.count %]
1229
                            <label for="cancellation-reason">Cancellation reason: </label>
1230
                            <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
1231
                                <option value="">No reason given</option>
1232
                                [% FOREACH reason IN hold_cancellation %]
1233
                                    <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1234
                                [% END %]
1235
                            </select>
1236
                        [% END %]
1237
                    </fieldset>
1238
                </div>
1239
                <div class="page-section">
1240
                    [% FOREACH biblioloo IN biblioloop %]
1241
                        [% IF ( biblioloo.reserveloop ) %]
1242
                            <div class="hold_title" id="hold_title_[% biblioloo.biblionumber | html %]">
1243
                                [% IF ( multi_hold ) %]
1244
                                    <h3>
1245
                                        <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblioloo.biblionumber | uri %]"> [% biblioloo.title | html %] </a>
1246
                                        <span class="badge text-bg-info"><span>[% biblioloo.reserveloop.size | html %] [% tn('Hold', 'Holds', biblioloo.reserveloop.size) | $raw %]</span></span>
1247
                                    </h3>
1248
                                [% END %]
1249
1301
1250
                                [% IF Koha.Preference('HoldsSplitQueue') == 'branch' %]
1302
                                            [% FOREACH b IN branchcodes.sort %]
1303
                                                [% SET holds_by_branch = [] %]
1304
                                                [% FOREACH h IN biblioloo.reserveloop %]
1305
                                                    [% IF h.branchcode == b %]
1306
                                                        [% holds_by_branch.push( h ) %]
1307
                                                    [% END %]
1308
                                                [% END %]
1309
                                                <div class="holds_by_library">
1310
                                                    <h4>[% Branches.GetName( b ) | html %]</h4>
1251
1311
1252
                                    [% SET branchcodes = [] %]
1312
                                                    [% INCLUDE holds_table.inc holds=holds_by_branch %]
1313
                                                </div>
1314
                                            [% END # /FOREACh b %]
1315
                                        [% END # /IF ( branchcodes.empty ) %]
1253
1316
1254
                                    [% FOREACH h IN biblioloo.reserveloop %]
1317
                                    [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
1255
                                        [% branchcodes.push( h.branchcode ) %]
1256
                                    [% END %]
1257
                                    [% branchcodes = branchcodes.unique %]
1258
                                    [% IF ( branchcodes.empty ) %]
1259
                                        <div class="alert alert-info"> There are no holds on this title. </div>
1260
                                    [% ELSE %]
1261
1318
1262
                                        [% FOREACH b IN branchcodes.sort %]
1319
                                        [% SET itemtypes = [] %]
1263
                                            [% SET holds_by_branch = [] %]
1264
                                            [% FOREACH h IN biblioloo.reserveloop %]
1265
                                                [% IF h.branchcode == b %]
1266
                                                    [% holds_by_branch.push( h ) %]
1267
                                                [% END %]
1268
                                            [% END %]
1269
                                            <div class="holds_by_library">
1270
                                                <h4>[% Branches.GetName( b ) | html %]</h4>
1271
1320
1272
                                                [% INCLUDE holds_table.inc holds=holds_by_branch %]
1321
                                        [% FOREACH h IN biblioloo.reserveloop %]
1322
                                            [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1323
                                            [% itemtypes.push( hold_itemtype ) %]
1324
                                        [% END %]
1325
                                        [% itemtypes = itemtypes.unique %]
1326
                                        [% IF ( itemtypes.empty ) %]
1327
                                            <div class="note">
1328
                                                There are no holds on this title.
1273
                                            </div>
1329
                                            </div>
1274
                                        [% END # /FOREACh b %]
1330
                                        [% ELSE %]
1275
                                    [% END # /IF ( branchcodes.empty ) %]
1276
                                [% ELSIF Koha.Preference('HoldsSplitQueue') == 'itemtype' %]
1277
1331
1278
                                    [% SET itemtypes = [] %]
1332
                                            [% FOREACH i IN itemtypes.sort %]
1333
                                                [% SET holds_by_itemtype = [] %]
1334
                                                [% FOREACH h IN biblioloo.reserveloop %]
1335
                                                    [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1336
                                                    [% IF hold_itemtype == i %]
1337
                                                        [% holds_by_itemtype.push( h ) %]
1338
                                                    [% END %]
1339
                                                [% END %]
1279
1340
1280
                                    [% FOREACH h IN biblioloo.reserveloop %]
1341
                                                <div class="holds_by_itemtype">
1281
                                        [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1342
                                                    [% IF i %]
1282
                                        [% itemtypes.push( hold_itemtype ) %]
1343
                                                        <h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
1283
                                    [% END %]
1344
                                                    [% ELSE %]
1284
                                    [% itemtypes = itemtypes.unique %]
1345
                                                        <h4>Any item type</h4>
1285
                                    [% IF ( itemtypes.empty ) %]
1346
                                                    [% END %]
1286
                                        <div class="alert alert-info"> There are no holds on this title. </div>
1347
                                                    [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1287
                                    [% ELSE %]
1348
                                                </div>
1349
                                            [% END # /FOREACH i %]
1350
                                        [% END # /IF ( itemtypes.empty ) %]
1288
1351
1289
                                        [% FOREACH i IN itemtypes.sort %]
1352
                                    [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
1290
                                            [% SET holds_by_itemtype = [] %]
1353
                                        [% SET branchcodes = [] %]
1291
                                            [% FOREACH h IN biblioloo.reserveloop %]
1292
                                                [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1293
                                                [% IF hold_itemtype == i %]
1294
                                                    [% holds_by_itemtype.push( h ) %]
1295
                                                [% END %]
1296
                                            [% END %]
1297
1354
1298
                                            <div class="holds_by_itemtype">
1355
                                        [% FOREACH h IN biblioloo.reserveloop %]
1299
                                                [% IF i %]
1356
                                            [% branchcodes.push( h.branchcode ) %]
1300
                                                    <h4>[% ItemTypes.GetDescription( i ) | html %]</h4>
1357
                                        [% END %]
1301
                                                [% ELSE %]
1358
                                        [% branchcodes = branchcodes.unique %]
1302
                                                    <h4>Any item type</h4>
1359
                                        [% IF ( branchcodes.empty ) %]
1303
                                                [% END %]
1360
                                            <div class="note">
1304
                                                [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1361
                                                There are no holds on this title.
1305
                                            </div>
1362
                                            </div>
1306
                                        [% END # /FOREACH i %]
1363
                                        [% ELSE %]
1307
                                    [% END # /IF ( itemtypes.empty ) %]
1364
1308
                                [% ELSIF Koha.Preference('HoldsSplitQueue') == 'branch_itemtype' %]
1365
                                            [% FOREACH b IN branchcodes.sort %]
1309
                                    [% SET branchcodes = [] %]
1366
                                                <div class="holds_by_library">
1310
1367
                                                    <h4 class="library_holds">[% Branches.GetName( b ) | html %]</h4>
1311
                                    [% FOREACH h IN biblioloo.reserveloop %]
1368
                                                    [% SET holds_by_branch = [] %]
1312
                                        [% branchcodes.push( h.branchcode ) %]
1369
                                                    [% FOREACH h IN biblioloo.reserveloop %]
1313
                                    [% END %]
1370
                                                        [% IF h.branchcode == b %]
1314
                                    [% branchcodes = branchcodes.unique %]
1371
                                                            [% holds_by_branch.push( h ) %]
1315
                                    [% IF ( branchcodes.empty ) %]
1372
                                                        [% END %]
1316
                                        <div class="alert alert-info"> There are no holds on this title. </div>
1373
                                                    [% END %]
1317
                                    [% ELSE %]
1318
1374
1319
                                        [% FOREACH b IN branchcodes.sort %]
1375
                                                    [% SET itemtypes = [] %]
1320
                                            <div class="holds_by_library">
1376
                                                    [% FOREACH h IN holds_by_branch %]
1321
                                                <h4 class="library_holds">[% Branches.GetName( b ) | html %]</h4>
1377
                                                        [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1322
                                                [% SET holds_by_branch = [] %]
1378
                                                        [% itemtypes.push( hold_itemtype ) %]
1323
                                                [% FOREACH h IN biblioloo.reserveloop %]
1324
                                                    [% IF h.branchcode == b %]
1325
                                                        [% holds_by_branch.push( h ) %]
1326
                                                    [% END %]
1379
                                                    [% END %]
1327
                                                [% END %]
1380
                                                    [% itemtypes = itemtypes.unique %]
1328
1381
1329
                                                [% SET itemtypes = [] %]
1382
                                                    [% FOREACH i IN itemtypes.sort %]
1330
                                                [% FOREACH h IN holds_by_branch %]
1383
                                                        <div class="holds_by_itemtype">
1331
                                                    [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1384
                                                            <h5 class="itemtype_holds">
1332
                                                    [% itemtypes.push( hold_itemtype ) %]
1385
                                                                [% IF i %]
1333
                                                [% END %]
1386
                                                                    [% ItemTypes.GetDescription( i ) | html %]
1334
                                                [% itemtypes = itemtypes.unique %]
1387
                                                                [% ELSE %]
1388
                                                                    <span>Any item type</span>
1389
                                                                [% END %]
1390
                                                            </h5>
1335
1391
1336
                                                [% FOREACH i IN itemtypes.sort %]
1392
                                                            [% SET holds_by_itemtype = [] %]
1337
                                                    <div class="holds_by_itemtype">
1393
                                                            [% FOREACH h IN holds_by_branch %]
1338
                                                        <h5 class="itemtype_holds">
1394
                                                                [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1339
                                                            [% IF i %]
1395
                                                                [% IF hold_itemtype == i %]
1340
                                                                [% ItemTypes.GetDescription( i ) | html %]
1396
                                                                    [% holds_by_itemtype.push( h ) %]
1341
                                                            [% ELSE %]
1397
                                                                [% END %]
1342
                                                                <span>Any item type</span>
1343
                                                            [% END %]
1398
                                                            [% END %]
1344
                                                        </h5>
1399
                                                            [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1400
                                                        </div> <!-- /.holds_by_itemtype -->
1401
                                                    [% END %]
1402
                                                </div> <!-- /.holds_by_library -->
1403
                                            [% END # /FOREACH b %]
1404
                                        [% END # /IF ( branchcodes.empty ) %]
1345
1405
1346
                                                        [% SET holds_by_itemtype = [] %]
1406
                                    [% ELSE %]
1347
                                                        [% FOREACH h IN holds_by_branch %]
1407
1348
                                                            [% SET hold_itemtype = h.object.item.effective_itemtype || h.itemtype %]
1408
                                        [% IF ( biblioloo.reserveloop.size ) %]
1349
                                                            [% IF hold_itemtype == i %]
1409
                                            [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
1350
                                                                [% holds_by_itemtype.push( h ) %]
1410
                                        [% ELSE %]
1351
                                                            [% END %]
1411
                                            <div class="note">
1352
                                                        [% END %]
1412
                                                There are no holds on this title.
1353
                                                        [% INCLUDE holds_table.inc holds=holds_by_itemtype %]
1354
                                                    </div>
1355
                                                    <!-- /.holds_by_itemtype -->
1356
                                                [% END %]
1357
                                            </div>
1413
                                            </div>
1358
                                            <!-- /.holds_by_library -->
1414
                                        [% END %]
1359
                                        [% END # /FOREACH b %]
1360
                                    [% END # /IF ( branchcodes.empty ) %]
1361
                                [% ELSE %]
1362
1415
1363
                                    [% IF ( biblioloo.reserveloop.size ) %]
1416
                                    [% END # /IF HoldsSplitQueue %]
1364
                                        [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %]
1417
                                </div> <!-- /hold_title -->
1365
                                    [% ELSE %]
1418
                            [% END # /IF biblioloo.reserveloop %]
1366
                                        <div class="alert alert-info"> There are no holds on this title. </div>
1419
                        [% END # FOREACH biblioloo %]
1367
                                    [% END %]
1420
                        </div>
1368
                                [% END # /IF HoldsSplitQueue %]
1421
                    </form> <!-- /#existing_holds -->
1369
                            </div>
1422
                [% END # IF reserveloop %]
1370
                            <!-- /hold_title -->
1423
            [% END # UNLESS patron %]
1371
                        [% END # /IF biblioloo.reserveloop %]
1372
                    [% END # FOREACH biblioloo %]
1373
                </div>
1374
            </form>
1375
            <!-- /#existing_holds -->
1376
        [% END # IF reserveloop %]
1377
    [% END # UNLESS patron %]
1378
[% END %]
1379
1424
1380
<div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
1425
        </main>
1381
    <div class="modal-dialog">
1382
        <div class="modal-content">
1383
            <div class="modal-header">
1384
                <h1 class="modal-title">Confirm deletion</h1>
1385
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1386
            </div>
1387
1426
1388
            <form id="cancel_modal_form" method="post" action="request.pl">
1427
        [% IF ( multi_hold || nobiblio ) # No sidebar menu when placing multiple holds or biblio not found %]
1389
                [% INCLUDE 'csrf-token.inc' %]
1428
            </div> <!-- /.col-md-10.offset-md-1 -->
1390
                <div id="inputs">
1429
        [% ELSE %]
1391
                    <input type="hidden" name="op" value="cud-cancel" />
1430
            </div> <!-- /.col-md-10.order-md-2 -->
1431
                <div class="col-md-2 order-sm-2 order-md-1">
1432
                    <aside>
1433
                        [% INCLUDE 'biblio-view-menu.inc' %]
1434
                    </aside>
1435
                </div> <!-- /.col-md-2.order-md-1 -->
1436
        [% END %]
1437
    </div> <!-- /.row -->
1438
1439
    <div id="cancelModal" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
1440
        <div class="modal-dialog">
1441
            <div class="modal-content">
1442
                <div class="modal-header">
1443
                    <h1 class="modal-title">Confirm deletion</h1>
1444
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
1392
                </div>
1445
                </div>
1393
1446
1394
                <div class="modal-body">
1447
                <form id="cancel_modal_form" method="post" action="request.pl">
1395
                    <p>Are you sure you want to cancel this hold?</p>
1448
                    [% INCLUDE 'csrf-token.inc' %]
1396
                    <div id="cancel_hold_alert" class="alert alert-danger" style="display:none;"></div>
1449
                    <div id="inputs">
1397
                    <fieldset class="action">
1450
                        <input type="hidden" name="op" value="cud-cancel">
1398
                        [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1451
                    </div>
1399
                        [% IF hold_cancellation.count %]
1400
                            <label for="modal-cancellation-reason">Cancellation reason: </label>
1401
                            <select class="cancellation-reason" name="cancellation-reason" id="modal-cancellation-reason">
1402
                                <option value="">No reason given</option>
1403
                                [% FOREACH reason IN hold_cancellation %]
1404
                                    <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1405
                                [% END %]
1406
                            </select>
1407
                        [% END %]
1408
                    </fieldset>
1409
                </div>
1410
1452
1411
                <div class="modal-footer">
1453
                    <div class="modal-body">
1412
                    <button id="cancelModalConfirmBtn" type="submit" class="btn btn-danger">Confirm cancellation</button>
1454
                        <p>Are you sure you want to cancel this hold?</p>
1413
                    <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
1455
                        <div id="cancel_hold_alert" class="alert alert-danger" style="display:none;"></div>
1414
                </div>
1456
                        <fieldset class="action">
1415
            </form>
1457
                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
1458
                            [% IF hold_cancellation.count %]
1459
                                <label for="cancellation-reason">Cancellation reason: </label>
1460
                                <select class="cancellation-reason" name="cancellation-reason" id="modal-cancellation-reason">
1461
                                    <option value="">No reason given</option>
1462
                                    [% FOREACH reason IN hold_cancellation %]
1463
                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
1464
                                    [% END %]
1465
                                </select>
1466
                            [% END %]
1467
                        </fieldset>
1468
                    </div>
1469
1470
                    <div class="modal-footer">
1471
                        <button id="cancelModalConfirmBtn" type="submit" class="btn btn-danger">Confirm cancellation</button>
1472
                        <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
1473
                    </div>
1474
1475
                </form>
1476
1477
            </div>
1416
        </div>
1478
        </div>
1417
    </div>
1479
    </div>
1418
</div>
1480
    <div id="hold-actions">
1419
<div id="hold-actions">
1481
        <form id="hold-actions-form">
1420
    <form id="hold-actions-form"> [% INCLUDE 'csrf-token.inc' %] </form>
1482
            [% INCLUDE 'csrf-token.inc' %]
1421
</div>
1483
        </form>
1484
    </div>
1422
1485
1423
[% MACRO jsinclude BLOCK %]
1486
[% MACRO jsinclude BLOCK %]
1424
    [% INCLUDE 'datatables.inc' %]
1487
    [% INCLUDE 'datatables.inc' %]
1425
    [% INCLUDE 'calendar.inc' %]
1488
    [% INCLUDE 'calendar.inc' %]
1426
    [% INCLUDE 'select2.inc' %]
1489
    [% INCLUDE 'select2.inc' %]
1427
    [% Asset.js("js/holds.js") | $raw %]
1490
    [% Asset.js("js/holds.js") | $raw%]
1428
    [% Asset.js("js/form-submit.js") | $raw %]
1491
    [% Asset.js("js/form-submit.js") | $raw%]
1429
1492
1430
    [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
1493
    [% SET url_biblio_params = "biblionumber=" _ biblionumbers.join("&amp;biblionumber=") %]
1431
    [% IF multi_hold %]
1494
    [% IF multi_hold %]
1432
        [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1495
        [% SET url_biblio_params = url_biblio_params _ "&amp;multi_hold=1" %]
1433
    [% END %]
1496
    [% END %]
1497
1434
    <script>
1498
    <script>
1435
        $(document).ready(function () {
1499
        $(document).ready(function () {
1436
            hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %];
1500
            hold_table_settings = [% TablesSettings.GetTableSettings( 'circ', 'holds', 'patron_holds_table', 'json' ) | $raw %];
Lines 1860-1866 Link Here
1860
                e.preventDefault();
1924
                e.preventDefault();
1861
                if($('.holds_table .select_hold:checked').length) {
1925
                if($('.holds_table .select_hold:checked').length) {
1862
                    cancel_link = $(this);
1926
                    cancel_link = $(this);
1863
                    $("#cancel_modal_form #inputs").empty();
1927
                    $("#cancel_modal_form #inputs").empty;
1864
                    biblionumbers.forEach( function(biblionumber){
1928
                    biblionumbers.forEach( function(biblionumber){
1865
                        $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="'+biblionumber+'">');
1929
                        $("#cancel_modal_form #inputs").append('<input type="hidden" name="biblionumber" value="'+biblionumber+'">');
1866
                    });
1930
                    });
Lines 1934-1960 Link Here
1934
                return true;
1998
                return true;
1935
            })
1999
            })
1936
        });
2000
        });
1937
    </script>
2001
</script>
2002
1938
    <script>
2003
    <script>
1939
        table_settings = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
2004
        table_settings = [% TablesSettings.GetTableSettings( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %];
1940
    </script>
2005
    </script>
1941
    [% UNLESS patron %]
2006
1942
        [% SET search_results_block_id = 'holds_patronsearch_pane_panel' %]
2007
    [% SET search_results_block_id = 'holds_patronsearch_pane_panel' %] [%# adjusting variable for patron-search.inc %]
1943
        [%# adjusting variable for patron-search.inc %]
2008
    [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %]
1944
        [% PROCESS patron_search_js table_id => 'table_borrowers', categories => categories, libraries => libraries, columns => columns, open_on_row_click => 1, on_click_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_one_result => 1, redirect_url => '/cgi-bin/koha/reserve/request.pl?' _ url_biblio_params, redirect_if_attribute_equal => 'cardnumber' %]
1945
        <script>
1946
            $(document).ready(function () {
1947
                $("#holds_patronsearch").on("submit", filter);
1948
            });
1949
        </script>
1950
    [% END %]
1951
    <script>
2009
    <script>
1952
        $(".printholdslip").click(function () {
2010
        $(document).ready(function() {
1953
            var reserve_id = $(this).attr("data-reserve_id");
2011
            $("#holds_patronsearch").on("submit", filter);
1954
            window.open("/cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=" + reserve_id);
1955
            return false;
1956
        });
2012
        });
2013
        $('.printholdslip').click(function(){
2014
                var reserve_id = $(this).attr('data-reserve_id');
2015
                window.open("/cgi-bin/koha/circ/hold-transfer-slip.pl?reserve_id=" + reserve_id);
2016
                return false;
2017
        })
1957
    </script>
2018
    </script>
1958
[% END %]
2019
[% END %]
1959
2020
1960
[% INCLUDE 'intranet-bottom.inc' %]
2021
<div class="modal fade" id="holdruleschecker" tabindex="-1" role="dialog" aria-labelledby="holdruleschecker-title">
2022
    <div class="modal-dialog modal-lg" role="document">
2023
        <div class="modal-content">
2024
            <div class="modal-header">
2025
                <h4 class="modal-title" id="holdruleschecker-title">[% t('Holding rules') | html %]</h4>
2026
            </div>
2027
            <div class="modal-body">
2028
                <div>
2029
                    <h4>[% t('Overall info') | html %]</h4>
2030
2031
                    <ul>
2032
                        <li>
2033
                            [% tnx('Patron has {count} hold', 'Patron has {count} holds', reserves_count, { count = '<strong>' _ reserves_count _ '</strong>' }) | $raw %]
2034
                            [% tx('and this request would raise the number to {count}.', { count = '<strong>' _ (new_reserves_count + reserves_count) _ '</strong>' }) | $raw %]
2035
                        </li>
2036
                        <li>
2037
                            [% IF reserves_count >= Koha.Preference('maxreserves') %]
2038
                                <span class="text-danger">
2039
                            [% ELSE %]
2040
                                <span>
2041
                            [% END %]
2042
                                [% tx('{preference_name} preference:', { preference_name = '<em>maxreserves</em>' }) | $raw %]
2043
                                <strong>[% Koha.Preference('maxreserves') | html %]</strong>
2044
                            </span>
2045
                        </li>
2046
                        <li>
2047
                            [% tx('{preference_name} preference:', { preference_name = '<em>ReservesControlBranch</em>' }) | $raw %]
2048
                            <strong>[% Koha.Preference('ReservesControlBranch') | html %]</strong>
2049
                        </li
2050
                    </ul>
2051
                </div>
2052
2053
                <h4>[% t('Per record info') | html %]</h4>
2054
2055
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
2056
                    [% FOREACH response IN canbookbereserved_responses %]
2057
                        <div class="panel panel-default">
2058
                            <div class="panel-heading" role="tab" id="heading-[% response.biblio.biblionumber | html %]">
2059
                                <h4 class="panel-title">
2060
                                    <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-[% response.biblio.biblionumber | html %]" aria-expanded="true" aria-controls="collapse-[% response.biblio.biblionumber | html %]">
2061
                                        [% response.biblio.title | html %]
2062
                                    </a>
2063
                                </h4>
2064
                            </div>
2065
                            <div id="collapse-[% response.biblio.biblionumber | html %]" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading-[% response.biblio.biblionumber | html %]">
2066
                                <div class="panel-body">
2067
                                    <h5>[% t('Circulation rules checked') | html %]</h5>
2068
2069
                                    <table>
2070
                                        <thead>
2071
                                            <tr>
2072
                                                <th>[% t('Item') | html %]</th>
2073
                                                <th>[% t('Library') | html %]</th>
2074
                                                <th>[% t('Category') | html %]</th>
2075
                                                <th>[% t('Item type') | html %]</th>
2076
                                                <th>[% t('Rule name') | html %]</th>
2077
                                                <th>[% t('Rule value') | html %]</th>
2078
                                            </tr>
2079
                                        </thead>
2080
                                        <tbody>
2081
                                            [% FOREACH circulation_rule IN response.circulation_rules %]
2082
                                                <tr>
2083
                                                    <td></td>
2084
                                                    <td>
2085
                                                        [% IF circulation_rule.branchcode %]
2086
                                                            [% Branches.GetName(circulation_rule.branchcode) | html %]
2087
                                                            ([% circulation_rule.branchcode | html %])
2088
                                                        [% ELSE %]
2089
                                                            <em>[% t('All') | html %]</em>
2090
                                                        [% END %]
2091
                                                    </td>
2092
                                                    <td>
2093
                                                        [% IF circulation_rule.categorycode %]
2094
                                                            [% Categories.GetName(circulation_rule.categorycode) | html %]
2095
                                                        [% ELSE %]
2096
                                                            <em>[% t('All') | html %]</em>
2097
                                                        [% END %]
2098
                                                    </td>
2099
                                                    <td>
2100
                                                        [% IF circulation_rule.itemtype %]
2101
                                                            [% ItemTypes.GetDescription(circulation_rule.itemtype) | html %]
2102
                                                        [% ELSE %]
2103
                                                            <em>[% t('All') | html %]</em>
2104
                                                        [% END %]
2105
                                                    </td>
2106
                                                    <td>
2107
                                                        [% circulation_rule.rule_name | html %]
2108
                                                    </td>
2109
                                                    <td>
2110
                                                        [% circulation_rule.rule_value | html %]
2111
                                                    </td>
2112
                                                </tr>
2113
                                            [% END %]
2114
                                            [% FOREACH item_response IN response.item_responses %]
2115
                                                [% FOREACH circulation_rule IN item_response.circulation_rules %]
2116
                                                    <tr>
2117
                                                        <td>
2118
                                                            [% item_response.item.barcode | html %] (#[% item_response.item.itemnumber | html %])
2119
                                                        </td>
2120
                                                        <td>
2121
                                                            [% IF circulation_rule.branchcode %]
2122
                                                                [% Branches.GetName(circulation_rule.branchcode) | html %]
2123
                                                                ([% circulation_rule.branchcode | html %])
2124
                                                            [% ELSE %]
2125
                                                                <em>[% t('All') | html %]</em>
2126
                                                            [% END %]
2127
                                                        </td>
2128
                                                        <td>
2129
                                                            [% IF circulation_rule.categorycode %]
2130
                                                                [% Categories.GetName(circulation_rule.categorycode) | html %]
2131
                                                            [% ELSE %]
2132
                                                                <em>[% t('All') | html %]</em>
2133
                                                            [% END %]
2134
                                                        </td>
2135
                                                        <td>
2136
                                                            [% IF circulation_rule.itemtype %]
2137
                                                                [% ItemTypes.GetDescription(circulation_rule.itemtype) | html %]
2138
                                                            [% ELSE %]
2139
                                                                <em>[% t('All') | html %]</em>
2140
                                                            [% END %]
2141
                                                        </td>
2142
                                                        <td>
2143
                                                            [% circulation_rule.rule_name | html %]
2144
                                                        </td>
2145
                                                        <td>
2146
                                                            [% circulation_rule.rule_value | html %]
2147
                                                        </td>
2148
                                                    </tr>
2149
                                                [% END %]
2150
                                            [% END %]
2151
                                        </tbody>
2152
                                    </table>
2153
                                </div>
2154
                            </div>
2155
                        </div>
2156
                    [% END %]
2157
                </div>
2158
            </div>
2159
            <div class="modal-footer">
2160
                <button type="button" class="btn btn-default" data-dismiss="modal">[% t('Close') | html %]</button>
2161
            </div>
2162
        </div>
2163
    </div>
2164
</div> <!-- end of Modal -->
2165
2166
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/reserve/request.pl (-29 / +31 lines)
Lines 88-95 my $warnings; Link Here
88
my $messages;
88
my $messages;
89
my $exceeded_maxreserves;
89
my $exceeded_maxreserves;
90
my $exceeded_holds_per_record;
90
my $exceeded_holds_per_record;
91
my @failed_holds   = $input->multi_param('failed_holds');
91
my @failed_holds = $input->multi_param('failed_holds');
92
my $form_submitted = $input->param('form_submitted');
93
92
94
my $op = $input->param('op') || q{};
93
my $op = $input->param('op') || q{};
95
94
Lines 146-174 if ($findborrower) { Link Here
146
    $borrowernumber_hold = $patron->borrowernumber if $patron;
145
    $borrowernumber_hold = $patron->borrowernumber if $patron;
147
}
146
}
148
147
149
if ($form_submitted) {
148
if ($findclub) {
150
    if ($findclub) {
149
    my $club = Koha::Clubs->find( { name => $findclub } );
151
        my $club = Koha::Clubs->find( { name => $findclub } );
150
    if ($club) {
152
        if ($club) {
151
        $club_hold = $club->id;
153
            $club_hold = $club->id;
152
    } else {
153
        my @clubs = Koha::Clubs->search(
154
            [
155
                { name        => { like => '%' . $findclub . '%' } },
156
                { description => { like => '%' . $findclub . '%' } }
157
            ]
158
        )->as_list;
159
        if ( scalar @clubs == 1 ) {
160
            $club_hold = $clubs[0]->id;
161
        } elsif (@clubs) {
162
            $template->param( clubs => \@clubs );
154
        } else {
163
        } else {
155
            my @clubs = Koha::Clubs->search(
164
            $messageclub = "'$findclub'";
156
                [
157
                    { name        => { like => '%' . $findclub . '%' } },
158
                    { description => { like => '%' . $findclub . '%' } }
159
                ]
160
            )->as_list;
161
            if ( scalar @clubs == 1 ) {
162
                $club_hold = $clubs[0]->id;
163
            } elsif (@clubs) {
164
                $template->param( clubs => \@clubs );
165
            } else {
166
                $messageclub = "'$findclub'";
167
            }
168
        }
165
        }
169
    } else {
170
        my @clubs = Koha::Clubs->search()->as_list;
171
        $template->param( clubs => \@clubs );
172
    }
166
    }
173
}
167
}
174
168
Lines 189-196 if ( $borrowernumber_hold && !$op ) { Link Here
189
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
183
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
190
184
191
    my $reserves_count = $patron->holds->count;
185
    my $reserves_count = $patron->holds->count;
186
    $template->param( reserves_count => $reserves_count );
192
187
193
    my $new_reserves_count = scalar(@biblionumbers);
188
    my $new_reserves_count = scalar(@biblionumbers);
189
    $template->param( new_reserves_count => $new_reserves_count );
194
190
195
    my $maxreserves = C4::Context->preference('maxreserves');
191
    my $maxreserves = C4::Context->preference('maxreserves');
196
    $template->param( maxreserves => $maxreserves );
192
    $template->param( maxreserves => $maxreserves );
Lines 206-213 if ( $borrowernumber_hold && !$op ) { Link Here
206
        $exceeded_maxreserves = 1;
202
        $exceeded_maxreserves = 1;
207
        $template->param(
203
        $template->param(
208
            new_reserves_allowed => $new_reserves_allowed,
204
            new_reserves_allowed => $new_reserves_allowed,
209
            new_reserves_count   => $new_reserves_count,
210
            reserves_count       => $reserves_count,
211
            maxreserves          => $maxreserves,
205
            maxreserves          => $maxreserves,
212
        );
206
        );
213
    }
207
    }
Lines 302-307 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
302
    my @biblioloop          = ();
296
    my @biblioloop          = ();
303
    my $no_reserves_allowed = 0;
297
    my $no_reserves_allowed = 0;
304
    my $num_bibs_available  = 0;
298
    my $num_bibs_available  = 0;
299
    my @canbookbereserved_responses;
305
    foreach my $biblionumber (@biblionumbers) {
300
    foreach my $biblionumber (@biblionumbers) {
306
        next unless $biblionumber =~ m|^\d+$|;
301
        next unless $biblionumber =~ m|^\d+$|;
307
302
Lines 320-325 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
320
        if ($patron) {
315
        if ($patron) {
321
            {    # CanBookBeReserved
316
            {    # CanBookBeReserved
322
                my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber );
317
                my $canReserve = CanBookBeReserved( $patron->borrowernumber, $biblionumber );
318
319
                push @canbookbereserved_responses, { %$canReserve, biblio => $biblio };
320
323
                if ( $canReserve->{status} eq 'OK' ) {
321
                if ( $canReserve->{status} eq 'OK' ) {
324
322
325
                    #All is OK and we can continue
323
                    #All is OK and we can continue
Lines 719-728 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
719
717
720
    $template->param( no_bibs_available => 1 ) unless $num_bibs_available > 0;
718
    $template->param( no_bibs_available => 1 ) unless $num_bibs_available > 0;
721
719
722
    $template->param( biblioloop                => \@biblioloop );
720
    $Data::Dumper::Maxdepth = 3;
723
    $template->param( no_reserves_allowed       => $no_reserves_allowed );
721
    use Data::Dumper;
724
    $template->param( exceeded_maxreserves      => $exceeded_maxreserves );
722
    warn Dumper \@canbookbereserved_responses;
725
    $template->param( exceeded_holds_per_record => $exceeded_holds_per_record );
723
    $template->param( canbookbereserved_responses => \@canbookbereserved_responses );
724
    $template->param( biblioloop                  => \@biblioloop );
725
    $template->param( no_reserves_allowed         => $no_reserves_allowed );
726
    $template->param( exceeded_maxreserves        => $exceeded_maxreserves );
727
    $template->param( exceeded_holds_per_record   => $exceeded_holds_per_record );
726
728
727
    # FIXME: getting just the first bib's result doesn't seem right
729
    # FIXME: getting just the first bib's result doesn't seem right
728
    $template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber( $biblionumbers[0] ) );
730
    $template->param( subscriptionsnumber => CountSubscriptionFromBiblionumber( $biblionumbers[0] ) );
(-)a/t/db_dependent/Reserves/HoldRulesChecker.t (-1 / +110 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2019 Biblibre
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Test::More tests => 13;
23
use t::lib::TestBuilder;
24
25
use C4::Reserves qw( CanBookBeReserved );
26
27
my $schema = Koha::Database->new->schema;
28
$schema->storage->txn_begin;
29
30
my $builder = t::lib::TestBuilder->new();
31
32
my $library  = $builder->build_object( { class => 'Koha::Libraries' } );
33
my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } );
34
my $patron   = $builder->build_object(
35
    {
36
        class => 'Koha::Patrons',
37
        value => {
38
            categorycode => $category->categorycode,
39
            branchcode   => $library->branchcode,
40
        },
41
    }
42
);
43
44
my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } );
45
46
my $biblio = $builder->build_sample_biblio(
47
    {
48
        title => 'Title 1',
49
    }
50
);
51
my $item = $builder->build_sample_item(
52
    {
53
        biblionumber => $biblio->biblionumber,
54
        library      => $library->branchcode,
55
        itype        => $itemtype->itemtype,
56
        damaged      => 0,
57
    }
58
);
59
60
my $rules_rs = Koha::Database->new()->schema()->resultset('CirculationRule');
61
$rules_rs->delete();
62
63
my $default_reservesallowed_rule = $rules_rs->create(
64
    {
65
        categorycode => undef,
66
        itemtype     => undef,
67
        branchcode   => undef,
68
        rule_name    => 'reservesallowed',
69
        rule_value   => 10,
70
    }
71
);
72
73
my $reservesallowed_rule = $rules_rs->create(
74
    {
75
        categorycode => $patron->categorycode,
76
        itemtype     => undef,
77
        branchcode   => $library->branchcode,
78
        rule_name    => 'reservesallowed',
79
        rule_value   => 0,
80
    }
81
);
82
83
my $can = CanBookBeReserved( $patron->borrowernumber, $biblio->biblionumber );
84
is( $can->{status},                                               '' );
85
is( scalar @{ $can->{circulation_rules} },                        0 );
86
is( scalar @{ $can->{item_responses} },                           1 );
87
is( $can->{item_responses}->[0]->{status},                        'noReservesAllowed' );
88
is( scalar @{ $can->{item_responses}->[0]->{circulation_rules} }, 1 );
89
is( $can->{item_responses}->[0]->{circulation_rules}->[0]->id,    $reservesallowed_rule->id );
90
91
my $holds_per_record_rule = $rules_rs->create(
92
    {
93
        categorycode => $patron->categorycode,
94
        itemtype     => undef,
95
        branchcode   => $library->branchcode,
96
        rule_name    => 'holds_per_record',
97
        rule_value   => 1,
98
    }
99
);
100
101
$can = CanBookBeReserved( $patron->borrowernumber, $biblio->biblionumber );
102
is( $can->{status},                                               '' );
103
is( scalar @{ $can->{circulation_rules} },                        0 );
104
is( scalar @{ $can->{item_responses} },                           1 );
105
is( $can->{item_responses}->[0]->{status},                        'noReservesAllowed' );
106
is( scalar @{ $can->{item_responses}->[0]->{circulation_rules} }, 2 );
107
is( $can->{item_responses}->[0]->{circulation_rules}->[0]->id,    $holds_per_record_rule->id );
108
is( $can->{item_responses}->[0]->{circulation_rules}->[1]->id,    $reservesallowed_rule->id );
109
110
$schema->storage->txn_rollback;

Return to bug 23732