Пример #1
0
    list($date_fr, $date_fr_short, $date_fr_long, $date_fr_hr, $date_fr_short_hr, $date_fr_long_hr, $date_fr_full_hr) = date_fr($program["course_date"]);
    // GET request
    $fiedset_msg = " Client " . $program["pseudo"];
    $fiedset_msg .= " en date de " . $date_fr_short;
    $fiedset_msg .= " ID " . $_GET["program_id"];
    // validation warning
    $date_msg = get_warning_error_p(check_date_vs_now($program['course_date']), true);
    list($msg_pseudo_autres, $msg_nom_patient) = validate_pseudo($pseudo, $pseudo_autres, $nom_patient, true);
    $msg_bon_no = validate_pseudo_bon_no($pseudo, $bon_no, true);
    //    echo $msg_pseudo_autres;
    //    echo $msg_nom_patient;
    $msg_pseudo_autres = get_warning_error_p($msg_pseudo_autres, true);
    $msg_nom_patient = get_warning_error_p($msg_nom_patient, true);
    $msg_bon_no = get_warning_error_p($msg_bon_no, true);
    // non post from GET
    $missing = validate_presences_non_post($required_fields, $program, true);
    foreach ($program as $key => $val) {
        $msg_key = "msg_presence_warning_" . $key;
        $text = "<strong>&nbsp;&nbsp;  " . ucfirst($key) . "</strong> est à compléter";
        ${$msg_key} = array_key_exists($key, $missing) ? get_warning_error_p($text, true) : "";
        //    $$msg_key= array_key_exists ($key, $missing)? get_warning_error($missing[$key],true)  : "" ;
    }
} else {
    $fiedset_msg = "";
    $date_msg = "";
}
?>



    //   redirect_to("manage_program.php");
    redirect_to($url);
}
// validation mgr all data must be completed
settype($validated_mgr, "integer");
settype($validated_chauffeur, "integer");
settype($validated_final, "integer");
$validated_mgr = (int) $program["validated_mgr"];
$validated_chauffeur = (int) $program["validated_chauffeur"];
$validated_final = (int) $program["validated_final"];
if ($validated_chauffeur == 2) {
    $required_fields = array("course_date", "heure", "pseudo");
} else {
    $required_fields = array("course_date", "chauffeur", "heure", "pseudo", "depart", "arrivee");
}
validate_presences_non_post($required_fields, $program);
$pseudo = $program["pseudo"];
$pseudo_autres = $program["pseudo_autres"];
$nom_patient = $program["nom_patient"];
$prix_course = $program["prix_course"];
$chauffeur = $program["chauffeur"];
if ($validated_chauffeur === 0) {
    $errors["validation_chauffeur"] = fieldname_as_text($field) . " doit etre auparavant validé ou annulé par chauffeur avant manager!";
}
if ($validated_mgr === 0) {
    $errors["validation_manager"] = fieldname_as_text($field) . " doit etre auparavant validé ou annulé par chauffeur avant manager!";
}
if (!$validated_chauffeur == 2) {
    validate_pseudo($pseudo, $pseudo_autres, $nom_patient);
    validate_chauffeur_by_name($chauffeur);
    validation_pseudo_clients($pseudo);