20,6 → 20,8 |
private $recapitulatifAdmin = []; |
private $messageRecapitulatif = null; |
|
private $dateRenvoi = null; |
|
private $observations_concernees = array(); |
private $messageHtml = null; |
private $messageTxt = null; |
32,6 → 34,7 |
public function executer() { |
try { |
$this->verifierModeUtilisation(); |
$this->verifierDateRenvoi(); |
$observations = $this->chargerObsADeterminer(); |
if (!empty($observations)) { |
$this->formaterObservations($observations); |
55,8 → 58,21 |
} |
} |
|
private function verifierDateRenvoi() { |
$dateRenvoi = $this->conteneur->getParametre('d'); |
if ($dateRenvoi) { |
if (preg_match('/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/', $dateRenvoi)) { |
$this->dateRenvoi = $dateRenvoi; |
} else { |
$msg = "Veuillez indiquer une date au format yyyy-mm-dd valide à la suite du paramètre «-d»."; |
new Exception($msg); |
} |
} |
} |
|
protected function chargerObsADeterminer() { |
//TODO: optimiser la requête si beaucoup de mails sont envoyés |
$date = ($this->dateRenvoi == null) ? 'CURDATE()' : "'$this->dateRenvoi'"; |
$requete = "SELECT * ". |
"FROM del_obs_image AS doi ". |
" INNER JOIN del_observation AS do ON doi.id_observation = do.id_observation ". |
65,9 → 81,9 |
' OR nom_sel IS NULL OR nom_sel = "" '. |
' OR nom_ret IS NULL OR nom_ret = "") '. |
' AND ('. |
' do.date_transmission > DATE_SUB(CURDATE(), INTERVAL 1 DAY) '. |
' OR do.date_creation > DATE_SUB(CURDATE(), INTERVAL 1 DAY) '. |
' OR do.date_modification > DATE_SUB(CURDATE(), INTERVAL 1 DAY) '. |
" do.date_transmission > DATE_SUB($date, INTERVAL 1 DAY) ". |
" OR do.date_creation > DATE_SUB($date, INTERVAL 1 DAY) ". |
" OR do.date_modification > DATE_SUB($date, INTERVAL 1 DAY) ". |
' ) '. |
"ORDER BY do.id_observation "; |
$obs = $this->conteneur->getBdd()->recupererTous($requete); |