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

(-)a/C4/Letters.pm (-2 / +1 lines)
Lines 610-617 sub _parseletter { Link Here
610
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
610
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
611
        my @waitingdate = split /-/, $values->{'waitingdate'};
611
        my @waitingdate = split /-/, $values->{'waitingdate'};
612
612
613
        my $dt = dt_from_string();
613
        my $dt = dt_from_string($values->{maxpickupdate});
614
        $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') );
615
        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
614
        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
616
615
617
        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
616
        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
(-)a/C4/Reserves.pm (-18 / +119 lines)
Lines 23-28 package C4::Reserves; Link Here
23
23
24
use strict;
24
use strict;
25
#use warnings; FIXME - Bug 2505
25
#use warnings; FIXME - Bug 2505
26
use Date::Calc qw( Add_Delta_Days );
26
use C4::Context;
27
use C4::Context;
27
use C4::Biblio;
28
use C4::Biblio;
28
use C4::Members;
29
use C4::Members;
Lines 116-122 BEGIN { Link Here
116
        
117
        
117
        &CheckReserves
118
        &CheckReserves
118
        &CanBookBeReserved
119
        &CanBookBeReserved
119
	&CanItemBeReserved
120
        &CanItemBeReserved
120
        &CancelReserve
121
        &CancelReserve
121
        &CancelExpiredReserves
122
        &CancelExpiredReserves
122
123
Lines 130-135 BEGIN { Link Here
130
        &ReserveSlip
131
        &ReserveSlip
131
        &ToggleSuspend
132
        &ToggleSuspend
132
        &SuspendAll
133
        &SuspendAll
134
        &GetReservesControlBranch
133
    );
135
    );
134
    @EXPORT_OK = qw( MergeHolds );
136
    @EXPORT_OK = qw( MergeHolds );
135
}    
137
}    
Lines 169-203 sub AddReserve { Link Here
169
        $waitingdate = $resdate;
171
        $waitingdate = $resdate;
170
    }
172
    }
171
173
174
    my $item = C4::Items::GetItem( $checkitem );
175
    my $maxpickupdate = GetMaxPickupDate( undef, $item );
176
172
    #eval {
177
    #eval {
173
    # updates take place here
178
    # updates take place here
174
    if ( $fee > 0 ) {
179
    if ( $fee > 0 ) {
175
        my $nextacctno = &getnextacctno( $borrowernumber );
180
        my $nextacctno = &getnextacctno( $borrowernumber );
176
        my $query      = qq/
181
        my $query      = q{
177
        INSERT INTO accountlines
182
        INSERT INTO accountlines
178
            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
183
            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
179
        VALUES
184
        VALUES
180
            (?,?,now(),?,?,'Res',?)
185
            (?,?,now(),?,?,'Res',?)
181
    /;
186
        };
182
        my $usth = $dbh->prepare($query);
187
        my $usth = $dbh->prepare($query);
183
        $usth->execute( $borrowernumber, $nextacctno, $fee,
188
        $usth->execute( $borrowernumber, $nextacctno, $fee,
184
            "Reserve Charge - $title", $fee );
189
            "Reserve Charge - $title", $fee );
185
    }
190
    }
186
191
187
    #if ($const eq 'a'){
192
    #if ($const eq 'a'){
188
    my $query = qq/
193
    my $query = q{
189
        INSERT INTO reserves
194
        INSERT INTO reserves
190
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
195
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
191
            priority,reservenotes,itemnumber,found,waitingdate,expirationdate)
196
            priority,reservenotes,itemnumber,found,waitingdate,expirationdate,maxpickupdate)
192
        VALUES
197
        VALUES
193
             (?,?,?,?,?,
198
             (?,?,?,?,?,
194
             ?,?,?,?,?,?)
199
             ?,?,?,?,?,?,?)
195
    /;
200
    };
196
    my $sth = $dbh->prepare($query);
201
    my $sth = $dbh->prepare($query);
197
    $sth->execute(
202
    $sth->execute(
198
        $borrowernumber, $biblionumber, $resdate, $branch,
203
        $borrowernumber, $biblionumber, $resdate, $branch,
199
        $const,          $priority,     $notes,   $checkitem,
204
        $const,          $priority,     $notes,   $checkitem,
200
        $found,          $waitingdate,	$expdate
205
        $found,          $waitingdate,  $expdate, $maxpickupdate
201
    );
206
    );
202
207
203
    # Send e-mail to librarian if syspref is active
208
    # Send e-mail to librarian if syspref is active
Lines 497-502 sub CanItemBeReserved{ Link Here
497
        return 0;
502
        return 0;
498
    }
503
    }
499
}
504
}
505
506
=head2 GetMaxPickupDate
507
508
$maxpickupdate = &GetMaxPickupDate($reserve [, $item]);
509
$reserve->{waitingdate} is a string or a DateTime.
510
511
this function returns the max pickup date (DateTime format).
512
(e.g. : the date after which the hold will be considered cancelled)
513
514
=cut
515
516
sub GetMaxPickupDate {
517
    my ( $reserve, $item ) = @_;
518
519
    if ( not defined $reserve and not defined $item->{itemnumber} ) {
520
        warn "ERROR: GetMaxPickupDate is called without reserve and without itemnumber";
521
        return;
522
    }
523
524
    if ( defined $reserve and not defined $item ) {
525
        $item = C4::Items::GetItem( $reserve->{itemnumber} );
526
    }
527
528
    unless ( defined $reserve ) {
529
        my $reserve = GetReservesFromItemnumber( $item->{itemnumber} );
530
    }
531
    return unless $reserve->{waitingdate};
532
533
    my $borrower = C4::Members::GetMember( 'borrowernumber' => $reserve->{borrowernumber} );
534
535
    my $controlbranch = GetReservesControlBranch( $borrower, $item );
536
537
    my $issuingrule = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $controlbranch );
538
539
    my $date = ref $reserve->{waitingdate} eq 'DateTime'
540
        ? $reserve->{waitingdate}
541
        : dt_from_string $reserve->{waitingdate};
542
543
    my $holdspickupdelay = 0;
544
    if ( defined($issuingrule)
545
        and defined $issuingrule->{holdspickupdelay} ) {
546
        $holdspickupdelay = $issuingrule->{holdspickupdelay}
547
    }
548
549
    $date->add( days => $holdspickupdelay );
550
551
    return $date;
552
}
553
554
=head2 GetReservesControlBranch
555
556
$branchcode = &GetReservesControlBranch($borrower, $item)
557
558
Returns the branchcode to consider to check hold rules against
559
560
=cut
561
562
sub GetReservesControlBranch {
563
    my ( $borrower, $item ) = @_;
564
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
565
    my $hbr           = C4::Context->preference('HomeOrHoldingBranch') || "homebranch";
566
    my $branchcode    = "*";
567
    if ( $controlbranch eq "ItemHomeLibrary" ) {
568
        $branchcode = $item->{$hbr};
569
    } elsif ( $controlbranch eq "PatronLibrary" ) {
570
        $branchcode = $borrower->{branchcode};
571
    }
572
    return $branchcode;
573
}
574
500
#--------------------------------------------------------------------------------
575
#--------------------------------------------------------------------------------
501
=head2 GetReserveCount
576
=head2 GetReserveCount
502
577
Lines 711-717 sub GetReservesToBranch { Link Here
711
sub GetReservesForBranch {
786
sub GetReservesForBranch {
712
    my ($frombranch) = @_;
787
    my ($frombranch) = @_;
713
    my $dbh          = C4::Context->dbh;
788
    my $dbh          = C4::Context->dbh;
714
	my $query        = "SELECT borrowernumber,reservedate,itemnumber,waitingdate
789
    my $query        = "SELECT borrowernumber,reservedate,itemnumber,waitingdate,maxpickupdate
715
        FROM   reserves 
790
        FROM   reserves 
716
        WHERE   priority='0'
791
        WHERE   priority='0'
717
            AND found='W' ";
792
            AND found='W' ";
Lines 906-920 sub CancelExpiredReserves { Link Here
906
    while ( my $res = $sth->fetchrow_hashref() ) {
981
    while ( my $res = $sth->fetchrow_hashref() ) {
907
        CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
982
        CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} );
908
    }
983
    }
909
  
984
910
    # Cancel reserves that have been waiting too long
985
    # Cancel reserves that have been waiting too long
911
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
986
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
912
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
913
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
987
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
914
988
915
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
989
        my $query = "SELECT * FROM reserves WHERE NOW() > maxpickupdate AND found = 'W' AND priority = 0";
916
        $sth = $dbh->prepare( $query );
990
        $sth = $dbh->prepare( $query );
917
        $sth->execute( $max_pickup_delay );
991
        $sth->execute();
918
992
919
        while (my $res = $sth->fetchrow_hashref ) {
993
        while (my $res = $sth->fetchrow_hashref ) {
920
            if ( $charge ) {
994
            if ( $charge ) {
Lines 1221-1229 sub ModReserveStatus { Link Here
1221
    my ($itemnumber, $newstatus) = @_;
1295
    my ($itemnumber, $newstatus) = @_;
1222
    my $dbh = C4::Context->dbh;
1296
    my $dbh = C4::Context->dbh;
1223
1297
1224
    my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0";
1298
    my $now = dt_from_string;
1299
    my $reserve = $dbh->selectrow_hashref(q{
1300
        SELECT *
1301
        FROM reserves
1302
        WHERE itemnumber = ?
1303
            AND found IS NULL
1304
            AND priority = 0
1305
    }, {}, $itemnumber);
1306
    return unless $reserve;
1307
1308
    my $maxpickupdate = GetMaxPickupDate( $reserve );
1309
    my $query = q{
1310
        UPDATE reserves
1311
        SET found = ?,
1312
            waitingdate = ?,
1313
            maxpickupdate = ?
1314
        WHERE itemnumber = ?
1315
            AND found IS NULL
1316
            AND priority = 0
1317
    };
1225
    my $sth_set = $dbh->prepare($query);
1318
    my $sth_set = $dbh->prepare($query);
1226
    $sth_set->execute( $newstatus, $itemnumber );
1319
    $sth_set->execute( $newstatus, $now, $maxpickupdate, $itemnumber );
1227
1320
1228
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1321
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1229
      CartToShelf( $itemnumber );
1322
      CartToShelf( $itemnumber );
Lines 1271-1291 sub ModReserveAffect { Link Here
1271
        WHERE borrowernumber = ?
1364
        WHERE borrowernumber = ?
1272
          AND biblionumber = ?
1365
          AND biblionumber = ?
1273
    ";
1366
    ";
1367
        $sth = $dbh->prepare($query);
1368
        $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1274
    }
1369
    }
1275
    else {
1370
    else {
1276
    # affect the reserve to Waiting as well.
1371
    # affect the reserve to Waiting as well.
1372
        my $item = C4::Items::GetItem( $itemnumber );
1373
        my $maxpickupdate = GetMaxPickupDate( undef, $item );
1277
        $query = "
1374
        $query = "
1278
            UPDATE reserves
1375
            UPDATE reserves
1279
            SET     priority = 0,
1376
            SET     priority = 0,
1280
                    found = 'W',
1377
                    found = 'W',
1281
                    waitingdate = NOW(),
1378
                    waitingdate = NOW(),
1379
                    maxpickupdate = ?,
1282
                    itemnumber = ?
1380
                    itemnumber = ?
1283
            WHERE borrowernumber = ?
1381
            WHERE borrowernumber = ?
1284
              AND biblionumber = ?
1382
              AND biblionumber = ?
1285
        ";
1383
        ";
1384
        $sth = $dbh->prepare($query);
1385
        $sth->execute( $maxpickupdate, $itemnumber, $borrowernumber,$biblionumber);
1286
    }
1386
    }
1287
    $sth = $dbh->prepare($query);
1288
    $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1289
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1387
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1290
1388
1291
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1389
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
Lines 1361-1366 sub GetReserveInfo { Link Here
1361
				   reserves.biblionumber, 
1459
				   reserves.biblionumber, 
1362
				   reserves.branchcode,
1460
				   reserves.branchcode,
1363
				   reserves.waitingdate,
1461
				   reserves.waitingdate,
1462
                   reserves.maxpickupdate,
1364
				   notificationdate, 
1463
				   notificationdate, 
1365
				   reminderdate, 
1464
				   reminderdate, 
1366
				   priority, 
1465
				   priority, 
Lines 1815-1820 sub _Findgroupreserve { Link Here
1815
               reserves.borrowernumber             AS borrowernumber,
1914
               reserves.borrowernumber             AS borrowernumber,
1816
               reserves.reservedate                AS reservedate,
1915
               reserves.reservedate                AS reservedate,
1817
               reserves.waitingdate                AS waitingdate,
1916
               reserves.waitingdate                AS waitingdate,
1917
               reserves.maxpickupdate              AS maxpickupdate,
1818
               reserves.branchcode                 AS branchcode,
1918
               reserves.branchcode                 AS branchcode,
1819
               reserves.cancellationdate           AS cancellationdate,
1919
               reserves.cancellationdate           AS cancellationdate,
1820
               reserves.found                      AS found,
1920
               reserves.found                      AS found,
Lines 2130-2136 sub RevertWaitingStatus { Link Here
2130
    SET
2230
    SET
2131
      priority = 1,
2231
      priority = 1,
2132
      found = NULL,
2232
      found = NULL,
2133
      waitingdate = NULL
2233
      waitingdate = NULL,
2234
      maxpickupdate = NULL,
2134
    WHERE
2235
    WHERE
2135
      reserve_id = ?
2236
      reserve_id = ?
2136
    ";
2237
    ";
(-)a/admin/smart-rules.pl (-6 / +7 lines)
Lines 101-109 elsif ($op eq 'delete-branch-item') { Link Here
101
# save the values entered
101
# save the values entered
102
elsif ($op eq 'add') {
102
elsif ($op eq 'add') {
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
103
    my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
104
    my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, reservesallowed, holdspickupdelay, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)');
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=?  WHERE branchcode=? AND categorycode=? AND itemtype=?");
105
    my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, reservesallowed=?, holdspickupdelay=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=?  WHERE branchcode=? AND categorycode=? AND itemtype=?");
106
    
106
107
    my $br = $branch; # branch
107
    my $br = $branch; # branch
108
    my $bor  = $input->param('categorycode'); # borrower category
108
    my $bor  = $input->param('categorycode'); # borrower category
109
    my $cat  = $input->param('itemtype');     # item type
109
    my $cat  = $input->param('itemtype');     # item type
Lines 115-120 elsif ($op eq 'add') { Link Here
115
    my $renewalsallowed  = $input->param('renewalsallowed');
115
    my $renewalsallowed  = $input->param('renewalsallowed');
116
    my $renewalperiod    = $input->param('renewalperiod');
116
    my $renewalperiod    = $input->param('renewalperiod');
117
    my $reservesallowed  = $input->param('reservesallowed');
117
    my $reservesallowed  = $input->param('reservesallowed');
118
    my $holdspickupdelay = $input->param('holdspickupdelay');
118
    $maxissueqty =~ s/\s//g;
119
    $maxissueqty =~ s/\s//g;
119
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
120
    $maxissueqty = undef if $maxissueqty !~ /^\d+/;
120
    my $issuelength  = $input->param('issuelength');
121
    my $issuelength  = $input->param('issuelength');
Lines 129-139 elsif ($op eq 'add') { Link Here
129
    $sth_search->execute($br,$bor,$cat);
130
    $sth_search->execute($br,$bor,$cat);
130
    my $res = $sth_search->fetchrow_hashref();
131
    my $res = $sth_search->fetchrow_hashref();
131
    if ($res->{total}) {
132
    if ($res->{total}) {
132
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
133
        $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $holdspickupdelay, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat);
133
    } else {
134
    } else {
134
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
135
        $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed, $holdspickupdelay, $issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap);
135
    }
136
    }
136
} 
137
}
137
elsif ($op eq "set-branch-defaults") {
138
elsif ($op eq "set-branch-defaults") {
138
    my $categorycode  = $input->param('categorycode');
139
    my $categorycode  = $input->param('categorycode');
139
    my $maxissueqty   = $input->param('maxissueqty');
140
    my $maxissueqty   = $input->param('maxissueqty');
(-)a/circ/circulation.pl (+3 lines)
Lines 373-378 if ($borrowernumber) { Link Here
373
        if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
373
        if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) {
374
            $getreserv{color}   = 'reserved';
374
            $getreserv{color}   = 'reserved';
375
            $getreserv{waiting} = 1;
375
            $getreserv{waiting} = 1;
376
            $getWaitingReserveInfo{maxpickupdate} = $num_res->{maxpickupdate};
377
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
378
376
#     genarate information displaying only waiting reserves
379
#     genarate information displaying only waiting reserves
377
        $getWaitingReserveInfo{title}        = $getiteminfo->{'title'};
380
        $getWaitingReserveInfo{title}        = $getiteminfo->{'title'};
378
        $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
381
        $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'};
(-)a/circ/waitingreserves.pl (-31 / +25 lines)
Lines 21-43 Link Here
21
use strict;
21
use strict;
22
use warnings;
22
use warnings;
23
use CGI;
23
use CGI;
24
use DateTime;
24
use C4::Context;
25
use C4::Context;
25
use C4::Output;
26
use C4::Output;
26
use C4::Branch; # GetBranchName
27
use C4::Branch; # GetBranchName
27
use C4::Auth;
28
use C4::Auth;
28
use C4::Dates qw/format_date/;
29
use C4::Dates qw/format_date/;
29
use C4::Circulation;
30
use C4::Circulation;
31
use C4::Reserves;
30
use C4::Members;
32
use C4::Members;
31
use C4::Biblio;
33
use C4::Biblio;
32
use C4::Items;
34
use C4::Items;
33
34
use Date::Calc qw(
35
  Today
36
  Add_Delta_Days
37
  Date_to_Days
38
);
39
use C4::Reserves;
35
use C4::Reserves;
40
use C4::Koha;
36
use C4::Koha;
37
use Koha::DateUtils;
41
38
42
my $input = new CGI;
39
my $input = new CGI;
43
40
Lines 86-116 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 = dt_from_string;
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
93
    my $itemnumber = $num->{'itemnumber'};
90
    my $itemnumber = $num->{'itemnumber'};
94
    my $gettitle     = GetBiblioFromItemNumber( $itemnumber );
91
    my $gettitle     = GetBiblioFromItemNumber( $itemnumber );
95
    my $borrowernum = $num->{'borrowernumber'};
92
    my $borrowernumber = $num->{'borrowernumber'};
96
    my $holdingbranch = $gettitle->{'holdingbranch'};
93
    my $holdingbranch = $gettitle->{'holdingbranch'};
97
    my $homebranch = $gettitle->{'homebranch'};
94
    my $homebranch = $gettitle->{'homebranch'};
98
95
99
    my %getreserv = (
96
    my %getreserv = (
100
        itemnumber => $itemnumber,
97
        itemnumber => $itemnumber,
101
        borrowernum => $borrowernum,
98
        borrowernum => $borrowernumber,
102
    );
99
    );
103
100
104
    # fix up item type for display
101
    # fix up item type for display
105
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
102
    $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'};
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'} = format_date( $num->{'waitingdate'} );
105
109
    my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'});
106
    if ( $num->{waitingdate} ) {
110
    ( $waiting_year, $waiting_month, $waiting_day ) =
107
        my $maxpickupdate = dt_from_string($num->{maxpickupdate});
111
      Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day,
108
        $getreserv{waitingdate} = $num->{waitingdate};
112
        C4::Context->preference('ReservesMaxPickUpDelay'));
109
        $getreserv{maxpickupdate} = $num->{maxpickupdate};
113
    my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day );
110
        if ( DateTime->compare( $today, $maxpickupdate ) == 1 ) {
111
            if ($cancelall) {
112
                my $res = cancel( $itemnumber, $borrowernumber, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
113
                push @cancel_result, $res if $res;
114
                next;
115
            } else {
116
                push @overloop,   \%getreserv;
117
                $overcount++;
118
            }
119
        }else{
120
            push @reservloop, \%getreserv;
121
            $reservcount++;
122
        }
123
    }
114
124
115
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
125
    $getreserv{'itemtype'}       = $itemtypeinfo->{'description'};
116
    $getreserv{'title'}          = $gettitle->{'title'};
126
    $getreserv{'title'}          = $gettitle->{'title'};
Lines 131-151 foreach my $num (@getreserves) { Link Here
131
    if ( $getborrower->{'emailaddress'} ) {
141
    if ( $getborrower->{'emailaddress'} ) {
132
        $getreserv{'borrowermail'}  = $getborrower->{'emailaddress'};
142
        $getreserv{'borrowermail'}  = $getborrower->{'emailaddress'};
133
    }
143
    }
134
 
135
    if ($today > $calcDate) {
136
        if ($cancelall) {
137
            my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
138
            push @cancel_result, $res if $res;
139
            next;
140
        } else {
141
            push @overloop,   \%getreserv;
142
            $overcount++;
143
        }
144
    }else{
145
        push @reservloop, \%getreserv;
146
        $reservcount++;
147
    }
148
    
149
}
144
}
150
145
151
$template->param(cancel_result => \@cancel_result) if @cancel_result;
146
$template->param(cancel_result => \@cancel_result) if @cancel_result;
Lines 155-161 $template->param( Link Here
155
    overloop    => \@overloop,
150
    overloop    => \@overloop,
156
    overcount   => $overcount,
151
    overcount   => $overcount,
157
    show_date   => format_date(C4::Dates->today('iso')),
152
    show_date   => format_date(C4::Dates->today('iso')),
158
    ReservesMaxPickUpDelay => C4::Context->preference('ReservesMaxPickUpDelay')
159
);
153
);
160
154
161
if ($cancelall) {
155
if ($cancelall) {
(-)a/installer/data/mysql/kohastructure.sql (+3 lines)
Lines 1129-1134 CREATE TABLE `issuingrules` ( -- circulation and fine rules Link Here
1129
  `renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed
1129
  `renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed
1130
  `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit
1130
  `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit
1131
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1131
  `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed
1132
  `holdspickupdelay` int(11)  default NULL, -- after how many days a hold is problematic (in days)
1132
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1133
  `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode)
1133
  overduefinescap decimal default NULL, -- the maximum amount of an overdue fine
1134
  overduefinescap decimal default NULL, -- the maximum amount of an overdue fine
1134
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
1135
  PRIMARY KEY  (`branchcode`,`categorycode`,`itemtype`),
Lines 1590-1595 CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b Link Here
1590
  `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
1591
  `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
1591
  `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1592
  `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1592
  `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
1593
  `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
1594
  `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup date for this reserves
1593
  PRIMARY KEY (`reserve_id`),
1595
  PRIMARY KEY (`reserve_id`),
1594
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1596
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1595
  KEY `old_reserves_biblionumber` (`biblionumber`),
1597
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 1789-1794 CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha Link Here
1789
  `lowestPriority` tinyint(1) NOT NULL,
1791
  `lowestPriority` tinyint(1) NOT NULL,
1790
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1792
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1791
  `suspend_until` DATETIME NULL DEFAULT NULL,
1793
  `suspend_until` DATETIME NULL DEFAULT NULL,
1794
  `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup date for this reserves
1792
  PRIMARY KEY (`reserve_id`),
1795
  PRIMARY KEY (`reserve_id`),
1793
  KEY priorityfoundidx (priority,found),
1796
  KEY priorityfoundidx (priority,found),
1794
  KEY `borrowernumber` (`borrowernumber`),
1797
  KEY `borrowernumber` (`borrowernumber`),
(-)a/installer/data/mysql/updatedatabase.pl (+28 lines)
Lines 7010-7015 CREATE TABLE IF NOT EXISTS borrower_files ( Link Here
7010
    SetVersion($DBversion);
7010
    SetVersion($DBversion);
7011
}
7011
}
7012
7012
7013
7014
$DBversion = "3.11.00.XXX";
7015
if ( CheckVersion($DBversion) ) {
7016
    my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0;
7017
    $dbh->do(q{
7018
        DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay';
7019
    });
7020
    $dbh->do(qq{
7021
        ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed;
7022
    });
7023
    my $sth = $dbh->prepare(q{
7024
        UPDATE issuingrules SET holdspickupdelay = ?
7025
    });
7026
    $sth->execute( $maxpickupdelay );
7027
    $dbh->do(q{
7028
        ALTER TABLE reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until;
7029
    });
7030
    $sth = $dbh->prepare(q{
7031
        UPDATE reserves SET maxpickupdate = ADDDATE(waitingdate, INTERVAL ? DAY);
7032
    });
7033
    $sth->execute( $maxpickupdelay );
7034
    $dbh->do(q{
7035
        ALTER TABLE old_reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until;
7036
    });
7037
    print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupdelay and reserves.maxpickupdate. Delete the ReservesMaxPickUpDelay syspref)\n";
7038
    SetVersion($DBversion);
7039
}
7040
7013
=head1 FUNCTIONS
7041
=head1 FUNCTIONS
7014
7042
7015
=head2 TableExists($table)
7043
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-6 / +1 lines)
Lines 365-380 Circulation: Link Here
365
                  PatronLibrary: "patron's home library"
365
                  PatronLibrary: "patron's home library"
366
            - to see if the patron can place a hold on the item.    
366
            - to see if the patron can place a hold on the item.    
367
        -
367
        -
368
            - Mark a hold as problematic if it has been waiting for more than
369
            - pref: ReservesMaxPickUpDelay
370
              class: integer
371
            - days.
372
        -
373
            - pref: ExpireReservesMaxPickUpDelay
368
            - pref: ExpireReservesMaxPickUpDelay
374
              choices:
369
              choices:
375
                  yes: Allow
370
                  yes: Allow
376
                  no: "Don't allow"
371
                  no: "Don't allow"
377
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
372
            - "holds to expire automatically if they have not been picked by within the time period specified in hold pickup delay defined in the issuing rules"
378
        -
373
        -
379
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
374
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
380
            - pref: ExpireReservesMaxPickUpDelayCharge
375
            - pref: ExpireReservesMaxPickUpDelayCharge
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +5 lines)
Lines 151-158 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
151
                <th>Renewals allowed (count)</th>
151
                <th>Renewals allowed (count)</th>
152
                <th>Renewal period</th>
152
                <th>Renewal period</th>
153
                <th>Holds allowed (count)</th>
153
                <th>Holds allowed (count)</th>
154
                <th>Holds pickup delay (day)</th>
154
                <th>Rental discount (%)</th>
155
                <th>Rental discount (%)</th>
155
                <th colspan="2">&nbsp;</th>
156
                <th>&nbsp;</th>
157
                <th>&nbsp;</th>
156
            </tr>
158
            </tr>
157
            </thead>
159
            </thead>
158
            <tbody>
160
            <tbody>
Lines 208-213 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
208
							<td>[% rule.renewalsallowed %]</td>
210
							<td>[% rule.renewalsallowed %]</td>
209
                            <td>[% rule.renewalperiod %]</td>
211
                            <td>[% rule.renewalperiod %]</td>
210
							<td>[% rule.reservesallowed %]</td>
212
							<td>[% rule.reservesallowed %]</td>
213
                            <td>[% rule.holdspickupdelay %]</td>
211
							<td>[% rule.rentaldiscount %]</td>
214
							<td>[% rule.rentaldiscount %]</td>
212
                            <td><a href="#" class="editrule">Edit</a></td>
215
                            <td><a href="#" class="editrule">Edit</a></td>
213
							<td>
216
							<td>
Lines 257-262 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
257
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
260
                    <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td>
258
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
261
                    <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td>
259
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
262
                    <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td>
263
                    <td><input type="text" name="holdspickupdelay" id="holdspickupdelay" size="2" /></td>
260
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
264
                    <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td>
261
                    <td colspan="2">
265
                    <td colspan="2">
262
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
266
                        <input type="hidden" name="branch" value="[% current_branch %]"/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +2 lines)
Lines 710-716 No patron matched <span class="ex">[% message %]</span> Link Here
710
		    <h4>Holds waiting:</h4>
710
		    <h4>Holds waiting:</h4>
711
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
711
			        [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %]
712
			            <ul>
712
			            <ul>
713
			                <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% WaitingReserveLoo.biblionumber %]">[% WaitingReserveLoo.title |html %]</a> ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %].
713
                            <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% WaitingReserveLoo.biblionumber %]">[% WaitingReserveLoo.title |html %]</a> ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %] waiting until [% WaitingReserveLoo.maxpickupdate | $KohaDates %].
714
			            [% IF ( WaitingReserveLoo.waitingat ) %]
714
			            [% IF ( WaitingReserveLoo.waitingat ) %]
715
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
715
			                <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong>
716
			            [% END %]
716
			            [% END %]
Lines 1115-1121 No patron matched <span class="ex">[% message %]</span> Link Here
1115
                    <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% reservloo.biblionumber %]"><strong>[% reservloo.title |html %]</strong></a>[% IF ( reservloo.author ) %], by [% reservloo.author %][% END %]</td>
1115
                    <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% reservloo.biblionumber %]"><strong>[% reservloo.title |html %]</strong></a>[% IF ( reservloo.author ) %], by [% reservloo.author %][% END %]</td>
1116
                    <td>[% reservloo.itemcallnumber %]</td>
1116
                    <td>[% reservloo.itemcallnumber %]</td>
1117
					<td><em>[% IF ( reservloo.barcodereserv ) %]Item [% reservloo.barcodereserv %]
1117
					<td><em>[% IF ( reservloo.barcodereserv ) %]Item [% reservloo.barcodereserv %]
1118
                        [% END %][% IF ( reservloo.waiting ) %] <strong>waiting at [% reservloo.waitingat %]</strong>
1118
                        [% END %][% IF ( reservloo.waiting ) %] <strong>waiting at [% reservloo.waitingat %][% IF reservloo.maxpickupdate %] until [% reservloo.maxpickupdate | $KohaDates %][% END %]</strong>
1119
                        [% END %]
1119
                        [% END %]
1120
                        [% IF ( reservloo.transfered ) %] <strong>in transit</strong> from
1120
                        [% IF ( reservloo.transfered ) %] <strong>in transit</strong> from
1121
                        [% reservloo.frombranch %] since [% reservloo.datesent %]
1121
                        [% reservloo.frombranch %] since [% reservloo.datesent %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt (-5 / +6 lines)
Lines 1-3 Link Here
1
[% USE KohaDates %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Circulation &rsaquo; Holds awaiting pickup</title>
3
<title>Koha &rsaquo; Circulation &rsaquo; Holds awaiting pickup</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 81-87 dt_add_type_uk_date(); Link Here
81
            [% IF ( reserveloop ) %]
82
            [% IF ( reserveloop ) %]
82
               <table id="holdst">
83
               <table id="holdst">
83
               <thead><tr>
84
               <thead><tr>
84
                    <th>Available since</th>
85
                    <th>Available since-until</th>
85
                    <th>Title</th>
86
                    <th>Title</th>
86
                    <th>Patron</th>
87
                    <th>Patron</th>
87
                    <th>Location</th>
88
                    <th>Location</th>
Lines 91-97 dt_add_type_uk_date(); Link Here
91
               </tr></thead>
92
               </tr></thead>
92
               <tbody>[% FOREACH reserveloo IN reserveloop %]
93
               <tbody>[% FOREACH reserveloo IN reserveloop %]
93
                <tr>
94
                <tr>
94
                    <td><p>[% reserveloo.waitingdate %]</p></td>
95
                    <td><p>[% reserveloo.waitingdate | $KohaDates %] - [% reserveloo.maxpickupdate | $KohaDates %]</p></td>
95
                    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
96
                    <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %]
96
                        [% reserveloo.title |html %] [% reserveloo.subtitle |html %]
97
                        [% reserveloo.title |html %] [% reserveloo.subtitle |html %]
97
                        </a>
98
                        </a>
Lines 126-132 dt_add_type_uk_date(); Link Here
126
        [% END %]
127
        [% END %]
127
        </div>
128
        </div>
128
        <div id="holdsover">
129
        <div id="holdsover">
129
                <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay %] days.</p>
130
                <p>Holds listed here have been awaiting pickup for too many days.</p>
130
               [% IF ( overloop ) %]
131
               [% IF ( overloop ) %]
131
               <p>
132
               <p>
132
               <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
133
               <form name="cancelAllReserve" action="waitingreserves.pl" method="post">
Lines 141-147 dt_add_type_uk_date(); Link Here
141
               <br/>
142
               <br/>
142
               <table id="holdso">
143
               <table id="holdso">
143
               <thead><tr>
144
               <thead><tr>
144
                    <th>Available since</th>
145
                    <th>Available since-until</th>
145
                    <th>Title</th>
146
                    <th>Title</th>
146
                    <th>Patron</th>
147
                    <th>Patron</th>
147
                    <th>Location</th>
148
                    <th>Location</th>
Lines 151-157 dt_add_type_uk_date(); Link Here
151
               </tr></thead>
152
               </tr></thead>
152
               <tbody>[% FOREACH overloo IN overloop %]
153
               <tbody>[% FOREACH overloo IN overloop %]
153
                    <tr>
154
                    <tr>
154
                        <td><p>[% overloo.waitingdate %]</p></td>
155
                        <td><p>[% overloo.waitingdate | $KohaDates %] - [% overloo.maxpickupdate | $KohaDates %]</p></td>
155
                        <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %]
156
                        <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %]
156
                        </a>
157
                        </a>
157
                            [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]&nbsp; (<b>[% overloo.itemtype %]</b>)[% END %][% END %]
158
                            [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %]&nbsp; (<b>[% overloo.itemtype %]</b>)[% END %][% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/waitingreserves.tt (-2 / +2 lines)
Lines 4-11 Link Here
4
4
5
<p>This report will show all of the holds that are waiting for patrons to pick them up.</p>
5
<p>This report will show all of the holds that are waiting for patrons to pick them up.</p>
6
6
7
<p>Items that have been on the hold shelf longer than you normally allow (based on the ReservesMaxPickUpDelay preference value) will appear on the 'Holds Over' tab, they will not automatically be cancelled unless you have set the cron job to do that for you, but you can cancel all holds using the button at the top of the list.</p>
7
<p>Items that have been on the hold shelf longer than you normally allow (based on the holds pickup delay defined in the issuing rules) will appear on the 'Holds Over' tab, they will not automatically be cancelled.</p>
8
8
9
<p><strong>See the full documentation for Holds Awaiting Pickup in the <a href="http://manual.koha-community.org/3.12/en/circreports.html#holdspickup">manual</a> (online).</strong></p>
9
<p><strong>See the full documentation for Holds Awaiting Pickup in the <a href="http://manual.koha-community.org/3.12/en/circreports.html#holdspickup">manual</a> (online).</strong></p>
10
10
11
[% INCLUDE 'help-bottom.inc' %]
11
[% INCLUDE 'help-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +1 lines)
Lines 637-643 function validate1(date) { Link Here
637
            </td>
637
            </td>
638
            <td>[% reservloo.itemcallnumber %]</td>
638
            <td>[% reservloo.itemcallnumber %]</td>
639
            <td>[% IF ( reservloo.waiting ) %]
639
            <td>[% IF ( reservloo.waiting ) %]
640
                <em>Item is <strong>waiting</strong></em>
640
                <em>Item is <strong>waiting</strong>[% IF reservloo.maxpickupdate %] until [% reservloo.maxpickupdate %][% END %]</em>
641
                [% END %]
641
                [% END %]
642
                [% IF ( reservloo.transfered ) %]
642
                [% IF ( reservloo.transfered ) %]
643
                <em>Item <strong>in transit</strong> from
643
                <em>Item <strong>in transit</strong> from
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-1 / +1 lines)
Lines 395-401 $.tablesorter.addParser({ Link Here
395
                    [% IF ( RESERVE.wait ) %]
395
                    [% IF ( RESERVE.wait ) %]
396
                        [% IF ( RESERVE.atdestination ) %]
396
                        [% IF ( RESERVE.atdestination ) %]
397
                            [% IF ( RESERVE.found ) %]
397
                            [% IF ( RESERVE.found ) %]
398
                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %]
398
                            Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %] until [% RESERVE.maxpickupdate | $KohaDates %][% END %]
399
                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
399
                            <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" />
400
                            [% ELSE %]
400
                            [% ELSE %]
401
                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
401
                            Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b>
(-)a/members/moremember.pl (+1 lines)
Lines 285-290 if ($borrowernumber) { Link Here
285
        if ( $num_res->{'found'} eq 'W' ) {
285
        if ( $num_res->{'found'} eq 'W' ) {
286
            $getreserv{color}   = 'reserved';
286
            $getreserv{color}   = 'reserved';
287
            $getreserv{waiting} = 1;
287
            $getreserv{waiting} = 1;
288
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
288
        }
289
        }
289
290
290
        # 		check transfers with the itemnumber foud in th reservation loop
291
        # 		check transfers with the itemnumber foud in th reservation loop
(-)a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl (-3 / +2 lines)
Lines 284-290 sub GetPredueIssues { Link Here
284
sub GetWaitingHolds {
284
sub GetWaitingHolds {
285
    my $query =
285
    my $query =
286
"SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
286
"SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname,
287
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,
287
                borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,reserves.maxpickupdate,
288
                reserves.branchcode AS site, branches.branchname AS site_name,
288
                reserves.branchcode AS site, branches.branchname AS site_name,
289
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
289
                TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting
290
                FROM borrowers JOIN reserves USING (borrowernumber)
290
                FROM borrowers JOIN reserves USING (borrowernumber)
Lines 298-304 sub GetWaitingHolds { Link Here
298
                AND message_transport_type = 'phone'
298
                AND message_transport_type = 'phone'
299
                AND message_name = 'Hold_Filled'
299
                AND message_name = 'Hold_Filled'
300
                ";
300
                ";
301
    my $pickupdelay = C4::Context->preference("ReservesMaxPickUpDelay");
302
    my $sth         = $dbh->prepare($query);
301
    my $sth         = $dbh->prepare($query);
303
    $sth->execute();
302
    $sth->execute();
304
    my @results;
303
    my @results;
Lines 306-312 sub GetWaitingHolds { Link Here
306
        my @waitingdate = split( /-/, $issue->{'waitingdate'} );
305
        my @waitingdate = split( /-/, $issue->{'waitingdate'} );
307
        my @date_due =
306
        my @date_due =
308
          Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2],
307
          Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2],
309
            $pickupdelay );
308
            $issue->{maxpickupdate} );
310
        $issue->{'date_due'} =
309
        $issue->{'date_due'} =
311
          sprintf( "%04d-%02d-%02d", $date_due[0], $date_due[1], $date_due[2] );
310
          sprintf( "%04d-%02d-%02d", $date_due[0], $date_due[1], $date_due[2] );
312
        $issue->{'level'} = 1;   # only one level for Hold Waiting notifications
311
        $issue->{'level'} = 1;   # only one level for Hold Waiting notifications
(-)a/opac/opac-user.pl (-2 / +5 lines)
Lines 257-263 foreach my $res (@reserves) { Link Here
257
      $res->{'expirationdate'} = '';
257
      $res->{'expirationdate'} = '';
258
    }
258
    }
259
259
260
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
260
    my $publictype = $res->{'publictype'};
261
    $res->{$publictype} = 1;
262
    if ( $res->{found} eq 'W' ) {
263
        $res->{waiting} = 1;
264
    }
261
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
265
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
262
    my $biblioData = GetBiblioData($res->{'biblionumber'});
266
    my $biblioData = GetBiblioData($res->{'biblionumber'});
263
    $res->{'reserves_title'} = $biblioData->{'title'};
267
    $res->{'reserves_title'} = $biblioData->{'title'};
264
- 

Return to bug 8367