<?php
require_once("../../base/php/startSession.php");
require_once("../../base/php//classDatabase.php");
require_once("../../base/php/Functions.php" );
require_once("../../base/php/WebAppLog.php");
require_once("../../outils/php/httpService_cacheManager_cleanCache.php");
require_once("../../base/php/Environnement.php");
require_once("../../base/php/lib/cti/Log/SettingsChangesLogger.php");

	

global $database;
global $action;
global $propagate;
global $recordNode;

$tableName = getPOST("tableName");
$action = getPOST("action");
$propagate = getPOST("propagate");
$recordXML = getPOST("recordNode");


$recordNode = @simplexml_load_string("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" . utf8_decode($recordXML));

$database = new Database("iCTI");

$settingsLogger = new SettingsChangesLogger;

try {
	$settingsLogger->logParameterChanges('rh', $tableName, $recordNode, $database);
} catch (Exception $e) {
	echo $e->getMessage();
}

$httpString = "";
$httpString = $httpString . "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
$httpString = $httpString . "\n<HTTP_SERVICE>";


if ($tableName == "t_divers") {
	$httpString = $httpString . setRecords_divers();
}
if ($tableName == "t_categorie_socio_professionnelle") {
	$httpString = $httpString . setRecords_categorie_socio_professionnelle();
}
if ($tableName == "t_codes_emploi") {
	$httpString = $httpString . setRecords_codes_emploi();
}
if ($tableName == "t_entreprises") {
	$httpString = $httpString . setRecords_entreprises();
}
if ($tableName == "t_etablissements") {
	$httpString = $httpString . setRecords_etablissements();
}
if ($tableName == "t_grilles") {
	$httpString = $httpString . setRecords_grilles();
}
if ($tableName == "t_grilles_groupes") {
	$httpString = $httpString . setRecords_grilles_groupes();
}
if ($tableName == "t_groupes_cotisant") {
	$httpString = $httpString . setRecords_groupes_cotisant();
}
if ($tableName == "t_service_motifs_arret") {
	$httpString = $httpString . setRecords_motifs_arret();
}
if ($tableName == "t_motifs_debut_contrat") {
	$httpString = $httpString . setRecords_motifs_debut_contrat();
}
if ($tableName == "t_motifs_fin_contrat") {
	$httpString = $httpString . setRecords_motifs_fin_contrat();
}
if ($tableName == "t_rubriques_nationalites") {
	$httpString = $httpString . setRecords_nationalites();
}
if ($tableName == "t_organismes_cotisation") {
	$httpString = $httpString . setRecords_organismes_cotisation();
}
if ($tableName == "t_precisions_motif_arret") {
	$httpString = $httpString . setRecords_precisions_motif_arret();
}
if ($tableName == "t_qualifications") {
	$httpString = $httpString . setRecords_qualifications();
}
if ($tableName == "t_rubriques") {
	$httpString = $httpString . setRecords_rubriques();
}
if ($tableName == "t_sections_analytiques") {
	$httpString = $httpString . setRecords_sections_analytiques();
}
if ($tableName == "t_sections_analytiques_paie") {
	$httpString = $httpString . setRecords_sections_analytiques_paie();
}


if ($tableName == "t_situations_famille") {
	$httpString = $httpString . setRecords_situations_famille();
}
if ($tableName == "t_societes_interim") {
	$httpString = $httpString . setRecords_societes_interim();
}
if ($tableName == "t_specialites") {
	$httpString = $httpString . setRecords_specialites();
}
if ($tableName == "t_statuts") {
	$httpString = $httpString . setRecords_statuts();
}

if ($tableName == "t_types_contrat") {
	$httpString = $httpString . setRecords_types_contrat();
}

if ($tableName == "t_types_horaire") {
	$httpString = $httpString . setRecords_types_horaire();
}

if ($tableName == "t_types_temps_travail") {
	$httpString = $httpString . setRecords_types_temps_travail();
}


if ($tableName == "t_motifs_visite") {
	$httpString = $httpString . setRecords_motifs_visite();
}

if ($tableName == "t_accident_circonstance") {
	$httpString = $httpString . setRecords_accident_circonstance();
}
if ($tableName == "t_accident_lieu") {
	$httpString = $httpString . setRecords_accident_lieu();
}

if ($tableName == "t_accident_nature") {
	$httpString = $httpString . setRecords_accident_nature();
}

if ($tableName == "t_accident_siege") {
	$httpString = $httpString . setRecords_accident_siege();
}

if ($tableName == "t_unite_fonctionnelle") {
	$httpString = $httpString . setRecords_unite_fonctionnelle();
}

if ($tableName == "t_lettre_budgetaire") {
	$httpString = $httpString . setRecords_lettre_budgetaire();
}

if ($tableName == "t_commission_paritaire") {
	$httpString = $httpString . setRecords_commission_paritaire();
}

if ($tableName == "t_categorie_conge") {
	$httpString = $httpString . setRecords_categorie_conge();
}

if ($tableName == "t_cadre_emploi") {
	$httpString = $httpString . setRecords_cadre_emploi();
}

if ($tableName == "t_filiere") {
	$httpString = $httpString . setRecords_filiere();
}

if ($tableName == "t_categorie_statutaire") {
	$httpString = $httpString . setRecords_categorie_statutaire();
}

if ($tableName == "t_compte") {
	$httpString = $httpString . setRecords_compte();
}

if ($tableName == "t_transformation") {
	$httpString = $httpString . setRecords_transformation();
}

if ($tableName == "t_expert_controle") {
	$httpString = $httpString . setRecords_expert_controle();
}

if ($tableName == "t_planning_service") {
	$httpString = $httpString . setRecords_planning_service();
}

if ($tableName == "t_planning_qualification") {
	$httpString = $httpString . setRecords_planning_qualification();
}

if ($tableName == "t_planning_type_absence") {
	$httpString = $httpString . setRecords_planning_type_absence();
}

if ($tableName == "t_data_profile") {
	$httpString = $httpString . setRecords_data_profile();
}



// Effacer le cache après maj parametre
erase_cache();

$httpString = $httpString . "\n</HTTP_SERVICE>";
 
$httpString = compress64($httpString);


echo "<CTICONTENT>$httpString</CTICONTENT>";

function setRecords_divers() {
	
	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$texte = utf8_decode($recordNode["texte"]);
	$valeur = utf8_decode($recordNode["valeur"]);
	$description = utf8_decode($recordNode["description"]);
	$valeur_date = utf8_decode($recordNode["valeur_date"]);
    $show_info_module = floatval($recordNode["show_info_module"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$texte = toSQL($texte);
		$valeur = toSQL($valeur);
		$description = toSQL($description);
        $show_info_module = floatval($show_info_module);
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_divers SET ";
			$sqlcmd = $sqlcmd . "valeur = '$valeur', ";
			$sqlcmd = $sqlcmd . "valeur_date = '$valeur_date', ";
            $sqlcmd = $sqlcmd . "show_info_module = ($show_info_module = 1) ";
			$sqlcmd = $sqlcmd . "WHERE code = '$code'";
			$result  =  $database->exec($sqlcmd);
			
           
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	
}




function setRecords_categorie_socio_professionnelle() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);
	


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_categorie_socio_professionnelle SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_codes_emploi() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_codes_emploi SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}



function setRecords_entreprises() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$oid = floatval($recordNode["oid"]);
	$planning_code = utf8_decode($recordNode["planning_code"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);
	
	


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$planning_code = toSQL($planning_code);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
	
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_entreprises SET 
					code = '$code', 
					code_original = '$code_original'
					planning_code = '$planning_code'
					section_code = '$section_code'
					section_id = '$section_id'
					section_texte = '$section_texte'
					texte = '$texte', 
					texte_court = '$texte_court'
					
				WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
}


function setRecords_etablissements() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$base_calcul_etp = floatval ($recordNode["base_calcul_etp"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$entreprise_id = floatval($recordNode["entreprise_id"]);
	$mode_calcul_etp_paye = utf8_decode($recordNode["mode_calcul_etp_paye"]);
	$oid = floatval($recordNode["oid"]);
	$planning_code = utf8_decode($recordNode["planning_code"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);
	


	if ($action != "delete" && $action != "copy") {
		$base_calcul_etp = toSQL($base_calcul_etp);
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$entreprise_id = toSQL($entreprise_id);
		$mode_calcul_etp_paye = toSQL($mode_calcul_etp_paye);
		$planning_code = toSQL($planning_code);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_etablissements SET
					base_calcul_etp = '$base_calcul_etp',
					code = '$code', 
					code_original = '$code_original'
					entreprise_id = '$entreprise_id'
					mode_calcul_etp_paye = '$mode_calcul_etp_paye'
					planning_code = '$planning_code'
					section_code = '$section_code'
					section_id = '$section_id'
					section_texte = '$section_texte'
					texte = '$texte', 
					texte_court = '$texte_court'
					
				WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	
}


function setRecords_grilles() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_grilles SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}
function setRecords_grilles_groupes() { 

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_grilles_groupes SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_groupes_cotisant() {

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_groupes_cotisant SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_motifs_arret(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$rang_edition = utf8_decode($recordNode["rang_edition"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$rang_edition = toSQL($rang_edition);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_arret SET 
					code = '$code',
					code_original = '$code_original',
					rang_edition = '$rang_edition',	
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_motifs_debut_contrat(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_debut_contrat SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_motifs_fin_contrat(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_fin_contrat SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_nationalites(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_nationalites	 SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
		
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}



function setRecords_organismes_cotisation(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_organismes_cotisation SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_precisions_motif_arret(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$rang_edition = utf8_decode($recordNode["rang_edition"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$rang_edition = toSQL($rang_edition);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_debut_contrat SET 
					code = '$code',
					code_original = '$code_original',
					rang_edition = '$rang_edition',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_qualifications(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_debut_contrat SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_rubriques(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$c_avantage_nature = utf8_decode($recordNode["c_avantage_nature"]);
	$c_base = floatval($recordNode["c_base"]);
	$c_brut = floatval($recordNode["c_brut"]);
	$c_cotisation_patronale = floatval($recordNode["c_cotisation_patronale"]);
	$c_cotisation_salarie = floatval($recordNode["c_cotisation_salarie"]);
	$c_frais_imposables = floatval($recordNode["c_frais_imposables"]);
	$c_heures_payees = floatval($recordNode["c_heures_payees"]);
	$c_heures_travaillees = floatval($recordNode["c_heures_travaillees"]);
	$c_masse_salariale = floatval($recordNode["c_masse_salariale"]);
	$c_net_a_payer = floatval($recordNode["c_net_a_payer"]);
	$c_net_imposable = floatval($recordNode["c_net_imposable"]);
	$c_nombre = floatval($recordNode["c_nombre"]);
	$c_od_net_patronale = floatval($recordNode["c_od_net_patronale"]);
	$c_od_net_salarie = floatval($recordNode["c_od_net_salarie"]);
	$chapitre_bulletin = utf8_decode($recordNode["chapitre_bulletin"]);
	$code_calcul = utf8_decode($recordNode["code_calcul"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$coefficient = floatval($recordNode["coefficient"]);
	$coefficient_base = floatval($recordNode["coefficient_base"]);
	$coefficient_nombre = floatval($recordNode["coefficient_nombre"]);
	$coefficient_txp = utf8_decode($recordNode["coefficient_txp"]);
	$coefficient_txs = utf8_decode($recordNode["coefficient_txs"]);
	$heures_payees = utf8_decode($recordNode["heures_payees"]);
	$p_avantage_nature = utf8_decode($recordNode["p_avantage_nature"]);
	$p_base = utf8_decode($recordNode["p_base"]);
	$p_brut = utf8_decode($recordNode["p_brut"]);
	$p_cotisation_patronale = utf8_decode($recordNode["p_cotisation_patronale"]);
	$p_cotisation_salarie = utf8_decode($recordNode["p_cotisation_salarie"]);
	$p_cumul = utf8_decode($recordNode["p_cumul"]);
	$p_detail = utf8_decode($recordNode["p_detail"]);
	$p_frais_imposables = utf8_decode($recordNode["p_frais_imposables"]);
	$p_heures_payees = utf8_decode($recordNode["p_heures_payees"]);
	$p_heures_travaillees = utf8_decode($recordNode["p_heures_travaillees"]);
	$p_masse_salariale = utf8_decode($recordNode["p_masse_salariale"]);
	$p_net_a_payer = utf8_decode($recordNode["p_net_a_payer"]);
	$p_net_imposable = utf8_decode($recordNode["p_net_imposable"]);
	$p_nombre = utf8_decode($recordNode["p_nombre"]);
	$p_od_net_patronale = utf8_decode($recordNode["p_od_net_patronale"]);
	$p_od_net_salarie = utf8_decode($recordNode["p_od_net_salarie"]);
	$rang_edition = floatval($recordNode["rang_edition"]);
	$s_avantage_nature = floatval($recordNode["s_avantage_nature"]);
	$s_base = floatval($recordNode["s_base"]);
	$s_brut = floatval($recordNode["s_brut"]);
	$s_cotisation_patronale = floatval($recordNode["s_cotisation_patronale"]);
	$s_cotisation_salarie = floatval($recordNode["s_cotisation_salarie"]);
	$s_frais_imposables = floatval($recordNode["s_frais_imposables"]);
	$s_heures_payees = floatval($recordNode["s_heures_payees"]);
	$s_heures_travaillees = floatval($recordNode["s_heures_travaillees"]);
	$s_masse_salariale = floatval($recordNode["s_masse_salariale"]);
	$s_net_a_payer = utf8_decode($recordNode["s_net_a_payer"]);
	$s_net_imposable = utf8_decode($recordNode["s_net_imposable"]);
	$s_nombre = floatval($recordNode["s_nombre"]);
	$s_od_net_patronale = floatval($recordNode["s_od_net_patronale"]);
	$s_od_net_salarie = floatval($recordNode["s_od_net_salarie"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);
	$unite = utf8_decode($recordNode["unite"]);
	$user_modified = utf8_decode($recordNode["user_modified"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$c_avantage_nature = toSQL($c_avantage_nature);
		$c_base = toSQL($c_base);
		$c_brut = toSQL($c_brut);
		$c_cotisation_patronale = toSQL($c_cotisation_patronale);
		$c_cotisation_salarie = toSQL($c_cotisation_salarie);
		$c_frais_imposables = toSQL($c_frais_imposables);
		$c_heures_payees = toSQL($c_heures_payees);
		$c_heures_travaillees = toSQL($c_heures_travaillees);
		$c_masse_salariale = toSQL($c_masse_salariale);
		$c_net_a_payer = toSQL($c_net_a_payer);
		$c_net_imposable = toSQL($c_net_imposable);
		$c_nombre = toSQL($c_nombre);
		$c_od_net_patronale = toSQL($c_od_net_patronale);
		$c_od_net_salarie = toSQL($c_od_net_salarie);
		$chapitre_bulletin = toSQL($chapitre_bulletin);
		$code_calcul = toSQL($code_calcul);
		$code_original = toSQL($code_original);
		$coefficient = toSQL($coefficient);
		$coefficient_base = toSQL($coefficient_base);
		$coefficient_nombre = toSQL($coefficient_nombre);
		$coefficient_txp = toSQL($coefficient_txp);
		$coefficient_txs = toSQL($coefficient_txs);
		$heures_payees = toSQL($heures_payees);
		$p_avantage_nature = toSQL($p_avantage_nature);
		$p_base = toSQL($p_base);
		$p_brut = toSQL($p_brut);
		$p_cotisation_patronale = toSQL($p_cotisation_patronale);
		$p_cotisation_salarie = toSQL($p_cotisation_salarie);
		$p_cumul = toSQL($p_cumul);
		$p_detail = toSQL($p_detail);
		$p_frais_imposables = toSQL($p_frais_imposables);
		$p_heures_payees = toSQL($p_heures_payees);
		$p_heures_travaillees = toSQL($p_heures_travaillees);
		$p_masse_salariale = toSQL($p_masse_salariale);
		$p_net_a_payer = toSQL($p_net_a_payer);
		$p_net_imposable = toSQL($p_net_imposable);
		$p_nombre = toSQL($p_nombre);
		$p_od_net_patronale = toSQL($p_od_net_patronale);
		$p_od_net_salarie = toSQL($p_od_net_salarie);
		$rang_edition = toSQL($rang_edition);
		$s_avantage_nature = toSQL($s_avantage_nature);
		$s_base = toSQL($s_base);
		$s_brut = toSQL($s_brut);
		$s_cotisation_patronale = toSQL($s_cotisation_patronale);
		$s_cotisation_salarie = toSQL($s_cotisation_salarie);
		$s_frais_imposables = toSQL($s_frais_imposables);
		$s_heures_payees = toSQL($s_heures_payees);
		$s_heures_travaillees = toSQL($s_heures_travaillees);
		$s_masse_salariale = toSQL($s_masse_salariale);
		$s_net_a_payer = toSQL($s_net_a_payer);
		$s_net_imposable = toSQL($s_net_imposable);
		$s_nombre = toSQL($s_nombre);
		$s_od_net_patronale = toSQL($s_od_net_patronale);
		$s_od_net_salarie = toSQL($s_od_net_salarie);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		$unite = toSQL($unite);
		$user_modified = toSQL($user_modified);
		
		
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_rubriques SET 
			
		code = '$code', 
		c_avantage_nature = '$c_avantage_nature', 
		c_base = '$c_base',
		c_brut = '$c_brut', 
		c_cotisation_patronale = '$c_cotisation_patronale', 
		c_cotisation_salarie = '$c_cotisation_salarie',
		c_frais_imposables = '$c_frais_imposables', 
		c_heures_payees = '$c_heures_payees',
		c_heures_travaillees = '$c_heures_travaillees', 
		c_masse_salariale = '$c_masse_salariale', 
		c_net_a_payer = '$c_net_a_payer',
		c_net_imposable = '$c_net_imposable',
		c_nombre = '$c_nombre',
		c_od_net_patronale = '$c_od_net_patronale',
		c_od_net_salarie = '$c_od_net_salarie',  
		chapitre_bulletin = '$chapitre_bulletin',
		code_calcul = '$code_calcul', 
		code_original = '$code_original', 
		coefficient = '$coefficient',
		coefficient_base = '$coefficient_base',
		coefficient_nombre = '$coefficient_nombre', 
		coefficient_txp = '$coefficient_txp', 
		coefficient_txs = '$coefficient_txs', 
		heures_payees ='$heures_payees', 
		p_avantage_nature = '$p_avantage_nature' ,
		p_base = '$p_base',
		p_brut = '$p_brut', 
		p_cotisation_patronale = '$p_cotisation_patronale',
		p_cotisation_salarie = '$p_cotisation_salarie',
		p_cumul = '$p_cumul', 
		p_detail = '$p_detail', 
		p_frais_imposables = '$p_frais_imposables', 
		p_heures_payees = '$p_heures_payees', 
		p_heures_travaillees = '$p_heures_travaillees',
		p_masse_salariale = '$p_masse_salariale', 
		p_net_a_payer = '$p_net_a_payer',
		p_net_imposable = '$p_net_imposable',
		p_nombre = '$p_nombre', 
		p_od_net_patronale = '$p_od_net_patronale',
		p_od_net_salarie = '$p_od_net_salarie', 
		rang_edition = '$rang_edition', 
		s_avantage_nature = '$s_avantage_nature', 
		s_base = '$s_base', 
		s_brut = '$s_brut', 
		s_cotisation_patronale = '$s_cotisation_patronale', 
		s_cotisation_salarie = '$s_cotisation_salarie', 
		s_frais_imposables = '$s_frais_imposables', 
		s_heures_payees = '$s_heures_payees', 
		s_heures_travaillees = '$s_heures_travaillees', 
		s_masse_salariale = '$s_masse_salariale', 
		s_net_a_payer = '$s_net_a_payer',
		s_net_imposable = '$s_net_imposable',
		s_nombre = '$s_nombre' ,
		s_od_net_patronale = '$s_od_net_patronale',
		s_od_net_salarie = '$s_od_net_salarie',
		section_code = '$section_code',
		section_id = '$section_id',
		section_texte = '$section_texte' ,
		texte = '$texte',
		texte_court = '$texte_court', 
		unite = '$unite', 
		user_modified = '$user_modified' 
					
		WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
	
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_sections_analytiques(){



	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_sections_analytiques SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_sections_analytiques_paie() {



	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_sections_analytiques_paie SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_services(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_services SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_situations_famille(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_situations_famille SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_societes_interim(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_societes_interim SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_specialites(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_specialites SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_statuts(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_statuts SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_types_contrat(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_types_contrat SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_types_horaire(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_types_horaire SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}



function setRecords_types_temps_travail(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_types_temps_travail SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_motifs_visite(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_motifs_visite SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_accident_circonstance(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_accident_circonstance SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_accident_lieu(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_accident_lieu SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	
}


function setRecords_accident_nature(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_accident_nature SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	
}


function setRecords_accident_siege(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_accident_siege SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
		
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_unite_fonctionnelle(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_unite_fonctionnelle SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_lettre_budgetaire(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_lettre_budgetaire SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_commission_paritaire(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_commission_paritaire SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	
}


function setRecords_categorie_conge(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_categorie_conge SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_cadre_emploi(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_cadre_emploi SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_filiere(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_filiere SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_categorie_statutaire(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_categorie_statutaire SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_compte(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_compte SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			if ($propagate != "false") {
				$result = $database->exec("SELECT rh.cti_reorganize_profils(); ");
			}
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_transformation(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	
	$date_debut = utf8_decode($recordNode["date_debut"]);
	$date_fin = utf8_decode($recordNode["date_fin"]);
	$from_qualification_id = floatval($recordNode["from_qualification_id"]);
	$from_service_id = floatval($recordNode["from_service_id"]);
	$oid = floatval($recordNode["oid"]);
	$salarie_id = floatval($recordNode["salarie_id"]);
	$texte = utf8_decode($recordNode["texte"]);
	$to_qualification_id = floatval($recordNode["to_qualification_id"]);
	$to_service_id = floatval($recordNode["to_service_id"]);


	if ($action != "delete" && $action != "copy") {
		$date_debut = toSQL($date_debut);
		$date_fin = toSQL($date_fin);
		$from_qualification_id = toSQL($from_qualification_id);
		$from_service_id = toSQL($from_service_id);
		$salarie_id = toSQL($salarie_id);		
		$texte = toSQL($texte);
		$to_qualification_id = toSQL($to_qualification_id);
		$to_service_id = toSQL($to_service_id);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_transformation SET 
					date_debut = '$date_debut',
					date_fin = '$date_fin',
					from_qualification_id = '$from_qualification_id',
					from_service_id = '$from_service_id',
					salarie_id = '$salarie_id',					
					texte = '$texte', 
					to_qualification_id = '$to_qualification_id',	
					to_service_id = '$to_service_id'
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_expert_controle() {

	global $database;
	global $action;
	global $recordNode;
	
	$httpString = "";
	
	$mode = floatval($recordNode["mode"]);
	
	// Mise à jour controles unitaires
	if ($mode == 0) {
		$oid = floatval($recordNode["oid"]);
		$code = utf8_decode($recordNode["code"]);
		$texte = utf8_decode($recordNode["texte"]);
		$texte_court = utf8_decode($recordNode["texte_court"]);
		if ($texte_court == "") {
			$texte_court = $texte;
		}
		$texte_abrege = utf8_decode($recordNode["texte_abrege"]);
		if ($texte_abrege == "") {
			$texte_abrege = $texte_court;
		}
		$description = $recordNode["description"];
		$is_cti = utf8_decode($recordNode["is_cti"]);
		$is_active = utf8_decode($recordNode["is_active"]);
		$is_hide = utf8_decode($recordNode["is_hide"]);
		$gravite_id = floatval($recordNode["gravite"]);
		$prestataire_id = floatval($recordNode["prestataire"]);
		$is_alert = utf8_decode($recordNode["is_alert"]);
		
		$rule_oid1 = floatval($recordNode["rule_oid1"]);
		$sqlcmd_where1 = utf8_decode($recordNode["sqlcmd_where1"]);
		$sqlcmd_justificatif1 = utf8_decode($recordNode["sqlcmd_justificatif1"]);
		$table1 = floatval($recordNode["table1"]);
		
		
		$code = toSQL($code);
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		$texte_abrege = toSQL($texte_abrege);
		$description = toSQL($description);
		$is_cti = toSQL($is_cti);
		$is_hide = toSQL($is_hide);
		$is_active = toSQL($is_active);
		$sqlcmd_where1 = toSQL($sqlcmd_where1);
		$sqlcmd_justificatif1 = toSQL($sqlcmd_justificatif1);
		

		if ($action != "delete" && $action != "copy" && $action != "execute_rules" && $action != "purge_history") {

			// creation ou mise à  jour de la liste
			if ($oid == -1) {
			
				$sqlcmd = "INSERT INTO rh.t_expert_controle 
						( 
							code, 
							texte, 
							texte_court, 
							texte_abrege, 
							description, 
							is_cti, 
							is_hide, 
							gravite_id,
							prestataire_id,
							is_active,
							alert_exp
							
						) 
						VALUES(
							'$code', 
							'$texte', 
							'$texte_court', 
							'$texte_abrege',
							'$description', 
							'$is_cti', 
							'$is_hide', 
							$gravite_id,
							$prestataire_id,
							'$is_active',
							'$is_alert'
							
						) ";
				$result  =  $database->exec($sqlcmd);
				if ($result == FALSE) {
					
				}
				else {
					$result = $database->exec(
						"SELECT max(oid) as oid FROM
						rh.t_expert_controle 
						WHERE 1=1
						AND code = '$code' AND texte = '$texte'"
					);
					if ($result != false) {
						$record = $database->nextRecordInto();
						if ($record != FALSE) {
							$oid = $record[0] + 0;
						}
					}
				}
			}
				
			else {
				
				$sqlcmd = "UPDATE rh.t_expert_controle SET 
							texte = '$texte', 
							texte_court = '$texte_court', 
							texte_abrege = '$texte_abrege',
							description = '$description',
							is_cti = '$is_cti' , 
							is_hide = '$is_hide' , 
							gravite_id = $gravite_id,
							prestataire_id = $prestataire_id,
							is_active = '$is_active',
							alert_exp = '$is_alert'
						WHERE oid = $oid;
						UPDATE rh.t_expert_controle SET 
							code = '$code'
						WHERE oid = $oid;
						";
				$result  =  $database->exec($sqlcmd);
			}
			
			// Ajout des règles
			$sqlcmd = "DELETE FROM rh.t_expert_controle_rule
				USING 
				(
				SELECT t_expert_controle_rule.oid
				FROM rh.t_expert_controle_rule
				LEFT JOIN rh.t_expert_controle ON t_expert_controle_rule.controle_id = t_expert_controle.oid
				WHERE t_expert_controle.oid IS NULL
				) AS subview
				WHERE t_expert_controle_rule.oid = subview.oid;

				INSERT INTO rh.t_expert_controle_rule (
					controle_id,
					numero,
					sqlcmd_where,
					sqlcmd_justificatif,
					table_id
					)
				SELECT t_expert_controle.oid AS controle_id, 
					1::bigint AS numero,
					'' AS sqlcmd_where,
					'' AS sqlcmd_justificatif,
					0::bigint AS table_id
				FROM rh.t_expert_controle
				LEFT JOIN rh.t_expert_controle_rule ON t_expert_controle_rule.controle_id = t_expert_controle.oid AND t_expert_controle_rule.numero = 1
				WHERE t_expert_controle_rule.oid IS NULL;";
			$result  =  $database->exec($sqlcmd);
			
			if ($oid != 0) {

					$sqlcmd = 
					"UPDATE rh.t_expert_controle_rule
					SET sqlcmd_where = '$sqlcmd_where1', 
						sqlcmd_justificatif = '$sqlcmd_justificatif1',
						table_id = $table1
					WHERE controle_id = $oid AND
						numero = 1;";
					$result  =  $database->exec($sqlcmd);	
			}
		}

		if ($action == "copy") {
		
			$pos = stripos($code, "_");
			if ($pos === false) {
				$fromcode = $code . "_";
			}
			else {
				$fromcode = substr($code,0,$pos) . "_";
			}
		
			$last_oid = 1;
			$result = $database->exec("SELECT max(to_number(substr(code,length('$fromcode')+1,10), '999999')) as oid FROM rh.t_expert_controle WHERE code LIKE '$fromcode%'");
			if ($result != false) {
				$record = $database->nextRecordInto();
				if ($record != FALSE) {
					$last_oid = $record[0];
				}
			}
			if ($last_oid == 0) {
				$last_oid = 1;
			}
			$last_oid++;
			
			$sqlcmd = "INSERT INTO rh.t_expert_controle(code, texte, texte_court) ";
			$sqlcmd = $sqlcmd . "SELECT '$fromcode$last_oid', 'Copie de ' || texte , 'Copie de ' || texte_court ";
			$sqlcmd = $sqlcmd . "FROM rh.t_expert_controle WHERE oid = $oid";
			$result = $database->exec($sqlcmd);
			
			$oid = 0;
			$result = $database->exec(
				"SELECT max(oid) as oid FROM
				rh.t_expert_controle 
				WHERE code = '$fromcode$last_oid' "
			);
			if ($result != false) {
				$record = $database->nextRecordInto();
				if ($record != FALSE) {
					$oid = $record[0];
				}
			}
		}

		if ($action == "delete") {
			$sqlcmd = "DELETE FROM rh.t_expert_controle WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			$sqlcmd = "DELETE FROM rh.t_expert_controle_rule WHERE controle_id = $oid";
			$result  =  $database->exec($sqlcmd);
		}
		
		if ($action == "purge_history") {
			$sqlcmd = "DELETE FROM rh.p_expert_controle WHERE controle_id = $oid";
			$result  =  $database->exec($sqlcmd);
		}
	}
	
	
	// Mise à jour paramètres généraux
	if ($mode == 2) {
		$EXPERT_ACTIVE = utf8_decode($recordNode["EXPERT_ACTIVE"]);
		$EXPERT_DATE_DEBUT = utf8_decode($recordNode["EXPERT_DATE_DEBUT"]);

		if ($action == "save") {
		
			$sqlcmd = "UPDATE rh.t_divers
					SET valeur = '$EXPERT_ACTIVE'
					WHERE code = 'EXPERT_ACTIVE' AND
						valeur IS DISTINCT FROM '$EXPERT_ACTIVE'; ";
			$result = $database->exec($sqlcmd);
			
			$sqlcmd = "UPDATE rh.t_divers
					SET valeur_date = to_date('$EXPERT_DATE_DEBUT','DD/MM/YYYY'),
						valeur = '$EXPERT_DATE_DEBUT'
					WHERE code = 'EXPERT_DATE_DEBUT' AND
						valeur_date IS DISTINCT FROM to_date('$EXPERT_DATE_DEBUT','DD/MM/YYYY'); ";
			$result = $database->exec($sqlcmd);
		}
	}
	
	// exécution des règles
	if ($action == "create_documentation" || $action == "save" || $action == "delete") {
	
		$reference_template_file = "../references/iCTI_RH_ExpertControle.template.HTML";
		$reference_file = "../references/iCTI_RH_ExpertControle.HTML";
		if (file_exists($reference_template_file)) {
			$reference_template_handle = @fopen($reference_template_file, "r");
			$reference_handle = @fopen($reference_file, "w");
			if ($reference_template_handle) {
				$currentIsControle = false;
				$controleString = "";
				while (!feof($reference_template_handle)) {
					$buffer = fgets($reference_template_handle, 99999);
					if (trim($buffer) == "<CONTROLE_DEFINITION>") {
						$currentIsControle = true;
					}
					else {
						if (trim($buffer) == "</CONTROLE_DEFINITION>") {
						
							$sqlcmd = "SELECT 
										t_expert_controle.oid, 
										t_expert_controle.code, 
										t_expert_controle.texte, 
										t_expert_controle.description,
										t_expert_controle.is_cti
									FROM rh.t_expert_controle  
									WHERE t_expert_controle.oid > 0 AND is_global <> 1 AND is_hide <> 1 AND description <> ''
									ORDER BY t_expert_controle.code";
							$result = $database->exec($sqlcmd);
								
							if ($result != false) {

								// lignes 
								$ok = TRUE;

								while ($ok == TRUE) {
									$ok = FALSE;
								
									$record = $database->nextRecordInto();

									if ($record != FALSE) {
										$ok = TRUE;

										$oid = $record[0];
										$code = toHTML(trim($record[1]));
										$texte = toHTML(trim($record[2]));
										$description = trim($record[3]);
										$is_cti = toHTML(trim($record[4]));
										
										if (substr($description,0,3) == "_c_") {
											$description = uncompress64(substr($description, 3));
										}
										$description = str_replace('SIZE="10"','SIZE="3"',$description);
										$description = str_replace('SIZE="12"','SIZE="3"',$description);
										$description = str_replace('SIZE="14"','SIZE="3"',$description);
										
										$controleStringControle = $controleString;
										$controleStringControle = str_replace("[CONTROLE_CODE]",$code,$controleStringControle);
										$controleStringControle = str_replace("[CONTROLE_TEXT]",$texte,$controleStringControle);
										$controleStringControle = str_replace("[CONTROLE_DESCRIPTION]",$description,$controleStringControle);
										
										fwrite($reference_handle,$controleStringControle);
									}
								}
							}
						
							$currentIsControle = false;
						}
						else {
							if ($currentIsControle == false) {
								fwrite($reference_handle,$buffer);
							}
							else {
								$controleString = "$controleString$buffer";
							}
						}
					}
				}
			}
			@fclose($reference_template_handle);
			@fclose($reference_handle);
		}
	}
	
	return $httpString;
}


function setRecords_planning_service(){

global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$oid = floatval($recordNode["oid"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$service_code = utf8_decode($recordNode["service_code"]);
	$service_id = floatval($recordNode["service_id"]);
	$service_section_code = utf8_decode($recordNode["service_section_code"]);
	$service_section_id = floatval($recordNode["service_section_id"]);
	$service_section_texte = utf8_decode($recordNode["service_section_texte"]);
	$service_texte = utf8_decode($recordNode["service_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);
		$service_code = toSQL($service_code);
		$service_id = toSQL($service_id);
		$service_section_code = toSQL($service_section_code);
		$service_section_id = toSQL($service_section_id);
		$service_section_texte = toSQL($service_section_texte);
		$service_texte = toSQL($service_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_planning_service SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',
					service_code = '$service_code',
					service_id = '$service_id',
					service_section_code = '$service_section_code',
					service_section_id = '$service_section_id',
					service_section_texte = '$service_section_texte',
					service_texte = '$service_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}

function setRecords_planning_qualification(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	

	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$oid = floatval($recordNode["oid"]);
	$qualification_code = utf8_decode($recordNode["qualification_code"]);
	$qualification_id = floatval($recordNode["qualification_id"]);
	$qualification_section_code = utf8_decode($recordNode["qualification_section_code"]);
	$qualification_section_id = floatval($recordNode["qualification_section_id"]);
	$qualification_section_texte = floatval($recordNode["qualification_section_texte"]);
	$qualification_texte = utf8_decode($recordNode["qualification_texte"]);
	$section_code = floatval($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["service_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$qualification_code = toSQL($qualification_code);
		$qualification_id = toSQL($qualification_id);
		$qualification_section_code = toSQL($qualification_section_code);
		$qualification_section_id = toSQL($qualification_section_id);
		$qualification_section_texte = toSQL($qualification_section_texte);
		$qualification_texte = toSQL($qualification_texte);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_planning_qualification SET 
					code = '$code',
					code_original = '$code_original',
					qualification_code = '$qualification_code',
					qualification_id = '$qualification_id',
					qualification_section_code = '$qualification_section_code',
					qualification_section_id = '$qualification_section_id',
					qualification_section_texte = '$qualification_section_texte',
					qualification_texte = '$qualification_texte',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_planning_type_absence(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	
	$oid = floatval($recordNode["oid"]);
	$code = utf8_decode($recordNode["code"]);
	$code_original = utf8_decode($recordNode["code_original"]);
	$section_code = utf8_decode($recordNode["section_code"]);
	$section_id = floatval($recordNode["section_id"]);
	$section_texte = utf8_decode($recordNode["section_texte"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$code_original = toSQL($code_original);
		$section_code = toSQL($section_code);
		$section_id = toSQL($section_id);
		$section_texte = toSQL($section_texte);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_planning_type_absence SET 
					code = '$code',
					code_original = '$code_original',
					section_code = '$section_code',
					section_id = '$section_id',
					section_texte = '$section_texte',					
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function setRecords_data_profile(){

	global $database;
	global $action;
	global $propagate;
	global $recordNode;
	

	$code = utf8_decode($recordNode["code"]);
	$etablissement_exclus = utf8_decode($recordNode["etablissement_exclus"]);
	$etablissement_id = floatval($recordNode["etablissement_id"]);
	$etablissement_inclus = utf8_decode($recordNode["etablissement_inclus"]);
	$oid = floatval($recordNode["oid"]);
	$service_exclus = utf8_decode($recordNode["service_exclus"]);
	$service_id_array = floatval($recordNode["service_id_array"]);
	$service_inclus = utf8_decode($recordNode["service_inclus"]);
	$statut_exclus = utf8_decode($recordNode["statut_exclus"]);
	$statut_id_array = floatval($recordNode["statut_id_array"]);
	$statut_inclus = utf8_decode($recordNode["statut_inclus"]);
	$texte = utf8_decode($recordNode["texte"]);
	$texte_court = utf8_decode($recordNode["texte_court"]);


	if ($action != "delete" && $action != "copy") {
		$code = toSQL($code);
		$etablissement_exclus = toSQL($etablissement_exclus);
		$etablissement_id = toSQL($etablissement_id);
		$etablissement_inclus = toSQL($etablissement_inclus);
		$service_exclus = toSQL($service_exclus);
		$service_id_array = toSQL($service_id_array);
		$service_inclus = toSQL($service_inclus);
		$statut_exclus = toSQL($statut_exclus);
		$statut_id_array = toSQL($statut_id_array);
		$statut_inclus = toSQL($service_inclus);	
		$texte = toSQL($texte);
		$texte_court = toSQL($texte_court);
		
		
		// creation ou mise à  jour de la liste
		if ($oid == -1) {
		
			
		}
		else {
			
			$sqlcmd = "UPDATE rh.t_data_profile SET 
					code = '$code',
					etablissement_exclus = '$etablissement_exclus',
					etablissement_id = '$etablissement_id',
					etablissement_inclus = '$etablissement_inclus',
					service_exclus = '$service_exclus',
					service_id_array = '$service_id_array',
					service_inclus = '$service_inclus',
					statut_exclus = '$statut_exclus',
					statut_id_array = '$statut_id_array',
					statut_inclus = '$statut_inclus',		
					texte = '$texte', 
					texte_court = '$texte_court'	
					WHERE oid = $oid";
			$result  =  $database->exec($sqlcmd);
			
			
		}
				

	}

	if ($action == "copy") {
	
		

	}


	if ($action == "delete") {
		
	}
	


}


function erase_cache() {

	global $database;
	
	// Ancienne version
	if ($database->cticache == "true") {
		$sqlcmd = "SELECT cti_cache_erase as result from cache.cti_cache_erase('iCTI_rh')";
		$result = $database->exec($sqlcmd);
	}
	
	// Nouvelle version
	cleanAllCache("iCTI_rh");


}

    
?>