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

(-)a/circ/waitingreserves.pl (-49 / +9 lines)
Lines 81-149 if ( C4::Context->preference('IndependentBranches') ) { Link Here
81
}
81
}
82
$template->param( all_branches => 1 ) if $all_branches;
82
$template->param( all_branches => 1 ) if $all_branches;
83
83
84
my (@reservloop, @overloop);
84
my (@reserve_loop, @over_loop);
85
my ($reservcount, $overcount);
86
# FIXME - Is priority => 0 useful? If yes it must be moved to waiting, otherwise we need to remove it from here.
85
# FIXME - Is priority => 0 useful? If yes it must be moved to waiting, otherwise we need to remove it from here.
87
my $holds = Koha::Holds->waiting->search({ priority => 0, ( $all_branches ? () : ( branchcode => $default ) ) }, { order_by => ['waitingdate'] });
86
my $holds = Koha::Holds->waiting->search({ priority => 0, ( $all_branches ? () : ( branchcode => $default ) ) }, { order_by => ['waitingdate'] });
87
88
# get reserves for the branch we are logged into, or for all branches
88
# get reserves for the branch we are logged into, or for all branches
89
89
90
my $today = Date_to_Days(&Today);
90
my $today = Date_to_Days(&Today);
91
my $max_pickup_delay = C4::Context->preference('ReservesMaxPickUpDelay');
92
91
93
while ( my $hold = $holds->next ) {
92
while ( my $hold = $holds->next ) {
94
    next unless ($hold->waitingdate && $hold->waitingdate ne '0000-00-00');
93
    next unless ($hold->waitingdate && $hold->waitingdate ne '0000-00-00');
95
94
96
    my $item = $hold->item;
97
    my $patron = $hold->borrower;
98
    my $biblio = $item->biblio;
99
    my $holdingbranch = $item->holdingbranch;
100
    my $homebranch = $item->homebranch;
101
102
    my %getreserv = (
103
        title             => $biblio->title,
104
        itemnumber        => $item->itemnumber,
105
        waitingdate       => $hold->waitingdate,
106
        reservedate       => $hold->reservedate,
107
        borrowernum       => $patron->borrowernumber,
108
        biblionumber      => $biblio->biblionumber,
109
        barcode           => $item->barcode,
110
        homebranch        => $homebranch,
111
        holdingbranch     => $item->holdingbranch,
112
        itemcallnumber    => $item->itemcallnumber,
113
        enumchron         => $item->enumchron,
114
        copynumber        => $item->copynumber,
115
        borrowername      => $patron->surname, # FIXME Let's send $patron to the template
116
        borrowerfirstname => $patron->firstname,
117
        borrowerphone     => $patron->phone,
118
    );
119
120
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
121
    my ( $expire_year, $expire_month, $expire_day ) = split (/-/, $hold->expirationdate);
95
    my ( $expire_year, $expire_month, $expire_day ) = split (/-/, $hold->expirationdate);
122
    my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day );
96
    my $calcDate = Date_to_Days( $expire_year, $expire_month, $expire_day );
123
97
124
    $getreserv{'itemtype'}       = $itemtype->description; # FIXME Should not it be translated_description?
125
    $getreserv{'subtitle'}       = GetRecordValue(
126
        'subtitle',
127
        GetMarcBiblio({ biblionumber => $biblio->biblionumber }),
128
        $biblio->frameworkcode);
129
    if ( $homebranch ne $holdingbranch ) {
130
        $getreserv{'dotransfer'} = 1;
131
    }
132
133
    $getreserv{patron} = $patron;
134
135
    if ($today > $calcDate) {
98
    if ($today > $calcDate) {
136
        if ($cancelall) {
99
        if ($cancelall) {
137
            my $res = cancel( $item->itemnumber, $patron->borrowernumber, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
100
            my $res = cancel( $hold->item->itemnumber, $hold->borrowernumber, $hold->item->holdingbranch, $hold->item->homebranch, !$transfer_when_cancel_all );
138
            push @cancel_result, $res if $res;
101
            push @cancel_result, $res if $res;
139
            next;
102
            next;
140
        } else {
103
        } else {
141
            push @overloop,   \%getreserv;
104
            push @over_loop, $hold;
142
            $overcount++;
143
        }
105
        }
144
    }else{
106
    }else{
145
        push @reservloop, \%getreserv;
107
        push @reserve_loop, $hold;
146
        $reservcount++;
147
    }
108
    }
148
    
109
    
149
}
110
}
Lines 151-162 while ( my $hold = $holds->next ) { Link Here
151
$template->param(cancel_result => \@cancel_result) if @cancel_result;
112
$template->param(cancel_result => \@cancel_result) if @cancel_result;
152
113
153
$template->param(
114
$template->param(
154
    reserveloop => \@reservloop,
115
    reserveloop => \@reserve_loop,
155
    reservecount => $reservcount,
116
    reservecount => scalar @reserve_loop,
156
    overloop    => \@overloop,
117
    overloop    => \@over_loop,
157
    overcount   => $overcount,
118
    overcount   => scalar @over_loop,
158
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
119
    show_date   => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
159
    ReservesMaxPickUpDelay => $max_pickup_delay,
160
    tab => $tab,
120
    tab => $tab,
161
);
121
);
162
122
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/waiting_holds.inc (+51 lines)
Line 0 Link Here
1
[% USE ItemTypes %]
2
<table id="[% table_name %]">
3
<thead><tr>
4
    <th class="title-string">Waiting since</th>
5
    <th class="title-string">Date hold placed</th>
6
    <th class="anti-the">Title</th>
7
    <th>Patron</th>
8
    <th>Home branch</th>
9
    <th>Current location</th>
10
    <th>Call number</th>
11
    <th>Copy number</th>
12
    <th>Enumeration</th>
13
    <th>Action</th>
14
</tr></thead>
15
<tbody>[% FOREACH reserveloo IN reserveloop %]
16
<tr>
17
    <td><span title="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
18
    <td><span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td>
19
    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
20
        [% reserveloo.biblio.title | html %] [% FOREACH subtitl IN reserveloo.biblio.subtitles %] [% subtitl.subfield | html %][% END %]
21
        </a>
22
            [% UNLESS ( item_level_itypes ) %][% IF ( ItemTypes.GetDescription(reserveloo.item.effective_itemtype) ) %]&nbsp; (<b>[% ItemTypes.GetDescription(reserveloo.item.effective_itemtype) | html %]</b>)[% END %][% END %]
23
            <br />Barcode: [% reserveloo.item.barcode | html %]
24
    </td>
25
    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.borrower.borrowernumber | uri %]">[% reserveloo.borrower.surname | html %], [% reserveloo.borrower.firstname | html %]</a>
26
        [% IF ( reserveloo.borrower.phone ) %]<br />[% reserveloo.borrower.phone | html %][% END %]
27
        [% IF ( reserveloo.borrower.first_valid_email_address ) %]<br /><a href="mailto:[% reserveloo.borrower.first_valid_email_address | uri %]?subject=Hold waiting: [% reserveloo.biblio.title | uri %]">
28
        [% reserveloo.borrower.first_valid_email_address | html %]</a>[% END %]
29
    </td>
30
    <td>[% Branches.GetName( reserveloo.item.homebranch ) | html %]</td>
31
    <td>[% Branches.GetName( reserveloo.item.holdingbranch ) | html %]</td>
32
    <td>[% reserveloo.item.itemcallnumber | html %]</td>
33
    <td>[% reserveloo.item.copynumber | html %]</td>
34
    <td>[% reserveloo.item.enumchron | html %]</td>
35
    <td>
36
        <form name="cancelReserve" action="waitingreserves.pl" method="post">
37
            <input type="hidden" name="borrowernumber" value="[% reserveloo.borrower.borrowernumber | html %]" />
38
            <input type="hidden" name="itemnumber" value="[% reserveloo.item.itemnumber | html %]" />
39
            <input type="hidden" name="fbr" value="[% reserveloo.item.holdingbranch | html %]" />
40
            <input type="hidden" name="tbr" value="[% reserveloo.item.homebranch | html %]" />
41
            <input type="hidden" name="tab" value="holdswaiting">
42
            [% IF ( reserveloo.item.homebranch != reserveloo.item.holdingbranch ) %]
43
            <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.item.homebranch ) | html %]" />
44
            [% ELSE %]
45
            <input type="submit" value="Cancel hold" />
46
            [% END %]
47
       </form>
48
    </td>
49
</tr>
50
[% END %]</tbody>
51
</table>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-101 / +4 lines)
Lines 63-124 Link Here
63
                <li><a href="#holdswaiting">Holds waiting: [% reservecount | html %]</a></li>
63
                <li><a href="#holdswaiting">Holds waiting: [% reservecount | html %]</a></li>
64
                <li>
64
                <li>
65
                    <a href="#holdsover">
65
                    <a href="#holdsover">
66
                        Holds waiting over [% ReservesMaxPickUpDelay | html %] days: [% overcount | html %]
66
                        Holds waiting over [% Koha.Preference('ReservesMaxPickUpDelay') | html %] days: [% overcount | html %]
67
                    </a>
67
                    </a>
68
                </li>
68
                </li>
69
            </ul>
69
            </ul>
70
            <div id="holdswaiting">
70
            <div id="holdswaiting">
71
            [% IF ( reserveloop ) %]
71
        [% IF ( reserveloop ) %]
72
               <table id="holdst">
72
            [% INCLUDE waiting_holds.inc table_name='holdst' reserveloop=reserveloop %]
73
               <thead><tr>
74
                    <th class="title-string">Waiting since</th>
75
                    <th class="title-string">Date hold placed</th>
76
                    <th class="anti-the">Title</th>
77
                    <th>Patron</th>
78
                    <th>Home branch</th>
79
                    <th>Current location</th>
80
                    <th>Call number</th>
81
                    <th>Copy number</th>
82
                    <th>Enumeration</th>
83
                    <th>Action</th>
84
               </tr></thead>
85
               <tbody>[% FOREACH reserveloo IN reserveloop %]
86
                <tr>
87
                    <td><span title="[% reserveloo.waitingdate | html %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
88
                    <td><span title="[% reserveloo.reservedate | html %]">[% reserveloo.reservedate | $KohaDates %]</span></td>
89
                    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
90
                        [% reserveloo.title | html %] [% FOREACH subtitl IN reserveloo.subtitle %] [% subtitl.subfield | html %][% END %]
91
                        </a>
92
                            [% UNLESS ( item_level_itypes ) %][% IF ( reserveloo.itemtype ) %]&nbsp; (<b>[% reserveloo.itemtype | html %]</b>)[% END %][% END %]
93
                            <br />Barcode: [% reserveloo.barcode | html %]
94
                    </td>
95
                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% reserveloo.patron.borrowernumber | uri %]">[% reserveloo.patron.surname | html %], [% reserveloo.patron.firstname | html %]</a>
96
                        [% IF ( reserveloo.patron.phone ) %]<br />[% reserveloo.patron.phone | html %][% END %]
97
                        [% IF ( reserveloo.patron.first_valid_email_address ) %]<br /><a href="mailto:[% reserveloo.patron.first_valid_email_address | uri %]?subject=Hold waiting: [% reserveloo.title | uri %]">
98
                        [% reserveloo.patron.first_valid_email_address | html %]</a>[% END %]
99
                    </td>
100
                    <td>[% Branches.GetName( reserveloo.homebranch ) | html %]</td>
101
                    <td>[% Branches.GetName( reserveloo.holdingbranch ) | html %]</td>
102
                    <td>[% reserveloo.itemcallnumber | html %]</td>
103
                    <td>[% reserveloo.copynumber | html %]</td>
104
                    <td>[% reserveloo.enumchron | html %]</td>
105
                    <td>
106
                        <form name="cancelReserve" action="waitingreserves.pl" method="post">
107
                            <input type="hidden" name="borrowernumber" value="[% reserveloo.borrowernum | html %]" />
108
                            <input type="hidden" name="itemnumber" value="[% reserveloo.itemnumber | html %]" />
109
                            <input type="hidden" name="fbr" value="[% reserveloo.holdingbranch | html %]" />
110
                            <input type="hidden" name="tbr" value="[% reserveloo.homebranch | html %]" />
111
                            <input type="hidden" name="tab" value="holdswaiting">
112
                            [% IF ( reserveloo.dotransfer ) %]
113
                            <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) | html %]" />
114
                            [% ELSE %]
115
                            <input type="submit" value="Cancel hold" />
116
                            [% END %]
117
                       </form>
118
                    </td>
119
                </tr>
120
                [% END %]</tbody>
121
        </table>
122
        [% ELSE %]
73
        [% ELSE %]
123
            <div class="dialog message">No holds found.</div>
74
            <div class="dialog message">No holds found.</div>
124
        [% END %]
75
        [% END %]
Lines 140-193 Link Here
140
                    Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds sypref)
91
                    Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds sypref)
141
               [% END %]
92
               [% END %]
142
93
143
               <table id="holdso">
94
               [% INCLUDE waiting_holds.inc table_name='holdso' reserveloop=overloop %]
144
               <thead><tr>
145
                    <th class="title-string">Waiting since</th>
146
                    <th class="title-string">Date hold placed</th>
147
                    <th class="anti-the">Title</th>
148
                    <th>Patron</th>
149
                    <th>Home branch</th>
150
                    <th>Current location</th>
151
                    <th>Call number</th>
152
                    <th>Copy number</th>
153
                    <th>Enumeration</th>
154
                    <th>Action</th>
155
               </tr></thead>
156
               <tbody>[% FOREACH overloo IN overloop %]
157
                    <tr>
158
                        <td><span title="[% overloo.waitingdate | html %]">[% overloo.waitingdate | $KohaDates %]</span></td>
159
                        <td><span title="[% overloo.reservedate | html %]">[% overloo.reservedate | $KohaDates %]</span></td>
160
                        <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title | html %]
161
                            [% FOREACH subtitl IN overloo.subtitle %] [% subtitl.subfield | html %][% END %]
162
                        </a>
163
                            [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]&nbsp; (<b>[% overloo.itemtype | html %]</b>)[% END %][% END %]
164
                        <br />Barcode: [% overloo.barcode | html %]
165
                    </td>
166
                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% overloo.patron.borrowernumber | uri %]">[% overloo.patron.surname | html %], [% overloo.patron.firstname | html %]</a><br />[% overloo.patron.phone | html %]<br />
167
                        [% IF ( overloo.patron.first_valid_email_address ) %]<a href="mailto:[% overloo.patron.first_valid_email_address | uri %]?subject=Reservation: [% overloo.title |url %]">
168
        [% overloo.patron.first_valid_email_address | html %]</a>[% END %]
169
                    </td>
170
                    <td>[% Branches.GetName( overloo.homebranch ) | html %]</td>
171
                    <td>[% Branches.GetName( overloo.holdingbranch ) | html %]</td>
172
                    <td>[% overloo.itemcallnumber | html %]</td>
173
                    <td>[% overloo.copynumber | html %]</td>
174
                    <td>[% overloo.enumchron | html %]</td>
175
                    <td><form name="cancelReserve" action="waitingreserves.pl" method="post">
176
                            <input type="hidden" name="borrowernumber" value="[% overloo.borrowernum | html %]" />
177
                            <input type="hidden" name="itemnumber" value="[% overloo.itemnumber | html %]" />
178
                            <input type="hidden" name="fbr" value="[% overloo.holdingbranch | html %]" />
179
                            <input type="hidden" name="tbr" value="[% overloo.homebranch | html %]" />
180
                            <input type="hidden" name="tab" value="holdsover">
181
                            [% IF ( overloo.dotransfer ) %]
182
                            <input type="submit" value="Cancel hold and return to : [% Branches.GetName( overloo.homebranch ) | html %]" />
183
                            [% ELSE %]
184
                            <input type="submit" value="Cancel hold" />
185
                            [% END %]
186
                       </form>
187
                    </td>
188
                </tr>
189
                [% END %]</tbody>
190
        </table>
191
        [% ELSE %]
95
        [% ELSE %]
192
            <div class="dialog message">No holds found.</div>
96
            <div class="dialog message">No holds found.</div>
193
                [% END %]
97
                [% END %]
194
- 

Return to bug 21628