Ejemplo n.º 1
0
if ($id_fta_composant) {
    $creation = 0;
    $ftaComposantModel = new FtaComposantModel($id_fta_composant);
    $ftaComposantModel->setDataFtaComposantTableToCompare();
    $ftaComposantView = new FtaComposantView($ftaComposantModel);
    $ftaComposantView->setIsEditable($isEditable);
    $codePSFValue = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_CODE_PRODUIT_AGROLOGIC_FTA_NOMENCLATURE)->getFieldValue();
} else {
    $creation = 1;
    $id_fta_composant = FtaComposantModel::createNewRecordset(array(FtaComposantModel::FIELDNAME_ID_FTA => $id_fta));
    /**
     * L'ajout d'un composant doit être notifie puisqu'il s'agit d'un champ verrouilé
     */
    FtaVerrouillageChampsModel::doUpdateLockField(FtaComposantModel::TABLENAME, $id_fta_composant, FtaComposantModel::KEYNAME);
    $ftaComposantModel = new FtaComposantModel($id_fta_composant);
    $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_QUANTITE_FTA_COMPOSITION_UVC)->setFieldValue(FtaComposantModel::DEFAULT_VALUE_QTE_UVC);
    $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_IS_NOMENCLATURE_FTA_COMPOSANT)->setFieldValue("1");
    $ftaComposantModel->saveToDatabase();
    $ftaComposantModel->setDataFtaComposantTableToCompare();
    $ftaComposantView = new FtaComposantView($ftaComposantModel);
    $ftaComposantView->setIsEditable($isEditable);
}
//Chargement des données de la FTA
//$ftaModel = new FtaModel($id_fta);
$bloc = "";
//Bloc de saisie
//Désignation
$bloc .= "<tr class=titre_principal><td>" . "Informations sur les produits du composant" . "</td></tr>" . "<tr><td>" . "<{$html_table}>";
// Prefixe code PSF
$bloc .= $ftaComposantView->getHtmlDataField(FtaComposantModel::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION);
//$bloc .=FtaComposantModel::ShowListeDeroulantePrefixeForComposant($HtmlList, $isEditable, $id_fta_composant);
} else {
    $checkCreation = 0;
    if (!$checkCreation) {
        $creation = 1;
        $id_fta_composant = FtaComposantModel::createNewRecordset(array(FtaComposantModel::FIELDNAME_ID_FTA => $id_fta));
        /**
         * L'ajout d'une composition doit être notifié puisqu'il s'agit d'un champ verrouilé
         */
        FtaVerrouillageChampsModel::doUpdateLockField(FtaComposantModel::TABLENAME, $id_fta_composant, FtaComposantModel::KEYNAME);
        $ftaComposantModel = new FtaComposantModel($id_fta_composant);
        $ftaModel = new FtaModel($id_fta);
        $DureeDeVieTechnique = $ftaModel->getDataField(FtaModel::FIELDNAME_DUREE_DE_VIE_TECHNIQUE_PRODUCTION)->getFieldValue();
        $PCB = $ftaModel->getDataField(FtaModel::FIELDNAME_NOMBRE_UVC_PAR_CARTON)->getFieldValue();
        $poidsUVFValueKG = $ftaModel->getDataField(FtaModel::FIELDNAME_POIDS_ELEMENTAIRE)->getFieldValue();
        $poidsUVFValueG = $poidsUVFValueKG * "1000";
        $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_IS_COMPOSITION_FTA_COMPOSANT)->setFieldValue("1");
        $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_IS_NOMENCLATURE_FTA_COMPOSANT)->setFieldValue("0");
        $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_POIDS_FTA_COMPOSITION)->setFieldValue($poidsUVFValueG);
        $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_DUREE_VIE_TECHNIQUE_FTA_COMPOSITION)->setFieldValue($DureeDeVieTechnique);
        $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_QUANTITE_FTA_COMPOSITION)->setFieldValue($PCB);
        $ftaComposantModel->saveToDatabase();
        $ftaComposantView = new FtaComposantView($ftaComposantModel);
        $ftaComposantView->setIsEditable($editable);
        $ftaComposantView2 = new FtaComposantView($ftaComposantModel);
        $_SESSION['checkCreation'] = $creation;
    } else {
        $titre = "Erreur ";
        $message = "Veuillez utiliser les boutons de navigation";
        Lib::showMessage($titre, $message, $redirection);
    }
    //Ce composant sera géré dans la composition
 /**
  * Affiche l'historique de la Fta
  * @param int $paramIdFtaDossier
  * @param int $paramIdFtaWorkflow
  * @return string
  */
 public static function getHtmlHistoriqueFta($paramIdFtaDossier, $paramIdFtaWorkflow)
 {
     /**
      * Historisation des changement d'état initialisé en modification
      */
     $arrayHistoValidationFta = DatabaseOperation::convertSqlStatementWithoutKeyToArray("SELECT DISTINCT " . FtaEtatHistoriqueModel::FIELDNAME_ID_DOSSIER_FTA . "," . FtaEtatHistoriqueModel::FIELDNAME_ID_DOSSIER_VERSION_FTA . "," . FtaEtatHistoriqueModel::FIELDNAME_ID_FTA_ETAT_DEST . "," . UserModel::FIELDNAME_NOM . "," . UserModel::FIELDNAME_PRENOM . "," . FtaEtatHistoriqueModel::FIELDNAME_STATE_CHANGE_DATE . " FROM " . FtaEtatHistoriqueModel::TABLENAME . "," . UserModel::TABLENAME . " WHERE " . FtaEtatHistoriqueModel::TABLENAME . "." . FtaEtatHistoriqueModel::FIELDNAME_ID_USER . "=" . UserModel::TABLENAME . "." . UserModel::KEYNAME . " AND " . FtaEtatHistoriqueModel::FIELDNAME_ID_DOSSIER_FTA . "=" . $paramIdFtaDossier . " ORDER BY " . FtaEtatHistoriqueModel::FIELDNAME_STATE_CHANGE_DATE . " DESC ");
     if ($arrayHistoValidationFta) {
         foreach ($arrayHistoValidationFta as $rowsHistoValidationFta) {
             $ftaEtatModel = new FtaEtatModel($rowsHistoValidationFta[FtaEtatHistoriqueModel::FIELDNAME_ID_FTA_ETAT_DEST]);
             $nomFtaEtat = $ftaEtatModel->getDataField(FtaEtatModel::FIELDNAME_NOM_FTA_ETAT)->getFieldValue();
             $versionEncours = "V" . $rowsHistoValidationFta[FtaEtatHistoriqueModel::FIELDNAME_ID_DOSSIER_VERSION_FTA];
             $nomSignataire = $rowsHistoValidationFta[UserModel::FIELDNAME_PRENOM] . " " . $rowsHistoValidationFta[UserModel::FIELDNAME_NOM];
             $dateValidation = $rowsHistoValidationFta[FtaEtatHistoriqueModel::FIELDNAME_STATE_CHANGE_DATE];
             /**
              * Changment de format de date
              */
             $date = FtaController::changementDuFormatDeDateFR($dateValidation);
             $arrayHistoModif[] = array("date" => $date, "nom" => $nomSignataire, "version" => $versionEncours, "etat" => $nomFtaEtat, "oldValue" => $oldValue, "newValue" => $newValue);
         }
     }
     /**
      * Listes des tables Fta à vérifier
      */
     $arrayTableCheck = array(FtaModel::TABLENAME, FtaComposantModel::TABLENAME, FtaConditionnementModel::TABLENAME);
     /**
      * Historiques des changement de données par les utilisateurs
      */
     foreach ($arrayTableCheck as $rowsTableCheck) {
         /**
          * Tableau des Fta selon le dossier encours
          */
         $arrayIdFta = FtaModel::getArrayIdFtaByIdDossierFta($paramIdFtaDossier);
         foreach ($arrayIdFta as $rowsIdFta) {
             $idFtaEncours = $rowsIdFta[FtaModel::KEYNAME];
             $ftaModelEncours = new FtaModel($idFtaEncours);
             $versionFta = "V" . $ftaModelEncours->getDataField(FtaModel::FIELDNAME_VERSION_DOSSIER_FTA)->getFieldValue();
             /**
              * Listes des noms des champs avec le label de la table encours
              */
             if ($rowsTableCheck == FtaModel::TABLENAME) {
                 $model = new FtaModel($idFtaEncours);
                 $model->setDataFtaTableToCompare();
                 $arrayChamps = DatabaseOperation::convertSqlStatementWithoutKeyToArray("SELECT DISTINCT " . IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO . "," . IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO . "," . IntranetColumnInfoModel::FIELDNAME_ID_LISTE_CHAPITRE_HISTORIQUE . " FROM " . IntranetColumnInfoModel::TABLENAME . " WHERE " . IntranetColumnInfoModel::FIELDNAME_TABLE_NAME_INTRANET_COLUMN_INFO . "='" . $rowsTableCheck . "'" . " AND " . IntranetColumnInfoModel::FIELDNAME_IS_ENABLED_INTRANET_HISTORIQUE . "=" . IntranetColumnInfoModel::IS_ENABLED_INTRANET_HISTORIQUE_TRUE);
                 foreach ($arrayChamps as $rowsChamps) {
                     $check = $model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO])->isFieldDiff();
                     if ($check) {
                         $htmlObjetOld = Html::getHtmlObjectFromDataField($model->getDataToCompare()->getDataFieldByFieldName($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                         $oldValue = $htmlObjetOld->getRawContent();
                         $htmlObjetNew = Html::getHtmlObjectFromDataField($model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                         $newValue = $htmlObjetNew->getRawContent();
                         $label = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO];
                         $idFtaChapitreTmp = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_ID_LISTE_CHAPITRE_HISTORIQUE];
                         $idFtaChapitreArray = explode(',', $idFtaChapitreTmp);
                         $idFtaChapitre = FtaWorkflowStructureModel::getIdFtaChapitreBetweenArrayByWorkflowAndArrayByColumn($paramIdFtaWorkflow, $idFtaChapitreArray);
                         if ($idFtaChapitre) {
                             $nomSignataire = FtaSuiviProjetModel::getUserNameByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                             $dateValidation = FtaSuiviProjetModel::getValidationDateByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                             $arrayHistoModif[] = array("date" => $dateValidation, "nom" => $nomSignataire, "version" => $versionFta, "etat" => $label, "oldValue" => $oldValue, "newValue" => $newValue);
                         }
                     }
                 }
             } elseif ($rowsTableCheck == FtaComposantModel::TABLENAME) {
                 /**
                  * On récupère la liste des composants
                  */
                 $arraIdFtaComposant = FtaComposantModel::getArrayIdFtaComposantTable($idFtaEncours);
                 if ($arraIdFtaComposant) {
                     foreach ($arraIdFtaComposant as $rowsIdFtaComposant) {
                         $idFtaComposant = $rowsIdFtaComposant[FtaComposantModel::KEYNAME];
                         $model = new FtaComposantModel($idFtaComposant);
                         $model->setDataFtaComposantTableToCompare();
                         $arrayChamps = DatabaseOperation::convertSqlStatementWithoutKeyToArray("SELECT DISTINCT " . IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO . "," . IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO . "," . IntranetColumnInfoModel::FIELDNAME_ID_LISTE_CHAPITRE_HISTORIQUE . " FROM " . IntranetColumnInfoModel::TABLENAME . " WHERE " . IntranetColumnInfoModel::FIELDNAME_TABLE_NAME_INTRANET_COLUMN_INFO . "='" . $rowsTableCheck . "'" . " AND " . IntranetColumnInfoModel::FIELDNAME_IS_ENABLED_INTRANET_HISTORIQUE . "=" . IntranetColumnInfoModel::IS_ENABLED_INTRANET_HISTORIQUE_TRUE);
                         foreach ($arrayChamps as $rowsChamps) {
                             $check = $model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO])->isFieldDiff();
                             if ($check) {
                                 $htmlObjetOld = Html::getHtmlObjectFromDataField($model->getDataToCompare()->getDataFieldByFieldName($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                                 $oldValue = $htmlObjetOld->getRawContent();
                                 $htmlObjetNew = Html::getHtmlObjectFromDataField($model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                                 $newValue = $htmlObjetNew->getRawContent();
                                 $label = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO];
                                 $idFtaChapitreTmp = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_ID_LISTE_CHAPITRE_HISTORIQUE];
                                 $idFtaChapitreArray = explode(',', $idFtaChapitreTmp);
                                 $idFtaChapitre = FtaWorkflowStructureModel::getIdFtaChapitreBetweenArrayByWorkflowAndArrayByColumn($paramIdFtaWorkflow, $idFtaChapitreArray);
                                 if ($idFtaChapitre) {
                                     $nomSignataire = FtaSuiviProjetModel::getUserNameByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                                     $dateValidation = FtaSuiviProjetModel::getValidationDateByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                                     $arrayHistoModif[] = array("date" => $dateValidation, "nom" => $nomSignataire, "version" => $versionFta, "etat" => $label, "oldValue" => $oldValue, "newValue" => $newValue);
                                 }
                             }
                         }
                     }
                 }
             } elseif ($rowsTableCheck == FtaConditionnementModel::TABLENAME) {
                 $arraIdFtaConditionnment = FtaConditionnementModel::getArrayIdFtaConditionnement($idFtaEncours);
                 /**
                  * On récupère la liste des embalalges
                  */
                 if ($arraIdFtaConditionnment) {
                     foreach ($arraIdFtaConditionnment as $rowsIdFtaConditionnment) {
                         $idFtaConditionnement = $rowsIdFtaConditionnment[FtaConditionnementModel::KEYNAME];
                         $model = new FtaConditionnementModel($idFtaConditionnement);
                         /**
                          * On vérifie si l'un des champs de l'emballage encours est différents de la version précedentes
                          */
                         $model->setDataFtaConditionnementTableToCompare();
                         /**
                          * restraiendre la liste des champs
                          */
                         $arrayChamps = DatabaseOperation::convertSqlStatementWithoutKeyToArray("SELECT DISTINCT " . IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO . "," . IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO . " FROM " . IntranetColumnInfoModel::TABLENAME . " WHERE " . IntranetColumnInfoModel::FIELDNAME_TABLE_NAME_INTRANET_COLUMN_INFO . "='" . $rowsTableCheck . "'" . " AND " . IntranetColumnInfoModel::FIELDNAME_IS_ENABLED_INTRANET_HISTORIQUE . "=" . IntranetColumnInfoModel::IS_ENABLED_INTRANET_HISTORIQUE_TRUE);
                         foreach ($arrayChamps as $rowsChamps) {
                             $check = $model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO])->isFieldDiff();
                             if ($check) {
                                 $htmlObjetOld = Html::getHtmlObjectFromDataField($model->getDataToCompare()->getDataFieldByFieldName($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                                 $oldValue = $htmlObjetOld->getRawContent();
                                 $htmlObjetNew = Html::getHtmlObjectFromDataField($model->getDataField($rowsChamps[IntranetColumnInfoModel::FIELDNAME_COLUMN_NAME_INTRANET_COLUMN_INFO]));
                                 $newValue = $htmlObjetNew->getRawContent();
                                 $label = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_LABEL_INTRANET_COLUMN_INFO];
                                 $idFtaChapitreTmp = $rowsChamps[IntranetColumnInfoModel::FIELDNAME_ID_LISTE_CHAPITRE_HISTORIQUE];
                                 $idFtaChapitreArray = explode(',', $idFtaChapitreTmp);
                                 $idFtaChapitre = FtaWorkflowStructureModel::getIdFtaChapitreBetweenArrayByWorkflowAndArrayByColumn($paramIdFtaWorkflow, $idFtaChapitreArray);
                                 if ($idFtaChapitre) {
                                     $nomSignataire = FtaSuiviProjetModel::getUserNameByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                                     $dateValidation = FtaSuiviProjetModel::getValidationDateByIdFtaChapitreAndIdFta($idFtaEncours, $idFtaChapitre);
                                     $arrayHistoModif[] = array("date" => $dateValidation, "nom" => $nomSignataire, "version" => $versionFta, "etat" => $label, "oldValue" => $oldValue, "newValue" => $newValue);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /**
      * Affichage du tableau
      */
     if (is_array($arrayHistoModif)) {
         FtaController::arraySortByColumn($arrayHistoModif, "date");
         $tableauFiche .= '<th>' . 'Date' . '</th><th>' . 'Ultilisateur' . '</th><th>' . 'Version du dossier FTA' . '</th><th>' . 'Colonne' . '</th><th>' . 'Ancienne valeur' . '</th><th>' . 'Nouvelle valeur' . '</th>';
         foreach ($arrayHistoModif as $rowsHistoModif) {
             $tableauFiche .= '<tr class=contenu >' . '<td width=8%> ' . $rowsHistoModif["date"] . '</td>' . '<td >' . $rowsHistoModif["nom"] . '</td>' . '<td >' . $rowsHistoModif["version"] . '</td>' . '<td >' . $rowsHistoModif["etat"] . '</td>' . '<td >' . $rowsHistoModif["oldValue"] . '</td>' . '<td >' . $rowsHistoModif["newValue"] . '</td>' . '</tr >';
         }
     }
     return $tableauFiche;
 }
Ejemplo n.º 4
0
 /**
  * Fonction non utilisé
  * @param HtmlListSelect $paramObjet
  * @param bolean $paramIsEditable
  * @param int $paramIdFtaComposant
  * @return string
  */
 public static function ShowListeDeroulantePrefixeForComposant($paramObjet, $paramIsEditable, $paramIdFtaComposant)
 {
     $ftaComposantModel = new FtaComposantModel($paramIdFtaComposant);
     $arraySite = DatabaseOperation::convertSqlStatementWithKeyAndOneFieldToArray('SELECT DISTINCT ' . AnnexeAgrologicArticleCodificationModel::KEYNAME . ', CONCAT_WS(\' - \',' . AnnexeAgrologicArticleCodificationModel::FIELDNAME_PREFIXE_ANNEXE_AGRO_ART_COD . ',' . AnnexeAgrologicArticleCodificationModel::FIELDNAME_NOM_ANNEXE_AGRO_ART_COD . ') FROM ' . AnnexeAgrologicArticleCodificationModel::TABLENAME . ' WHERE ' . AnnexeAgrologicArticleCodificationModel::FIELDNAME_PREFIXE_ANNEXE_AGRO_ART_COD . ' <>\'00\'' . ' ORDER BY ' . AnnexeAgrologicArticleCodificationModel::FIELDNAME_PREFIXE_ANNEXE_AGRO_ART_COD);
     $paramObjet->setArrayListContent($arraySite);
     $HtmlTableName = self::TABLENAME . '_' . self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION . '_' . $paramIdFtaComposant;
     $arrayIdPrefixeCodePSFComposant = DatabaseOperation::convertSqlStatementWithoutKeyToArray('SELECT DISTINCT ' . self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION . ' FROM ' . self::TABLENAME . ' WHERE ' . self::KEYNAME . '=' . $paramIdFtaComposant);
     if ($arrayIdPrefixeCodePSFComposant) {
         foreach ($arrayIdPrefixeCodePSFComposant as $value) {
             $IdPrefixeCodePSF = $value[self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION];
             $paramObjet->setDefaultValue($IdPrefixeCodePSF);
         }
     }
     $paramObjet->getAttributes()->getName()->setValue(self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION);
     $paramObjet->setLabel(DatabaseDescription::getFieldDocLabel(self::TABLENAME, self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION));
     $paramObjet->setIsEditable($paramIsEditable);
     $paramObjet->initAbstractHtmlSelect($HtmlTableName, $paramObjet->getLabel(), $ftaComposantModel->getDataField(self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION)->getFieldValue(), NULL, $paramObjet->getArrayListContent());
     $paramObjet->getEventsForm()->setOnChangeWithAjaxAutoSave(self::TABLENAME, self::KEYNAME, $paramIdFtaComposant, self::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION);
     $listePrefixeCodePSF = $paramObjet->getHtmlResult();
     return $listePrefixeCodePSF;
 }
Ejemplo n.º 5
0
$returnCOLIS = $ftaModel->buildArrayEmballageTypeDuColis();
$poids_net_colis = $returnCOLIS["colis_net"];
//$req = "SELECT id_fta_composition FROM fta_composition WHERE id_fta='".$id_fta."' ORDER BY ordre_fta_composition, nom_fta_composition ";
$req = "SELECT " . FtaComposantModel::KEYNAME . " FROM " . FtaComposantModel::TABLENAME . " WHERE " . FtaComposantModel::FIELDNAME_ID_FTA . "='" . $id_fta . "'" . " AND " . FtaComposantModel::FIELDNAME_IS_COMPOSITION_FTA_COMPOSANT . "=1 " . " ORDER BY " . FtaComposantModel::FIELDNAME_ORDRE_FTA_COMPOSITION . ", " . FtaComposantModel::FIELDNAME_NOM_FTA_COMPOSITION . " ";
$result = DatabaseOperation::convertSqlStatementWithoutKeyToArray($req);
//$nbdeCompo=count($result);
if ($result) {
    foreach ($result as $rows) {
        $pdf->SetAutoPageBreak(0);
        //Chargement des données
        //$id_fta_composition=$rows["id_fta_composition"];
        $id_fta_composant = $rows[FtaComposantModel::KEYNAME];
        $ftaComposantModel = new FtaComposantModel($id_fta_composant);
        $checkNutri = FALSE;
        //Préparation des données de sortie
        $nom_fta_composition = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_NOM_FTA_COMPOSITION)->getFieldValue();
        $quantite_fta_composition = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_QUANTITE_FTA_COMPOSITION)->getFieldValue();
        $poids_fta_compositionTmp = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_POIDS_FTA_COMPOSITION)->getFieldValue();
        $taille_nom_fta_composition = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_TAILLE_POLICE_NOM_FTA_COMPOSITION)->getFieldValue();
        $ingredient_fta_composition = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_INGREDIENT_FTA_COMPOSITION)->getFieldValue();
        $ingredient_fta_composition1 = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_INGREDIENT_FTA_COMPOSITION1)->getFieldValue();
        $val_nut_kcal = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_NUT_KCAL)->getFieldValue();
        $NOM_val_nut_kcal = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_NUT_KCAL)->getFieldLabel();
        $val_nut_kj = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_NUT_KJ)->getFieldValue();
        $NOM_val_nut_kj = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_NUT_KJ)->getFieldLabel();
        $val_nut_mat_grasse = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_MAT_GRASSE)->getFieldValue();
        $NOM_val_nut_mat_grasse = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_MAT_GRASSE)->getFieldLabel();
        $val_nut_acide_gras = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_ACIDE_GRAS)->getFieldValue();
        $NOM_val_nut_acide_gras = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_ACIDE_GRAS)->getFieldLabel();
        $val_nut_glucide = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_GLUCIDE)->getFieldValue();
        $NOM_val_nut_glucide = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_VAL_GLUCIDE)->getFieldLabel();
                     $valueToTest = $rowsValues[AnnexeListeAllergeneDicoModel::FIELDNAME_NOM_ANNEXE_LISTE_ALLERGENE_DICO];
                     if ($stringCorrige) {
                         $rowsString = $stringCorrige;
                     }
                     $mot = FtaController::stringToLowerCase($valueToTest);
                     //Remplace tous les caractères du text
                     //                            $stringCorrige = str_replace($mot, $valueToTest, $rowsString);
                     $stringCorrige = preg_replace('/\\b' . $mot . '\\b/i', $valueToTest, $rowsString, 1);
                 }
             }
             /**
              * Enregistrement en BDD
              */
             switch ($key) {
                 case "0":
                     $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_INGREDIENT_FTA_COMPOSITION)->setFieldValue($stringCorrige);
                     break;
                 case "1":
                     $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_INGREDIENT_FTA_COMPOSITION1)->setFieldValue($stringCorrige);
                     break;
                 case "2":
                     $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_ETIQUETTE)->setFieldValue($stringCorrige);
                     break;
                 case "3":
                     $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_ETIQUETTE_SUPPLEMENTAIRE_FTA_COMPOSIITON)->setFieldValue($stringCorrige);
                     break;
             }
         }
     }
 }
 $ftaComposantModel->saveToDatabase();
  résultat vers une autre page.
 Le plus souvent, le traitement est délocalisé sous forme de
  fonction située dans le fichier "functions.php"
*/
switch ($action) {
    /*
     S'il n'y a pas d'actions défini
    */
    case '':
        //Redirection
        header("Location: index.php");
        break;
    case 'valider':
        if ($id_fta_composant and $proprietaire) {
            $ftaComposantModel = new FtaComposantModel($id_fta_composant);
            $idAnnexeAgroArtCodification = $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_ID_ANNEXE_AGRO_ART_CODIFICATION)->getFieldValue();
            if ($idAnnexeAgroArtCodification) {
                $annexexAgrologicModel = new AnnexeAgrologicArticleCodificationModel($idAnnexeAgroArtCodification);
                $prefixe_code_produit_agrologic_fta_nomenclature = $annexexAgrologicModel->getDataField(AnnexeAgrologicArticleCodificationModel::FIELDNAME_PREFIXE_ANNEXE_AGRO_ART_COD)->getFieldValue();
                $isComposition = $annexexAgrologicModel->getDataField(AnnexeAgrologicArticleCodificationModel::FIELDNAME_IS_COMPOSITION)->getFieldValue();
                /**
                 * Les Produits toujours en Kg
                 */
                if ($prefixe_code_produit_agrologic_fta_nomenclature == "13" or $prefixe_code_produit_agrologic_fta_nomenclature == "11") {
                    $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_ID_ANNEXE_UNITE)->setFieldValue("kg");
                }
                /**
                 * Les Produits toujours en L
                 */
                if ($prefixe_code_produit_agrologic_fta_nomenclature == "17") {
                    $ftaComposantModel->getDataField(FtaComposantModel::FIELDNAME_ID_ANNEXE_UNITE)->setFieldValue("L");