function dde_form($form_name)
{
    global $l, $protectedPost, $protectedGet, $pages_refs;
    //cas of dde modification
    if (isset($protectedPost['MODIF'])) {
        $item_modif_values = info_dde($protectedPost['MODIF']);
        if (is_object($item_modif_values)) {
            foreach ($item_modif_values as $key => $value) {
                if (substr_count($key, 'fields_')) {
                    if (substr_count($value, '**&&&**')) {
                        $array_value = explode('**&&&**', $value);
                        foreach ($array_value as $nb => $value_tab) {
                            //if this field is readonly
                            //we sow all values
                            $value_list[substr($key, 7)] .= $value_tab . ". ";
                            $protectedPost[substr($key, 7) . '_' . $nb] = $value_tab;
                        }
                    } elseif (substr_count($value, '**check&check**')) {
                        $array_value = explode('**check&check**', $value);
                        foreach ($array_value as $nb => $value_tab) {
                            //if this field is readonly
                            //we sow all values
                            $value_list[substr($key, 7)] .= $value_tab . ". ";
                            $protectedPost[substr($key, 7) . '_' . $value_tab] = 'on';
                        }
                    } else {
                        $protectedPost[substr($key, 7)] = $value;
                    }
                } elseif ($key == 'ID') {
                    $protectedPost['OLD_MODIF'] = $value;
                } elseif ($key == 'STATUT') {
                    $protectedPost['STATUS'] = $value;
                } elseif ($key == 'LOGIN_USER') {
                    $protectedPost['LOGIN_USER'] = $value;
                }
            }
            unset($protectedPost['MODIF']);
        }
        if ($protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser'] and is_array($value_list)) {
            foreach ($value_list as $key => $value) {
                $protectedPost[$key] = $value;
            }
        }
    }
    //search all tab of this form
    $sql_TAB = "select VALUE,LBL,ID,DEFAULT_FIELD from downloadwk_tab_values where FIELD = 'TAB'";
    $result_TAB = mysql_query($sql_TAB, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
    while ($item = mysql_fetch_object($result_TAB)) {
        if (!isset($protectedPost['cat']) or $protectedPost['cat'] == '') {
            $protectedPost['cat'] = $item->ID;
        }
        $lbl = define_lbl($item->LBL, $item->DEFAULT_FIELD);
        $cat_value[$item->ID] = $lbl;
    }
    //show all tab
    onglet($cat_value, $form_name, "cat", 5);
    //search all fields of the form
    $sql_fields = "select TAB,FIELD,TYPE,LBL,MUST_COMPLETED,ID,VALUE,DEFAULT_FIELD,RESTRICTED,LINK_STATUS from downloadwk_fields";
    $result_fields = mysql_query($sql_fields, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
    while ($item = mysql_fetch_object($result_fields)) {
        unset($value);
        if ($item->RESTRICTED == 1 and $_SESSION['OCS']['RESTRICTION']['TELEDIFF_WK_FIELDS'] == 'YES' or isset($protectedPost['OLD_MODIF']) and $item->TYPE != 8 and $item->TYPE != 10 and $protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser']) {
            $grise = 3;
            //cas of status
            if ($item->FIELD == "STATUS") {
                //It's the only field witch admin can modify when request is create by someone else
                if ($_SESSION['OCS']['RESTRICTION']['TELEDIFF_WK_FIELDS'] == 'YES') {
                    $val_field = $item->VALUE;
                    $sql_service = "select id, lbl as value from downloadwk_statut_request where id='" . $val_field . "'";
                    $resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
                    $item_conf_values = mysql_fetch_object($resultSERV);
                    $value = $item_conf_values->value;
                } else {
                    $grise = $item->TYPE;
                }
            } else {
                //cas of list and checkbox
                if (isset($protectedPost[$item->ID])) {
                    $list_id = explode('.', $protectedPost[$item->ID]);
                    $p = 0;
                    $ok_num = true;
                    while ($list_id[$p]) {
                        if (!is_numeric($list_id[$p]) and trim($list_id[$p]) != "") {
                            $ok_num = false;
                        }
                        if (trim($list_id[$p]) == "") {
                            unset($list_id[$p]);
                        }
                        $p++;
                    }
                    if ($ok_num and implode(',', $list_id)) {
                        $sql_service = "select field, value from downloadwk_conf_values where id in (%s)";
                        $arg_service = array(implode(',', $list_id));
                        $resultSERV = mysql2_query_secure($sql_service, $_SESSION['OCS']["readServer"], $arg_service);
                        $value = "";
                        while ($item_conf_values = mysql_fetch_object($resultSERV)) {
                            $value .= $item_conf_values->value . ' ';
                        }
                    }
                    //	echo $value;
                }
                if (!isset($value) or $value == "") {
                    $value = $protectedPost[$item->ID];
                }
                if ($value == "") {
                    $value = $value_list[$item->ID];
                }
                /*$val_field=$item->ID;
                		$sql_service="select field, value from downloadwk_conf_values where field='".$val_field."'";
                		echo $sql_service."<br>";
                		$resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
                		$item_conf_values = mysql_fetch_object($resultSERV);
                		if (isset($item_conf_values))	
                		$value=$item_conf_values->value;*/
            }
        } elseif (isset($protectedPost['OLD_MODIF']) and $item->TYPE == 8 and $protectedPost['LOGIN_USER'] != $_SESSION['OCS']['loggeduser']) {
            $grise = 9;
        } else {
            $grise = $item->TYPE;
        }
        //echo $item->FIELD."=>".$grise."<br>";
        //	print_r($item);
        //si le champs n'est pas restraint, on l'affiche
        //$item->LINK_STATUS
        if (!(is_numeric($item->LINK_STATUS) and $protectedPost['STATUS'] != $item->LINK_STATUS and $item->LINK_STATUS != 0)) {
            $lbl = define_lbl($item->LBL, $item->DEFAULT_FIELD);
            $name_field[$item->TAB][$item->ID] = $item->ID;
            $oblig_field[$item->TAB][$item->ID] = $item->MUST_COMPLETED;
            $tab_name[$item->TAB][$item->ID] = $lbl;
            $type_field[$item->TAB][$item->ID] = $grise;
            $type_field_temp[$item->ID] = $grise;
            $restricted_field[$item->TAB][$item->ID] = $item->RESTRICTED;
            $link_status[$item->TAB][$item->ID] = $item->LINK_STATUS;
            //si une valeur par défaut est donnée au champ
            //mais que l'on n'est dans un champ type multi lignes
            if (!isset($value)) {
                if ($item->VALUE != '' and $grise != 6) {
                    if (isset($_SESSION['OCS'][$item->VALUE])) {
                        $value = $_SESSION['OCS'][$item->VALUE];
                    } else {
                        $value = $item->VALUE;
                    }
                } else {
                    $value = $protectedPost[$item->ID];
                }
            }
            //cas du champ multi ligne => on récupère le nbre de champ a afficher
            if ($grise == 6) {
                if (!is_numeric($item->VALUE)) {
                    $nb_fields[$item->TAB][$item->ID] = 6;
                } else {
                    $nb_fields[$item->TAB][$item->ID] = $item->VALUE;
                }
                //ajout des champs a prendre en compte quand on passe d'onglet en onglet
                $k = 0;
                while ($k < $nb_fields[$item->TAB][$item->ID]) {
                    $name_field[$item->TAB][$item->ID . '_' . $k] = $item->ID . '_' . $k;
                    $k++;
                }
            }
            //unset($value_field[$item->TAB][$item->ID]);
            if ($grise == 2 or $grise == 5) {
                //echo $item->FIELD."<br>";
                //GESTION DU STATUT DE LA DEMANDE
                if ($item->FIELD == "STATUS") {
                    $list_status = list_status();
                    $sql_service = "select id, lbl as value from downloadwk_statut_request where id in (" . implode(',', $list_status['ID_TAB']) . ")";
                } else {
                    $add_values_admin[$item->TAB][$item->ID] = $item->ID;
                    $sql_service = "select field,value,id,default_field FROM downloadwk_conf_values where field=" . $item->ID;
                }
                //echo $item->FIELD."<br>";
                $resultSERV = mysql_query($sql_service, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
                while ($item_conf_values = mysql_fetch_object($resultSERV)) {
                    if (!isset($List[$item_conf_values->field]) and $grise == 2) {
                        $value_field[$item->TAB][$item->ID][''] = '';
                    }
                    if ($grise == 5) {
                        $name_field[$item->TAB][$item->ID . '_' . $item_conf_values->id] = $item->ID . '_' . $item_conf_values->id;
                    }
                    $value_field[$item->TAB][$item->ID][$item_conf_values->id] = $item_conf_values->value;
                    //echo $value_field[$item->TAB][$item->ID][$item_conf_values->id]."<br>";
                }
            } elseif ($grise == 9) {
                $sql_files = "select id,file_name from temp_files where fields_name='fields_" . $item->ID . "' and id_dde='" . $protectedPost['OLD_MODIF'] . "'";
                $result_files = mysql_query($sql_files, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
                while ($item_files = mysql_fetch_object($result_files)) {
                    $value_field[$item->TAB][$item->ID][$item_files->id] = $item_files->file_name;
                }
            } elseif ($grise == 8) {
                $nb_dde[$item->TAB][$item->ID] = $protectedPost['OLD_MODIF'];
            } else {
                $value_field[$item->TAB][$item->ID] = $value;
            }
        }
    }
    /*********************END initialisation***********************/
    //echo "<br><hr><br>";
    //DDE POST
    if ($protectedPost['SUBMIT_FORM'] == "SUBMIT_FORM") {
        foreach ($oblig_field as $key => $array_value) {
            foreach ($array_value as $id => $value) {
                //les champs en lecture seule ne sont pas à mettre à jour
                if ($type_field[$key][$id] != 3) {
                    //si on est à l'insertion de fichier dans la demande
                    if ($type_field[$key][$id] == 8 or $type_field[$key][$id] == 9) {
                        //	//recherche des fichiers disponibles pour ce champ
                        $sql = "select id from temp_files where fields_name = 'fields_" . $id . "' \n\t\t\t\t\t\t\t\t\t\t\tand AUTHOR='" . $_SESSION['OCS']['loggeduser'] . "'\n\t\t\t\t\t\t\t\t\t\t\tand (ID_DDE is null or ID_DDE='" . $protectedPost['OLD_MODIF'] . "')";
                        $result = mysql_query($sql, $_SESSION['OCS']["readServer"]) or mysql_error($_SESSION['OCS']["readServer"]);
                        unset($id_files_value);
                        while ($item_values = mysql_fetch_object($result)) {
                            $id_files_value[] = $item_values->id;
                            $list_id_files_to_update[] = $item_values->id;
                        }
                        //on ajoute les id des fichiers aux posts pour les insérer en base
                        if (isset($id_files_value)) {
                            $protectedPost[$id] = implode(',', $id_files_value);
                        }
                    }
                    //si le post n'existe pas ou qu'il est vide mais que ce champ est obligatoire
                    if ((!isset($protectedPost[$id]) or $protectedPost[$id] == '') and $value == 1) {
                        //cas of checkbox
                        unset($check);
                        if ($type_field[$key][$id] == 5) {
                            foreach ($name_field[$key] as $id_check) {
                                if ($protectedPost[$id_check]) {
                                    $check = true;
                                }
                            }
                        }
                        //traitement des multi listes
                        if ($type_field[$key][$id] == 6) {
                            foreach ($protectedPost as $key2 => $value2) {
                                if (strstr($key2, $id . '_') and $value2 != '') {
                                    $value_list[$id] .= $value2 . '**&&&**';
                                    $check = true;
                                }
                            }
                        }
                        if (!isset($check)) {
                            $msg_empty .= $tab_name[$key][$id] . "<br>";
                        }
                    }
                    //si le champ est en lecture seule, on ne prend pas en compte la valeur
                    //du post
                    /*if ($type_field[$key][$id] == 3)
                    		unset($protectedPost[$id]);		*/
                }
            }
        }
        //	$msg_empty="STOP";
        //print_r($type_field_temp);
        if (isset($msg_empty)) {
            msg_error($l->g(684) . ":<br>" . $msg_empty);
            unset($protectedPost['SUBMIT_FORM']);
        } else {
            //on récupère l'id du champ status
            $item_id_STATUS = find_id_field();
            if (isset($item_id_STATUS['STATUS']->id) and $item_id_STATUS['STATUS']->id != '') {
                foreach ($protectedPost as $key => $value) {
                    //cas of checkbox
                    $checkbox = explode('_', $key);
                    if ($type_field_temp[$key] != 9) {
                        if (isset($protectedPost['OLD_MODIF']) and is_numeric($protectedPost['OLD_MODIF']) and $type_field_temp[$key] != 3 and $type_field_temp[$checkbox[0]] != 3 or !isset($protectedPost['OLD_MODIF'])) {
                            //echo $key."=>".$type_field_temp[$key]."<br>";
                            if (is_numeric($checkbox[0]) and is_numeric($checkbox[1]) and !isset($value_list[$checkbox[0]])) {
                                $check_on[$checkbox[0]] .= $checkbox[1] . "**check&check**";
                            } elseif (isset($value_list[$checkbox[0]]) and $value_list[$checkbox[0]] != '') {
                                $array_fields_form[] = "fields_" . $checkbox[0];
                                $array_value_form[] = $value_list[$checkbox[0]];
                                $value_list[$checkbox[0]] = '';
                            }
                            if (is_numeric($key)) {
                                $array_fields_form[] = "fields_" . $key;
                                //gestion du statut. La demande est faite => statut=2
                                if ($item_id_STATUS['STATUS']->id == $key and $value == '' or $item_id_STATUS['STATUS']->id == $key and !is_numeric($value)) {
                                    $array_value_form[] = "2";
                                } else {
                                    $array_value_form[] = $value;
                                }
                            }
                        }
                    }
                }
                if (isset($check_on)) {
                    foreach ($check_on as $key => $value) {
                        $array_fields_form[] = "fields_" . $key;
                        $array_value_form[] = $value;
                    }
                }
                if (isset($protectedPost['OLD_MODIF']) and is_numeric($protectedPost['OLD_MODIF'])) {
                    //search old parameters
                    $sql_old_param = "select * from downloadwk_pack where id = '%s'";
                    $arg = array($protectedPost['OLD_MODIF']);
                    $result_old_param = mysql2_query_secure($sql_old_param, $_SESSION['OCS']["readServer"], $arg);
                    $item_old_param = mysql_fetch_object($result_old_param);
                    $sql_wk_dde = "UPDATE downloadwk_pack set ";
                    $i = 0;
                    $arg = array();
                    while ($array_fields_form[$i]) {
                        $sql_wk_dde .= $array_fields_form[$i] . "='%s', ";
                        $arg_wk_dde[] = $array_value_form[$i];
                        if ($item_old_param->{$array_fields_form}[$i] != $array_value_form[$i]) {
                            $id_field = explode('_', $array_fields_form[$i]);
                            $sql_fields_modif = "select lbl from downloadwk_fields where id = '%s'";
                            $arg_lbl = array($id_field[1]);
                            $result_fields_modif = mysql2_query_secure($sql_fields_modif, $_SESSION['OCS']["readServer"], $arg_lbl);
                            $item_fields_modif = mysql_fetch_object($result_fields_modif);
                            if (is_numeric($item_fields_modif->lbl)) {
                                $modif_field = $l->g($item_fields_modif->lbl);
                            } else {
                                $modif_field = $item_fields_modif->lbl;
                            }
                            $list_fields_modif[] = $modif_field;
                        }
                        $i++;
                    }
                    $sql_wk_dde = substr($sql_wk_dde, 0, -2) . " WHERE ID='%s'";
                    $arg_wk_dde[] = $protectedPost['OLD_MODIF'];
                    $subjet_mail = $l->g(1053) . ": " . $protectedPost['OLD_MODIF'];
                    $body = $_SESSION['OCS']['loggeduser'] . $l->g(1090) . $protectedPost['OLD_MODIF'];
                    //LOGS MODIF
                    if (isset($list_fields_modif) and is_array($list_fields_modif)) {
                        $sql_log_modif = "INSERT INTO downloadwk_history (ID_DDE,AUTHOR,DATE,ACTION) \n\t\t\t\t\t\t\t\t\t\t\tVALUES ('%s','%s',sysdate(),'%s')";
                        $arg = array($protectedPost['OLD_MODIF'], $_SESSION['OCS']['loggeduser'], implode(',', $list_fields_modif));
                        mysql2_query_secure($sql_log_modif, $_SESSION['OCS']["writeServer"], $arg);
                        $body .= "Champs modifiés: <br>" . implode('<br>', $list_fields_modif);
                    }
                    $msg_popup = $l->g(1053);
                } else {
                    $sql_wk_dde = "INSERT INTO downloadwk_pack (LOGIN_USER,GROUP_USER,Q_DATE,";
                    $sql_wk_dde .= implode(",", $array_fields_form);
                    $sql_wk_dde .= ") VALUES ('%s','%s',UNIX_TIMESTAMP(),";
                    $arg_wk_dde = array($_SESSION['OCS']['loggeduser'], $_SESSION['OCS']['user_group']);
                    foreach ($array_value_form as $key_form => $value_form) {
                        $sql_wk_dde .= "'%s',";
                        $arg_wk_dde[] = $value_form;
                    }
                    $sql_wk_dde = substr($sql_wk_dde, 0, -1) . ")";
                    $msg_popup = $l->g(1054);
                    $subjet_mail = $l->g(1091);
                    $body = $_SESSION['OCS']['loggeduser'] . $l->g(1092);
                }
                /*echo "<br><hr><br>";
                		echo $sql_wk_dde;
                		echo "<br><hr><br>";*/
                //print_r($array_value_form);
                //$sql_insert= substr($sql_insert,0,-1);
                //$list_value= substr($list_value,0,-2);
                mysql2_query_secure($sql_wk_dde, $_SESSION['OCS']["writeServer"], $arg_wk_dde);
                //mise à jour des blobs insérés
                if (isset($list_id_files_to_update)) {
                    if (mysql_insert_id($_SESSION['OCS']["writeServer"])) {
                        $id_dde = mysql_insert_id($_SESSION['OCS']["writeServer"]);
                    } elseif (isset($protectedPost['OLD_MODIF'])) {
                        $id_dde = $protectedPost['OLD_MODIF'];
                    }
                    if (isset($id_dde)) {
                        $sql_up = "update temp_files \n\t\t\t\t\t\t\t\t\tset ID_DDE='%s' \n\t\t\t\t\t\t\t\t\twhere ID in (%s)";
                        $arg = array($id_dde, implode(",", $list_id_files_to_update));
                        mysql2_query_secure($sql_up, $_SESSION['OCS']["writeServer"], $arg);
                    }
                }
                $tab = $protectedPost['cat'];
                unset($protectedPost);
                $protectedPost['cat'] = $tab;
                msg_success($msg_popup);
                //TODO: envoi de mail au group admin + soit à l'utilisateur soit à son groupe (voir la conf du profil)
                $mail_active = option_conf_activate('IT_SET_MAIL');
                if ($mail_active) {
                    //mail for admin of workflow
                    $group_admin_mail = look_config_default_values(array('IT_SET_MAIL_ADMIN'));
                    if (isset($group_admin_mail['ivalue']['IT_SET_MAIL_ADMIN'])) {
                        $sql_mail = "select email \n\t\t\t\t\t\t\t\t\t\tfrom operators \n\t\t\t\t\t\t\t\t\t\twhere user_group='%s'";
                        $arg = array($group_admin_mail['ivalue']['IT_SET_MAIL_ADMIN']);
                        $result_mail = mysql2_query_secure($sql_mail, $_SESSION['OCS']["readServer"], $arg);
                        $mail_list = array();
                        while ($item_mail = mysql_fetch_object($result_mail)) {
                            if (VerifyMailadd($item_mail->email)) {
                                $mail_list[] = $item_mail->email;
                            }
                        }
                    }
                    //mail for other
                    $sql_mail = "select email,user_group \n\t\t\t\t\t\t\t\t   from operators \n\t\t\t\t\t\t\t\t   where ID='%s'";
                    $arg = array($_SESSION['OCS']['loggeduser']);
                    $result_mail = mysql2_query_secure($sql_mail, $_SESSION['OCS']["readServer"], $arg);
                    $item_mail = mysql_fetch_object($result_mail);
                    if (!VerifyMailadd($item_mail->email)) {
                        msg_error($l->g(1055) . " " . $l->g(1056));
                    }
                    if ($_SESSION['OCS']['TELEDIFF_WK'] == 'LOGIN') {
                        if (VerifyMailadd($item_mail->email)) {
                            $mail_list[] = $item_mail->email;
                        }
                    } elseif ($_SESSION['OCS']['TELEDIFF_WK'] == 'USER_GROUP') {
                        $sql_mail_group = "select email from operators \n\t\t\t\t\t\t\t\t\t\t\t where USER_GROUP='%s'";
                        $arg = array($item_mail->user_group);
                        $result_mail_group = mysql2_query_secure($sql_mail_group, $_SESSION['OCS']["readServer"], $arg);
                        while ($item_mail_group = mysql_fetch_object($result_mail_group)) {
                            if (VerifyMailadd($item_mail_group->email)) {
                                $mail_list[] = $item_mail_group->email;
                            }
                        }
                    }
                    if (isset($mail_list[0])) {
                        send_mail($mail_list, $subjet, $body);
                    } else {
                        msg_error($l->g(1058));
                    }
                }
                unset($_SESSION['OCS']['DATA_CACHE'], $_SESSION['OCS']['NUM_ROW']);
            } else {
                msg_error($l->g(1093) . ".<br> " . $l->g(1094));
                unset($protectedPost['SUBMIT_FORM']);
            }
        }
    }
    /***************BEGIN Show fields*************/
    if ($name_field[$protectedPost['cat']]) {
        //print_r($type_field[$protectedPost['cat']]);
        $tab_typ_champ = show_field($name_field[$protectedPost['cat']], $type_field[$protectedPost['cat']], $value_field[$protectedPost['cat']]);
        if (isset($nb_fields[$protectedPost['cat']])) {
            foreach ($nb_fields[$protectedPost['cat']] as $key => $value) {
                $tab_typ_champ[$key]['CONFIG']['NB_FIELD'] = $value;
            }
        }
        if (isset($nb_dde[$protectedPost['cat']])) {
            foreach ($nb_dde[$protectedPost['cat']] as $key => $value) {
                $tab_typ_champ[$key]['CONFIG']['DDE'] = $value;
            }
        }
        //add * before the lbl if this field must be completed
        foreach ($tab_name[$protectedPost['cat']] as $key => $value) {
            if ($oblig_field[$protectedPost['cat']][$key] == 1) {
                $tab_name[$protectedPost['cat']][$key] = '*' . $value;
            }
        }
        ksort($tab_name[$protectedPost['cat']]);
        //print_r($add_values[$protectedPost['cat']]);
        if ($_SESSION['OCS']['CONFIGURATION']['TELEDIFF_WK'] == 'YES') {
            if (isset($add_values_admin[$protectedPost['cat']])) {
                foreach ($add_values_admin[$protectedPost['cat']] as $key => $value) {
                    $tab_typ_champ[$value]['COMMENT_BEHING'] = "<a href=# onclick=window.open(\"index.php?" . PAG_INDEX . "=" . $pages_refs['ms_admin_management'] . "&head=1&value=" . $value . "&form=" . $form_name . "\",\"admin_management\",\"location=0,status=0,scrollbars=0,menubar=0,resizable=0,width=550,height=450\")><img src=image/plus.png></a>";
                }
            }
        }
    } else {
        echo "NOT DEFINE";
    }
    /***************END Show fields*************/
    if (isset($msg)) {
        msg_success($msg);
    }
    if (isset($tab_typ_champ)) {
        //print_r($name_field);
        $tab_hidden = hidden($protectedPost, $name_field[$protectedPost['cat']]);
        tab_modif_values($tab_name[$protectedPost['cat']], $tab_typ_champ, $tab_hidden, $title = "", $comment = "", $name_button = "modif", $showbutton = false, 'NO_FORM');
        if (isset($protectedPost['OLD_MODIF'])) {
            $lbl = $l->g(115);
        } else {
            $lbl = $l->g(114);
        }
        echo "<input type=button name='VALID' id='VALID' value='" . $lbl . "' OnClick='pag(\"SUBMIT_FORM\",\"SUBMIT_FORM\",\"" . $form_name . "\");'>";
        echo "<input type='hidden' name='SUBMIT_FORM' id='SUBMIT_FORM' value=''>";
    }
}
echo "<script language='javascript'>\n\t\tfunction verif()\n\t\t {\n\t\t\tvar msg = '';\n\t\t\tchamps = new Array('NAME','DESCRIPTION','OS','PROTOCOLE','PRIORITY','ACTION','ACTION_INPUT','REDISTRIB_USE');\n\t\t\tchamps_OS = new Array('NOTIFY_USER','NEED_DONE_ACTION');\n\t\t\tchamps_ACTION=new Array('teledeploy_file');\n\t\t\tchamps_REDISTRIB_USE=new Array('REDISTRIB_PRIORITY');\n\t\t\tchamps_NOTIFY_USER=new Array('NOTIFY_TEXT','NOTIFY_COUNTDOWN','NOTIFY_CAN_ABORT','NOTIFY_CAN_DELAY');\n\t\t\tchamps_NEED_DONE_ACTION=new Array('NEED_DONE_ACTION_TEXT');\n\t\t\t\n\n\n\t\t\n\t\t\tfor (var n = 0; n < champs.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById(champs[n]).value == ''){\n\t\t\t\t document.getElementById(champs[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_OS.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('OS').value == 'WINDOWS' && document.getElementById(champs_OS[n]).value == ''){\n\t\t\t\t document.getElementById(champs_OS[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_OS[n]).style.backgroundColor = '';\n\t\t\t}\n\t\t\tfor (var n = 0; n < champs_ACTION.length; n++)\n\t\t\t{\n\t\t\t\tvar name_file=document.getElementById(champs_ACTION[n]).value;\n\t\t\t\tname_file=name_file.toUpperCase();\n\t\t\t\tif (document.getElementById(\"OS\").value == 'WINDOWS')\n\t\t\t\t\tvar debut=name_file.length-3;\n\t\t\t\telse\n\t\t\t\t\tvar debut=name_file.length-6;\n\t\t\t\tif (document.getElementById('ACTION').value != 'EXECUTE' && document.getElementById(champs_ACTION[n]).value == ''){\n\t\t\t\t\talert('" . $l->g(602) . "');\n\t\t\t\t \tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t \tmsg='NULL';\n\t\t\t\t }\n\t\t\t\telse if (document.getElementById('ACTION').value != 'EXECUTE' && name_file.substring(debut,name_file.length) != 'ZIP' && document.getElementById(\"OS\").value == 'WINDOWS'){\n\t\t\t\t\talert('" . $l->g(1231) . "');\n\t\t\t\t\tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t\tmsg='NULL';\n\t\t\t\t}else if (document.getElementById('ACTION').value != 'EXECUTE' && name_file.substring(debut,name_file.length) != 'TAR.GZ' && document.getElementById(\"OS\").value != 'WINDOWS'){\n\t\t\t\t\talert('" . $l->g(1232) . "');\n\t\t\t\t\tdocument.getElementById(champs_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t\tmsg='NULL';\n\t\t\t\t}\n\t\t\t\t document.getElementById(champs_ACTION[n]).style.backgroundColor = '';\n\n\t\t\t}\n\t\t\t\n\t\t\tfor (var n = 0; n < champs_REDISTRIB_USE.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('REDISTRIB_USE').value == 1 && document.getElementById(champs_REDISTRIB_USE[n]).value == ''){\n\t\t\t\t document.getElementById(champs_REDISTRIB_USE[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_REDISTRIB_USE[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_NOTIFY_USER.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('NOTIFY_USER').value == 1 && document.getElementById(champs_NOTIFY_USER[n]).value == ''){\n\t\t\t\t document.getElementById(champs_NOTIFY_USER[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_NOTIFY_USER[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tfor (var n = 0; n < champs_NEED_DONE_ACTION.length; n++)\n\t\t\t{\n\t\t\t\tif (document.getElementById('NEED_DONE_ACTION').value == 1 && document.getElementById(champs_NEED_DONE_ACTION[n]).value == ''){\n\t\t\t\t document.getElementById(champs_NEED_DONE_ACTION[n]).style.backgroundColor = 'RED';\n\t\t\t\t msg='NULL';\n\t\t\t\t }\n\t\t\t\telse\n\t\t\t\t document.getElementById(champs_NEED_DONE_ACTION[n]).style.backgroundColor = '';\n\t\t\t}\n\n\t\t\tif (msg != ''){\n\t\t\talert ('" . $l->g(1001) . "');\n\t\t\treturn false;\n\t\t\t}else\n\t\t\treturn true;\t\t\t\n\t\t}\n\t</script>";
echo "<div ";
if ($protectedPost['valid']) {
    echo " style='display:none;'";
}
echo ">";
printEnTete($l->g(434));
echo "<br>";
$activate = option_conf_activate('TELEDIFF_WK');
//If workflow for teledeploy is activated
//We show only the package we can create
if ($activate) {
    msg_info($l->g(1105) . "<br>" . $l->g(1106) . "<br>" . $l->g(1107));
    //get all request with the status "Create a Package"
    $conf_creat_Wk = look_config_default_values(array('IT_SET_NIV_CREAT'));
    $info_dde_statut_creat = info_dde(find_dde_by_status($conf_creat_Wk['tvalue']['IT_SET_NIV_CREAT']));
    if ($info_dde_statut_creat != '') {
        $array_id_fields = find_id_field(array('NAME_TELEDEPLOY', 'PRIORITY', 'NOTIF_USER', 'REPORT_USER', 'INFO_PACK'));
        //build the seach
        $id_name = "fields_" . $array_id_fields['NAME_TELEDEPLOY']->id;
        $id_description = "fields_" . $array_id_fields['INFO_PACK']->id;
        $id_priority = "fields_" . $array_id_fields['PRIORITY']->id;
        $id_notify_user = "******" . $array_id_fields['NOTIF_USER']->id;
        foreach ($info_dde_statut_creat as $id => $tab_value) {
            $list_dde_creat[$tab_value->ID] = $tab_value->{$id_name};
        }
        echo "<br><b>" . $l->g(1183) . ":</b>" . show_modif($list_dde_creat, 'LIST_DDE_CREAT', 2, $form_name);
        if (!$protectedPost['LIST_DDE_CREAT'] or $protectedPost['LIST_DDE_CREAT'] == "") {
            echo close_form();
            require_once FOOTER_HTML;
            die;