Exemple #1
0
 $argsCpt = ['cpt_date' => date('Y-m-d'), 'cpt_nom' => $_REQUEST['cptNom'], 'cpt_com' => $_REQUEST['cptCom'], 'cpt_code' => $_REQUEST['cptCode'], 'cpt_type' => 1];
 //On hydrate notre objet compte
 $oCompte = new Compte($argsCpt);
 print_r($oCompte);
 //On appel le manager pour effectuer l'insert
 $resInsCompte = CompteManager::addCompte($oCompte);
 //Et on récupère son identifiant
 $idCpt = Connection::dernierId();
 echo 'resultat compte ' . $resInsCompte;
 //On créé le tableau d'arguments pour notre objet Entreprise
 $argsEnt = ['cpt_id' => $idCpt, 'fmju_id' => $_REQUEST['fmju'], 'catent_id' => $_REQUEST['catEnt'], 'ent_horaire' => $_REQUEST['entHoraire'], 'ent_siren' => $_REQUEST['entSiren'], 'ent_num_tva' => $_REQUEST['entTva'], 'ent_site' => $_REQUEST['entSite'], 'ent_ecommerce' => $_REQUEST['entEcom']];
 //On hydrate notre objet personne
 $oEntreprise = new Entreprise($argsEnt);
 print_r($oEntreprise);
 //On appel le manager pour effectuer l'insert
 $resInsPers = EntrepriseManager::addEntreprise($oEntreprise);
 //Et on récupère son identifiant
 $idPers = Connection::dernierId();
 //echo 'resultat personne '.$resInsPers;
 //On regroupe toutes les informations
 $resAllAdr = ['adr_lbl' => $_REQUEST['adrLbl'], 'pays_id' => $_REQUEST['paysId'], 'adr_num' => $_REQUEST['adrNum'], 'adr_voie' => $_REQUEST['adrVoie'], 'adr_rue1' => $_REQUEST['adrRue1'], 'adr_rue2' => $_REQUEST['adrRue2'], 'adr_rue3' => $_REQUEST['adrRue3'], 'adr_cp' => $_REQUEST['adrCp'], 'adr_ville' => $_REQUEST['adrVille'], 'adr_etat' => $_REQUEST['adrEtat']];
 print_r($resAllAdr);
 //On utilise le pays comme référence pour compter le nombre de cases
 for ($i = 1; $i < count($resAllAdr['pays_id']); $i++) {
     //On créé un nouvelle objet pour chaque ligne du tableau
     //en sautant la ligne fantôme 0
     $oAdr = new Adresse();
     //On l'hydrate
     $oAdr->pays_id = $resAllAdr['pays_id'][$i];
     $oAdr->adr_num = $resAllAdr['adr_num'][$i];
     $oAdr->adr_voie = $resAllAdr['adr_voie'][$i];
Exemple #2
0
 $oCompte->cpt_com = $_REQUEST['cptCom'];
 $oCompte->cpt_code = $_REQUEST['cptCode'];
 //Modification du compte
 $updCpt = CompteManager::updCompte($oCompte);
 //echo "Mise à jour du bon check : $updCpt ";
 //Mise à jour de l'entreprise
 $oEntreprise = new Entreprise();
 $oEntreprise->cpt_id = $cptId;
 $oEntreprise->catent_id = $_REQUEST['catEnt'];
 $oEntreprise->fmju_id = $_REQUEST['fmju'];
 $oEntreprise->ent_siren = $_REQUEST['entSiren'];
 $oEntreprise->ent_num_tva = $_REQUEST['entTva'];
 $oEntreprise->ent_site = $_REQUEST['entSite'];
 $oEntreprise->ent_ecommerce = $_REQUEST['entEcom'];
 $oEntreprise->ent_horaire = $_REQUEST['entHoraire'];
 $updEnt = EntrepriseManager::updEntreprise($oEntreprise);
 //-----------------Gestion des lignes du formulaire-------------------------
 //Création des tableaux contenant toutes les informations
 //Un tableau par type de champs
 $resLigMail = ['mail_id' => $_REQUEST['mailId'], 'mail_lbl' => $_REQUEST['mailLbl'], 'mail_adr' => $_REQUEST['mailAdr']];
 $resLigTel = ['tel_id' => $_REQUEST['telId'], 'tel_lbl' => $_REQUEST['telLbl'], 'tel_ind' => $_REQUEST['telInd'], 'tel_num' => $_REQUEST['telNum']];
 $resLigAdr = ['adr_id' => $_REQUEST['adrId'], 'adr_lbl' => $_REQUEST['adrLbl'], 'adr_num' => $_REQUEST['adrNum'], 'adr_voie' => $_REQUEST['adrVoie'], 'adr_rue1' => $_REQUEST['adrRue1'], 'adr_rue2' => $_REQUEST['adrRue2'], 'adr_rue3' => $_REQUEST['adrRue3'], 'adr_cp' => $_REQUEST['adrCp'], 'adr_ville' => $_REQUEST['adrVille'], 'adr_etat' => $_REQUEST['adrEtat'], 'pays_id' => $_REQUEST['paysId']];
 //Tableau pour la suppression de ligne
 //Ce tableau est un tableau à deux dimensions
 //la premiere est une clé associative contenant 'adr', 'tel', ou 'mail', le second
 //contient l'id de l'élément à supprimer
 if (isset($_REQUEST['ligSupp'])) {
     $tLigSupp = $_REQUEST['ligSupp'];
 }
 //On traite les lignes de mails
 //On prend mail_id comme témoin