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

(-)a/circ/waitingreserves.pl (-12 / +7 lines)
Lines 31-41 use C4::Members; Link Here
31
use C4::Biblio;
31
use C4::Biblio;
32
use C4::Items;
32
use C4::Items;
33
33
34
use Date::Calc qw(
34
use DateTime;
35
  Today
35
36
  Add_Delta_Days
37
  Date_to_Days
38
);
39
use C4::Reserves;
36
use C4::Reserves;
40
use C4::Koha;
37
use C4::Koha;
41
38
Lines 86-92 my ($reservcount, $overcount); Link Here
86
my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default);
83
my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default);
87
# get reserves for the branch we are logged into, or for all branches
84
# get reserves for the branch we are logged into, or for all branches
88
85
89
my $today = Date_to_Days(&Today);
86
my $today = DateTime->now();
90
foreach my $num (@getreserves) {
87
foreach my $num (@getreserves) {
91
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
88
    next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00');
92
89
Lines 106-118 foreach my $num (@getreserves) { Link Here
106
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
103
    my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'});
107
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
104
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
108
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
105
    $getreserv{'waitingdate'} = $num->{'waitingdate'};
109
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
106
110
    ( $waiting_year, $waiting_month, $waiting_day ) =
107
    my $lastpickupdate = C4::Reserves::_reserve_last_pickup_date( $num );
111
      Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day,
112
        C4::Context->preference('ReservesMaxPickUpDelay'));
113
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
114
108
115
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
109
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
110
    $getreserv{'lastpickupdate'} = C4::Dates->new($lastpickupdate->ymd(), 'iso')->output();
116
    $getreserv{'title'}          = $gettitle->{'title'};
111
    $getreserv{'title'}          = $gettitle->{'title'};
117
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
112
    $getreserv{'biblionumber'}   = $gettitle->{'biblionumber'};
118
    $getreserv{'barcode'}        = $gettitle->{'barcode'};
113
    $getreserv{'barcode'}        = $gettitle->{'barcode'};
Lines 132-138 foreach my $num (@getreserves) { Link Here
132
        $getreserv{'borrowermail'}  = $getborrower->{'emailaddress'};
127
        $getreserv{'borrowermail'}  = $getborrower->{'emailaddress'};
133
    }
128
    }
134
 
129
 
135
    if ($today > $calcDate) {
130
    if (   DateTime->compare( $today,$lastpickupdate ) == 1   ) { #If today is bigger than lastpickupdate, pickup time has expired
136
        if ($cancelall) {
131
        if ($cancelall) {
137
            my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
132
            my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
138
            push @cancel_result, $res if $res;
133
            push @cancel_result, $res if $res;
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js (+1 lines)
Lines 10-15 $(document).ready(function() { Link Here
10
                    {
10
                    {
11
                        "mDataProp": "reservedate_formatted"
11
                        "mDataProp": "reservedate_formatted"
12
                    },
12
                    },
13
                    { "mDataProp": "lastpickupdate_formatted" },
13
                    {
14
                    {
14
                        "mDataProp": function ( oObj ) {
15
                        "mDataProp": function ( oObj ) {
15
                            title = "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber="
16
                            title = "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber="
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+1 lines)
Lines 771-776 No patron matched <span class="ex">[% message %]</span> Link Here
771
            <thead>
771
            <thead>
772
                <tr>
772
                <tr>
773
                    <th>Hold date</th>
773
                    <th>Hold date</th>
774
                    <th>Last pickup date</th>
774
                    <th>Title</th>
775
                    <th>Title</th>
775
                    <th>Call number</th>
776
                    <th>Call number</th>
776
                    <th>Barcode</th>
777
                    <th>Barcode</th>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (+4 lines)
Lines 78-83 Link Here
78
               <table id="holdst">
78
               <table id="holdst">
79
               <thead><tr>
79
               <thead><tr>
80
                    <th class="title-string">Available since</th>
80
                    <th class="title-string">Available since</th>
81
                    <th>Last pickup date</th>
81
                    <th class="anti-the">Title</th>
82
                    <th class="anti-the">Title</th>
82
                    <th>Patron</th>
83
                    <th>Patron</th>
83
                    <th>Location</th>
84
                    <th>Location</th>
Lines 88-93 Link Here
88
               <tbody>[% FOREACH reserveloo IN reserveloop %]
89
               <tbody>[% FOREACH reserveloo IN reserveloop %]
89
                <tr>
90
                <tr>
90
                    <td><span title="[% reserveloo.waitingdate %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
91
                    <td><span title="[% reserveloo.waitingdate %]">[% reserveloo.waitingdate | $KohaDates %]</span></td>
92
                    <td>[% reserveloo.lastpickupdate %]</td>
91
                    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
93
                    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
92
                        [% reserveloo.title |html %] [% reserveloo.subtitle |html %]
94
                        [% reserveloo.title |html %] [% reserveloo.subtitle |html %]
93
                        </a>
95
                        </a>
Lines 138-143 Link Here
138
               <table id="holdso">
140
               <table id="holdso">
139
               <thead><tr>
141
               <thead><tr>
140
                    <th class="title-string">Available since</th>
142
                    <th class="title-string">Available since</th>
143
                    <th>Last pickup date</th>
141
                    <th class="anti-the">Title</th>
144
                    <th class="anti-the">Title</th>
142
                    <th>Patron</th>
145
                    <th>Patron</th>
143
                    <th>Location</th>
146
                    <th>Location</th>
Lines 148-153 Link Here
148
               <tbody>[% FOREACH overloo IN overloop %]
151
               <tbody>[% FOREACH overloo IN overloop %]
149
                    <tr>
152
                    <tr>
150
                        <td><p><span title="[% overloo.waitingdate %]">[% overloo.waitingdate | $KohaDates %]</span></p></td>
153
                        <td><p><span title="[% overloo.waitingdate %]">[% overloo.waitingdate | $KohaDates %]</span></p></td>
154
                        <td>[% overloo.lastpickupdate | $KohaDates %]</td>
151
                        <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %]
155
                        <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %]
152
                        </a>
156
                        </a>
153
                            [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]&nbsp; (<b>[% overloo.itemtype %]</b>)[% END %][% END %]
157
                            [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]&nbsp; (<b>[% overloo.itemtype %]</b>)[% END %][% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 506-511 function validate1(date) { Link Here
506
            <thead>
506
            <thead>
507
                <tr>
507
                <tr>
508
                    <th>Hold date</th>
508
                    <th>Hold date</th>
509
                    <th>Last pickup date</th>
509
                    <th>Title</th>
510
                    <th>Title</th>
510
                    <th>Call number</th>
511
                    <th>Call number</th>
511
                    <th>Barcode</th>
512
                    <th>Barcode</th>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (+7 lines)
Lines 493-498 Link Here
493
                                        <tr>
493
                                        <tr>
494
                                            <th class="anti-the">Title</th>
494
                                            <th class="anti-the">Title</th>
495
                                            <th class="psort">Placed on</th>
495
                                            <th class="psort">Placed on</th>
496
                                            <th class="psort">Last pickup date</th>
496
                                            <th>Expires on</th>
497
                                            <th>Expires on</th>
497
                                            <th>Pick up location</th>
498
                                            <th>Pick up location</th>
498
                                            [% IF ( showpriority ) %]
499
                                            [% IF ( showpriority ) %]
Lines 530-535 Link Here
530
                                                    [% RESERVE.reservedate | $KohaDates %]
531
                                                    [% RESERVE.reservedate | $KohaDates %]
531
                                                </span>
532
                                                </span>
532
                                            </td>
533
                                            </td>
534
                                            <td class="lastpickupdate">
535
                                                <span title="[% RESERVE.lastpickupdate %]">
536
                                                    <span class="tdlabel">Last pickup date:</span>
537
                                                    [% RESERVE.lastpickupdate | $KohaDates %]
538
                                                </span>
539
                                            </td>
533
                                            <td class="expirationdate">
540
                                            <td class="expirationdate">
534
                                                [% IF ( RESERVE.expirationdate ) %]
541
                                                [% IF ( RESERVE.expirationdate ) %]
535
                                                    <span>
542
                                                    <span>
(-)a/opac/opac-user.pl (+4 lines)
Lines 321-326 foreach my $res (@reserves) { Link Here
321
            }
321
            }
322
            # set found to 1 if reserve is waiting for patron pickup
322
            # set found to 1 if reserve is waiting for patron pickup
323
            $res->{'found'} = 1 if $res->{'found'} eq 'W';
323
            $res->{'found'} = 1 if $res->{'found'} eq 'W';
324
325
            my $lastpickupdate = C4::Reserves::_reserve_last_pickup_date( $res );
326
            $res->{'lastpickupdate'} = $lastpickupdate if $lastpickupdate;
327
324
        } else {
328
        } else {
325
            my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
329
            my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} );
326
            if ($transfertwhen) {
330
            if ($transfertwhen) {
(-)a/svc/holds (-4 / +15 lines)
Lines 31-36 use C4::Context; Link Here
31
31
32
use Koha::Database;
32
use Koha::Database;
33
use Koha::DateUtils;
33
use Koha::DateUtils;
34
use Koha::Reserves;
34
35
35
my $input = new CGI;
36
my $input = new CGI;
36
37
Lines 53-60 my $borrowernumber = $input->param('borrowernumber'); Link Here
53
my $offset            = $input->param('iDisplayStart');
54
my $offset            = $input->param('iDisplayStart');
54
my $results_per_page  = $input->param('iDisplayLength');
55
my $results_per_page  = $input->param('iDisplayLength');
55
my $sorting_direction = $input->param('sSortDir_0') || 'desc';
56
my $sorting_direction = $input->param('sSortDir_0') || 'desc';
56
my $sorting_column    = $sort_columns[ $input->param('iSortCol_0') ]
57
my $sorting_column    = ( $input->param('iSortCol_0') )   ?
57
  || 'reservedate';
58
        $sort_columns[ $input->param('iSortCol_0') ]   :   'reservedate';
58
59
59
binmode STDOUT, ":encoding(UTF-8)";
60
binmode STDOUT, ":encoding(UTF-8)";
60
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
61
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
Lines 106-112 while ( my $h = $holds_rs->next() ) { Link Here
106
          )
107
          )
107
        : q{},
108
        : q{},
108
    };
109
    };
109
110
    
111
    #Calculate the last pickup date for reservations that are waiting for pickup.
112
    if ($hold->{waiting}) {
113
        my $lastpickupdate = Koha::Reserves::GetLastpickupdate( $h );
114
        $hold->{lastpickupdate} = $lastpickupdate->ymd();
115
        $hold->{lastpickupdate_formatted} = C4::Dates->new($lastpickupdate->ymd(), 'iso')->output();
116
    }
117
    else {#These values need to be initialized anyway for DataTables to not complain.
118
        $hold->{lastpickupdate} = '';
119
        $hold->{lastpickupdate_formatted} = '';
120
    }
121
    
110
    $hold->{transfered}     = 0;
122
    $hold->{transfered}     = 0;
111
    $hold->{not_transfered} = 0;
123
    $hold->{not_transfered} = 0;
112
124
113
- 

Return to bug 12353