function isExist($c)
 {
     $ct = new maserati_owners_code_tridente();
     $ct->code = $c;
     $nb = $ct->find();
     //echo $ct->_query;
     if ($nb > 0) {
         $ct->fetch();
         if ($ct->id > 0) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
    }
} elseif (!empty($_POST['form']) && !empty($_POST['form']['action']) && $_POST['form']['action'] == 'form_coord') {
    $step = 'coordonnees';
    $uid = !empty($_POST['form']['uid']) ? $_POST['form']['uid'] : '';
    $value['nom'] = !empty($_POST['form']['nom']) ? $_POST['form']['nom'] : '';
    $value['prenom'] = !empty($_POST['form']['prenom']) ? $_POST['form']['prenom'] : '';
    $value['num_tridente'] = !empty($_POST['form']['num_tridente']) ? $_POST['form']['num_tridente'] : '';
    $value['email'] = !empty($_POST['form']['email']) ? $_POST['form']['email'] : '';
    $value['prospection'] = !empty($_POST['form']['prospection']) ? $_POST['form']['prospection'][0] : '';
    if (empty($value['nom'])) {
        $tab_erreur['nom'] = true;
    }
    if (empty($value['prenom'])) {
        $tab_erreur['prenom'] = true;
    }
    if (empty($value['num_tridente']) || !verif_champ($value['num_tridente'], 'num_tridente') || !maserati_owners_code_tridente::isExist($value['num_tridente'])) {
        $tab_erreur['num_tridente'] = true;
    }
    if (empty($value['email']) || !verif_champ($value['email'], 'email')) {
        $tab_erreur['email'] = true;
    }
    if (!in_array('true', $tab_erreur)) {
        $c = new maserati_owners();
        $c->hash = $uid;
        $nbc = $c->find();
        if ($nbc > 0) {
            $c->fetch();
        } else {
            $c->pays = PAYS;
            $c->langue = LANGUE;
            $c->civilite = '';