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

(-)a/Koha/Schema/Result/Reserve.pm (+24 lines)
Lines 465-470 __PACKAGE__->belongs_to( Link Here
465
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
465
  { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
466
);
466
);
467
467
468
__PACKAGE__->belongs_to(
469
  "branch",
470
  "Koha::Schema::Result::Branch",
471
  { branchcode => "branchcode" },
472
  {
473
    is_deferrable => 1,
474
    join_type     => "LEFT",
475
    on_delete     => "CASCADE",
476
    on_update     => "CASCADE",
477
  },
478
);
479
480
__PACKAGE__->belongs_to(
481
  "desk",
482
  "Koha::Schema::Result::Desk",
483
  { desk_id => "desk_id" },
484
  {
485
    is_deferrable => 1,
486
    join_type     => "LEFT",
487
    on_delete     => "SET NULL",
488
    on_update     => "CASCADE",
489
  },
490
);
491
468
__PACKAGE__->add_columns(
492
__PACKAGE__->add_columns(
469
    '+item_level_hold' => { is_boolean => 1 },
493
    '+item_level_hold' => { is_boolean => 1 },
470
    '+lowestPriority'  => { is_boolean => 1 },
494
    '+lowestPriority'  => { is_boolean => 1 },
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-27 / +27 lines)
Lines 68-76 Link Here
68
                    <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
68
                    <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id | html %]">
69
                    <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
69
                    <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id | html %]">
70
                    [% IF ( hold.found ) %]
70
                    [% IF ( hold.found ) %]
71
                        [% IF ( hold.intransit ) %]
71
                        [% IF ( hold.found == 'T' ) %]
72
                            <option value="T" selected="selected">In transit</option>
72
                            <option value="T" selected="selected">In transit</option>
73
                        [% ELSIF (hold.inprocessing) %]
73
                        [% ELSIF ( hold.found == 'P' ) %]
74
                            <option value="P" selected="selected">In processing</option>
74
                            <option value="P" selected="selected">In processing</option>
75
                        [% ELSE %]
75
                        [% ELSE %]
76
                            <option value="W" selected="selected">Waiting</option>
76
                            <option value="W" selected="selected">Waiting</option>
Lines 86-101 Link Here
86
                    [%- SET prev_priority  = loop.prev.priority -%]
86
                    [%- SET prev_priority  = loop.prev.priority -%]
87
                    [%- SET next_priority  = loop.next.priority -%]
87
                    [%- SET next_priority  = loop.next.priority -%]
88
                    <td style="white-space:nowrap;">
88
                    <td style="white-space:nowrap;">
89
                        <a title="Move hold up" href="request.pl?action=move&amp;where=up&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
89
                        <a title="Move hold up" href="request.pl?action=move&amp;where=up&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
90
                            <img src="[% interface | html %]/[% theme | html %]/img/go-up.png" alt="Go up" />
90
                            <img src="[% interface | html %]/[% theme | html %]/img/go-up.png" alt="Go up" />
91
                        </a>
91
                        </a>
92
                        <a title="Move hold to top" href="request.pl?action=move&amp;where=top&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
92
                        <a title="Move hold to top" href="request.pl?action=move&amp;where=top&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
93
                            <img src="[% interface | html %]/[% theme | html %]/img/go-top.png" alt="Go top" />
93
                            <img src="[% interface | html %]/[% theme | html %]/img/go-top.png" alt="Go top" />
94
                        </a>
94
                        </a>
95
                        <a title="Move hold to bottom" href="request.pl?action=move&amp;where=bottom&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
95
                        <a title="Move hold to bottom" href="request.pl?action=move&amp;where=bottom&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
96
                            <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Go bottom" />
96
                            <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Go bottom" />
97
                        </a>
97
                        </a>
98
                        <a title="Move hold down" href="request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
98
                        <a title="Move hold down" href="request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | html %]&amp;last_priority=[% last_priority | html %]&amp;prev_priority=[% prev_priority | html %]&amp;next_priority=[% next_priority | html %]&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
99
                            <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Go down" />
99
                            <img src="[% interface | html %]/[% theme | html %]/img/go-down.png" alt="Go down" />
100
                        </a>
100
                        </a>
101
                    </td>
101
                    </td>
Lines 106-117 Link Here
106
            <td>
106
            <td>
107
                [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %]
107
                [% INCLUDE 'patron-title.inc' patron=hold.patron hide_patron_infos_if_needed=1 %]
108
            </td>
108
            </td>
109
            <td>[% hold.notes | html | html_line_break %]</td>
109
            <td>[% hold.reservenotes | html | html_line_break %]</td>
110
            <td>
110
            <td>
111
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
111
                [% IF Koha.Preference('AllowHoldDateInFuture') %]
112
                    <input type="text" class="flatpickr" value="[% hold.date | $KohaDates %]" required="required" size="10" name="reservedate" />
112
                    <input type="text" class="flatpickr" value="[% hold.reservedate | $KohaDates %]" required="required" size="10" name="reservedate" />
113
                [% ELSE %]
113
                [% ELSE %]
114
                    [% hold.date | $KohaDates %]
114
                    [% hold.reservedate | $KohaDates %]
115
                [% END %]
115
                [% END %]
116
            </td>
116
            </td>
117
            <td>
117
            <td>
Lines 119-144 Link Here
119
            </td>
119
            </td>
120
            <td>
120
            <td>
121
                [%- IF ( hold.found ) -%]
121
                [%- IF ( hold.found ) -%]
122
                    <input type="hidden" name="pickup" value="[% hold.wbrcode | html %]" />
122
                    <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
123
                    [%- IF ( hold.atdestination ) -%]
123
                    [%- IF ( hold.found == 'W' && hold.item.holdingbranch == hold.branchcode ) -%]
124
                            Item waiting at <strong> [% hold.wbrname | html %]</strong>[% IF hold.desk_name %], [% hold.desk_name | html %],[% END %] since [% hold.waiting_date | $KohaDates %]
124
                            Item waiting at <strong> [% hold.branch.branchname | html %]</strong>[% IF hold.desk %], [% hold.desk.desk_name | html %],[% END %] since [% hold.waiting_date | $KohaDates %]
125
                    [%- ELSIF (hold.intransit) -%]
125
                    [%- ELSIF (hold.found == 'T') -%]
126
                        Item being transferred to <strong> [% hold.wbrname | html %]</strong>
126
                        Item being transferred to <strong> [% hold.branch.branchname | html %]</strong>
127
                    [%- ELSIF (hold.inprocessing) -%]
127
                    [%- ELSIF (hold.found == 'P') -%]
128
                        Item being processed at <strong> [% hold.wbrname | html %]</strong>
128
                        Item being processed at <strong> [% hold.branch.branchname | html %]</strong>
129
                    [%- ELSE -%]
129
                    [%- ELSE -%]
130
                        Hold expected at <strong>[% hold.wbrname | html %]</strong>, please checkin to verify status
130
                        Hold expected at <strong>[% hold.branch.branchname | html %]</strong>, please checkin to verify status
131
                    [%- END -%]
131
                    [%- END -%]
132
                [%- ELSE -%]
132
                [%- ELSE -%]
133
                    [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%]
133
                    [%- IF Koha.Preference('IndependentBranches') && Branches.all().size == 1 -%]
134
                        [% Branches.GetName(hold.branchcode) | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
134
                        [% hold.branch.branchname | html %] <input type="hidden" name="pickup" value="[% hold.branchcode | html %]" />
135
                    [%- ELSE -%]
135
                    [%- ELSE -%]
136
                        <select class="pickup_location_dropdown"
136
                        <select class="pickup_location_dropdown"
137
                                data-selected="[% hold.branchcode | html %]"
137
                                data-selected="[% hold.branchcode | html %]"
138
                                data-hold-id="[% hold.reserve_id | html %]"
138
                                data-hold-id="[% hold.reserve_id | html %]"
139
                                data-pickup-location-source="hold"
139
                                data-pickup-location-source="hold"
140
                                name="pickup">
140
                                name="pickup">
141
                            <option selected="selected" value="[% hold.branchcode | html %]">[% Branches.GetName(hold.branchcode) | html %]</option>
141
                            <option selected="selected" value="[% hold.branchcode | html %]">[% hold.branch.branchname | html %]</option>
142
                            <option value="" disabled="disabled" class="loading">Loading...</option>
142
                            <option value="" disabled="disabled" class="loading">Loading...</option>
143
                        </select>
143
                        </select>
144
                        <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/>
144
                        <img class="loading_[% hold.reserve_id | html %]" src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" style="display:none;"/>
Lines 148-155 Link Here
148
            <td>
148
            <td>
149
                [%- IF ( hold.found ) -%]
149
                [%- IF ( hold.found ) -%]
150
                    <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
150
                    <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
151
                        [%- IF ( hold.barcodenumber ) -%]
151
                        [%- IF ( hold.item.barcode ) -%]
152
                            [%- hold.barcodenumber | html -%]
152
                            [%- hold.item.barcode | html -%]
153
                            <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
153
                            <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
154
                        [%- ELSE -%]
154
                        [%- ELSE -%]
155
                            No barcode
155
                            No barcode
Lines 160-167 Link Here
160
                        <em>
160
                        <em>
161
                            Only item
161
                            Only item
162
                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
162
                            <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]#item[% hold.itemnumber | uri %]">
163
                                [%- IF ( hold.barcodenumber ) -%]
163
                                [%- IF ( hold.item.barcode ) -%]
164
                                    [%- hold.barcodenumber | html -%]
164
                                    [%- hold.item.barcode | html -%]
165
                                    <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
165
                                    <input type="hidden" name="itemnumber" value="[% hold.itemnumber | html %]" />
166
                                [%- ELSE -%]
166
                                [%- ELSE -%]
167
                                    No barcode
167
                                    No barcode
Lines 185-191 Link Here
185
            [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
185
            [%- IF ( CAN_user_reserveforothers_modify_holds_priority ) -%]
186
            [%- UNLESS hold.found -%]
186
            [%- UNLESS hold.found -%]
187
                    <td>
187
                    <td>
188
                        <a title="Toggle lowest priority" href="request.pl?action=setLowestPriority&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
188
                        <a title="Toggle lowest priority" href="request.pl?action=setLowestPriority&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
189
                            [%- IF ( hold.lowestPriority ) -%]
189
                            [%- IF ( hold.lowestPriority ) -%]
190
                                <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Unset lowest priority" />
190
                                <img src="[% interface | html %]/[% theme | html %]/img/go-bottom.png" alt="Unset lowest priority" />
191
                            [%- ELSE -%]
191
                            [%- ELSE -%]
Lines 198-204 Link Here
198
        [%- END -%]
198
        [%- END -%]
199
            [%- END -%]
199
            [%- END -%]
200
            <td>
200
            <td>
201
                <a class="btn btn-default btn-xs cancel-hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.date | html %]">
201
                <a class="btn btn-default btn-xs cancel-hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&amp;borrowernumber=[% hold.borrowernumber | html %]&amp;biblionumber=[% hold.biblionumber | html %]&amp;reserve_id=[% hold.reserve_id | html %]&amp;date=[% hold.reservedate | html %]">
202
                    <i class="fa fa-trash" aria-hidden="true"></i> Cancel
202
                    <i class="fa fa-trash" aria-hidden="true"></i> Cancel
203
                </a>
203
                </a>
204
            </td>
204
            </td>
Lines 222-231 Link Here
222
                    [%- END -%]
222
                    [%- END -%]
223
                [%- END # IF SuspendHoldsIntranet -%]
223
                [%- END # IF SuspendHoldsIntranet -%]
224
                [%- IF ( hold.found ) -%]
224
                [%- IF ( hold.found ) -%]
225
                    <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | uri %]&amp;last_priority=[% last_priority | uri %]&amp;prev_priority=0&amp;next_priority=1&amp;borrowernumber=[% hold.borrowernumber | uri %]&amp;biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]&amp;reserve_id=[% hold.reserve_id | uri %]&amp;date=[% hold.date | uri %]'">
225
                    <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.found == 'T' %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&amp;where=down&amp;first_priority=[% first_priority | uri %]&amp;last_priority=[% last_priority | uri %]&amp;prev_priority=0&amp;next_priority=1&amp;borrowernumber=[% hold.borrowernumber | uri %]&amp;biblionumber=[% hold.biblionumber | uri %]&amp;itemnumber=[% hold.itemnumber | uri %]&amp;reserve_id=[% hold.reserve_id | uri %]&amp;date=[% hold.reservedate | uri %]'">
226
                [%- END -%]
226
                [%- END -%]
227
            </td>
227
            </td>
228
            [% IF ( hold.intransit || hold.atdestination ) %]
228
            [% IF ( hold.found == 'T' || ( hold.found == 'W' && hold.item.holdingbranch == hold.branchcode ) ) %]
229
                <td><input class="printholdslip" type="button" name="printholdslip" value="Print slip" data-reserve_id=[% hold.reserve_id | html %]></td>
229
                <td><input class="printholdslip" type="button" name="printholdslip" value="Print slip" data-reserve_id=[% hold.reserve_id | html %]></td>
230
            [% ELSE %]
230
            [% ELSE %]
231
                <td></td>
231
                <td></td>
(-)a/reserve/request.pl (-53 / +3 lines)
Lines 598-655 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
598
        $template->param( always_show_holds => $always_show_holds );
598
        $template->param( always_show_holds => $always_show_holds );
599
        my $show_holds_now = $input->param('show_holds_now');
599
        my $show_holds_now = $input->param('show_holds_now');
600
        unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
600
        unless( (defined $always_show_holds && $always_show_holds eq 'DONT') && !$show_holds_now ){
601
            my @reserves = Koha::Holds->search( { biblionumber => $biblionumber }, { order_by => 'priority' } )->as_list;
601
            @reserveloop = Koha::Holds->search( { 'me.biblionumber' => $biblionumber }, {
602
            foreach my $res (
602
                prefetch => ['item','patron','branch','desk'],
603
                sort {
603
                order_by => [ {-desc => 'found'},'priority'] } )->as_list;
604
                    my $a_found = $a->found() || '';
605
                    my $b_found = $a->found() || '';
606
                    $a_found cmp $b_found;
607
                } @reserves
608
              )
609
            {
610
                my %reserve;
611
                if ( $res->is_found() ) {
612
                    $reserve{'holdingbranch'} = $res->item()->holdingbranch();
613
                    $reserve{'biblionumber'}  = $res->item()->biblionumber();
614
                    $reserve{'barcodenumber'} = $res->item()->barcode();
615
                    $reserve{'wbrcode'}       = $res->branchcode();
616
                    $reserve{'itemnumber'}    = $res->itemnumber();
617
                    $reserve{'wbrname'}       = $res->branch()->branchname();
618
                    $reserve{'atdestination'} = $res->is_at_destination();
619
                    $reserve{'desk_name'}     = ( $res->desk() ) ? $res->desk()->desk_name() : '' ;
620
                    $reserve{'found'}     = $res->is_found();
621
                    $reserve{'inprocessing'} = $res->is_in_processing();
622
                    $reserve{'intransit'} = $res->is_in_transit();
623
                }
624
                elsif ( $res->priority() > 0 ) {
625
                    if ( my $item = $res->item() )  {
626
                        $reserve{'itemnumber'}      = $item->id();
627
                        $reserve{'barcodenumber'}   = $item->barcode();
628
                        $reserve{'item_level_hold'} = 1;
629
                    }
630
                }
631
632
                $reserve{'expirationdate'} = $res->expirationdate;
633
                $reserve{'date'}           = $res->reservedate;
634
                $reserve{'borrowernumber'} = $res->borrowernumber();
635
                $reserve{'biblionumber'}   = $res->biblionumber();
636
                $reserve{'patron'}         = $res->borrower;
637
                $reserve{'notes'}          = $res->reservenotes();
638
                $reserve{'waiting_date'}   = $res->waitingdate();
639
                $reserve{'ccode'}          = $res->item() ? $res->item()->ccode() : undef;
640
                $reserve{'barcode'}        = $res->item() ? $res->item()->barcode() : undef;
641
                $reserve{'priority'}       = $res->priority();
642
                $reserve{'lowestPriority'} = $res->lowestPriority();
643
                $reserve{'suspend'}        = $res->suspend();
644
                $reserve{'suspend_until'}  = $res->suspend_until();
645
                $reserve{'reserve_id'}     = $res->reserve_id();
646
                $reserve{itemtype}         = $res->itemtype();
647
                $reserve{branchcode}       = $res->branchcode();
648
                $reserve{non_priority}     = $res->non_priority();
649
                $reserve{object}           = $res;
650
651
                push( @reserveloop, \%reserve );
652
            }
653
        }
604
        }
654
605
655
        # get the time for the form name...
606
        # get the time for the form name...
656
- 

Return to bug 30269