Order : Doctrine

This commit is contained in:
Michael RICOIS 2016-10-18 16:14:45 +02:00
parent f8fc36a6de
commit ae57b0ba50

View File

@ -58,7 +58,7 @@ class Order extends Scores_Ws_Server
return $refCommande;
}
}
catch (Zend_Db_Exception $e) {
catch (\Doctrine\DBAL\DBALException $e) {
if ($this->User->idClient == 1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
@ -217,8 +217,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('end', $dateEnd);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach($result as $item) {
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$cmd = new BilanInput();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Siren = $item->siren;
@ -255,11 +254,6 @@ class Order extends Scores_Ws_Server
$this->authenticate();
try {
$commandeM = new Application_Model_Sdv1OrderBilanInput();
$sql = $commandeM->select()->where('userId=?', $this->User->id)->where('refCommande=?', $ref);
$item = $commandeM->fetchRow($sql);
$sql = "SELECT * FROM sdv1.order_bilan_input WHERE userId = :id
AND refCommande = :ref";
$stmt = $this->conn->prepare($sql);
@ -267,6 +261,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('ref', $ref);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$item = $stmt->fetch(\PDO::FETCH_OBJ);
$cmd = new BilanInput();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Siren = $item->siren;
@ -280,7 +275,7 @@ class Order extends Scores_Ws_Server
return $cmd;
}
}
catch(Zend_Db_Exception $e) {
catch(\Doctrine\DBAL\DBALException $e) {
if ($this->User->idClient == 1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
@ -318,8 +313,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('end', $dateEnd);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach($result as $item) {
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$cmd = new PieceKbis();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Mode = $item->mode;
@ -354,10 +348,14 @@ class Order extends Scores_Ws_Server
$this->authenticate();
try {
$commandeM = new Application_Model_Sdv1GreffeCommandesKb();
$sql = $commandeM->select()->where('login=?', $this->User->login)->where('refCommande=?', $ref);
$item = $commandeM->fetchRow($sql);
if ($item !== null) {
$sql = "SELECT * FROM sdv1.greffe_commandes_kb WHERE login = :login
AND refCommande = :ref";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('login', $this->User->login);
$stmt->bindValue('ref', $ref);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$item = $stmt->fetch(\PDO::FETCH_OBJ);
$cmd = new BilanInput();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Mode = $item->mode;
@ -369,7 +367,7 @@ class Order extends Scores_Ws_Server
return $cmd;
}
}
catch(Zend_Db_Exception $e) {
catch(\Doctrine\DBAL\DBALException $e) {
if ($this->User->idClient == 1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
@ -395,11 +393,14 @@ class Order extends Scores_Ws_Server
// --- Lecture des informations de la commande
try {
$commandeM = new Application_Model_Sdv1GreffeCommandesKb();
$sql = $commandeM->select()->where('login=?', $this->User->login)->where('refCommande=?', $ref);
$item = $commandeM->fetchRow($sql);
if ($item !== null) {
$sql = "SELECT * FROM sdv1.greffe_commandes_kb WHERE login = :login
AND refCommande = :ref";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('login', $this->User->login);
$stmt->bindValue('ref', $ref);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$item = $stmt->fetch(\PDO::FETCH_OBJ);
}
}
catch(Zend_Db_Exception $e) {
@ -438,8 +439,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('end', $dateEnd);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach($result as $item) {
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$cmd = new Acte();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Mode = $item->mode;
@ -499,8 +499,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('end', $dateEnd);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach($result as $item) {
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$cmd = new Bilan();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Mode = $item->mode;
@ -607,8 +606,7 @@ class Order extends Scores_Ws_Server
$stmt->bindValue('end', $dateEnd);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(\PDO::FETCH_OBJ);
foreach($result as $item) {
while($item = $stmt->fetch(\PDO::FETCH_OBJ)) {
$cmd = new AssoStatut();
$cmd->Reference = strtoupper($item->refCommande);
$cmd->Mode = $item->mode;