Пример #1
0
 public static function verif_new_param(&$tab_new_user, &$tab_new_jours_an, &$tab_new_solde, &$return = null)
 {
     $PHP_SELF = $_SERVER['PHP_SELF'];
     $session = session_id();
     $return = '';
     foreach ($tab_new_jours_an as $id_cong => $jours_an) {
         $valid = verif_saisie_decimal($tab_new_jours_an[$id_cong]);
         //verif la bonne saisie du nombre décimal
         $valid = verif_saisie_decimal($tab_new_solde[$id_cong]);
         //verif la bonne saisie du nombre décimal
     }
     // verif des parametres reçus :
     // si on travaille avec la base dbconges, on teste tout, mais si on travaille avec ldap, on ne teste pas les champs qui viennent de ldap ...
     if (!\admin\Fonctions::test_form_add_user($tab_new_user)) {
         $return .= '<h3><font color="red">' . _('admin_verif_param_invalides') . '</font></h3>';
         // affichage des param :
         $return .= htmlentities($tab_new_user['login']) . '---' . htmlentities($tab_new_user['nom']) . '---' . htmlentities($tab_new_user['prenom']) . '---' . htmlentities($tab_new_user['quotite']) . '---' . htmlentities($tab_new_user['is_resp']) . '---' . htmlentities($tab_new_user['resp_login']) . '<br>';
         foreach ($tab_new_jours_an as $id_cong => $jours_an) {
             $return .= $tab_new_jours_an[$id_cong] . '---' . $tab_new_solde[$id_cong] . '<br>';
         }
         $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=ajout-user" method="POST">';
         $return .= '<input type="hidden" name="new_login" value="' . $tab_new_user['login'] . '">';
         $return .= '<input type="hidden" name="new_nom" value="' . $tab_new_user['nom'] . '">';
         $return .= '<input type="hidden" name="new_prenom" value="' . $tab_new_user['prenom'] . '">';
         $return .= '<input type="hidden" name="new_is_resp" value="' . $tab_new_user['is_resp'] . '">';
         $return .= '<input type="hidden" name="new_resp_login" value="' . $tab_new_user['resp_login'] . '">';
         $return .= '<input type="hidden" name="new_is_admin" value="' . $tab_new_user['is_admin'] . '">';
         $return .= '<input type="hidden" name="new_is_hr" value="' . $tab_new_user['is_hr'] . '">';
         $return .= '<input type="hidden" name="new_see_all" value="' . $tab_new_user['see_all'] . '">';
         $return .= '<input type="hidden" name="new_quotite" value="' . $tab_new_user['quotite'] . '">';
         $return .= '<input type="hidden" name="new_email" value="' . $tab_new_user['email'] . '">';
         foreach ($tab_new_jours_an as $id_cong => $jours_an) {
             $return .= '<input type="hidden" name="tab_new_jours_an[$id_cong]" value="' . $tab_new_jours_an[$id_cong] . '">';
             $return .= '<input type="hidden" name="tab_new_solde[' . $id_cong . ']" value="' . $tab_new_solde[$id_cong] . '">';
         }
         $return .= '<input type="hidden" name="saisie_user" value="faux">';
         $return .= '<input type="submit" value="' . _('form_redo') . '"">';
         $return .= '</form>';
         return true;
     } else {
         // verif si le login demandé n'existe pas déjà ....
         $sql_verif = 'SELECT u_login FROM conges_users WHERE u_login="******"';
         $ReqLog_verif = \includes\SQL::query($sql_verif);
         $num_verif = $ReqLog_verif->num_rows;
         if ($num_verif != 0) {
             $return .= '<h3><font color="red">' . _('admin_verif_login_exist') . '</font></h3>';
             $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=ajout-user" method="POST">';
             $return .= '<input type="hidden" name="new_login" value="' . $tab_new_user['login'] . '">';
             $return .= '<input type="hidden" name="new_nom" value="' . $tab_new_user['nom'] . '">';
             $return .= '<input type="hidden" name="new_prenom" value="' . $tab_new_user['prenom'] . '">';
             $return .= '<input type="hidden" name="new_is_resp" value="' . $tab_new_user['is_resp'] . '">';
             $return .= '<input type="hidden" name="new_resp_login" value="' . $tab_new_user['resp_login'] . '">';
             $return .= '<input type="hidden" name="new_is_admin" value="' . $tab_new_user['is_admin'] . '">';
             $return .= '<input type="hidden" name="new_is_hr" value="' . $tab_new_user['is_hr'] . '">';
             $return .= '<input type="hidden" name="new_quotite" value="' . $tab_new_user['quotite'] . '">';
             $return .= '<input type="hidden" name="new_email" value="' . $tab_new_user['email'] . '">';
             foreach ($tab_new_jours_an as $id_cong => $jours_an) {
                 $return .= '<input type="hidden" name="tab_new_jours_an[' . $id_cong . ']" value="' . $tab_new_jours_an[$id_cong] . '">';
                 $return .= '<input type="hidden" name="tab_new_solde[' . $id_cong . ']" value="' . $tab_new_solde[$id_cong] . '">';
             }
             $return .= '<input type="hidden" name="saisie_user" value="faux">';
             $return .= '<input type="submit" value="' . _('form_redo') . '">';
             $return .= '</form>';
             return true;
         } elseif ($_SESSION['config']['where_to_find_user_email'] == "dbconges" && strrchr($tab_new_user['email'], "@") == FALSE) {
             $return .= '<h3>' . _('admin_verif_bad_mail') . '</h3>';
             $return .= '<form action="' . $PHP_SELF . '?session=' . $session . '&onglet=ajout-user" method="POST">';
             $return .= '<input type="hidden" name="new_login" value="' . $tab_new_user['login'] . '">';
             $return .= '<input type="hidden" name="new_nom" value="' . $tab_new_user['nom'] . '">';
             $return .= '<input type="hidden" name="new_prenom" value="' . $tab_new_user['prenom'] . '">';
             $return .= '<input type="hidden" name="new_is_resp" value="' . $tab_new_user['is_resp'] . '">';
             $return .= '<input type="hidden" name="new_resp_login" value="' . $tab_new_user['resp_login'] . '">';
             $return .= '<input type="hidden" name="new_is_admin" value="' . $tab_new_user['is_admin'] . '">';
             $return .= '<input type="hidden" name="new_is_hr" value="' . $tab_new_user['is_hr'] . '">';
             $return .= '<input type="hidden" name="new_quotite" value="' . $tab_new_user['quotite'] . '">';
             $return .= '<input type="hidden" name="new_email" value="' . $tab_new_user['email'] . '">';
             foreach ($tab_new_jours_an as $id_cong => $jours_an) {
                 $return .= '<input type="hidden" name="tab_new_jours_an[' . $id_cong . ']" value="' . $tab_new_jours_an[$id_cong] . '">';
                 $return .= '<input type="hidden" name="tab_new_solde[' . $id_cong . ']" value="' . $tab_new_solde[$id_cong] . '">';
             }
             $return .= '<input type="hidden" name="saisie_user" value="faux">';
             $return .= '<input class="btn" type="submit" value="' . _('form_redo') . '">';
             $return .= '</form>';
             return true;
         } else {
             return false;
         }
     }
 }