Catalog : getCurrency - Doctrine
This commit is contained in:
parent
059240f555
commit
bee08ee26a
@ -254,7 +254,7 @@ class Catalog extends Scores_Ws_Server
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
foreach ($result as $item) {
|
||||
$tab[$i]['code'] = $item;
|
||||
$tab[$item['code']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ class Catalog extends Scores_Ws_Server
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
foreach ($result as $item) {
|
||||
$tab[$i]['codEven'] = $item;
|
||||
$tab[$item['codEven']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ class Catalog extends Scores_Ws_Server
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
foreach ($result as $item) {
|
||||
$tab[$i]['codPays3'] = $item;
|
||||
$tab[$item['codPays3']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,29 +420,37 @@ class Catalog extends Scores_Ws_Server
|
||||
$this->authenticate();
|
||||
|
||||
$columnsDisplay = array('devIso', 'devNom');
|
||||
|
||||
// Data
|
||||
try {
|
||||
$currencyM = new Application_Model_JoTabDevises();
|
||||
$sql = $currencyM->select()->from($currencyM, $columnsDisplay);
|
||||
if ( $id!==null ) {
|
||||
$sql->where('devIso=?', $id);
|
||||
} else {
|
||||
$sql->where("devIso!=''");
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection $conn
|
||||
*/
|
||||
$conn = Zend_Registry::get('doctrine');
|
||||
$queryBuilder = $conn->createQueryBuilder();
|
||||
$queryBuilder->select($columnsDisplay)->from('jo.tabDevises');
|
||||
if ($id !== null) {
|
||||
$queryBuilder->where('devIso = :id');
|
||||
$queryBuilder->setParameter('id', $id);
|
||||
}
|
||||
$result = $currencyM->fetchAll($sql);
|
||||
} catch (Zend_Db_Adapter_Exception $e) {
|
||||
if ($this->User->idClient==1) {
|
||||
else {
|
||||
$queryBuilder->where("devIso != ''");
|
||||
}
|
||||
$stmt = $queryBuilder->execute();
|
||||
} catch (DBALException $e) {
|
||||
if ($this->User->idClient == 1) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
} else {
|
||||
throw new SoapFault('ERR', "Application error");
|
||||
}
|
||||
} catch (Zend_Exception $e) {
|
||||
throw new SoapFault('ERR', $e->getMessage());
|
||||
}
|
||||
|
||||
// Format
|
||||
$tab = array();
|
||||
if ( $result->count()>0 ) {
|
||||
foreach ( $result as $item ) {
|
||||
$tab[$item->devIso] = $item->toArray();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
foreach ($result as $item) {
|
||||
$tab[$item['devIso']] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user