Skip to content
Snippets Groups Projects
Commit 554c5ebb authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

hotline #121319 Drive : fix opening search when all openings have validity start but no end

parent 259bb686
Branches
Tags
1 merge request!3721hotline #121319 Drive : fix opening search when all openings have validity start but no end
Pipeline #11584 failed with stage
in 46 minutes and 16 seconds
- ticket #121319 : Drive : correction de la prise de rendez-vous lorsque le drive ne commence que la semaine suivante
\ No newline at end of file
......@@ -295,7 +295,9 @@ class Class_Ouverture extends Storm_Model_Abstract {
public function isValidOnDate($time) {
$time_start = strtotime($this->getValidityStart());
$time_end = strtotime($this->getValidityEnd() . ' +1 day');
$time_end = $this->getValidityEnd()
? strtotime($this->getValidityEnd() . ' +1 day')
: 0;
if (($time_start <= 0) && ($time_end <= 0))
return true;
......@@ -303,7 +305,7 @@ class Class_Ouverture extends Storm_Model_Abstract {
if (($time_start > 0) && ($time_end > 0))
return ($time_start <= $time) && ($time_end >= $time);
if($time_end > 0)
if ($time_end > 0)
return $time <= $time_end;
return $time >= $time_start;
......
......@@ -340,6 +340,42 @@ class DriveCheckOutBookingPlanWithoutHoldCheckTest extends DriveCheckOutBookingT
class DriveCheckOutBookingPlanOnBibWithDriveStartingNextWeekTest extends DriveCheckOutBookingTestCase {
public function setUp() {
parent::setUp();
CLass_AdminVar::set('DRIVE_DISABLE_HOLD_CHECK',1);
$this->fixture('Class_Bib',
['id' => 5,
'enable_drive' => 1,
'libelle' => 'Superdrive',
'ouvertures' => [
Class_Ouverture::chaqueSamedi('10:00', '12:00', '12:00', '15:00')
->setValidityStart('2020-11-17')
->beDrive()] ]);
$timesource = new TimeSourceForTest('2020-11-10 11:30');
Class_DriveCheckout_Plan::setTimeSource($timesource);
Class_DriveCheckout::setTimeSource($timesource);
$this->dispatch('/opac/drive-checkout/plan/id_bib/5');
}
/** @test */
public function selectedLibraryShouldContainsSuperdrive() {
$this->assertXPathContentContains('//div[contains(@class, "card-title")]', 'Superdrive');
}
/** @test */
public function pageShouldContainsLinkToChoose2020_11_21() {
$this->assertXPathContentContains('//a[contains(@href, "/checkout_date/2020-11-21")]',
'sam. 21 nov');
}
}
class DriveCheckOutBookingPlanWithFuturExistingTest extends DriveCheckOutBookingTestCase {
public function setUp() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment