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

(-)a/C4/Reserves.pm (-1 / +2 lines)
Lines 2505-2511 sub GetHoldGroupHolds { Link Here
2505
    my $dbh = C4::Context->dbh;
2505
    my $dbh = C4::Context->dbh;
2506
2506
2507
    my $reserves = $dbh->selectall_arrayref(q{
2507
    my $reserves = $dbh->selectall_arrayref(q{
2508
        SELECT * FROM reserves
2508
        SELECT * FROM reserves LEFT JOIN items
2509
        ON reserves.itemnumber = items.itemnumber
2509
        WHERE hold_group_id = ?
2510
        WHERE hold_group_id = ?
2510
    }, { Slice => {} }, $hold_group_id);
2511
    }, { Slice => {} }, $hold_group_id);
2511
2512
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/hold-group.tt (+4 lines)
Lines 13-18 Link Here
13
            <th>Title</th>
13
            <th>Title</th>
14
            <th>Priority</th>
14
            <th>Priority</th>
15
            <th>Notes</th>
15
            <th>Notes</th>
16
            <th>Barcode</th>
17
            <th>Enumchron</th>
16
          </tr>
18
          </tr>
17
        </thead>
19
        </thead>
18
        <tbody>
20
        <tbody>
Lines 22-27 Link Here
22
              <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
24
              <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% biblio.biblionumber %]">[% biblio.title %]</a></td>
23
              <td>[% hold.priority %]</td>
25
              <td>[% hold.priority %]</td>
24
              <td>[% hold.reservenotes %]</td>
26
              <td>[% hold.reservenotes %]</td>
27
              <td>[% hold.barcode %]</td>
28
              <td>[% hold.enumchron %]</td>
25
            </tr>
29
            </tr>
26
          [% END %]
30
          [% END %]
27
        </tbody>
31
        </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (-4 / +46 lines)
Lines 809-814 function checkMultiHold() { Link Here
809
	<th>&nbsp;</th>
809
	<th>&nbsp;</th>
810
    [% IF SuspendHoldsIntranet %]<th>&nbsp;</th><!-- Suspend Holds Column Header -->[% END %]
810
    [% IF SuspendHoldsIntranet %]<th>&nbsp;</th><!-- Suspend Holds Column Header -->[% END %]
811
      </tr>
811
      </tr>
812
      [% IF (grouped_holds) %]
813
          [% FOREACH group_level_hold IN grouped_holds %]
814
            <tr>
815
                <td>Group hold: <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% group_level_hold.hold.hold_group_id %]">hold group</a></td>
816
                <td></td>
817
                <td>[% INCLUDE 'patron-title.inc' patron=group_level_hold.patron hide_patron_infos_if_needed=1 %]</td>
818
                <td>[% group_level_hold.hold.reservenotes %]</td>
819
                <td>[% group_level_hold.hold.reservedate | $KohaDates %]</td>
820
                <td>[% group_level_hold.hold.expirationdate | $KohaDates %]</td>
821
                <td>
822
                    [% IF ( group_level_hold.hold.found ) %]
823
                        [% IF ( group_level_hold.hold.atdestination ) %]
824
                            [% IF ( group_level_hold.hold.found ) %]
825
                                Item waiting at <b> [% group_level_hold.hold.wbrname %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" /> since [% group_level_hold.hold.waiting_date | $KohaDates %]
826
                            [% ELSE %]
827
                                Waiting to be pulled <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" />
828
                            [% END %]
829
                        [% ELSE %]
830
                            Item being transferred to <b> [% group_level_hold.hold.wbrname %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.wbrcode %]" />
831
                        [% END %]
832
                    [% ELSE %]
833
                        [% IF Koha.Preference('IndependentBranches') && Branches.all().size  == 1 %]
834
                            [% Branches.GetName(group_level_hold.hold.branchcode) %] <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" />
835
                        [% ELSE %]
836
                            <select name="pickup">
837
                                [% PROCESS options_for_libraries libraries => Branches.all( selected => group_level_hold.hold.branchcode ) %]
838
                            </select>
839
                        [% END %]
840
                    [% END %]
841
                </td>
842
                <td>
843
                    [% IF group_level_hold.hold.hold_group_id %]
844
                        <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% group_level_hold.hold.hold_group_id %]">hold group</a>)</div>
845
                    [% END %]
846
                </td>
847
                <td></td>
848
                <td>
849
                    <a class="cancel-hold" title="Cancel hold" href="request.pl?action=cancel_group_hold&amp;borrowernumber=[% group_level_hold.hold.borrowernumber %]&amp;biblionumber=[% group_level_hold.hold.biblionumber %]&amp;group_hold_id=[% group_level_hold.hold.hold_group_id %]">
850
                    <img src="[% interface %]/[% theme %]/img/x.png" alt="Cancel" />
851
                   </a>
852
                </td>
853
                <td></td>
854
            </tr>
855
          [% END %]
856
    [% END %]
857
812
  [% FOREACH reserveloo IN biblioloo.reserveloop %]
858
  [% FOREACH reserveloo IN biblioloo.reserveloop %]
813
        <tr>
859
        <tr>
814
        <td>
860
        <td>
Lines 917-925 function checkMultiHold() { Link Here
917
                 <input type="hidden" name="itemnumber" value="" />
963
                 <input type="hidden" name="itemnumber" value="" />
918
            [% END %]
964
            [% END %]
919
    [% END %]
965
    [% END %]
920
            [% IF reserveloo.hold_group_id %]
921
                <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% reserveloo.hold_group_id %]">hold group</a>)</div>
922
            [% END %]
923
        </td>
966
        </td>
924
967
925
    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
968
    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
Lines 959-965 function checkMultiHold() { Link Here
959
        [% END # IF SuspendHoldsIntranet %]
1002
        [% END # IF SuspendHoldsIntranet %]
960
1003
961
      </tr>
1004
      </tr>
962
963
  [% END %] <!-- existing reserveloop -->
1005
  [% END %] <!-- existing reserveloop -->
964
     </table>
1006
     </table>
965
  [% END %]<!-- /reserveloop -->
1007
  [% END %]<!-- /reserveloop -->
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-13 / +146 lines)
Lines 4-9 Link Here
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE ItemTypes %]
5
[% USE ItemTypes %]
6
[% USE Price %]
6
[% USE Price %]
7
[% USE Biblio %]
7
8
8
[% SET borrower_club_enrollments =  borrower.get_club_enrollments(1) %]
9
[% SET borrower_club_enrollments =  borrower.get_club_enrollments(1) %]
9
[% SET borrower_enrollable_clubs = borrower.get_enrollable_clubs(1,1) %]
10
[% SET borrower_enrollable_clubs = borrower.get_enrollable_clubs(1,1) %]
Lines 585-604 Link Here
585
                                        </tr>
586
                                        </tr>
586
                                    </thead>
587
                                    </thead>
587
                                    <tbody>
588
                                    <tbody>
588
                                    [% FOREACH RESERVE IN RESERVES %]
589
                                        [% IF (grouped_holds) %]
589
                                        [% IF ( RESERVE.is_waiting ) %]
590
                                           [% FOREACH group_level_hold IN grouped_holds %]
590
                                            [% IF ( RESERVE.is_at_destination ) %]
591
                                             <tr>
591
                                                [% IF ( RESERVE.is_found ) %]
592
                                               <td class="title">
593
                                                 [% biblio = Biblio.Get(group_level_hold.hold.biblionumber) %]
594
                                                 <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber %]">
595
                                                 [% biblio.title %]
596
                                                 </a>
597
                                                 [% biblio.author %]
598
                                               </td>
599
                                               <td class="reservedate">
600
                                                   <span title="[% group_level_hold.hold.reservedate %]">
601
                                                     <span class="tdlabel">Hold date:</span>
602
                                                     [% group_level_hold.hold.reservedate | $KohaDates %]
603
                                                   </span>
604
                                               </td>
605
                                               <td class="expirationdate">
606
                                                 [% IF ! group_level_hold.hold.found %]
607
                                                    [% IF ( group_level_hold.hold.expirationdate ) %]
608
                                                       <span title="[% group_level_hold.hold.expirationdate %]">
609
                                                          <span class="tdlabel">Expiration:</span>
610
                                                              [% group_level_hold.hold.expirationdate | $KohaDates %]
611
                                                          </span>
612
                                                    [% ELSE %]
613
                                                          <span title="0000-00-00"> 
614
                                                             <span class="tdlabel">Expiration:</span>
615
                                                                  Never expires
616
                                                             </span>
617
                                                    [%END %]
618
                                                 [% ELSE %]
619
                                                    <span title="0000-00-00">-</span>
620
                                                 [% END %]
621
                                               </td>
622
                                               [% UNLESS( singleBranchMode) %]
623
                                                  <td class="branch">
624
                                                     <span class="tdlabel">Pick up location:</span>
625
                                                     [% Branches.GetName(group_level_hold.hold.branchcode ) %]
626
                                                  </td>
627
                                               [% END %]
628
                                               [% IF ( showpriority ) %]
629
                                                  <td class="priority">
630
                                                  </td>
631
                                               [% END %]
632
                                               <td class="status">
633
                                                  <span class="tdlabel">Status:</span>
634
                                                  [% IF ( group_level_hold.hold.is_waiting ) %]
635
                                                      [% IF ( group_level_hold.hold.is_at_destination ) %]
636
                                                         [% IF ( group_level_hold.hold.found ) %]
637
                                                             Item waiting at <b> [% group_level_hold.hold.branch.branchname %]</b>
638
                                                             [% IF ( group_level_hold.hold.waitingdate ) %]
639
                                                                 since [% group_level_hold.hold.waitingdate | $KohaDates %] until [% group_level_hold.hold.lastpickupdate | $KohaDates %]
640
                                                             [% END %]
641
                                                                 <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" />
642
                                                         [% ELSE %]
643
                                                             Item waiting to be pulled from <b> [% Branches.GetName( group_level_hold.hold.branchcode ) %]</b>
644
                                                         [% END %]
645
                                                      [% ELSE %]
646
                                                         Item in transit to <b> [% Branches.GetName(group_level_hold.hold.branchcode ) %]</b> <input type="hidden" name="pickup" value="[% group_level_hold.hold.branchcode %]" />
647
                                                      [% END %]
648
                                                  [% ELSE %]
649
                                                      [% IF ( group_level_hold.hold.is_in_transit ) %]
650
                                                          [% SET transfer = group_level_hold.hold.item.get_transfer %]
651
                                                            Item in transit from <b> [% Branches.GetName( transfer.frombranch ) %]</b> since
652
                                                            [% transfer.datesent | $KohaDates %]
653
                                                      [% ELSIF ( group_level_level.hold.suspend ) %]
654
                                                            Suspended [% IF ( group_level_hold.hold.suspend_until ) %] until [% grou_level_hold.hold.suspend_until %] [% END %]
655
                                                      [% ELSE %]
656
                                                            [% IF group_level_hold.hold.itemtype %]
657
                                                                 Pending for next available item of itemtype '[% ItemTypes.GetDescription( group_level_hold.hold.itemtype ) %]'
658
                                                            [% ELSE %]
659
                                                                 Pending
660
                                                            [% END %]
661
                                                      [% END %]
662
                                                  [% END %]
663
                                               </td>
664
                                               [% IF SuspendHoldsOpac %]
665
                                                 <td>
666
                                                   [% IF ( group_level_hold.hold.is_cancelable_from_opac ) %]
667
                                                       [% IF group_level_hold.hold.suspend %]
668
                                                          <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
669
                                                             <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" />
670
                                                             <button class="btn btn-link" type="submit" name="submit"><i class="icon-play"></i> Resume</button>
671
                                                          </form>
672
                                                       [% ELSE %]
673
                                                          [% IF AutoResumeSuspendedHolds %]
674
                                                             <a class="btn btn-link js-show" href="#suspendModal[% group_level_hold.hold.reserve_id %]" role="button" data-toggle="modal"><i class="icon-pause"></i> Suspend</a>
675
                                                             [% # hold suspend modal form %]
676
                                                             <div id="suspendModal[% group_level_hold.hold.reserve_id %]" class="modal-nojs" tabindex="-1" role="dialog" aria-labelledby="suspendModal[% group_level_hold.hold.reserve_id %]Label" aria-hidden="true">
677
                                                             <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
678
                                                                  <div class="modal-header">
679
                                                                      <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
680
                                                                      [% IF group_level_hold.hold.suspend %]
681
                                                                          <h3 id="suspendModal[% group_level_hold.hold.reserve_id %]Label">Resume your hold on <i>[% group_level_hold.hold.biblio.title %]</i></h3>
682
                                                                      [% ELSE %]
683
                                                                          <h3 id="suspendModal[% group_level_hold.hold.reserve_id %]Label">Suspend your hold on <i>[% group_level_hold.hold.biblio.title %]</i></h3>
684
                                                                      [% END %]
685
                                                                 </div>
686
                                                                 <div class="modal-body">
687
                                                                      <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" />
688
                                                                      <label for="suspend_until_[% group_level_hold.hold.reserve_id %]">Suspend until:</label>
689
                                                                      <input name="suspend_until" id="suspend_until_[% group_level_hold.hold.reserve_id %]" class="suspend-until" size="10" />
690
                                                                      [% INCLUDE 'date-format.inc' %]
691
                                                                      <p class="js-show"><a href="#" onclick="document.getElementById('suspend_until_[% group_level_hold.hold.reserve_id %]').value='';return false;">Clear date to suspend indefinitely</a></p>
692
                                                                      <button class="btn btn-mini js-hide" type="submit" name="submit">Suspend</button>
693
                                                                 </div>
694
                                                                 <div class="modal-footer">
695
                                                                   <button class="btn btn-primary" type="submit" name="submit">Suspend</button>
696
                                                                   <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
697
                                                                 </div>
698
                                                             </form>
699
                                                             [% ELSE %]
700
                                                                <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post">
701
                                                                  <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" />
702
                                                                  <button class="btn btn-link" type="submit" name="submit"><i class="icon-pause"></i> Suspend</button>
703
                                                                </form>
704
                                                          [% END # / IF AutoResumeSuspendedHolds %]
705
                                                       [% END # / IF RESERVE.suspend %]
706
                                                   [% END # / IF ( RESERVE.is_cancelable_from_opac)%]
707
                                                 </td>
708
                                               [% END # / IF SuspendHoldsOpac %]
709
                                               <td class="modify">
710
                                                  [% IF ( RESERVE.is_cancelable_from_opac ) %]
711
                                                     <form action="/cgi-bin/koha/opac-modrequest.pl"method="post">
712
                                                        <input type="hidden" name="biblionumber" value="[% group_level_hold.hold.biblionumber %]" />
713
                                                        <input type="hidden" name="reserve_id" value="[% group_level_hold.hold.reserve_id %]" />
714
                                                        <button type="submit" name="submit" class="btn btn-mini btn-danger" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"><i class="icon-remove icon-white"></i> Cancel</button></form>
715
                                                  [% END %]
716
                                               </td>
717
                                            </tr>
718
                                       [% END # /FOREACH grouped reserves %]
719
                                    [% END %]
720
                                       [% FOREACH RESERVE IN RESERVES %]
721
                                          [% IF ( RESERVE.is_waiting ) %]
722
                                             [% IF ( RESERVE.is_at_destination ) %]
723
                                                 [% IF ( RESERVE.is_found ) %]
592
                                                    <tr class="reserved">
724
                                                    <tr class="reserved">
593
                                                [% ELSE %]
725
                                                 [% ELSE %]
594
                                                    <tr>
726
                                                    <tr>
595
                                                [% END %]
727
                                                 [% END %]
596
                                            [% ELSE %]
728
                                             [% ELSE %]
597
                                                <tr class="transfered">
729
                                                 <tr class="transfered">
598
                                            [% END %]
730
                                             [% END %]
599
                                        [% ELSE %]
731
                                          [% ELSE %]
600
                                            <tr>
732
                                             <tr>
601
                                        [% END %]
733
                                          [% END %]
734
602
                                            <td class="title">
735
                                            <td class="title">
603
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
736
                                                <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]">
604
                                                    [% RESERVE.biblio.title %]
737
                                                    [% RESERVE.biblio.title %]
Lines 732-737 Link Here
732
                                            </td>
865
                                            </td>
733
                                        </tr>
866
                                        </tr>
734
                                    [% END # /FOREACH RESERVES %]
867
                                    [% END # /FOREACH RESERVES %]
868
                                    [% END %]
735
                                </tbody>
869
                                </tbody>
736
                            </table>
870
                            </table>
737
871
Lines 755-761 Link Here
755
                                        <input type="hidden" name="suspend" value="0" />
889
                                        <input type="hidden" name="suspend" value="0" />
756
                                    </form>
890
                                    </form>
757
                                </div>
891
                                </div>
758
                            [% END %]
759
                        </div> <!-- / #opac-user-holds -->
892
                        </div> <!-- / #opac-user-holds -->
760
                        [% END # / #RESERVES.count %]
893
                        [% END # / #RESERVES.count %]
761
894
(-)a/opac/opac-user.pl (+38 lines)
Lines 42-47 use Koha::Patron::Attribute::Types; Link Here
42
use Koha::Patron::Messages;
42
use Koha::Patron::Messages;
43
use Koha::Patron::Discharge;
43
use Koha::Patron::Discharge;
44
use Koha::Patrons;
44
use Koha::Patrons;
45
use Data::Dumper;
45
46
46
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
47
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
47
48
Lines 298-303 if ($show_barcode) { Link Here
298
$template->param( show_barcode => 1 ) if $show_barcode;
299
$template->param( show_barcode => 1 ) if $show_barcode;
299
300
300
# now the reserved items....
301
# now the reserved items....
302
my @reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
303
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
304
305
my %reserve_records;
306
my $count = 0;
307
foreach my $reserve ( @reserves ) {
308
  warn Dumper($reserve->hold_group_id);
309
  if ($reserve->hold_group_id) {
310
      # Keep track of which hold_group_id (duplicated field) go with each reserve_id (unique field)
311
      $reserve_records{ $reserve->hold_group_id }->{ $reserve->reserve_id }++;
312
      warn $reserve->reserve_id;
313
      $reserves = grep { $_->{'reserve_id'} != $reserve->reserve_id } $reserves;
314
  }else {
315
      warn $reserve->reserve_id;
316
      warn $reserve->hold_group_id;
317
  }
318
}
319
my @grouped_parts;
320
for my $hold_group ( sort { $a <=> $b } keys %reserve_records ) {
321
    my @reserveids = sort { $a <=> $b } keys %{ $reserve_records{ $hold_group } };
322
    my @holds = GetHoldGroupHolds($hold_group);
323
    my $hold = $holds[0];
324
    my $patron = Koha::Patrons->find( {borrowernumber => $hold->{borrowernumber}} );
325
    # Merge the itemnumbers with each hold_group_id
326
    push @grouped_parts, {
327
        hold_group_id => $hold_group,
328
        reserve_id => join(', ', sort { $a <=> $b } @reserveids),
329
        hold => $hold,
330
        patron => $patron,
331
    };
332
}
333
334
warn Dumper(@grouped_parts);
335
if (@grouped_parts) {
336
    $template->param( grouped_holds => \@grouped_parts );
337
}
338
301
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
339
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
302
340
303
$template->param(
341
$template->param(
(-)a/reserve/hold-group.pl (+2 lines)
Lines 21-26 use CGI qw( -utf8 ); Link Here
21
use C4::Auth;
21
use C4::Auth;
22
use C4::Output;
22
use C4::Output;
23
use C4::Reserves;
23
use C4::Reserves;
24
use C4::Items;
25
use Data::Dumper;
24
26
25
my $cgi = new CGI;
27
my $cgi = new CGI;
26
my ($template, $loggedinuser, $cookie) = get_template_and_user({
28
my ($template, $loggedinuser, $cookie) = get_template_and_user({
(-)a/reserve/request.pl (-3 / +39 lines)
Lines 42-47 use Koha::DateUtils; Link Here
42
use C4::Utils::DataTables::Members;
42
use C4::Utils::DataTables::Members;
43
use C4::Members;
43
use C4::Members;
44
use C4::Search;		# enabled_staff_search_views
44
use C4::Search;		# enabled_staff_search_views
45
use Data::Dumper;
45
46
46
use Koha::Biblios;
47
use Koha::Biblios;
47
use Koha::DateUtils;
48
use Koha::DateUtils;
Lines 115-120 if ( $action eq 'move' ) { Link Here
115
  my $reserve_id = $input->param('reserve_id');
116
  my $reserve_id = $input->param('reserve_id');
116
  my $suspend_until  = $input->param('suspend_until');
117
  my $suspend_until  = $input->param('suspend_until');
117
  ToggleSuspend( $reserve_id, $suspend_until );
118
  ToggleSuspend( $reserve_id, $suspend_until );
119
} elsif ( $action eq 'cancel_group_hold' ) {
120
  
121
118
}
122
}
119
123
120
if ($findborrower) {
124
if ($findborrower) {
Lines 568-573 foreach my $biblionumber (@biblionumbers) { Link Here
568
        } @reserves
572
        } @reserves
569
      )
573
      )
570
    {
574
    {
575
571
        my $priority = $res->priority();
576
        my $priority = $res->priority();
572
        my %reserve;
577
        my %reserve;
573
        my @optionloop;
578
        my @optionloop;
Lines 580-586 foreach my $biblionumber (@biblionumbers) { Link Here
580
                }
585
                }
581
            );
586
            );
582
        }
587
        }
583
584
        if ( $res->is_found() ) {
588
        if ( $res->is_found() ) {
585
            $reserve{'holdingbranch'} = $res->item()->holdingbranch();
589
            $reserve{'holdingbranch'} = $res->item()->holdingbranch();
586
            $reserve{'biblionumber'}  = $res->item()->biblionumber();
590
            $reserve{'biblionumber'}  = $res->item()->biblionumber();
Lines 631-640 foreach my $biblionumber (@biblionumbers) { Link Here
631
        $reserve{itemtype}         = $res->itemtype();
635
        $reserve{itemtype}         = $res->itemtype();
632
        $reserve{branchcode}       = $res->branchcode();
636
        $reserve{branchcode}       = $res->branchcode();
633
        $reserve{'hold_group_id'} = $res->hold_group_id;
637
        $reserve{'hold_group_id'} = $res->hold_group_id;
634
635
        push( @reserveloop, \%reserve );
638
        push( @reserveloop, \%reserve );
636
    }
639
    }
637
640
641
    my %reserve_records;
642
    my $count = 0;
643
    foreach my $reserve ( @reserves ) {
644
        warn $reserve->reserve_id;
645
        if ($reserve->hold_group_id) {
646
           # Keep track of which hold_group_id (duplicated field) go with each reserve_id (unique field)
647
           $reserve_records{ $reserve->hold_group_id }->{ $reserve->reserve_id }++;
648
           warn $reserve->reserve_id;
649
           @reserveloop = grep { $_->{reserve_id} != $reserve->reserve_id } @reserveloop;
650
       }else {
651
            warn $reserve->reserve_id;
652
            warn $reserve->hold_group_id;
653
        }
654
    }
655
    my @grouped_parts;
656
    for my $hold_group ( sort { $a <=> $b } keys %reserve_records ) {
657
       my @reserveids = sort { $a <=> $b } keys %{ $reserve_records{ $hold_group } };
658
659
       my @holds = GetHoldGroupHolds($hold_group);
660
       my $hold = $holds[0];
661
       my $patron = Koha::Patrons->find( {borrowernumber => $hold->{borrowernumber}} );
662
663
       # Merge the itemnumbers with each hold_group_id
664
       push @grouped_parts, {
665
           hold_group_id => $hold_group,
666
           reserve_id => join(', ', sort { $a <=> $b } @reserveids),
667
           hold => $hold,
668
           patron => $patron,
669
       };
670
    }
671
    if (@grouped_parts) {
672
        $template->param( grouped_holds => \@grouped_parts );
673
    }
674
638
    # get the time for the form name...
675
    # get the time for the form name...
639
    my $time = time();
676
    my $time = time();
640
677
641
- 

Return to bug 21528