$row["source_id"], 'name' => utf8_normalize($row["name"]), 'comment' => utf8_normalize($row["comment"]), ); } return $result; } public function rec_record($source_id, $record) { global $charset,$base_path, $dbh; $record = charset_pmb_normalize($record); $n_header = array(); foreach($record["header"] as $aheader_field) { switch($aheader_field["name"]) { case "rs": $n_header["rs"] = $aheader_field["value"]; break; case "ru": $n_header["ru"] = $aheader_field["value"]; break; case "el": $n_header["el"] = $aheader_field["value"]; break; case "bl": $n_header["bl"] = $aheader_field["value"]; break; case "hl": $n_header["hl"] = $aheader_field["value"]; break; case "dt": $n_header["dt"] = $aheader_field["value"]; break; default: break; } } $ref = md5(print_r($record, true)); //Suppression d'un éventuel doublon $requete="delete from entrepot_source_".$source_id." where ref='".addslashes($ref)."'"; pmb_mysql_query($requete, $dbh); $requete="delete from external_count where recid='".addslashes("agnostic ".$source_id." ".$ref)."' and source_id = ".$source_id; pmb_mysql_query($requete, $dbh); //Récupération d'un ID $requete="insert into external_count (recid, source_id) values('".addslashes("agnostic ".$source_id." ".$ref)."', ".$source_id.")"; $rid=pmb_mysql_query($requete, $dbh); if ($rid) $recid=pmb_mysql_insert_id(); if (!$recid) return false; $date_import=date( 'Y-m-d H:i:s',time()); $ufield=""; $usubfield=""; $field_order=0; $subfield_order=0; $value=""; foreach($n_header as $hc=>$code) { $requete="insert into entrepot_source_".$source_id." (connector_id,source_id,ref,date_import,ufield,usubfield,field_order,subfield_order,value,i_value,recid) values( '".addslashes('agnostic')."',".$source_id.",'".addslashes($ref)."','".addslashes($date_import)."', '".$hc."','',0,0,'".addslashes($code)."','',$recid)"; pmb_mysql_query($requete, $dbh); } for ($i=0; $irec_record($source_id, $notice); return array("notice" => $notice); } } ?>