Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
bibliossimo
opacce
Commits
b648a748
Commit
b648a748
authored
Jan 06, 2018
by
Laurent
Browse files
hotline #66376 display overlapsed openings 30 days before validity start
parent
51561674
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
11 deletions
+45
-11
VERSIONS_HOTLINE/66376
VERSIONS_HOTLINE/66376
+1
-0
library/Class/Ouverture.php
library/Class/Ouverture.php
+11
-0
library/Class/Ouverture/Visitor.php
library/Class/Ouverture/Visitor.php
+1
-2
library/ZendAfi/View/Helper/LibraryOpenings.php
library/ZendAfi/View/Helper/LibraryOpenings.php
+3
-6
tests/application/modules/opac/controllers/BibControllerTest.php
...pplication/modules/opac/controllers/BibControllerTest.php
+29
-3
No files found.
VERSIONS_HOTLINE/66376
0 → 100644
View file @
b648a748
- ticket #66376 : Les dates d'ouvertures exceptionnelles s'affichent 30 jours avant la date de début, même si des périodes de validité se superposent
\ No newline at end of file
library/Class/Ouverture.php
View file @
b648a748
...
...
@@ -236,6 +236,17 @@ class Class_Ouverture extends Storm_Model_Abstract {
}
public
function
isValidDuring
(
$from
,
$to
)
{
if
(
$this
->
isValidOnDate
(
$from
)
||
$this
->
isValidOnDate
(
$to
))
return
true
;
$time_start
=
strtotime
(
$this
->
getValidityStart
());
$time_end
=
strtotime
(
$this
->
getValidityEnd
());
return
(
$from
<=
$time_start
&&
$time_end
<=
$to
);
}
public
function
isExceptionalOpenOnDate
(
$date
)
{
return
$this
->
isExceptional
()
&&
(
!
$this
->
isClosure
())
...
...
library/Class/Ouverture/Visitor.php
View file @
b648a748
...
...
@@ -118,8 +118,7 @@ class Class_Ouverture_Visitor {
return
$now
<=
$opening_day
&&
$now_plus_30
>=
$opening_day
;
}
return
$opening
->
isValidOnDate
(
$now
)
||
$opening
->
isValidOnDate
(
$now_plus_30
);
return
$opening
->
isValidDuring
(
$now
,
$now_plus_30
);
}
...
...
library/ZendAfi/View/Helper/LibraryOpenings.php
View file @
b648a748
...
...
@@ -71,12 +71,9 @@ class ZendAfi_View_Helper_LibraryOpenings extends ZendAfi_View_Helper_BaseHelper
protected
function
_renderPeriods
(
$periodical
)
{
if
(
!
$periodical
)
return
''
;
return
(
$periodical
)
?
$this
->
_renderPeriod
(
current
(
$periodical
))
:
''
;
return
implode
(
''
,
array_map
([
$this
,
'_renderPeriod'
],
$periodical
));
}
...
...
tests/application/modules/opac/controllers/BibControllerTest.php
View file @
b648a748
...
...
@@ -409,6 +409,25 @@ class BibControllerBibViewAnnecyTest extends BibControllerBibViewTestCase {
'id_site'
=>
4
,
'jour_semaine'
=>
Class_Ouverture
::
LUNDI
]);
$this
->
fixture
(
'Class_Ouverture'
,
[
'id'
=>
20
,
'id_site'
=>
4
,
'jour_semaine'
=>
Class_Ouverture
::
MARDI
]);
$this
->
fixture
(
'Class_Ouverture'
,
[
'id'
=>
21
,
'id_site'
=>
4
,
'label'
=>
'Horaires réduits'
,
'jour_semaine'
=>
Class_Ouverture
::
MARDI
,
'debut_matin'
=>
'00:00'
,
'fin_matin'
=>
'00:00'
,
'debut_apres_midi'
=>
'15:00'
,
'fin_apres_midi'
=>
'17:00'
,
'validity_start'
=>
'2016-07-01'
,
'validity_end'
=>
'2016-07-20'
]);
$this
->
fixture
(
'Class_Ouverture'
,
[
'id'
=>
2
,
'id_site'
=>
4
,
...
...
@@ -536,9 +555,16 @@ class BibControllerBibViewAnnecyTest extends BibControllerBibViewTestCase {
/** @test */
public
function
openingsShouldNotContainsSecondPeriodLabel
()
{
$this
->
assertNotXPathContentContains
(
'//div[contains(@class, "library_schedule")]//h3'
,
'du samedi 02 au dimanche 03 juillet 2016'
);
public
function
openingsShouldContainsSecondPeriodLabel
()
{
$this
->
assertXPathContentContains
(
'//div[contains(@class, "library_schedule")]//h3'
,
'du samedi 02 au dimanche 03 juillet 2016'
);
}
/** @test */
public
function
openingsShouldContainsHorairesReduits
()
{
$this
->
assertXPathContentContains
(
'//div[contains(@class, "library_schedule")]//h3'
,
'Horaires réduits du vendredi 01 au mercredi 20 juillet 2016'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment