function store() { $this->updatePlainFields(); if (!$this->_no_synchro) { $service = $this->getService(); $where = array(); $where["date"] = $this->_spec->ds->prepare("= %", $this->date); $where["service_id"] = $this->_spec->ds->prepare("= %", $service->_id); $where["typerepas_id"] = $this->_spec->ds->prepare("= %", $this->typerepas_id); $validationrepas = new CValidationRepas(); $validationrepas->loadObject($where); if ($validationrepas->validationrepas_id) { $validationrepas->modif = 1; $validationrepas->store(); $this->modif = 1; } } return parent::store(); }
function validationRepas($date, $listTypeRepas = null) { $this->_ref_validrepas[$date] = array(); $validation =& $this->_ref_validrepas[$date]; if (!$listTypeRepas) { $listTypeRepas = new CTypeRepas(); $order = "debut, fin, nom"; $listTypeRepas = $listTypeRepas->loadList(null, $order); } $where = array(); $where["date"] = $this->_spec->ds->prepare(" = %", $date); $where["service_id"] = $this->_spec->ds->prepare(" = %", $this->service_id); foreach ($listTypeRepas as $keyType => $typeRepas) { $where["typerepas_id"] = $this->_spec->ds->prepare("= %", $keyType); $validrepas = new CValidationRepas(); $validrepas->loadObject($where); $validation[$keyType] = $validrepas; } }