/** * Check if exist chapter associated to the current referentiel * * @return string */ public function checkIfAssociatedChapterExist() { $return = ""; $search = new \SearchDoc("", "COGIP_AUDIT_CHAPITRE"); $search->addFilter("%s = '%d'", \Dcp\AttributeIdentifiers\COGIP_AUDIT_CHAPITRE::cac_ref, $this->getPropertyValue("initid")); $search->setSlice(1); $nb = $search->onlyCount(); if ($nb > 0) { $return = ___("You have to delete all associated chapter before delete the ref", "COGIP_AUDIT:REFERENTIEL"); } return $return; }
public function checkAssociatedFNC() { //Search in the FNC $searchDoc = new \SearchDoc("", \Dcp\Family\Cogip_audit_fnc::familyName); //If you find one FNC it's enough (speed the search) $searchDoc->setSlice(1); $searchDoc->addFilter("%s = '%d'", \Dcp\AttributeIdentifiers\Cogip_audit_fnc::caf_audit, $this->doc->getPropertyValue("initid")); $searchDoc->addFilter("state <> '%s'", COGIP_AUDIT_FNC__WFL::e_clos); if ($searchDoc->onlyCount() > 0) { return _("coa:You have to close all FNC before change state"); } return ""; }