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

(-)a/C4/Circulation.pm (+1 lines)
Lines 2055-2060 sub AddReturn { Link Here
2055
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
2055
    # if we don't have a reserve with the status W, we launch the Checkreserves routine
2056
    my ($resfound, $resrec);
2056
    my ($resfound, $resrec);
2057
    my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds
2057
    my $lookahead= C4::Context->preference('ConfirmFutureHolds'); #number of days to look for future holds
2058
2058
    ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->itemnumber, undef, $lookahead ) unless ( $item->withdrawn );
2059
    ($resfound, $resrec, undef) = C4::Reserves::CheckReserves( $item->itemnumber, undef, $lookahead ) unless ( $item->withdrawn );
2059
    if ($resfound) {
2060
    if ($resfound) {
2060
        $resrec->{'ResFound'} = $resfound;
2061
        $resrec->{'ResFound'} = $resfound;
(-)a/C4/Reserves.pm (-4 / +5 lines)
Lines 186-192 sub AddReserve { Link Here
186
    }
186
    }
187
    my ($waitingdate, $lastpickupdate);
187
    my ($waitingdate, $lastpickupdate);
188
188
189
    my $item = C4::Items::GetItem( $checkitem );
189
    my $item = Koha::Items->find( $checkitem ); #FIXME Prevent bad calls
190
    # If the reserv had the waiting status, we had the value of the resdate
190
    # If the reserv had the waiting status, we had the value of the resdate
191
    if ( $found eq 'W' ) {
191
    if ( $found eq 'W' ) {
192
        $waitingdate = $resdate;
192
        $waitingdate = $resdate;
Lines 897-904 sub CheckReserves { Link Here
897
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
897
                    my $branchitemrule = C4::Circulation::GetBranchItemRule($branch,$item->effective_itemtype);
898
                    next if ($branchitemrule->{'holdallowed'} == 0);
898
                    next if ($branchitemrule->{'holdallowed'} == 0);
899
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
899
                    next if (($branchitemrule->{'holdallowed'} == 1) && ($branch ne $patron->branchcode));
900
                    my $hold_fulfillment_policy = $branchitemrule->{hold_fulfillment_policy};
900
                    my $hold_fulfillment_policy = $branchitemrule->{'hold_fulfillment_policy'};
901
                    next if ( ($branchitemrule->{hold_fulfillment_policy} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) );
901
902
                    next if ( ($branchitemrule->{'hold_fulfillment_policy'} ne 'any') && ($res->{branchcode} ne $item->$hold_fulfillment_policy) );
902
                    next unless $item->can_be_transferred( { to => scalar Koha::Libraries->find( $res->{branchcode} ) } );
903
                    next unless $item->can_be_transferred( { to => scalar Koha::Libraries->find( $res->{branchcode} ) } );
903
                    $priority = $res->{'priority'};
904
                    $priority = $res->{'priority'};
904
                    $highest  = $res;
905
                    $highest  = $res;
Lines 1198-1204 sub ModReserveAffect { Link Here
1198
    $hold->itemnumber($itemnumber);
1199
    $hold->itemnumber($itemnumber);
1199
    $hold->set_waiting($transferToDo);
1200
    $hold->set_waiting($transferToDo);
1200
1201
1201
    my $item = C4::Items::GetItem( $itemnumber );
1202
    my $item = Koha::Items->find( $itemnumber );
1202
    my $borrower = Koha::Patrons->find( $borrowernumber );
1203
    my $borrower = Koha::Patrons->find( $borrowernumber );
1203
    $borrower = $borrower->unblessed;
1204
    $borrower = $borrower->unblessed;
1204
    my $lastpickupdate = GetLastPickupDate( $hold, $item, $borrower );
1205
    my $lastpickupdate = GetLastPickupDate( $hold, $item, $borrower );
(-)a/circ/waitingreserves.pl (-45 / +5 lines)
Lines 89-149 my $holds = Koha::Holds->waiting->search({ priority => 0, ( $all_branches ? () : Link Here
89
# get reserves for the branch we are logged into, or for all branches
89
# get reserves for the branch we are logged into, or for all branches
90
90
91
my $today = dt_from_string;
91
my $today = dt_from_string;
92
my $max_pickup_delay = C4::Context->preference('ReservesMaxPickUpDelay');
93
92
94
while ( my $hold = $holds->next ) {
93
while ( my $hold = $holds->next ) {
95
    next unless ($hold->waitingdate && $hold->waitingdate ne '0000-00-00');
94
    next unless ($hold->waitingdate && $hold->waitingdate ne '0000-00-00');
96
    my $item = $hold->item;
95
    if ( $hold->waitingdate ) {
97
    my $patron = $hold->borrower;
96
        my $lastpickupdate = dt_from_string($hold->lastpickupdate);
98
    my $biblio = $item->biblio;
99
    my $holdingbranch = $item->holdingbranch;
100
    my $homebranch = $item->homebranch;
101
    my %getreserv = (
102
        title             => $biblio->title,
103
        itemnumber        => $item->itemnumber,
104
        waitingdate       => $hold->waitingdate,
105
        reservedate       => $hold->reservedate,
106
        borrowernumber       => $patron->borrowernumber,
107
        biblionumber      => $biblio->biblionumber,
108
        barcode           => $item->barcode,
109
        homebranch        => $homebranch,
110
        holdingbranch     => $item->holdingbranch,
111
        itemcallnumber    => $item->itemcallnumber,
112
        enumchron         => $item->enumchron,
113
        copynumber        => $item->copynumber,
114
        borrowername      => $patron->surname, # FIXME Let's send $patron to the template
115
        borrowerfirstname => $patron->firstname,
116
        borrowerphone     => $patron->phone,
117
        lastpickupdate    => $hold->lastpickupdate,
118
    );
119
120
    my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
121
    $getreserv{'itemtype'}       = $itemtype->description; # FIXME Should not it be translated_description?
122
    $getreserv{'subtitle'}       = GetRecordValue(
123
        'subtitle',
124
        GetMarcBiblio({ biblionumber => $biblio->biblionumber }),
125
        $biblio->frameworkcode);
126
    if ( $homebranch ne $holdingbranch ) {
127
        $getreserv{'dotransfer'} = 1;
128
    }
129
130
    $getreserv{patron} = $patron;
131
    warn $getreserv{'waitingdate'};
132
    warn $getreserv{'lastpickupdate'};
133
    if ( $getreserv{'waitingdate'} ) {
134
        my $lastpickupdate = dt_from_string($getreserv{'lastpickupdate'});
135
        if ( DateTime->compare( $today, $lastpickupdate ) == 1 ) {
97
        if ( DateTime->compare( $today, $lastpickupdate ) == 1 ) {
136
            if ($cancelall) {
98
            if ($cancelall) {
137
                my $res = cancel( $item->itemnumber, $patron->borrowernumber, $item->holdingbranch, $homebranch, !$transfer_when_cancel_all );
99
                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;
100
                push @cancel_result, $res if $res;
139
                next;
101
                next;
140
            } else {
102
            } else {
141
                push @overloop,   \%getreserv;
103
                push @over_loop, $hold;
142
                $overcount++;
143
            }
104
            }
144
        }else{
105
        }else{
145
            push @reservloop, \%getreserv;
106
            push @reserve_loop, $hold;
146
            $reservcount++;
147
        }
107
        }
148
    }
108
    }
149
}
109
}
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc (-2 / +1 lines)
Lines 107-113 Link Here
107
                                    [% IF ( HOLD.found ) %]
107
                                    [% IF ( HOLD.found ) %]
108
                                        Item waiting at <b> [% HOLD.branch.branchname | html %]</b>
108
                                        Item waiting at <b> [% HOLD.branch.branchname | html %]</b>
109
                                        [% IF ( HOLD.waitingdate ) %]
109
                                        [% IF ( HOLD.waitingdate ) %]
110
                                            since [% HOLD.waitingdate | $KohaDates %] until [% RESERVE.lastpickupdate | $KohaDates %]
110
                                            since [% HOLD.waitingdate | $KohaDates %] until [% HOLD.lastpickupdate | $KohaDates %]
111
                                        [% END %]
111
                                        [% END %]
112
                                        <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
112
                                        <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
113
                                    [% ELSE %]
113
                                    [% ELSE %]
114
- 

Return to bug 8367