/** * @author Okan CIRAN * @ Quest için npk lı firmanın danısman tarafından onaylanmış kayıtların sayısını döndürür !! * @version v 1.0 24.06.2016 * @param array | null $args * @return array * @throws \PDOException */ public function fillUserProductsServicesNpkQuestRtc($params = array()) { try { $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory'); $getUserIdValue = NULL; $getUser = InfoUsers::getUserIdsForNetworkKey(array('network_key' => $params['network_key'])); if (\Utill\Dal\Helper::haveRecord($getUser)) { $getUserIdValue = $getUser['resultSet'][0]['user_id']; $sql = " \n SELECT \n COUNT(a.id) AS count\n FROM info_users_products_services a\n INNER JOIN info_users_detail iud ON iud.root_id = a.user_id AND iud.active = 0 AND iud.deleted = 0 AND iud.language_parent_id =0\n INNER JOIN sys_language l ON l.id = iud.language_id AND l.deleted =0 AND l.active =0 \n INNER JOIN info_users iu ON iu.id = a.user_id \n\t\t INNER JOIN sys_unspsc_codes suc ON suc.id = a.unspsc_codes_id AND suc.active = 0 AND suc.deleted = 0 AND suc.language_id =l.id AND suc.language_parent_id =0 \t\t \n\t\t WHERE \n a.user_id = " . intval($getUserIdValue) . " AND\n a.cons_allow_id =2 AND \n\t\t\ta.profile_public = 0 \n\t\t ORDER BY unspsc_name\n "; $statement = $pdo->prepare($sql); //echo debugPDO($sql, $params); $statement->execute(); $result = $statement->fetchAll(\PDO::FETCH_ASSOC); $errorInfo = $statement->errorInfo(); if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) { throw new \PDOException($errorInfo[0]); } return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result); } else { $errorInfo = '23502'; // 23502 not_null_violation $errorInfoColumn = 'unpk'; return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn); } } catch (\PDOException $e) { return array("found" => false, "errorInfo" => $e->getMessage()); } }