public function import() { global $msg; $this->num_origin = origin::import("authorities", $this->notice->common_data['source']); //on commence par regarder si le numéro d'autorité est présent dans la table authorities_sources... if ($this->notice->common_data['authority_number']) { $query = "select num_authority from authorities_sources where authority_number = '" . $this->notice->common_data['authority_number'] . "' and authority_type = '" . $this->notice->type . "' and num_origin_authority = " . $this->num_origin; $result = mysql_query($query); if (mysql_num_rows($result)) { //existe dans la table authority_source $row = mysql_fetch_object($result); $id_authority = $row->num_authority; } if ($id_authority == 0) { //existe pas, on regarde si l'autorité existe dans PMB $id_authority = $this->notice->check_if_exists($this->notice->specifics_data); } } if ($id_authority != 0) { //on regarde si l'autorité PMB est déjà importée dans un autre source authorities_sources $query = "select * from authorities_sources where num_authority = " . $id_authority . " and authority_type= '" . $this->notice->type . "' and authority_favorite = 1 and num_origin_authority != " . $this->num_origin; $result = mysql_query($query); if (mysql_num_rows($result)) { //déjà importée avec une autre source, on la sépare $this->split_authority($id_authority); } else { //jamais citée, on la met à jour $this->update_authority($id_authority); } } else { $this->create_authority(); } if ($this->authority_id != 0 && $this->create_link != 0) { $this->import_link(); } }