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

(-)a/C4/Letters.pm (-2 / +1 lines)
Lines 605-612 sub _parseletter { Link Here
605
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
605
    if ( $table eq 'reserves' && $values->{'waitingdate'} ) {
606
        my @waitingdate = split /-/, $values->{'waitingdate'};
606
        my @waitingdate = split /-/, $values->{'waitingdate'};
607
607
608
        my $dt = dt_from_string();
608
        my $dt = dt_from_string($values->{maxpickupdate});
609
        $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') );
610
        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
609
        $values->{'expirationdate'} = output_pref( $dt, undef, 1 );
611
610
612
        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
611
        $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 );
(-)a/C4/Reserves.pm (-53 / +81 lines)
Lines 131-138 BEGIN { Link Here
131
        &ReserveSlip
131
        &ReserveSlip
132
        &ToggleSuspend
132
        &ToggleSuspend
133
        &SuspendAll
133
        &SuspendAll
134
        &GetMaxPickupDelay
135
        &GetMaxPickupDate
136
        &GetReservesControlBranch
134
        &GetReservesControlBranch
137
    );
135
    );
138
    @EXPORT_OK = qw( MergeHolds );
136
    @EXPORT_OK = qw( MergeHolds );
Lines 173-207 sub AddReserve { Link Here
173
        $waitingdate = $resdate;
171
        $waitingdate = $resdate;
174
    }
172
    }
175
173
174
    my $maxpickupdate = GetMaxPickupDate({
175
        waitingdate => $waitingdate,
176
        itemnumber => $checkitem,
177
        borrowernumber => $borrowernumber
178
    });
179
176
    #eval {
180
    #eval {
177
    # updates take place here
181
    # updates take place here
178
    if ( $fee > 0 ) {
182
    if ( $fee > 0 ) {
179
        my $nextacctno = &getnextacctno( $borrowernumber );
183
        my $nextacctno = &getnextacctno( $borrowernumber );
180
        my $query      = qq/
184
        my $query      = q{
181
        INSERT INTO accountlines
185
        INSERT INTO accountlines
182
            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
186
            (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
183
        VALUES
187
        VALUES
184
            (?,?,now(),?,?,'Res',?)
188
            (?,?,now(),?,?,'Res',?)
185
    /;
189
            };
186
        my $usth = $dbh->prepare($query);
190
        my $usth = $dbh->prepare($query);
187
        $usth->execute( $borrowernumber, $nextacctno, $fee,
191
        $usth->execute( $borrowernumber, $nextacctno, $fee,
188
            "Reserve Charge - $title", $fee );
192
            "Reserve Charge - $title", $fee );
189
    }
193
    }
190
194
191
    #if ($const eq 'a'){
195
    #if ($const eq 'a'){
192
    my $query = qq/
196
    my $query = q{
193
        INSERT INTO reserves
197
        INSERT INTO reserves
194
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
198
            (borrowernumber,biblionumber,reservedate,branchcode,constrainttype,
195
            priority,reservenotes,itemnumber,found,waitingdate,expirationdate)
199
            priority,reservenotes,itemnumber,found,waitingdate,expirationdate,maxpickupdate)
196
        VALUES
200
        VALUES
197
             (?,?,?,?,?,
201
             (?,?,?,?,?,
198
             ?,?,?,?,?,?)
202
             ?,?,?,?,?,?,?)
199
    /;
203
    };
200
    my $sth = $dbh->prepare($query);
204
    my $sth = $dbh->prepare($query);
201
    $sth->execute(
205
    $sth->execute(
202
        $borrowernumber, $biblionumber, $resdate, $branch,
206
        $borrowernumber, $biblionumber, $resdate, $branch,
203
        $const,          $priority,     $notes,   $checkitem,
207
        $const,          $priority,     $notes,   $checkitem,
204
        $found,          $waitingdate,	$expdate
208
        $found,          $waitingdate,  $expdate, $maxpickupdate
205
    );
209
    );
206
210
207
    # Send e-mail to librarian if syspref is active
211
    # Send e-mail to librarian if syspref is active
Lines 502-555 sub CanItemBeReserved{ Link Here
502
    }
506
    }
503
}
507
}
504
508
505
=item GetMaxPickupDelay
509
=item GetMaxPickupDate
506
510
507
$resallowed = &GetMaxPickupDelay($borrowernumber, $item)
511
$maxpickupdate = &GetMaxPickupDate($reserve [, $item]);
512
$reserve->{waitingdate} is a string or a DateTime.
508
513
509
this function return the max delay for an hold
514
this function returns the max pickup date (DateTime format).
515
(e.g. : the date after which the hold will be considered cancelled)
510
516
511
=cut
517
=cut
512
518
513
sub GetMaxPickupDelay {
519
sub GetMaxPickupDate {
514
    my ( $borrowernumber, $item ) = @_;
520
    my ( $reserve, $item ) = @_;
515
516
    my $dbh             = C4::Context->dbh;
517
    my $allowedreserves = 0;
518
519
    my $borrower        = C4::Members::GetMember( 'borrowernumber' => $borrowernumber );
520
521
    my $controlbranch   = GetReservesControlBranch( $borrower, $item );
522
521
523
    my $issuingrule     = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $controlbranch );
522
    if ( not defined $reserve and not defined $item->{itemnumber} ) {
523
        warn "ERROR: GetMaxPickupDate is called without reserve and without itemnumber";
524
        return;
525
    }
524
526
525
    return $issuingrule->{holdspickupdelay}
527
    if ( defined $reserve and not defined $item ) {
526
        if defined($issuingrule)
528
        $item = C4::Items::GetItem( $reserve->{itemnumber} );
527
            and defined $issuingrule->{holdspickupdelay};
529
    }
528
530
529
    # if nothing found, return the syspref value
531
    unless ( defined $reserve ) {
530
    return C4::Context->preference("ReservesMaxPickUpDelay") || 0;
532
        my $reserve = GetReservesFromItemnumber( $item->{itemnumber} );
531
}
533
    }
534
    return unless $reserve->{waitingdate};
532
535
533
=item GetMaxPickupDate
536
    my $borrower = C4::Members::GetMember( 'borrowernumber' => $reserve->{borrowernumber} );
534
537
535
$maxpickupdate = &GetMaxPickupDate($item, $borrowernumber);
538
    my $controlbranch = GetReservesControlBranch( $borrower, $item );
536
$item->{waitingdate} is a string or a DateTime.
537
539
538
this function returns the max pickup date (DateTime format).
540
    my $issuingrule = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $controlbranch );
539
(e.g. : the date after which the hold will be considered cancelled)
540
541
541
=cut
542
    my $date = ref $reserve->{waitingdate} eq 'DateTime'
543
        ? $reserve->{waitingdate}
544
        : dt_from_string $reserve->{waitingdate};
542
545
543
sub GetMaxPickupDate {
546
    my $holdspickupdelay = 0;
544
    my ( $item, $borrowernumber ) = @_;
547
    if ( defined($issuingrule)
545
    return unless $item->{waitingdate};
548
        and defined $issuingrule->{holdspickupdelay} ) {
549
        $holdspickupdelay = $issuingrule->{holdspickupdelay}
550
    }
546
551
547
    my $date = ref $item->{waitingdate} eq 'DateTime'
552
    $date->add( days => $holdspickupdelay );
548
        ? $item->{waitingdate}
549
        : dt_from_string $item->{waitingdate};
550
553
551
    my $delay  = GetMaxPickupDelay( $borrowernumber, $item );
552
    $date->add( days => $delay );
553
    return $date;
554
    return $date;
554
}
555
}
555
556
Lines 788-794 sub GetReservesToBranch { Link Here
788
sub GetReservesForBranch {
789
sub GetReservesForBranch {
789
    my ($frombranch) = @_;
790
    my ($frombranch) = @_;
790
    my $dbh          = C4::Context->dbh;
791
    my $dbh          = C4::Context->dbh;
791
	my $query        = "SELECT borrowernumber,reservedate,itemnumber,waitingdate
792
    my $query        = "SELECT borrowernumber,reservedate,itemnumber,waitingdate,maxpickupdate
792
        FROM   reserves 
793
        FROM   reserves 
793
        WHERE   priority='0'
794
        WHERE   priority='0'
794
            AND found='W' ";
795
            AND found='W' ";
Lines 961-975 sub CancelExpiredReserves { Link Here
961
    }
962
    }
962
963
963
    # Cancel reserves that have been waiting too long
964
    # Cancel reserves that have been waiting too long
964
    # FIXME The only way I see to do this job with the issuingrules.holdspickupdelay value would be to
965
    # get all reserves and to get the related borrower and item. So we could call GetMaxPickupDelay for each reserve.
966
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
965
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
967
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
968
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
966
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
969
967
970
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
968
        my $query = "SELECT * FROM reserves WHERE NOW() > maxpickupdate AND found = 'W' AND priority = 0";
971
        $sth = $dbh->prepare( $query );
969
        $sth = $dbh->prepare( $query );
972
        $sth->execute( $max_pickup_delay );
970
        $sth->execute();
973
971
974
        while (my $res = $sth->fetchrow_hashref ) {
972
        while (my $res = $sth->fetchrow_hashref ) {
975
            if ( $charge ) {
973
            if ( $charge ) {
Lines 1276-1284 sub ModReserveStatus { Link Here
1276
    my ($itemnumber, $newstatus) = @_;
1274
    my ($itemnumber, $newstatus) = @_;
1277
    my $dbh = C4::Context->dbh;
1275
    my $dbh = C4::Context->dbh;
1278
1276
1279
    my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0";
1277
    my $now = dt_from_string;
1278
    my $reserve = $dbh->selectrow_hashref(q{
1279
        SELECT *
1280
        FROM reserves
1281
        WHERE itemnumber = ?
1282
            AND found IS NULL
1283
            AND priority = 0
1284
    }, {}, $itemnumber);
1285
    return unless $reserve;
1286
1287
    my $maxpickupdate = GetMaxPickupDate( $reserve );
1288
    my $query = q{
1289
        UPDATE reserves
1290
        SET found = ?,
1291
            waitingdate = ?,
1292
            maxpickupdate = ?
1293
        WHERE itemnumber = ?
1294
            AND found IS NULL
1295
            AND priority = 0
1296
    };
1280
    my $sth_set = $dbh->prepare($query);
1297
    my $sth_set = $dbh->prepare($query);
1281
    $sth_set->execute( $newstatus, $itemnumber );
1298
    $sth_set->execute( $newstatus, $now, $maxpickupdate, $itemnumber );
1282
1299
1283
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1300
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1284
      CartToShelf( $itemnumber );
1301
      CartToShelf( $itemnumber );
Lines 1326-1346 sub ModReserveAffect { Link Here
1326
        WHERE borrowernumber = ?
1343
        WHERE borrowernumber = ?
1327
          AND biblionumber = ?
1344
          AND biblionumber = ?
1328
    ";
1345
    ";
1346
        $sth = $dbh->prepare($query);
1347
        $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1329
    }
1348
    }
1330
    else {
1349
    else {
1331
    # affect the reserve to Waiting as well.
1350
    # affect the reserve to Waiting as well.
1351
        my $maxpickupdate = GetMaxPickupDate({
1352
            waitingdate => dt_from_string,
1353
            itemnumber => $itemnumber,
1354
            borrowernumber => $borrowernumber
1355
        });
1332
        $query = "
1356
        $query = "
1333
            UPDATE reserves
1357
            UPDATE reserves
1334
            SET     priority = 0,
1358
            SET     priority = 0,
1335
                    found = 'W',
1359
                    found = 'W',
1336
                    waitingdate = NOW(),
1360
                    waitingdate = NOW(),
1361
                    maxpickupdate = ?,
1337
                    itemnumber = ?
1362
                    itemnumber = ?
1338
            WHERE borrowernumber = ?
1363
            WHERE borrowernumber = ?
1339
              AND biblionumber = ?
1364
              AND biblionumber = ?
1340
        ";
1365
        ";
1366
        $sth = $dbh->prepare($query);
1367
        $sth->execute( $maxpickupdate, $itemnumber, $borrowernumber,$biblionumber);
1341
    }
1368
    }
1342
    $sth = $dbh->prepare($query);
1343
    $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1344
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1369
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1345
1370
1346
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1371
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
Lines 1416-1421 sub GetReserveInfo { Link Here
1416
				   reserves.biblionumber, 
1441
				   reserves.biblionumber, 
1417
				   reserves.branchcode,
1442
				   reserves.branchcode,
1418
				   reserves.waitingdate,
1443
				   reserves.waitingdate,
1444
                   reserves.maxpickupdate,
1419
				   notificationdate, 
1445
				   notificationdate, 
1420
				   reminderdate, 
1446
				   reminderdate, 
1421
				   priority, 
1447
				   priority, 
Lines 1870-1875 sub _Findgroupreserve { Link Here
1870
               reserves.borrowernumber             AS borrowernumber,
1896
               reserves.borrowernumber             AS borrowernumber,
1871
               reserves.reservedate                AS reservedate,
1897
               reserves.reservedate                AS reservedate,
1872
               reserves.waitingdate                AS waitingdate,
1898
               reserves.waitingdate                AS waitingdate,
1899
               reserves.maxpickupdate              AS maxpickupdate,
1873
               reserves.branchcode                 AS branchcode,
1900
               reserves.branchcode                 AS branchcode,
1874
               reserves.cancellationdate           AS cancellationdate,
1901
               reserves.cancellationdate           AS cancellationdate,
1875
               reserves.found                      AS found,
1902
               reserves.found                      AS found,
Lines 2192-2198 sub RevertWaitingStatus { Link Here
2192
    SET
2219
    SET
2193
      priority = 1,
2220
      priority = 1,
2194
      found = NULL,
2221
      found = NULL,
2195
      waitingdate = NULL
2222
      waitingdate = NULL,
2223
      maxpickupdate = NULL
2196
    WHERE
2224
    WHERE
2197
      reserve_id = ?
2225
      reserve_id = ?
2198
    ";
2226
    ";
(-)a/admin/systempreferences.pl (-1 lines)
Lines 165-171 $tabsysprefs{printcirculationslips} = "Circulation"; Link Here
165
$tabsysprefs{ReturnBeforeExpiry}             = "Circulation";
165
$tabsysprefs{ReturnBeforeExpiry}             = "Circulation";
166
$tabsysprefs{SpecifyDueDate}                 = "Circulation";
166
$tabsysprefs{SpecifyDueDate}                 = "Circulation";
167
$tabsysprefs{AutomaticItemReturn}            = "Circulation";
167
$tabsysprefs{AutomaticItemReturn}            = "Circulation";
168
$tabsysprefs{ReservesMaxPickUpDelay}         = "Circulation";
169
$tabsysprefs{TransfersMaxDaysWarning}        = "Circulation";
168
$tabsysprefs{TransfersMaxDaysWarning}        = "Circulation";
170
$tabsysprefs{useDaysMode}                    = "Circulation";
169
$tabsysprefs{useDaysMode}                    = "Circulation";
171
$tabsysprefs{ReservesNeedReturns}            = "Circulation";
170
$tabsysprefs{ReservesNeedReturns}            = "Circulation";
(-)a/circ/circulation.pl (-3 / +2 lines)
Lines 367-375 if ($borrowernumber) { Link Here
367
        if ( $num_res->{'found'} eq 'W' ) {
367
        if ( $num_res->{'found'} eq 'W' ) {
368
            $getreserv{color}   = 'reserved';
368
            $getreserv{color}   = 'reserved';
369
            $getreserv{waiting} = 1;
369
            $getreserv{waiting} = 1;
370
            my $maxpickupdate = GetMaxPickupDate( $num_res, $borrowernumber );
370
            $getWaitingReserveInfo{maxpickupdate} = $num_res->{maxpickupdate};
371
            $getWaitingReserveInfo{maxpickupdate} = $maxpickupdate;
371
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
372
            $getreserv{maxpickupdate} = $maxpickupdate;
373
372
374
#     genarate information displaying only waiting reserves
373
#     genarate information displaying only waiting reserves
375
        $getWaitingReserveInfo{title}        = $getiteminfo->{'title'};
374
        $getWaitingReserveInfo{title}        = $getiteminfo->{'title'};
(-)a/circ/waitingreserves.pl (-3 / +2 lines)
Lines 104-112 foreach my $num (@getreserves) { Link Here
104
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
104
    my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} );  # using the fixed up itype/itemtype
105
105
106
    if ( $num->{waitingdate} ) {
106
    if ( $num->{waitingdate} ) {
107
        my $maxpickupdate = GetMaxPickupDate( $num, $borrowernumber );
107
        my $maxpickupdate = dt_from_string($num->{maxpickupdate});
108
        $getreserv{waitingdate} = $num->{waitingdate};
108
        $getreserv{waitingdate} = $num->{waitingdate};
109
        $getreserv{maxpickupdate} = $maxpickupdate;
109
        $getreserv{maxpickupdate} = $num->{maxpickupdate};
110
        if ( DateTime->compare( $today, $maxpickupdate ) == 1 ) {
110
        if ( DateTime->compare( $today, $maxpickupdate ) == 1 ) {
111
            if ($cancelall) {
111
            if ($cancelall) {
112
                my $res = cancel( $itemnumber, $borrowernumber, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
112
                my $res = cancel( $itemnumber, $borrowernumber, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
Lines 150-156 $template->param( Link Here
150
    overloop    => \@overloop,
150
    overloop    => \@overloop,
151
    overcount   => $overcount,
151
    overcount   => $overcount,
152
    show_date   => format_date(C4::Dates->today('iso')),
152
    show_date   => format_date(C4::Dates->today('iso')),
153
    dateformat  => C4::Context->preference("dateformat"),
154
);
153
);
155
154
156
if ($cancelall) {
155
if ($cancelall) {
(-)a/installer/data/mysql/kohastructure.sql (+2 lines)
Lines 1490-1495 CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b Link Here
1490
  `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
1490
  `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no)
1491
  `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1491
  `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1492
  `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
1492
  `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely)
1493
  `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup delay for this reserves
1493
  PRIMARY KEY (`reserve_id`),
1494
  PRIMARY KEY (`reserve_id`),
1494
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1495
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1495
  KEY `old_reserves_biblionumber` (`biblionumber`),
1496
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 1689-1694 CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha Link Here
1689
  `lowestPriority` tinyint(1) NOT NULL,
1690
  `lowestPriority` tinyint(1) NOT NULL,
1690
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1691
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1691
  `suspend_until` DATETIME NULL DEFAULT NULL,
1692
  `suspend_until` DATETIME NULL DEFAULT NULL,
1693
  `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup delay for this reserves
1692
  PRIMARY KEY (`reserve_id`),
1694
  PRIMARY KEY (`reserve_id`),
1693
  KEY priorityfoundidx (priority,found),
1695
  KEY priorityfoundidx (priority,found),
1694
  KEY `borrowernumber` (`borrowernumber`),
1696
  KEY `borrowernumber` (`borrowernumber`),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +19 lines)
Lines 6439-6448 if ( CheckVersion($DBversion) ) { Link Here
6439
6439
6440
$DBversion = "3.11.00.XXX";
6440
$DBversion = "3.11.00.XXX";
6441
if ( CheckVersion($DBversion) ) {
6441
if ( CheckVersion($DBversion) ) {
6442
    my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0;
6443
    $dbh->do(q{
6444
        DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay';
6445
    });
6442
    $dbh->do(qq{
6446
    $dbh->do(qq{
6443
        ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed;
6447
        ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed;
6444
    });
6448
    });
6445
    print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupdelay)\n";
6449
    my $sth = $dbh->prepare(q{
6450
        UPDATE issuingrules SET holdspickupdelay = ?
6451
    });
6452
    $sth->execute( $maxpickupdelay );
6453
    $dbh->do(q{
6454
        ALTER TABLE reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until;
6455
    });
6456
    $sth = $dbh->prepare(q{
6457
        UPDATE reserves SET maxpickupdate = ADDDATE(waitingdate, INTERVAL ? DAY);
6458
    });
6459
    $sth->execute( $maxpickupdelay );
6460
    $dbh->do(q{
6461
        ALTER TABLE old_reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until;
6462
    });
6463
    print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupdelay and reserves.maxpickupdate. Delete the ReservesMaxPickUpDelay syspref)\n";
6446
    SetVersion($DBversion);
6464
    SetVersion($DBversion);
6447
}
6465
}
6448
6466
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-6 / +1 lines)
Lines 358-373 Circulation: Link Here
358
                  PatronLibrary: "patron's home library"
358
                  PatronLibrary: "patron's home library"
359
            - to see if the patron can place a hold on the item.    
359
            - to see if the patron can place a hold on the item.    
360
        -
360
        -
361
            - Mark a hold as problematic if it has been waiting for more than
362
            - pref: ReservesMaxPickUpDelay
363
              class: integer
364
            - days.
365
        -
366
            - pref: ExpireReservesMaxPickUpDelay
361
            - pref: ExpireReservesMaxPickUpDelay
367
              choices:
362
              choices:
368
                  yes: Allow
363
                  yes: Allow
369
                  no: "Don't allow"
364
                  no: "Don't allow"
370
            - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay"
365
            - "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"
371
        -
366
        -
372
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
367
            - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of
373
            - pref: ExpireReservesMaxPickUpDelayCharge
368
            - pref: ExpireReservesMaxPickUpDelayCharge
(-)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.</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.10/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.10/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 628-634 function validate1(date) { Link Here
628
            </td>
628
            </td>
629
            <td>[% reservloo.itemcallnumber %]</td>
629
            <td>[% reservloo.itemcallnumber %]</td>
630
            <td>[% IF ( reservloo.waiting ) %]
630
            <td>[% IF ( reservloo.waiting ) %]
631
                <em>Item is <strong>waiting</strong> until [% reservloo.maxpickupdate %]</em>
631
                <em>Item is <strong>waiting</strong>[% IF reservloo.maxpickupdate %] until [% reservloo.maxpickupdate %][% END %]</em>
632
                [% END %]
632
                [% END %]
633
                [% IF ( reservloo.transfered ) %]
633
                [% IF ( reservloo.transfered ) %]
634
                <em>Item <strong>in transit</strong> from
634
                <em>Item <strong>in transit</strong> from
(-)a/members/moremember.pl (-1 / +1 lines)
Lines 292-298 if ($borrowernumber) { Link Here
292
        if ( $num_res->{'found'} eq 'W' ) {
292
        if ( $num_res->{'found'} eq 'W' ) {
293
            $getreserv{color}   = 'reserved';
293
            $getreserv{color}   = 'reserved';
294
            $getreserv{waiting} = 1;
294
            $getreserv{waiting} = 1;
295
            $getreserv{maxpickupdate} = GetMaxPickupDate( $num_res, $borrowernumber );
295
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
296
        }
296
        }
297
297
298
        # 		check transfers with the itemnumber foud in th reservation loop
298
        # 		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 lines)
Lines 261-267 foreach my $res (@reserves) { Link Here
261
    $res->{$publictype} = 1;
261
    $res->{$publictype} = 1;
262
    if ( $res->{found} eq 'W' ) {
262
    if ( $res->{found} eq 'W' ) {
263
        $res->{waiting} = 1;
263
        $res->{waiting} = 1;
264
        $res->{maxpickupdate} = GetMaxPickupDate( $res, $borrowernumber );
265
    }
264
    }
266
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
265
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
267
    my $biblioData = GetBiblioData($res->{'biblionumber'});
266
    my $biblioData = GetBiblioData($res->{'biblionumber'});
268
- 

Return to bug 8367