1 |
mbideau |
9470 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 20/08/2020 15:43 |
4 |
|
|
|
5 |
|
|
require_once "../gen/obj/commune.class.php"; |
6 |
|
|
|
7 |
|
|
class commune extends commune_gen { |
8 |
|
|
|
9 |
mbideau |
9494 |
/** |
10 |
|
|
* Retourne 'true' si une commune est archivée au moment spécifié (hors dates de validité) |
11 |
|
|
* |
12 |
|
|
* @param object $refDT (optionel) Un temps de référence pour la comparaison |
13 |
|
|
* |
14 |
|
|
* @return bool |
15 |
|
|
*/ |
16 |
|
|
public function archivee(object $refDT = null) : bool { |
17 |
|
|
if (empty($refDT)) { |
18 |
|
|
$refDT = new DateTime(); |
19 |
|
|
} |
20 |
|
|
if ($refDT < (new DateTime($this->getVal('validite_debut')))) { |
21 |
|
|
return true; |
22 |
|
|
} |
23 |
|
|
if (!empty($this->getVal('validite_fin'))) { |
24 |
|
|
if ($refDT > (new DateTime($this->getVal('validite_fin')))) { |
25 |
|
|
return true; |
26 |
|
|
} |
27 |
|
|
} |
28 |
|
|
return false; |
29 |
|
|
} |
30 |
mbideau |
9470 |
} |