Suppression $idDbCrm en global

This commit is contained in:
Michael RICOIS 2010-11-25 09:11:42 +00:00
parent 5de704d2d2
commit ffacab6388
2 changed files with 44 additions and 36 deletions

View File

@ -22,7 +22,6 @@ class WsEntreprise
protected $wsdl = null;
protected $wsdlOptions = array();
protected $iInsee;
protected $iDbCrm;
protected $tabInfoUser;
function __construct()
@ -39,7 +38,6 @@ class WsEntreprise
$this->wsdlOptions = $options;
$this->iInsee = new MInsee();
$this->iDbCrm = new WDB('sdv1');
}
/**
@ -185,7 +183,7 @@ class WsEntreprise
'Capital' =>$entrep['Capital'],
'CapitalDev' =>$entrep['CapitalDev'],
'CapitalLib' =>$entrep['CapitalLib'], // Ajouté le 18 02 2008
'CapitalType' =>$entrep['CapitalType'],// Ajouté le 4 08 2009
'CapitalType' =>$entrep['CapitalType'], // Ajouté le 4 08 2009
'DateCreaEt' =>$entrep['DateCreaEt'],
'DateCreaEn' =>$entrep['DateCreaEn'],
'DateClotEt' =>$entrep['DateClotEt'],
@ -198,7 +196,7 @@ class WsEntreprise
'EffEtTr' =>$entrep['EffEtTr'], // Ajout le 11 08 2010
'EffEtTrLib' =>$entrep['EffEtTrLib'], // Ajout le 11 08 2010
'EffectifEtab' =>$entrep['EffectifEtab'],// Ajout le 11 08 2010
'EffectifEtab' =>$entrep['EffectifEtab'], // Ajout le 11 08 2010
'Dept' =>$entrep['Dept'],
'codeCommune' =>$entrep['codeCommune'],
@ -1933,7 +1931,8 @@ class WsEntreprise
*/
protected function checkAuth($login, $password, $ipConnexion)
{
$rep = $this->iDbCrm->select(//'utilisateurs', 'login, id, email, password, idClient, typeCompte, filtre_ip, civilite, nom, prenom, tel, fax, mobile, profil, raisonSociale, siret, adrNum, adrIndRep, adrTypeVoie, adrLibVoie, adrCp, adrVille, adrComp, tel, fax, mobile, pref, profil, dateInscription, dateValidation, nombreConnexions, dateDerniereConnexion, droits, referenceParDefaut, nbReponses, formatMail, dateDebutCompte, dateFinCompte, maxFicheId', "login='$login' AND actif=1", true, MYSQL_ASSOC);
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select(//'utilisateurs', 'login, id, email, password, idClient, typeCompte, filtre_ip, civilite, nom, prenom, tel, fax, mobile, profil, raisonSociale, siret, adrNum, adrIndRep, adrTypeVoie, adrLibVoie, adrCp, adrVille, adrComp, tel, fax, mobile, pref, profil, dateInscription, dateValidation, nombreConnexions, dateDerniereConnexion, droits, referenceParDefaut, nbReponses, formatMail, dateDebutCompte, dateFinCompte, maxFicheId', "login='$login' AND actif=1", true, MYSQL_ASSOC);
'utilisateurs u, clients c',
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.civilite, u.nom, u.prenom, u.tel, u.fax, u.mobile, u.profil, u.raisonSociale, u.siret, u.adrNum, u.adrIndRep, u.adrTypeVoie, u.adrLibVoie, u.adrCp, u.adrVille, u.adrComp, u.tel, u.fax, u.mobile, u.pref, u.profil, u.dateInscription, u.dateValidation, u.nombreConnexions, u.dateDerniereConnexion, u.droits, u.referenceParDefaut, u.nbReponses, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.maxFicheId, c.droits AS droitsClients, c.timeout',
"u.login='$login' AND u.idClient=c.id AND u.actif=1 AND u.deleted=0 AND c.actif='Oui'",
@ -1988,7 +1987,7 @@ class WsEntreprise
'dateFinCompte'=> $tabRep['dateFinCompte'],
'maxFicheId'=> $tabRep['maxFicheId'],
);
$tabTmp = $this->iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabTmp = $iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabRep = $tabTmp[0];
$this->tabInfoUser['typeScore'] = $tabRep['typeScore'];
debugLog('W',"CheckAuth $login/$password OK", __LINE__,__FILE__, __FUNCTION__, __CLASS__);
@ -2004,5 +2003,4 @@ class WsEntreprise
}
?>

View File

@ -20,7 +20,6 @@ require_once 'framework/mail/sendMail.php';
class WsInterne
{
protected $dbConfig;
protected $iDbCrm;
protected $tabInfoUser;
function __construct()
@ -28,8 +27,6 @@ class WsInterne
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH .
'/configs/databases.ini', APPLICATION_ENV);
$this->dbConfig = $dbConfig->db;
$this->iDbCrm = new WDB('sdv1');
}
/**
@ -40,7 +37,8 @@ class WsInterne
*/
protected function checkAuth($login, $password, $ipConnexion)
{
$rep = $this->iDbCrm->select(//'utilisateurs', 'login, id, email, password, idClient, typeCompte, filtre_ip, civilite, nom, prenom, tel, fax, mobile, profil, raisonSociale, siret, adrNum, adrIndRep, adrTypeVoie, adrLibVoie, adrCp, adrVille, adrComp, tel, fax, mobile, pref, profil, dateInscription, dateValidation, nombreConnexions, dateDerniereConnexion, droits, referenceParDefaut, nbReponses, formatMail, dateDebutCompte, dateFinCompte, maxFicheId', "login='$login' AND actif=1", true, MYSQL_ASSOC);
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select(//'utilisateurs', 'login, id, email, password, idClient, typeCompte, filtre_ip, civilite, nom, prenom, tel, fax, mobile, profil, raisonSociale, siret, adrNum, adrIndRep, adrTypeVoie, adrLibVoie, adrCp, adrVille, adrComp, tel, fax, mobile, pref, profil, dateInscription, dateValidation, nombreConnexions, dateDerniereConnexion, droits, referenceParDefaut, nbReponses, formatMail, dateDebutCompte, dateFinCompte, maxFicheId', "login='$login' AND actif=1", true, MYSQL_ASSOC);
'utilisateurs u, clients c',
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.civilite, u.nom, u.prenom, u.tel, u.fax, u.mobile, u.profil, u.raisonSociale, u.siret, u.adrNum, u.adrIndRep, u.adrTypeVoie, u.adrLibVoie, u.adrCp, u.adrVille, u.adrComp, u.tel, u.fax, u.mobile, u.pref, u.profil, u.dateInscription, u.dateValidation, u.nombreConnexions, u.dateDerniereConnexion, u.droits, u.referenceParDefaut, u.nbReponses, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.maxFicheId, c.droits AS droitsClients, c.timeout',
"u.login='$login' AND u.idClient=c.id AND u.actif=1 AND u.deleted=0 AND c.actif='Oui'",
@ -95,7 +93,7 @@ class WsInterne
'dateFinCompte'=> $tabRep['dateFinCompte'],
'maxFicheId'=> $tabRep['maxFicheId'],
);
$tabTmp = $this->iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabTmp = $iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabRep = $tabTmp[0];
$this->tabInfoUser['typeScore'] = $tabRep['typeScore'];
debugLog('W',"CheckAuth $login/$password OK", __LINE__,__FILE__, __FUNCTION__, __CLASS__);
@ -215,6 +213,7 @@ class WsInterne
$idOppo =str_replace('m','',trim($tabJugement['oppo']))*1;
/** Nom et Identifiant de l'opérateur de saisie **/
$iDbCrm = new WDB('sdv1');
$rep=$iDbCrm->select('utilisateurs', 'id', "login='".$this->tabInfoUser['login']."'");
$idUser=$rep[0][0];
@ -1076,7 +1075,8 @@ class WsInterne
{
//debugLog('I',"getInfosLogin - Un administrateur veut il des infos sur un login",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
/** Un administrateur veut il des infos sur un login ? **/
$rep = $this->iDbCrm->select(
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select(
'utilisateurs u, clients c',
'u.login, u.id, u.email, u.password, u.idClient, u.typeCompte, u.actif, u.filtre_ip, u.civilite, u.nom, u.prenom, u.tel, u.fax, u.mobile, u.profil, u.raisonSociale, u.siret, u.adrNum, u.adrIndRep, u.adrTypeVoie, u.adrLibVoie, u.adrCp, u.adrVille, u.adrComp, u.tel, u.fax, u.mobile, u.pref, u.profil, u.dateInscription, u.dateValidation, u.nombreConnexions, u.dateDerniereConnexion, u.droits, u.referenceParDefaut, u.nbReponses, u.formatMail, u.dateDebutCompte, u.dateFinCompte, u.maxFicheId, c.droits AS droitsClients, c.timeout',
"u.login='$login' AND u.idClient=c.id AND u.deleted=0",
@ -1125,7 +1125,7 @@ class WsInterne
'dateFinCompte'=> $tabRep['dateFinCompte'],
'maxFicheId'=> $tabRep['maxFicheId'],
);
$tabTmp = $this->iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabTmp = $iDbCrm->select('clients', 'typeScore', 'id='.$tabRep['idClient'], true, MYSQL_ASSOC);
$tabRep = $tabTmp[0];
$rep['typeScore'] = $tabRep['typeScore'];
}
@ -1257,11 +1257,12 @@ class WsInterne
if (isset($tabInfoUserWS['reference'])) $tabUpdate['referenceParDefaut']=stripslashes($tabInfoUserWS['reference']);
}
}
$iDbCrm = new WDB('sdv1');
if ($tabInfoUserWS['action']=='new')
{
$tabUpdate['login']=$login;
$tabUpdate['idClient']=$tabInfoUserWS['idClient'];
if ($this->iDbCrm->insert('utilisateurs', $tabUpdate))
if ($iDbCrm->insert('utilisateurs', $tabUpdate))
{
$result = true;
}
@ -1271,7 +1272,7 @@ class WsInterne
$error->errmsg = 'Création impossible';
}
}
if ($this->iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'"))
if ($iDbCrm->update('utilisateurs', $tabUpdate, "login='$login'"))
{
$result = true;
}
@ -1307,6 +1308,7 @@ class WsInterne
$this->tabInfoUser['profil']=='SuperAdministrateur')
{
/** Un administrateur veut créer un nouveau login **/
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select('utilisateurs u, clients c', 'u.idClient, c.racineLogin, c.droits', "u.login='$login' AND u.idClient=c.id");
$racine = $rep[0]['racineLogin'];
$idClient = $rep[0]['idClient'];
@ -1381,7 +1383,8 @@ class WsInterne
$iDb = new WDB();
/** Nom et Identifiant de l'opérateur de saisie **/
$rep = $this->iDbCrm->select('utilisateurs', 'id', "login='".$this->tabInfoUser['login']."'");
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select('utilisateurs', 'id', "login='".$this->tabInfoUser['login']."'");
$idUser = $rep[0][0];
$infos = serialize($tabInfos);
@ -2598,6 +2601,7 @@ class WsInterne
"Demandeur:".EOL.print_r($infoDemande, true).EOL.EOL.
"Réponse RefAsso en $duree secondes :".EOL.print_r($page, true)
);
$iDbCrm = new WDB('sdv1');
$ret = $iDbCrm->insert('commandes', $tabInsert, true);
$result = new CommandeAsso();
@ -2663,6 +2667,7 @@ class WsInterne
$messageInfo=print_r($infoEnq, 1).EOL.print_r($infoDemande,1).EOL;
$idClient = $this->tabInfoUser['idClient'];
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select('clients', ' nom, racineLogin, InterSudLogin, InterSudPass', "id='$idClient'", false, MYSQL_ASSOC);
$login = trim($rep[0]['InterSudLogin']);
$pass = trim($rep[0]['InterSudPass']);
@ -2867,7 +2872,8 @@ class WsInterne
}
else
{
$rep=$this->iDbCrm->select('utilisateurs', 'idClient', "login='$login'");
$iDbCrm = new WDB('sdv1');
$rep=$iDbCrm->select('utilisateurs', 'idClient', "login='$login'");
$idClient=$rep[0][0];
if ($idClient==-1)
{
@ -2876,7 +2882,7 @@ class WsInterne
}
else
{
$rep=$this->iDbCrm->select('utilisateurs', 'id, idClient, login, email, actif, nom, prenom, referenceParDefaut', "idClient='$idClient' AND deleted=0 ORDER BY login ASC", true, MYSQL_ASSOC);
$rep=$iDbCrm->select('utilisateurs', 'id, idClient, login, email, actif, nom, prenom, referenceParDefaut', "idClient='$idClient' AND deleted=0 ORDER BY login ASC", true, MYSQL_ASSOC);
foreach ($rep as $uti)
{
$utilisateur = new Utilisateur();
@ -2939,7 +2945,8 @@ class WsInterne
{
$strClient = '';
if ($idClient>0) $strClient.=" AND id='$idClient' ";
$rep = $this->iDbCrm->select('clients', 'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore', "1 $strClient", true, MYSQL_ASSOC);
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select('clients', 'id, nom, actif, test, racineLogin, siren, nic, tva, editerFacture, fact_detail, fac_dest, fac_adr1, fac_adr2, fac_adr3, fac_email, fac_tel, fact_rib, liv_dest, liv_adr1, liv_adr2, liv_adr3, liv_email, liv_tel, droits, filtres_ip, dateInsert, dateUpdate, respComSD, typeContrat, dateSignature, typeAcces, typeScore, accesPieces, accesKbis, accesInvestigations, accesInternationnal, accesEnquetes, miseSousSurveillance, forfaitExtranetPeriode, forfaitExtranetMontant, reconductionAuto, remarque, forfaitPiecesNb, forfaitPiecesMt, forfaitPiecesDep, forfaitInvestigNb, forfaitInvestigMt, forfaitInvestigDep, tarifIndiscore', "1 $strClient", true, MYSQL_ASSOC);
$tabRet = array();
foreach ($rep as $uti)
{
@ -3028,12 +3035,13 @@ class WsInterne
else {
$strPayant='';
}
if ($type=='jour')
$rep=$iDbCrm->select('logs', 'date(dateHeure) as jours, count(*) as nb', "1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY jours", true, MYSQL_ASSOC);
elseif ($type=='heure')
$rep=$iDbCrm->select('logs', 'HOUR(dateHeure) as heures, count(*) as nb', "1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY heures", true, MYSQL_ASSOC);
$tabRet=$rep;
$iDbCrm = new WDB('sdv1');
if ($type=='jour'){
$rep = $iDbCrm->select('logs', 'date(dateHeure) as jours, count(*) as nb', "1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY jours", true, MYSQL_ASSOC);
}elseif ($type=='heure'){
$rep = $iDbCrm->select('logs', 'HOUR(dateHeure) as heures, count(*) as nb', "1 $strPayant AND login='$login' AND dateHeure BETWEEN '$mois-01' AND '$mois-31' GROUP BY heures", true, MYSQL_ASSOC);
}
$tabRet = $rep;
return array('error'=>array('errnum'=>0, 'errmsg'=>''), 'results'=>$tabRet);
}
@ -4151,3 +4159,5 @@ class WsInterne
return $this->getIdentiteAGS($siret, $id, $forceVerif);
}
}
?>