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

(-)a/Koha/Hold.pm (+14 lines)
Lines 386-391 sub cancel { Link Here
386
    return $self;
386
    return $self;
387
}
387
}
388
388
389
=head3 hold_group
390
391
Returns the Koha::Hold objects with this hold_group_id
392
393
=cut
394
395
sub hold_group {
396
    my ($self) = @_;
397
398
    $self->{_hold_group} ||= Koha::Holds->search({ hold_group_id => $self->hold_group_id });
399
400
    return $self->{_hold_group};
401
}
402
389
=head3 _move_to_old
403
=head3 _move_to_old
390
404
391
my $is_moved = $hold->_move_to_old;
405
my $is_moved = $hold->_move_to_old;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-7 / +10 lines)
Lines 38-46 Link Here
38
                        [% ELSE %]
38
                        [% ELSE %]
39
                            <option value="W" selected="selected">Waiting</option>
39
                            <option value="W" selected="selected">Waiting</option>
40
                        [% END %]
40
                        [% END %]
41
                    [% END %]
41
                    [% ELSIF ( CAN_user_reserveforothers_modify_holds_priority ) %]
42
43
                    [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
44
                        [% IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' %]
42
                        [% IF Koha.Preference('HoldsSplitQueueNumbering') == 'actual' %]
45
                            [% FOREACH optionloo IN hold.optionloop %]
43
                            [% FOREACH optionloo IN hold.optionloop %]
46
                                [% IF ( optionloo.selected ) %]
44
                                [% IF ( optionloo.selected ) %]
Lines 136-142 Link Here
136
                        [% END %]
134
                        [% END %]
137
                    </a>
135
                    </a>
138
                [% ELSE %]
136
                [% ELSE %]
139
                    [% IF ( hold.item_level_hold ) %]
137
                    [% IF ( hold.hold_group ) %]
138
                        <i><a id="group_hold_link_[% hold.hold_group_id %]" title="[% hold.hold_group_id %]" class="group_hold_link">Group hold</a></i>
139
                        <div id="group_hold_[% hold.hold_group_id %]" title="[% hold.hold_group_id %]" class="group_hold">
140
                            Containing the following items:
141
                            [% FOREACH h in hold.hold_group %]
142
                                <br><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% h.biblionumber %]">[% h.item.barcode %]</a>
143
                            [% END %]
144
                        </div>
145
                    [% ELSIF ( hold.item_level_hold ) %]
140
                        <i>
146
                        <i>
141
                            Only item
147
                            Only item
142
                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
148
                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
Lines 158-166 Link Here
158
                        <input type="hidden" name="itemnumber" value="" />
164
                        <input type="hidden" name="itemnumber" value="" />
159
                    [% END %]
165
                    [% END %]
160
                [% END %]
166
                [% END %]
161
                [% IF hold.hold_group_id %]
162
                    <div>(part of a <a href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=[% hold.hold_group_id | uri %]" class="hold-group">hold group</a>)</div>
163
                [% END %]
164
            </td>
167
            </td>
165
168
166
            [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
169
            [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/holds.js (-16 / +41 lines)
Lines 42-53 $(document).ready(function() { Link Here
42
                                title += " - <span class='" + span_class + "'>" + oObj.itemnotes.escapeHtml() + "</span>"
42
                                title += " - <span class='" + span_class + "'>" + oObj.itemnotes.escapeHtml() + "</span>"
43
                            }
43
                            }
44
44
45
                            if (oObj.hold_group_id) {
46
                              title += '<br>';
47
                              var link = '<a class="hold-group" href="/cgi-bin/koha/reserve/hold-group.pl?hold_group_id=' + oObj.hold_group_id + '">' + PART_OF_A_HOLD_GROUP +'</a>'
48
                              title += '<span>(' + link + ')</span>';
49
                            }
50
51
                            return title;
45
                            return title;
52
                        }
46
                        }
53
                    },
47
                    },
Lines 59-74 $(document).ready(function() { Link Here
59
                    {
53
                    {
60
                        "mDataProp": function( oObj ) {
54
                        "mDataProp": function( oObj ) {
61
                            var data = "";
55
                            var data = "";
62
                            if ( oObj.barcode ) {
56
                            if ( oObj.hold_group_id ) {
63
                                data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
57
                                data+= "<i><a id='group_hold_link_"
64
                                  + oObj.biblionumber
58
                                    + oObj.hold_group_id
65
                                  + "&itemnumber="
59
                                    + "' title='"
66
                                  + oObj.itemnumber
60
                                    + oObj.hold_group_id
67
                                  + "#"
61
                                    + "' class='group_hold_link'>Group hold</a></i>"
68
                                  + oObj.itemnumber
62
                                    + "<div id='group_hold_"
69
                                  + "'>"
63
                                    + oObj.hold_group_id
70
                                  + oObj.barcode.escapeHtml()
64
                                    + "' title='"
71
                                  + "</a>";
65
                                    + oObj.hold_group_id
66
                                    + "' class='group_hold'>"
67
                                    + "Containing the following items:";
68
                                oObj.hold_group.forEach( function( hold ) {
69
                                    if ( oObj.barcode ) {
70
                                        data+= "<br><a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
71
                                            + oObj.biblionumber
72
                                            + "'>"
73
                                            + oObj.barcode.escapeHtml()
74
                                            + "</a>";
75
                                    }
76
                                });
77
                                data += "</div>";
78
                            } else {
79
                                if ( oObj.barcode ) {
80
                                    data += " <a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber="
81
                                         + oObj.biblionumber
82
                                         + "&itemnumber="
83
                                         + oObj.itemnumber
84
                                         + "#"
85
                                         + oObj.itemnumber
86
                                         + "'>"
87
                                         + oObj.barcode.escapeHtml()
88
                                         + "</a>";
89
                                }
72
                            }
90
                            }
73
                            return data;
91
                            return data;
74
                        }
92
                        }
Lines 229-234 $(document).ready(function() { Link Here
229
                    });
247
                    });
230
                });
248
                });
231
249
250
                $(".group_hold").hide();
251
252
                $(".group_hold_link").click(function(e){
253
                    var group_hold_id = $(this).attr("title");
254
                    $("#group_hold_"+group_hold_id).toggle();
255
                });
256
232
            });
257
            });
233
258
234
            if ( $("#holds-table").length ) {
259
            if ( $("#holds-table").length ) {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc (-2 / +11 lines)
Lines 2-11 Link Here
2
[% USE ItemTypes %]
2
[% USE ItemTypes %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
4
5
[% IF ( HOLDS.count ) %]
5
[% IF ( HOLDS.size ) %]
6
    <div id="opac-user-holds">
6
    <div id="opac-user-holds">
7
        <table id="holdst" class="table table-bordered table-striped">
7
        <table id="holdst" class="table table-bordered table-striped">
8
            <caption>Holds <span class="count">([% HOLDS.count | html %] total)</span></caption>
8
            <caption>Holds <span class="count">([% HOLDS.size | html %] total)</span></caption>
9
            <!-- HOLDS TABLE ROWS -->
9
            <!-- HOLDS TABLE ROWS -->
10
            <thead>
10
            <thead>
11
                <tr>
11
                <tr>
Lines 65-70 Link Here
65
                                </strong>
65
                                </strong>
66
                            [% END %]
66
                            [% END %]
67
                            [% HOLD.biblio.author | html %]
67
                            [% HOLD.biblio.author | html %]
68
                            [% IF HOLD.hold_group_id %]
69
                                <br><i><a id="group_hold_link_[% HOLD.hold_group_id %]" title="[% HOLD.hold_group_id %]" class="group_hold_link">Group hold</a></i>
70
                                <div id="group_hold_[% HOLD.hold_group_id %]" title="[% HOLD.hold_group_id %]" class="group_hold">
71
                                    Containing the following items:
72
                                    [% FOREACH h in HOLD.hold_group %]
73
                                        <br><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% h.biblionumber %]">[% h.item.barcode %]</a>
74
                                    [% END %]
75
                                </div>
76
                            [% END %]
68
                        </td>
77
                        </td>
69
                        <td class="reservedate">
78
                        <td class="reservedate">
70
                            <span title="[% HOLD.reservedate | html %]">
79
                            <span title="[% HOLD.reservedate | html %]">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-1 / +8 lines)
Lines 162-168 Link Here
162
                                </li>
162
                                </li>
163
                            [% END %]
163
                            [% END %]
164
164
165
                            [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count | html %])</a></li>[% END %]
165
                            [% IF ( RESERVES.size ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.size | html %])</a></li>[% END %]
166
                            [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %]
166
                            [% IF Koha.Preference('ArticleRequests') && logged_in_user.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% logged_in_user.article_requests_current.count | html %])</a></li>[% END %]
167
                            [% IF ( OverDriveCirculation ) %]
167
                            [% IF ( OverDriveCirculation ) %]
168
                            <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
168
                            <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
Lines 922-927 Link Here
922
    <script>
922
    <script>
923
    var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
923
    var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
924
    $(document).ready(function() {
924
    $(document).ready(function() {
925
        $(".group_hold").hide();
926
927
        $(".group_hold_link").click(function(e){
928
            var group_hold_id = $(this).attr("title");
929
            $("#group_hold_"+group_hold_id).toggle();
930
        });
931
925
        [% IF ( overdrive_error ) %]
932
        [% IF ( overdrive_error ) %]
926
            KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
933
            KOHA.OverDriveCirculation.display_error("#opac-user-overdrive", "[% overdrive_error.dquote | html %]");
927
        [% END %]
934
        [% END %]
(-)a/opac/opac-user.pl (-2 / +18 lines)
Lines 301-310 if ($show_barcode) { Link Here
301
$template->param( show_barcode => 1 ) if $show_barcode;
301
$template->param( show_barcode => 1 ) if $show_barcode;
302
302
303
# now the reserved items....
303
# now the reserved items....
304
my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
304
my @all_reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } );
305
306
my @hold_group_ids = ();
307
my @reserves = ();
308
while ( my $hold = shift @all_reserves ){
309
    warn($hold->hold_group_id);
310
    if ( defined $hold->hold_group_id ){
311
        if ( grep(/$hold->hold_group_id/, @hold_group_ids) ){
312
            # don't add to filtered loop
313
        } else {
314
            push @hold_group_ids, $hold->hold_group_id;
315
            push @reserves, $hold;
316
        }
317
    } else {
318
        push @reserves, $hold;
319
    }
320
}
305
321
306
$template->param(
322
$template->param(
307
    RESERVES       => $reserves,
323
    RESERVES       => \@reserves,
308
    showpriority   => $show_priority,
324
    showpriority   => $show_priority,
309
);
325
);
310
326
(-)a/reserve/request.pl (-15 / +38 lines)
Lines 539-556 foreach my $biblionumber (@biblionumbers) { Link Here
539
        } @reserves
539
        } @reserves
540
      )
540
      )
541
    {
541
    {
542
        my $priority = $res->priority();
542
543
        my %reserve;
543
        my %reserve;
544
        my @optionloop;
545
        for ( my $i = 1 ; $i <= $totalcount ; $i++ ) {
546
            push(
547
                @optionloop,
548
                {
549
                    num      => $i,
550
                    selected => ( $i == $priority ),
551
                }
552
            );
553
        }
554
544
555
        if ( $res->is_found() ) {
545
        if ( $res->is_found() ) {
556
            $reserve{'holdingbranch'} = $res->item()->holdingbranch();
546
            $reserve{'holdingbranch'} = $res->item()->holdingbranch();
Lines 595-612 foreach my $biblionumber (@biblionumbers) { Link Here
595
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
585
        $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
596
        $reserve{'priority'}       = $res->priority();
586
        $reserve{'priority'}       = $res->priority();
597
        $reserve{'lowestPriority'} = $res->lowestPriority();
587
        $reserve{'lowestPriority'} = $res->lowestPriority();
598
        $reserve{'optionloop'}     = \@optionloop;
599
        $reserve{'suspend'}        = $res->suspend();
588
        $reserve{'suspend'}        = $res->suspend();
600
        $reserve{'suspend_until'}  = $res->suspend_until();
589
        $reserve{'suspend_until'}  = $res->suspend_until();
601
        $reserve{'reserve_id'}     = $res->reserve_id();
590
        $reserve{'reserve_id'}     = $res->reserve_id();
602
        $reserve{itemtype}         = $res->itemtype();
591
        $reserve{itemtype}         = $res->itemtype();
603
        $reserve{branchcode}       = $res->branchcode();
592
        $reserve{branchcode}       = $res->branchcode();
604
        $reserve{object}           = $res;
593
        $reserve{object}           = $res;
594
        $reserve{'hold_group'}     = $res->hold_group_id ? Koha::Holds->search({ hold_group_id => $res->hold_group_id }) : undef;
605
        $reserve{'hold_group_id'}  = $res->hold_group_id;
595
        $reserve{'hold_group_id'}  = $res->hold_group_id;
606
596
607
        push( @reserveloop, \%reserve );
597
        push( @reserveloop, \%reserve );
608
    }
598
    }
609
599
600
    my @hold_group_ids = ();
601
    my @filtered_reserveloop = ();
602
    while ( my $hold = shift @reserveloop ){
603
        if ( defined $hold->{hold_group_id} ){
604
            if ( grep(/$hold->{hold_group_id}/, @hold_group_ids) ){
605
                # don't add to filtered loop
606
            } else {
607
                push @hold_group_ids, $hold->{hold_group_id};
608
                push @filtered_reserveloop, $hold;
609
            }
610
        } else {
611
            push @filtered_reserveloop, $hold;
612
        }
613
    }
614
615
    my $row_count = scalar @filtered_reserveloop;
616
617
    my $row_num = 0;
618
    foreach my $hold (@filtered_reserveloop){
619
        $row_num++;
620
        my @optionloop;
621
        for ( my $i = 1 ; $i <= $row_count ; $i++ ) {
622
            push(
623
                @optionloop,
624
                {
625
                    num      => $i,
626
                    selected => ( $i == $row_num ),
627
                }
628
            );
629
        }
630
        $hold->{optionloop} = \@optionloop;
631
    }
632
610
    # get the time for the form name...
633
    # get the time for the form name...
611
    my $time = time();
634
    my $time = time();
612
635
Lines 633-642 foreach my $biblionumber (@biblionumbers) { Link Here
633
    $biblioloopiter{biblionumber} = $biblionumber;
656
    $biblioloopiter{biblionumber} = $biblionumber;
634
    $biblioloopiter{title} = $biblio->title;
657
    $biblioloopiter{title} = $biblio->title;
635
    $biblioloopiter{rank} = $fixedRank;
658
    $biblioloopiter{rank} = $fixedRank;
636
    $biblioloopiter{reserveloop} = \@reserveloop;
659
    $biblioloopiter{reserveloop} = \@filtered_reserveloop;
637
660
638
    if (@reserveloop) {
661
    if (@filtered_reserveloop) {
639
        $template->param( reserveloop => \@reserveloop );
662
        $template->param( reserveloop => \@filtered_reserveloop );
640
    }
663
    }
641
664
642
    push @biblioloop, \%biblioloopiter;
665
    push @biblioloop, \%biblioloopiter;
(-)a/svc/holds (-6 / +24 lines)
Lines 100-108 while ( my $h = $holds_rs->next() ) { Link Here
100
        waiting        => $h->is_waiting(),
100
        waiting        => $h->is_waiting(),
101
        waiting_at     => $h->branch()->branchname(),
101
        waiting_at     => $h->branch()->branchname(),
102
        waiting_here   => $h->branch()->branchcode() eq $branch,
102
        waiting_here   => $h->branch()->branchcode() eq $branch,
103
        priority       => $h->priority(),
104
        itemtype_limit => $itemtype_limit,
103
        itemtype_limit => $itemtype_limit,
105
        hold_group_id => $h->hold_group_id,
104
        hold_group     => Koha::Holds->search({ hold_group_id => $h->hold_group_id })->unblessed,
105
        hold_group_id  => $h->hold_group_id,
106
        subtitle       => GetRecordValue(
106
        subtitle       => GetRecordValue(
107
            'subtitle',
107
            'subtitle',
108
            GetMarcBiblio({ biblionumber => $biblionumber }),
108
            GetMarcBiblio({ biblionumber => $biblionumber }),
Lines 150-159 while ( my $h = $holds_rs->next() ) { Link Here
150
    push( @holds, $hold );
150
    push( @holds, $hold );
151
}
151
}
152
152
153
my @hold_group_ids = ();
154
my @filtered_holds = ();
155
my $row_counter = 1;
156
while ( my $h = shift @holds ){
157
    if ( defined $h->{hold_group_id} ){
158
        if ( grep(/$h->{hold_group_id}/, @hold_group_ids) ){
159
            # don't add to filtered loop
160
        } else {
161
            push @hold_group_ids, $h->{hold_group_id};
162
            $h->{priority} = $row_counter;
163
            push @filtered_holds, $h;
164
        }
165
    } else {
166
        $h->{priority} = $row_counter;
167
        push @filtered_holds, $h;
168
    }
169
    $row_counter++;
170
}
171
153
my $data;
172
my $data;
154
$data->{'iTotalRecords'}        = scalar @holds;
173
$data->{'iTotalRecords'}        = scalar @filtered_holds;
155
$data->{'iTotalDisplayRecords'} = scalar @holds;
174
$data->{'iTotalDisplayRecords'} = scalar @filtered_holds;
156
$data->{'sEcho'}                = $input->param('sEcho') || undef;
175
$data->{'sEcho'}                = $input->param('sEcho') || undef;
157
$data->{'aaData'}               = \@holds;
176
$data->{'aaData'}               = \@filtered_holds;
158
177
159
print to_json($data);
178
print to_json($data);
160
- 

Return to bug 21528