Bug 8045: fixes "date due" when checking in

Added cloning of object parameters in "days_between" method.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

Checked in items that were overdue, due in the future and not
checked out and all showed the right info in the check in
table.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Adrien Saurat 2012-05-07 16:11:11 +02:00 committed by Paul Poulain
parent e8ad24ca78
commit f1b3f46de5

View file

@ -169,13 +169,16 @@ sub days_between {
my $start_dt = shift;
my $end_dt = shift;
my $datestart_temp = $start_dt->clone();
my $dateend_temp = $end_dt->clone();
# start and end should not be closed days
my $duration = $end_dt->delta_days($start_dt);
$start_dt->truncate( to => 'days' );
$end_dt->truncate( to => 'days' );
while ( DateTime->compare( $start_dt, $end_dt ) == -1 ) {
$start_dt->add( days => 1 );
if ( $self->is_holiday($start_dt) ) {
my $duration = $dateend_temp->delta_days($datestart_temp);
$datestart_temp->truncate( to => 'days' );
$dateend_temp->truncate( to => 'days' );
while ( DateTime->compare( $datestart_temp, $dateend_temp ) == -1 ) {
$datestart_temp->add( days => 1 );
if ( $self->is_holiday($datestart_temp) ) {
$duration->subtract( days => 1 );
}
}