SET @id_table_cmlv = '112';
SET @id_admin = '1';
SET @ip_admin = '162.38.234.1';
SET @id_meta = '';
SET @enrg = '';
#+--------------------------------------------------------------------------------------------------------------------+#
# MODIFICATION ONTOLOGIE
SET @id_etat_modif = '2';

# Mise à jour des abréviations de la liste 40 id 1043
SET @notes = 'Remplacement de l''abréviation numérique par un code.';

SET @id_valeur = '2246';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'PH', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2247';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'GY', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2248';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'AN', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2249';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'CR', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2250';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'AL', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2251';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'CH', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2252';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'LI', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2253';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'BR', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

SET @id_valeur = '2254';
INSERT INTO tb_coel.coel_meta_historique_ligne (cmhl_ce_table, cmhl_cle_ligne, cmhl_enregistrement, cmhl_date_modification, cmhl_notes, cmhl_ce_modifier_par, cmhl_ce_etat ,cmhl_ip) 
	VALUES	(@id_table_cmlv, @id_valeur, NULL , NOW( ) , @notes, @id_admin, @id_etat_modif, @ip_admin);
SELECT @id_meta := cmhl_id_historique_ligne, cmhl_date_modification FROM tb_coel.coel_meta_historique_ligne WHERE cmhl_ce_table = CONVERT(@id_table_cmlv USING utf8) AND cmhl_cle_ligne = CONVERT(@id_valeur USING utf8) ORDER BY cmhl_date_modification DESC LIMIT 1;
UPDATE tb_coel.coel_meta_liste_valeur SET 
	cmlv_abreviation = 'PT', 
	cmlv_ce_meta = @id_meta 
	WHERE cmlv_id_valeur = @id_valeur;
SELECT @enrg := CONCAT('<?xml version="1.0" encoding="UTF-8" ?>\n<resultset>\n',
	'<row>\n', 
	'<cmlv_id_valeur>', cmlv_id_valeur, '</cmlv_id_valeur>\n', 
	'<cmlv_ce_parent>', cmlv_ce_parent, '</cmlv_ce_parent>\n', 
	'<cmlv_ce_projet>', cmlv_ce_projet, '</cmlv_ce_projet>\n',
	'<cmlv_nom>', cmlv_nom, '</cmlv_nom>\n',
	'<cmlv_abreviation>', cmlv_abreviation, '</cmlv_abreviation>\n',
	'<cmlv_description>', cmlv_description, '</cmlv_description>\n',
	'<cmlv_ce_meta>', cmlv_ce_meta, '</cmlv_ce_meta>\n',
	'</row>\n',
	'</resultset>') AS xmldoc 
	FROM tb_coel.coel_meta_liste_valeur
	WHERE cmlv_id_valeur = @id_valeur;
UPDATE tb_coel.coel_meta_historique_ligne SET 
	cmhl_enregistrement = @enrg
	WHERE cmhl_id_historique_ligne = @id_meta;

#+--------------------------------------------------------------------------------------------------------------------+#
# MODIFICATION PUBLICATION
ALTER TABLE tb_coel.coel_publication CHANGE 
	`cpu_date_parution` `cpu_date_parution` VARCHAR( 10 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 
	COMMENT 'Année(s) de parution de la publication. Formats acceptés : AAAA-MM-JJ ou AAAA ou AAAA-AAAA.'
