2016-02-15 21:31:44 +00:00
< ? php
2015-04-27 14:25:04 +00:00
define ( 'ARTISANAT_DISPO_WEB' , 1 );
2016-07-15 19:54:06 +02:00
require_once 'framework/common/curl.php' ;
2013-11-05 11:18:30 +00:00
2016-07-15 19:54:06 +02:00
class Metier_Partenaires_MArtisanat
{
2013-11-05 11:18:30 +00:00
public $body = '' ;
public $header = '' ;
public $codeRetour = 0 ;
public $referer = '' ;
public $libErreur = '' ;
public $cookie = '' ;
public $iDb ;
public $enCache = false ;
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
function __construct () {
2016-07-18 15:21:48 +02:00
$this -> iDb = new Metier_Util_Db ();
2013-11-05 11:18:30 +00:00
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
function getIdentite ( $siren , $refresh = false ) {
$siren = $siren * 1 ;
2015-04-27 15:05:08 +00:00
$res = $this -> iDb -> select ( 'jo.artisanat' , 'id, siren, actif, numRM, denomination, sigle, nomCommercial, enseigne, fj, effectif, aprm, debutActivite, activite, adresse, cp, ville, cessation, radiation, nbInscriptions, nom, prenom, nomUsage, dateNaiss, lieuNaiss, natio, qualite, qualif, dateQualif, dateFctDeb, dateFctFin, IF(dateInsert>dateUpdate,dateInsert,dateUpdate) AS dateUpdate' , " siren= $siren " , false , MYSQL_ASSOC );
2013-11-05 11:18:30 +00:00
if ( count ( $res ) > 0 && ! $refresh ) {
$this -> enCache = true ;
$tabInsert = $res [ 0 ];
} elseif ( ARTISANAT_DISPO_WEB ) {
$this -> enCache = false ;
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=recherche' ;
$page = getUrl ( $url , '' , '' , $this -> referer , false , 'www.cma-paris.fr' , false , '' , '' , 21 );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Artisanat 200a !' ;
return false ;
}
$this -> cookie = $page [ 'header' ][ 'Set-Cookie' ];
$this -> referer = $url ;
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche' ;
$postData = array ( 'siren_op' => '%3D' ,
'siren' => $siren ,
'den_rent_op' => '%25' ,
'den_rent' => '' ,
'adresse_op' => 'contient' ,
'adresse' => '' ,
'bde_rent_op' => '%25' ,
'bde_rent' => '' ,
'nom_rdir_op' => '%25' ,
'nom_rdir' => '' ,
'pren_rdir_op' => '%25' ,
'pren_rdir' => '' ,
'table' => 'rentreprise' , //'rentrad',
'x' => 56 ,
'y' => 14 ,
);
2016-07-15 19:54:06 +02:00
sleep ( rand ( 1 , 2 ));
2013-11-05 11:18:30 +00:00
$page = getUrl ( $url , $this -> cookie , $postData , $this -> referer , false , 'www.cma-paris.fr' , false , '' , '' , 21 );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Artisanat 200b !' ;
return false ;
}
$this -> referer = $url ;
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<span.class="rouge">aucune.entreprise.ne.correspond(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis' , $this -> body , $matches )) {
$url = 'http://www.cma-paris.fr/CMP/rm_recherche.php?dom=Gerer&fonction=cherche' ;
$postData = array ( 'siren_op' => '%3D' ,
'siren' => $siren ,
'den_rent_op' => '%25' ,
'den_rent' => '' ,
'adresse_op' => 'contient' ,
'adresse' => '' ,
'bde_rent_op' => '%25' ,
'bde_rent' => '' ,
'nom_rdir_op' => '%25' ,
'nom_rdir' => '' ,
'pren_rdir_op' => '%25' ,
'pren_rdir' => '' ,
'table' => 'rentrad' ,
'x' => 56 ,
'y' => 14 ,
);
2016-07-15 19:54:06 +02:00
sleep ( rand ( 1 , 2 ));
2013-11-05 11:18:30 +00:00
$page = getUrl ( $url , $this -> cookie , $postData , $this -> referer , false , 'www.cma-paris.fr' , false , '' , '' , 21 );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Artisanat 200c !' ;
return false ;
}
$this -> referer = $url ;
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
/** Gestion des multi-inscriptions au RM **/
2015-04-27 14:25:04 +00:00
if ( preg_match ( '/<b class="gris">(.*)entreprises.correspondent(?:.*)vos.crit(?:.*)de.recherche<\/span>/Uis' , $this -> body , $matches ))
2013-11-05 11:18:30 +00:00
{
$nbRep = trim ( $matches [ 1 ]) * 1 ;
$iRadMax =- 1 ;
if ( preg_match_all ( '/<a class="turquoise" href="(rm\.php\?dom=Gerer&fonction=dossier&(.*))">/Uis' , $this -> body , $matches )) {
$tabUrls = array_unique ( $matches [ 1 ]);
$anRadMax = 0 ;
// Recherche de la dernière inscription
foreach ( $tabUrls as $iUrl => $url ) {
// On prend la dernière inscription
$tabTmp = explode ( '&' , $url );
if ( substr ( $tabTmp [ 3 ], 0 , 8 ) == 'an_rera=' ) {
$anRad = substr ( $tabTmp [ 3 ], 8 );
if ( $anRad > $anRadMax ) {
$anRadMax = $anRad ;
$iRadMax = $iUrl ;
}
}
}
}
2016-07-12 16:45:26 +02:00
if ( $iRadMax ==- 1 ) die ( '$iRadMax==-1 Cas impossible !' . PHP_EOL . print_r ( $tabUrls , true ) . PHP_EOL . print_r ( $matches , true ));
2013-11-05 11:18:30 +00:00
// Accès à la dernière fiche
$url = 'http://www.cma-paris.fr/CMP/' . strtr ( trim ( $tabUrls [ $iRadMax ]), array ( '&' => '&' ));
2016-07-15 19:54:06 +02:00
sleep ( rand ( 1 , 2 ));
2013-11-05 11:18:30 +00:00
$page = getUrl ( $url , $this -> cookie , '' , $this -> referer , false , 'www.cma-paris.fr' , false , '' , '' , 21 );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Artisanat 200c !' ;
return false ;
}
$this -> referer = $url ;
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
$tabInsert = array ();
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/n° d\'identification \(SIREN\)<\/span><\/td>(?:.*)<td align="left" nowrap>(.*) <\/td>((?:.*)n° de gestion rm<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>)?/Uis' , $this -> body , $matches )) {
$sirenLu = $matches [ 1 ] * 1 ;
if ( $siren == $sirenLu ) {
$tabInsert [ 'siren' ] = $matches [ 1 ];
$tabInsert [ 'numRM' ] =@ $matches [ 2 ];
} else {
$this -> libErreur = 'Erreur Siren $sirenLu<>$siren !' ;
return false ;
}
} elseif ( preg_match ( '/<span class="rouge">aucune entreprise ne correspond à vos critères de recherche<\/span>/Uis' , $this -> body , $matches )) {
$this -> libErreur = 'Erreur Artisan absent de la base Artisanat !' ;
// die($this->body);
return false ;
} else {
$this -> libErreur = 'Erreur Siren absent dans la page !' ;
return false ;
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
$actif = null ;
if ( preg_match ( " /Renseignements.relatif(?:.*)entreprise(.*)< \ /b>/Uis " , $this -> body , $matches )) {
switch ( trim ( strtr ( $matches [ 1 ], array ( chr ( 160 ) => '' )))) {
2015-04-27 14:25:04 +00:00
case 'en activité' : $actif = 1 ; break ;
2013-11-05 11:18:30 +00:00
case 'radiée' : $actif = 0 ; break ;
default : print_r ( $matches ); die (); break ;
}
2016-07-12 16:45:26 +02:00
//die(PHP_EOL.'$actif='.$actif.PHP_EOL.print_r($matches));
2013-11-05 11:18:30 +00:00
}
$tabInsert [ 'actif' ] = $actif ;
if ( $actif === null ) {
2016-07-12 16:45:26 +02:00
//die("siren=$siren".PHP_EOL."sirenLu=$sirenLu".PHP_EOL.$this->body);
2013-11-05 11:18:30 +00:00
$this -> libErreur = 'Erreur Actif/Radié non trouvé !' ;
return false ;
}
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">dénomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis' , $this -> body , $matches )) {
$tabInsert [ 'denomination' ] = $matches [ 1 ];
}
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">dénomination<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'denomination' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">sigle<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'sigle' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> nom commercial<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'nomCommercial' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">enseigne<\/span><\/td>(?:.*)<td align="left" colspan="4">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'enseigne' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">forme juridique<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis' , $this -> body , $matches ))
2015-04-27 14:25:04 +00:00
$tabInsert [ 'fj' ] = $matches [ 1 ];
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">effectif<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'effectif' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code APRM<\/span><\/td>(?:.*)<td align="left">(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'aprm' ] = $matches [ 1 ];
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">début d\'activité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'debutActivite' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> activité\(s\) exercée\(s\) donnant lieu à immatriculation<\/span>(?:.*)<td colspan="5">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'activite' ] = trim ( $matches [ 1 ]);
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">adresse de l\'entreprise<\/span><\/td>(?:.*)<td align="left" colspan="5">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'adresse' ] = trim ( $matches [ 1 ]);
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">code postal<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'cp' ] = trim ( $matches [ 1 ]);
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">ville<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'ville' ] = trim ( $matches [ 1 ]);
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">cessation d\'activité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'cessation' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">radiation du RM<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'radiation' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
$tabEtabs = array ();
if ( preg_match ( '/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Aucune inscription complémentaire<\/b>(?:.*)<!--fin Etablissements secondaires-->/Uis' , $this -> body , $matches ))
2015-04-27 14:25:04 +00:00
$tabInsert [ 'nbInscriptions' ] = 0 ;
2013-11-05 11:18:30 +00:00
elseif ( preg_match ( '/<!--deb Etablissements secondaires-->(?:.*)<b class="gris">Inscription complémentaire<\/b>(.*)<!--fin Etablissements secondaires-->/Uis' , $this -> body , $matches )) {
$tabInsert [ 'nbInscriptions' ] = 0 ;
if ( preg_match_all ( '/<tr>(?:.*)<td><img alt="" src="inter\/pixtrans\.gif" width="30" height="1"><\/td>(?:.*)<td nowrap>(?:.*)<!-- adresse -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- code postal et ville -->(.*)<\/td>(?:.*)<td nowrap>(?:.*)<!-- enseigne -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- debut activite -->(.*)<\/td>(?:.*)<td>(?:.*)<!-- fin activite -->(.*)<\/td>(?:.*)<\/tr>/Uis' , $matches [ 1 ], $matches2 )) {
foreach ( $matches2 [ 1 ] as $i => $adresse ) {
$tabEtabs [ $i ][ 'siren' ] = $siren ;
$tabEtabs [ $i ][ 'num' ] = $i ;
$tabEtabs [ $i ][ 'adresse' ] = trim ( strtr ( html_entity_decode ( $adresse ), chr ( 160 ), ' ' ));
$tabEtabs [ $i ][ 'cpVille' ] = trim ( strtr ( html_entity_decode ( $matches2 [ 2 ][ $i ]), chr ( 160 ), ' ' ));
$tabEtabs [ $i ][ 'enseigne' ] = trim ( strtr ( html_entity_decode ( $matches2 [ 3 ][ $i ]), chr ( 160 ), ' ' ));
2016-07-13 14:35:17 +02:00
$tabEtabs [ $i ][ 'actDeb' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches2 [ 4 ][ $i ]), chr ( 160 ), ' ' )));
$tabEtabs [ $i ][ 'actFin' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches2 [ 5 ][ $i ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
$tabInsert [ 'nbInscriptions' ] ++ ;
}
}
}
/** Informations sur la Personne Physique **/
if ( preg_match ( '/<a class="turquoise" href="(rm\.php\?dom=Gerer&fonction=dirigeant&dept_re(.*))" onclick="window\.open\(this\.href/Uis' , $this -> body , $matches )) {
$urlDir = 'http://www.cma-paris.fr/CMP/' . strtr ( trim ( $matches [ 1 ]), array ( '&' => '&' ));
//die($urlDir);
2016-07-15 19:54:06 +02:00
sleep ( rand ( 1 , 2 ));
2013-11-05 11:18:30 +00:00
$page = getUrl ( $urlDir , $this -> cookie , '' , $this -> referer , false , 'www.cma-paris.fr' , false , '' , '' , 21 );
$this -> body = $page [ 'body' ];
$this -> codeRetour = $page [ 'code' ];
if ( $this -> codeRetour <> '200' ) {
$this -> libErreur = 'Erreur Artisanat 200d !' ;
return false ;
}
$this -> referer = $url ;
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'nom' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prénom<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'prenom' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nom d\'usage<\/span><\/td>(?:.*)<td align="left" nowrap>(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'nomUsage' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"(?:.*)<span class="turquoise"> date de naissance<\/span><\/td>(?:.*)-->(?:.*)<td(?: +)align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'dateNaiss' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
// if (preg_match('/date de naissance(.*)<td background="inter\/pix3_turquoise\.gif" align="right"/Uis', $this->body, $matches))
// die(print_r($matches));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise"> lieu de naissance<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'lieuNaiss' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">nationalité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'natio' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">qualité<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'qualite' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right" nowrap><span class="turquoise">qualification artisanale<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
$tabInsert [ 'qualif' ] = trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' ));
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">date d\'obtention<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'datequalif' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">prise de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'dateFctDeb' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2013-11-05 11:18:30 +00:00
if ( preg_match ( '/<td background="inter\/pix3_turquoise\.gif" align="right"><span class="turquoise">fin de fonction<\/span><\/td>(?:.*)<td align="left">(.*)<\/td>/Uis' , $this -> body , $matches ))
2016-07-13 14:35:17 +02:00
$tabInsert [ 'dateFctFin' ] = Metier_Util_Date :: dateT ( 'd/m/Y' , 'Y-m-d' , trim ( strtr ( html_entity_decode ( $matches [ 1 ]), chr ( 160 ), ' ' )));
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
// Insertion en base de données
$tabInsert [ 'dateInsert' ] = date ( 'Y-m-d H:i:s' );
2015-04-27 14:25:04 +00:00
$id = $this -> iDb -> insert ( 'jo.artisanat' , $tabInsert , true );
2013-11-05 11:18:30 +00:00
$tabInsert [ 'id' ] = $id ;
foreach ( $tabEtabs as $tabInsert2 ) {
$tabInsert2 [ 'dateInsert' ] = $tabInsert [ 'dateInsert' ];
2015-04-27 14:25:04 +00:00
$id2 = $this -> iDb -> insert ( 'jo.artisanat_etab' , $tabInsert2 , true );
2013-11-05 11:18:30 +00:00
}
2016-07-13 17:35:13 +02:00
2013-11-05 11:18:30 +00:00
$tabInsert [ 'dateUpdate' ] = substr ( $tabInsert [ 'dateInsert' ], 0 , 10 );
unset ( $tabInsert [ 'dateInsert' ]);
}
return $tabInsert ;
}
}
?>