/** * @see parent::check() */ function check() { parent::check(); $this->completeField("domain_id", "object_class", "group_id"); // Recherche si on a pas déjà un établissement du domaine pour un type d'objet différent $ljoin = array("domain" => "domain.domain_id = group_domain.domain_id"); $group_domain = new CGroupDomain(); // Recherche si on a un établissement du domaine déjà en master avec le même type d'objet et le même établissement if ($this->master) { $where = array("master" => " = '1'", "object_class" => " = '{$this->object_class}'", "group_id" => " = '{$this->group_id}'", "domain.active" => " = '1'"); if ($group_domain->countList($where, null, $ljoin) > 0) { return "CGroupDomain-master_already_exist"; } } $where = array("domain.domain_id" => " = '{$this->domain_id}'", "incrementer_id" => "IS NOT NULL", "object_class" => " != '{$this->object_class}'", "domain.active" => " = '1'"); if ($group_domain->countList($where, null, $ljoin) > 0) { return "CGroupDomain-object_class_already_exist"; } }