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 (-54 / +82 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-559 sub CanItemBeReserved{ Link Here
502
    }
506
    }
503
}
507
}
504
508
505
=item GetMaxPickupDelay
509
=head2 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
556
=item GetReservesControlBranch
557
=head2 GetReservesControlBranch
557
558
558
$branchcode = &GetReservesControlBranch($borrower, $item)
559
$branchcode = &GetReservesControlBranch($borrower, $item)
559
560
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 985-999 sub CancelExpiredReserves { Link Here
985
    }
986
    }
986
987
987
    # Cancel reserves that have been waiting too long
988
    # Cancel reserves that have been waiting too long
988
    # FIXME The only way I see to do this job with the issuingrules.holdspickupdelay value would be to
989
    # get all reserves and to get the related borrower and item. So we could call GetMaxPickupDelay for each reserve.
990
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
989
    if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) {
991
        my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
992
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
990
        my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge");
993
991
994
        my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0";
992
        my $query = "SELECT * FROM reserves WHERE NOW() > maxpickupdate AND found = 'W' AND priority = 0";
995
        $sth = $dbh->prepare( $query );
993
        $sth = $dbh->prepare( $query );
996
        $sth->execute( $max_pickup_delay );
994
        $sth->execute();
997
995
998
        while (my $res = $sth->fetchrow_hashref ) {
996
        while (my $res = $sth->fetchrow_hashref ) {
999
            if ( $charge ) {
997
            if ( $charge ) {
Lines 1300-1308 sub ModReserveStatus { Link Here
1300
    my ($itemnumber, $newstatus) = @_;
1298
    my ($itemnumber, $newstatus) = @_;
1301
    my $dbh = C4::Context->dbh;
1299
    my $dbh = C4::Context->dbh;
1302
1300
1303
    my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0";
1301
    my $now = dt_from_string;
1302
    my $reserve = $dbh->selectrow_hashref(q{
1303
        SELECT *
1304
        FROM reserves
1305
        WHERE itemnumber = ?
1306
            AND found IS NULL
1307
            AND priority = 0
1308
    }, {}, $itemnumber);
1309
    return unless $reserve;
1310
1311
    my $maxpickupdate = GetMaxPickupDate( $reserve );
1312
    my $query = q{
1313
        UPDATE reserves
1314
        SET found = ?,
1315
            waitingdate = ?,
1316
            maxpickupdate = ?
1317
        WHERE itemnumber = ?
1318
            AND found IS NULL
1319
            AND priority = 0
1320
    };
1304
    my $sth_set = $dbh->prepare($query);
1321
    my $sth_set = $dbh->prepare($query);
1305
    $sth_set->execute( $newstatus, $itemnumber );
1322
    $sth_set->execute( $newstatus, $now, $maxpickupdate, $itemnumber );
1306
1323
1307
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1324
    if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) {
1308
      CartToShelf( $itemnumber );
1325
      CartToShelf( $itemnumber );
Lines 1350-1370 sub ModReserveAffect { Link Here
1350
        WHERE borrowernumber = ?
1367
        WHERE borrowernumber = ?
1351
          AND biblionumber = ?
1368
          AND biblionumber = ?
1352
    ";
1369
    ";
1370
        $sth = $dbh->prepare($query);
1371
        $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1353
    }
1372
    }
1354
    else {
1373
    else {
1355
    # affect the reserve to Waiting as well.
1374
    # affect the reserve to Waiting as well.
1375
        my $maxpickupdate = GetMaxPickupDate({
1376
            waitingdate => dt_from_string,
1377
            itemnumber => $itemnumber,
1378
            borrowernumber => $borrowernumber
1379
        });
1356
        $query = "
1380
        $query = "
1357
            UPDATE reserves
1381
            UPDATE reserves
1358
            SET     priority = 0,
1382
            SET     priority = 0,
1359
                    found = 'W',
1383
                    found = 'W',
1360
                    waitingdate = NOW(),
1384
                    waitingdate = NOW(),
1385
                    maxpickupdate = ?,
1361
                    itemnumber = ?
1386
                    itemnumber = ?
1362
            WHERE borrowernumber = ?
1387
            WHERE borrowernumber = ?
1363
              AND biblionumber = ?
1388
              AND biblionumber = ?
1364
        ";
1389
        ";
1390
        $sth = $dbh->prepare($query);
1391
        $sth->execute( $maxpickupdate, $itemnumber, $borrowernumber,$biblionumber);
1365
    }
1392
    }
1366
    $sth = $dbh->prepare($query);
1367
    $sth->execute( $itemnumber, $borrowernumber,$biblionumber);
1368
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1393
    _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf );
1369
1394
1370
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
1395
    if ( C4::Context->preference("ReturnToShelvingCart") ) {
Lines 1440-1445 sub GetReserveInfo { Link Here
1440
				   reserves.biblionumber, 
1465
				   reserves.biblionumber, 
1441
				   reserves.branchcode,
1466
				   reserves.branchcode,
1442
				   reserves.waitingdate,
1467
				   reserves.waitingdate,
1468
                   reserves.maxpickupdate,
1443
				   notificationdate, 
1469
				   notificationdate, 
1444
				   reminderdate, 
1470
				   reminderdate, 
1445
				   priority, 
1471
				   priority, 
Lines 1894-1899 sub _Findgroupreserve { Link Here
1894
               reserves.borrowernumber             AS borrowernumber,
1920
               reserves.borrowernumber             AS borrowernumber,
1895
               reserves.reservedate                AS reservedate,
1921
               reserves.reservedate                AS reservedate,
1896
               reserves.waitingdate                AS waitingdate,
1922
               reserves.waitingdate                AS waitingdate,
1923
               reserves.maxpickupdate              AS maxpickupdate,
1897
               reserves.branchcode                 AS branchcode,
1924
               reserves.branchcode                 AS branchcode,
1898
               reserves.cancellationdate           AS cancellationdate,
1925
               reserves.cancellationdate           AS cancellationdate,
1899
               reserves.found                      AS found,
1926
               reserves.found                      AS found,
Lines 2209-2215 sub RevertWaitingStatus { Link Here
2209
    SET
2236
    SET
2210
      priority = 1,
2237
      priority = 1,
2211
      found = NULL,
2238
      found = NULL,
2212
      waitingdate = NULL
2239
      waitingdate = NULL,
2240
      maxpickupdate = NULL,
2213
    WHERE
2241
    WHERE
2214
      reserve_id = ?
2242
      reserve_id = ?
2215
    ";
2243
    ";
(-)a/circ/circulation.pl (-3 / +2 lines)
Lines 373-381 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
            my $maxpickupdate = GetMaxPickupDate( $num_res, $borrowernumber );
376
            $getWaitingReserveInfo{maxpickupdate} = $num_res->{maxpickupdate};
377
            $getWaitingReserveInfo{maxpickupdate} = $maxpickupdate;
377
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
378
            $getreserv{maxpickupdate} = $maxpickupdate;
379
378
380
#     genarate information displaying only waiting reserves
379
#     genarate information displaying only waiting reserves
381
        $getWaitingReserveInfo{title}        = $getiteminfo->{'title'};
380
        $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 1591-1596 CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b Link Here
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
  `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (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` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no)
1593
  `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
1594
  PRIMARY KEY (`reserve_id`),
1595
  PRIMARY KEY (`reserve_id`),
1595
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1596
  KEY `old_reserves_borrowernumber` (`borrowernumber`),
1596
  KEY `old_reserves_biblionumber` (`biblionumber`),
1597
  KEY `old_reserves_biblionumber` (`biblionumber`),
Lines 1790-1795 CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha Link Here
1790
  `lowestPriority` tinyint(1) NOT NULL,
1791
  `lowestPriority` tinyint(1) NOT NULL,
1791
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1792
  `suspend` BOOLEAN NOT NULL DEFAULT 0,
1792
  `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
1793
  PRIMARY KEY (`reserve_id`),
1795
  PRIMARY KEY (`reserve_id`),
1794
  KEY priorityfoundidx (priority,found),
1796
  KEY priorityfoundidx (priority,found),
1795
  KEY `borrowernumber` (`borrowernumber`),
1797
  KEY `borrowernumber` (`borrowernumber`),
(-)a/installer/data/mysql/updatedatabase.pl (-5 / +19 lines)
Lines 7011-7029 CREATE TABLE IF NOT EXISTS borrower_files ( Link Here
7011
}
7011
}
7012
7012
7013
7013
7014
7015
7016
7017
$DBversion = "3.11.00.XXX";
7014
$DBversion = "3.11.00.XXX";
7018
if ( CheckVersion($DBversion) ) {
7015
if ( CheckVersion($DBversion) ) {
7016
    my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0;
7017
    $dbh->do(q{
7018
        DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay';
7019
    });
7019
    $dbh->do(qq{
7020
    $dbh->do(qq{
7020
        ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed;
7021
        ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed;
7021
    });
7022
    });
7022
    print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupdelay)\n";
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";
7023
    SetVersion($DBversion);
7038
    SetVersion($DBversion);
7024
}
7039
}
7025
7040
7026
7027
=head1 FUNCTIONS
7041
=head1 FUNCTIONS
7028
7042
7029
=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/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> until [% reservloo.maxpickupdate %]</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/members/moremember.pl (-1 / +1 lines)
Lines 285-291 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} = GetMaxPickupDate( $num_res, $borrowernumber );
288
            $getreserv{maxpickupdate} = $num_res->{maxpickupdate};
289
        }
289
        }
290
290
291
        # 		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 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