Ejemplo n.º 1
0
 /**
  * Kullanıcı ilk kayıt ta "pk" sız olarak  cagırılacak servis.
  * Kullanıcıyı kaydeder. pk, pktemp, privatekey degerlerinin olusturur.  
  * @author Okan CIRAN
  * @version v 1.0 27.01.2016
  * @param array | null $args
  * @return array
  * @throws PDOException
  */
 public function insertTemp($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $kontrol = $this->haveRecords($params);
         if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
             $getConsultant = SysOsbConsultants::getConsultantIdForUsers(array('category_id' => 0));
             if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                 $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
             } else {
                 $ConsultantId = 1001;
             }
             $sql = " \n                INSERT INTO info_users(                           \n                        operation_type_id, \n                        username, \n                        password,                         \n                        op_user_id,                            \n                        language_id, \n                        role_id,\n                        consultant_id\n                              )      \n                VALUES (1,\n                        :username,\n                        :password,\n                        (SELECT last_value FROM info_users_id_seq),\n                        :language_id,\n                        5 ,\n                       " . intval($ConsultantId) . "\n                    )";
             $statement = $pdo->prepare($sql);
             $statement->bindValue(':username', $params['username'], \PDO::PARAM_STR);
             $statement->bindValue(':password', $params['password'], \PDO::PARAM_STR);
             $statement->bindValue(':language_id', $params['preferred_language'], \PDO::PARAM_INT);
             //echo debugPDO($sql, $params);
             $result = $statement->execute();
             $insertID = $pdo->lastInsertId('info_users_id_seq');
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             /*
              * kullanıcı için gerekli olan private key ve value değerleri yaratılılacak.  
              * kullanıcı için gerekli olan private key temp ve value temp değerleri yaratılılacak.  
              */
             $this->setPrivateKey(array('id' => $insertID));
             /*
              * kullanıcının public key temp değeri alınacak..  
              */
             $publicKeyTemp = $this->getPublicKeyTemp(array('id' => $insertID));
             if (\Utill\Dal\Helper::haveRecord($publicKeyTemp)) {
                 $publicKeyTempValue = $publicKeyTemp['resultSet'][0]['pk_temp'];
             } else {
                 $publicKeyTempValue = NULL;
             }
             /*
              * kullanıcı bilgileri info_users_detail tablosuna kayıt edilecek.   
              */
             $this->insertDetail(array('op_user_id' => $insertID, 'role_id' => 5, 'active' => 0, 'operation_type_id' => 1, 'language_id' => $params['preferred_language'], 'profile_public' => $params['profile_public'], 'f_check' => 0, 'name' => $params['name'], 'surname' => $params['surname'], 'username' => $params['username'], 'auth_email' => $params['auth_email'], 'act_parent_id' => 0, 'auth_allow_id' => 0, 'cons_allow_id' => 0, 'root_id' => $insertID, 'password' => $params['password'], 'consultant_id' => $ConsultantId));
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID, "pktemp" => $publicKeyTempValue);
         } else {
             $errorInfo = '23505';
             // 23505  unique_violation
             $errorInfoColumn = 'username';
             $pdo->rollback();
             $result = $kontrol;
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
Ejemplo n.º 2
0
 /**
  * @author Okan CIRAN
  * @ info_firm_verbal tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  25.04.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $getFirm = InfoFirmProfile::getCheckIsThisFirmRegisteredUser(array('cpk' => $params['cpk'], 'op_user_id' => $opUserIdValue));
             if (\Utill\Dal\Helper::haveRecord($getFirm)) {
                 $getFirmId = $getFirm['resultSet'][0]['firm_id'];
                 $kontrol = $this->haveRecords(array('firm_id' => $getFirmId));
                 if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                     $operationIdValue = -1;
                     $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 32, 'type_id' => 1));
                     if (\Utill\Dal\Helper::haveRecord($operationId)) {
                         $operationIdValue = $operationId['resultSet'][0]['id'];
                     }
                     $languageId = NULL;
                     $languageIdValue = 647;
                     if (isset($params['language_code']) && $params['language_code'] != "") {
                         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                         if (\Utill\Dal\Helper::haveRecord($languageId)) {
                             $languageIdValue = $languageId['resultSet'][0]['id'];
                         }
                     }
                     $ConsultantId = 1001;
                     $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_firm_verbal', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                     if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                         $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                     }
                     $profilePublic = 0;
                     if (isset($params['profile_public']) && $params['profile_public'] != "") {
                         $profilePublic = intval($params['profile_public']);
                     }
                     $countryId = 91;
                     if (isset($params['country_id']) && $params['country_id'] != "") {
                         $countryId = intval($params['country_id']);
                     }
                     $xc = InfoFirmProfile::updateVerbal(array('op_user_id' => $opUserIdValue, 'firm_id' => $getFirmId, 'profile_public' => $profilePublic, 'language_id' => $languageIdValue, 'foundation_yearx' => $params['foundation_yearx'], 'country_id' => $countryId, 'firm_name' => $params['firm_name'], 'firm_name_eng' => $params['firm_name_eng'], 'firm_name_short' => $params['firm_name_short'], 'firm_name_short_eng' => $params['firm_name_short_eng'], 'web_address' => $params['web_address'], 'tax_office' => $params['tax_office'], 'tax_no' => $params['tax_no'], 'description' => $params['description'], 'description_eng' => $params['description_eng'], 'sgk_sicil_no' => $params['sgk_sicil_no'], 'duns_number' => $params['duns_number'], 'logo' => $params['logo']));
                     if ($xc['errorInfo'][0] != "00000" && $xc['errorInfo'][1] != NULL && $xc['errorInfo'][2] != NULL) {
                         throw new \PDOException($xc['errorInfo']);
                     }
                     $sql = " \n                        INSERT INTO info_firm_verbal(\n                            firm_id, \n                            consultant_id,\n                            operation_type_id, \n                            language_id,\n                            op_user_id,\n                            profile_public,                        \n                            act_parent_id, \n                            about,\n                            about_eng,\n                            verbal1_title, \n                            verbal1, \n                            verbal2_title, \n                            verbal2, \n                            verbal3_title, \n                            verbal3, \n                            verbal1_title_eng, \n                            verbal1_eng, \n                            verbal2_title_eng, \n                            verbal2_eng, \n                            verbal3_title_eng, \n                            verbal3_eng\n                            )\n                        VALUES (\n                            :firm_id, \n                            " . intval($ConsultantId) . ",\n                            " . intval($operationIdValue) . ", \n                            " . intval($languageIdValue) . ", \n                            " . intval($opUserIdValue) . ", \n                            " . intval($profilePublic) . ",                         \n                            (SELECT last_value FROM info_firm_verbal_id_seq),\n                            cast(:about AS character varying(3000)),\n                            cast(:about_eng AS character varying(3000)),\n                            cast(:verbal1_title AS character varying(150)),\n                            cast(:verbal1 AS character varying(2000)),\n                            cast(:verbal2_title AS character varying(150)),\n                            cast(:verbal2 AS character varying(2000)),\n                            cast(:verbal3_title AS character varying(150)),\n                            cast(:verbal3 AS character varying(2000)),\n                            cast(:verbal1_title_eng AS character varying(150)),\n                            cast(:verbal1_eng AS character varying(2000)), \n                            cast(:verbal2_title_eng AS character varying(150)),\n                            cast(:verbal2_eng AS character varying(2000)),\n                            cast(:verbal3_title_eng AS character varying(150)),\n                            cast(:verbal3_eng AS character varying(2000))\n                             )";
                     $statement = $pdo->prepare($sql);
                     $statement->bindValue(':firm_id', $getFirmId, \PDO::PARAM_INT);
                     $statement->bindValue(':about', $params['about'], \PDO::PARAM_STR);
                     $statement->bindValue(':about_eng', $params['about_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal1_title', $params['verbal1_title'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal1', $params['verbal1'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal2_title', $params['verbal2_title'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal2', $params['verbal2'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal3_title', $params['verbal3_title'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal3', $params['verbal3'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal1_title_eng', $params['verbal1_title_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal1_eng', $params['verbal1_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal2_title_eng', $params['verbal2_title_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal2_eng', $params['verbal2_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal3_title_eng', $params['verbal3_title_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':verbal3_eng', $params['verbal3_eng'], \PDO::PARAM_STR);
                     //  echo debugPDO($sql, $params);
                     $result = $statement->execute();
                     $insertID = $pdo->lastInsertId('info_firm_verbal_id_seq');
                     $errorInfo = $statement->errorInfo();
                     if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                         throw new \PDOException($errorInfo[0]);
                     }
                     $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                     if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                         throw new \PDOException($xjobs['errorInfo']);
                     }
                     $pdo->commit();
                     return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
                 } else {
                     $errorInfo = '23502';
                     // 23502  not_null_violation
                     $errorInfoColumn = 'firm_id';
                     $pdo->rollback();
                     return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
                 }
             } else {
                 $errorInfo = '23502';
                 // 23502  not_null_violation
                 $errorInfoColumn = 'cpk';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ info_users_addresses tablosuna pktemp için yeni bir kayıt oluşturur.  !!
  * @version v 1.0  03.02.2016
  * @return array
  * @throws \PDOException
  */
 public function insertTemp($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserIdTemp(array('pktemp' => $params['pktemp']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $addSql = " op_user_id, ";
             $addSqlValue = " " . $opUserIdValue . ",";
             $addSql .= " user_id,  ";
             if (isset($params['user_id']) && $params['user_id'] != "") {
                 $userId = $params['user_id'];
             } else {
                 $userId = $opUserIdValue;
             }
             $addSqlValue .= " " . $userId . ",";
             $getConsultant = SysOsbConsultants::getConsultantIdForUsers(array('category_id' => 1));
             if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                 $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
             } else {
                 $ConsultantId = 1001;
             }
             $addSql .= " consultant_id,  ";
             $addSqlValue .= " " . intval($ConsultantId) . ",";
             $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
             if (\Utill\Dal\Helper::haveRecord($languageId)) {
                 $languageIdValue = $languageId['resultSet'][0]['id'];
             } else {
                 $languageIdValue = 647;
             }
             $addSql .= "  language_id,  ";
             $addSqlValue .= " " . intval($languageIdValue) . ",";
             $sql = "                \n                        INSERT INTO info_users_addresses (                           \n                                " . $addSql . " \n                                operation_type_id,     \n                                language_code,                                \n                                address_type_id, \n                                address1, \n                                address2, \n                                postal_code, \n                                country_id, \n                                city_id, \n                                borough_id, \n                                city_name, \n                                description,                                 \n                                profile_public,\n                                history_parent_id\n                                )                        \n                        VALUES (\n                                " . $addSqlValue . " \n                                1,    \n                                :language_code,                               \n                                :address_type_id, \n                                :address1, \n                                :address2, \n                                :postal_code, \n                                :country_id, \n                                :city_id, \n                                :borough_id, \n                                :city_name, \n                                :description,                                 \n                                :profile_public,\n                                (SELECT last_value FROM info_users_addresses_id_seq)\n                                           )     ";
             $statement = $pdo->prepare($sql);
             $statement->bindValue(':language_code', $params['language_code'], \PDO::PARAM_STR);
             $statement->bindValue(':address_type_id', $params['address_type_id'], \PDO::PARAM_INT);
             $statement->bindValue(':address1', $params['address1'], \PDO::PARAM_STR);
             $statement->bindValue(':address2', $params['address2'], \PDO::PARAM_STR);
             $statement->bindValue(':postal_code', $params['postal_code'], \PDO::PARAM_STR);
             $statement->bindValue(':country_id', $params['country_id'], \PDO::PARAM_INT);
             $statement->bindValue(':city_id', $params['city_id'], \PDO::PARAM_INT);
             $statement->bindValue(':borough_id', $params['borough_id'], \PDO::PARAM_INT);
             $statement->bindValue(':description', $params['description'], \PDO::PARAM_STR);
             $statement->bindValue(':city_name', $params['city_name'], \PDO::PARAM_STR);
             $statement->bindValue(':profile_public', $params['profile_public'], \PDO::PARAM_INT);
             // echo debugPDO($sql, $params);
             $result = $statement->execute();
             $insertID = $pdo->lastInsertId('info_users_addresses_id_seq');
             $errorInfo = $statement->errorInfo();
             if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                 throw new \PDOException($errorInfo[0]);
             }
             $pdo->commit();
             return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ info_users_socialmedia tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  21.04.2016
  * @param type $params
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $kontrol = $this->haveRecords(array('sys_socialmedia_id' => $params['sys_socialmedia_id'], 'user_link' => $params['user_link'], 'user_id' => $opUserIdValue));
             if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                 $operationIdValue = -1;
                 $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 42, 'type_id' => 1));
                 if (\Utill\Dal\Helper::haveRecord($operationId)) {
                     $operationIdValue = $operationId['resultSet'][0]['id'];
                 }
                 $languageId = NULL;
                 $languageIdValue = 647;
                 if (isset($params['language_code']) && $params['language_code'] != "") {
                     $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                     if (\Utill\Dal\Helper::haveRecord($languageId)) {
                         $languageIdValue = $languageId['resultSet'][0]['id'];
                     }
                 }
                 $ConsultantId = 1001;
                 $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_users_socialmedia', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                 if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                     $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                 }
                 $sql = "\n                INSERT INTO info_users_socialmedia(                        \n                        user_id, \n                        profile_public, \n                        op_user_id, \n                        operation_type_id, \n                        consultant_id, \n                        sys_socialmedia_id, \n                        act_parent_id, \n                        user_link\n                         )\n                VALUES (\n                        :user_id, \n                        :profile_public, \n                        :op_user_id, \n                        :operation_type_id, \n                        :consultant_id, \n                        :sys_socialmedia_id, \n                        (SELECT last_value FROM info_users_socialmedia_id_seq), \n                        :user_link\n                                             )   ";
                 $statement = $pdo->prepare($sql);
                 $statement->bindValue(':profile_public', $params['profile_public'], \PDO::PARAM_INT);
                 $statement->bindValue(':operation_type_id', $operationIdValue, \PDO::PARAM_INT);
                 $statement->bindValue(':consultant_id', $ConsultantId, \PDO::PARAM_INT);
                 $statement->bindValue(':sys_socialmedia_id', $params['sys_socialmedia_id'], \PDO::PARAM_INT);
                 $statement->bindValue(':user_id', $opUserIdValue, \PDO::PARAM_INT);
                 $statement->bindValue(':op_user_id', $opUserIdValue, \PDO::PARAM_INT);
                 $statement->bindValue(':user_link', $params['user_link'], \PDO::PARAM_STR);
                 // echo debugPDO($sql, $params);
                 $result = $statement->execute();
                 $insertID = $pdo->lastInsertId('info_users_socialmedia_id_seq');
                 $errorInfo = $statement->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
                 $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                 if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                     throw new \PDOException($xjobs['errorInfo']);
                 }
                 $pdo->commit();
                 return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
             } else {
                 $errorInfo = '23505';
                 $errorInfoColumn = 'sys_socialmedia_id';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
Ejemplo n.º 5
0
 /**
  * @author Okan CIRAN
  * @ info_firm_address tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  16.05.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $getFirm = InfoFirmProfile::getCheckIsThisFirmRegisteredUser(array('cpk' => $params['cpk'], 'op_user_id' => $opUserIdValue));
             if (\Utill\Dal\Helper::haveRecord($getFirm)) {
                 $getFirmId = $getFirm['resultSet'][0]['firm_id'];
                 $kontrol = $this->haveRecords(array('firm_id' => $getFirmId, 'firm_building_type_id' => $params['firm_building_type_id']));
                 if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                     $operationIdValue = -1;
                     $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 2, 'type_id' => 1));
                     if (\Utill\Dal\Helper::haveRecord($operationId)) {
                         $operationIdValue = $operationId['resultSet'][0]['id'];
                     }
                     $languageId = NULL;
                     $languageIdValue = 647;
                     if (isset($params['language_code']) && $params['language_code'] != "") {
                         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                         if (\Utill\Dal\Helper::haveRecord($languageId)) {
                             $languageIdValue = $languageId['resultSet'][0]['id'];
                         }
                     }
                     $ConsultantId = 1001;
                     $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_firm_address', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                     if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                         $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                     }
                     $profilePublic = 0;
                     if (isset($params['profile_public']) && $params['profile_public'] != "") {
                         $profilePublic = $params['profile_public'];
                     }
                     $osbId = 0;
                     if (isset($params['osb_id']) && $params['osb_id'] != "") {
                         $osbId = $params['osb_id'];
                     }
                     $sql = " \n                        INSERT INTO info_firm_address(\n                            firm_id, \n                            consultant_id,\n                            operation_type_id,\n                            language_id,\n                            op_user_id, \n                            profile_public,\n                            act_parent_id,  \n                            firm_building_type_id,\n                            firm_building_name, \n                            address, \n                            borough_id, \n                            city_id, \n                            country_id,\n                            description,\n                            description_eng,\n                            osb_id,\n                            tel,\n                            fax,\n                            email\n                            )\n                        VALUES (\n                            :firm_id, \n                            " . intval($ConsultantId) . ",\n                            " . intval($operationIdValue) . ",                       \n                            " . intval($languageIdValue) . ",\n                            " . intval($opUserIdValue) . ",\n                            " . intval($profilePublic) . ",\n                            (SELECT last_value FROM info_firm_address_id_seq),\n                            :firm_building_type_id,\n                            :firm_building_name, \n                            :address, \n                            :borough_id, \n                            :city_id, \n                            :country_id,\n                            :description,\n                            :description_eng,\n                            :osb_id,\n                            :tel,\n                            :fax,\n                            :email\n                             )";
                     $statement = $pdo->prepare($sql);
                     $statement->bindValue(':firm_id', $getFirmId, \PDO::PARAM_INT);
                     $statement->bindValue(':firm_building_type_id', $params['firm_building_type_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':firm_building_name', $params['firm_building_name'], \PDO::PARAM_STR);
                     $statement->bindValue(':address', $params['address'], \PDO::PARAM_STR);
                     $statement->bindValue(':borough_id', $params['borough_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':city_id', $params['city_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':country_id', $params['country_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':description', $params['description'], \PDO::PARAM_STR);
                     $statement->bindValue(':description_eng', $params['description_eng'], \PDO::PARAM_STR);
                     $statement->bindValue(':osb_id', $params['osb_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':tel', $params['tel'], \PDO::PARAM_STR);
                     $statement->bindValue(':fax', $params['fax'], \PDO::PARAM_STR);
                     $statement->bindValue(':email', $params['email'], \PDO::PARAM_STR);
                     //  echo debugPDO($sql, $params);
                     $result = $statement->execute();
                     $insertID = $pdo->lastInsertId('info_firm_address_id_seq');
                     $errorInfo = $statement->errorInfo();
                     if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                         throw new \PDOException($errorInfo[0]);
                     }
                     $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                     if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                         throw new \PDOException($xjobs['errorInfo']);
                     }
                     $pdo->commit();
                     return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
                 } else {
                     // 23505  unique_violation
                     $errorInfo = '23505';
                     $errorInfoColumn = 'firm_building_type_id';
                     $pdo->rollback();
                     return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
                 }
             } else {
                 $errorInfo = '23502';
                 // 23502  not_null_violation
                 $errorInfoColumn = 'cpk';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ info_firm_profile tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  06.01.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insertTemp($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserIdTemp(array('pktemp' => $params['pktemp']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $kontrol = $this->haveRecords($params);
             if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                 $addSql = " op_user_id, ";
                 $addSqlValue = " " . $opUserIdValue . ",";
                 $addSql .= " operation_type_id,  ";
                 $addSqlValue .= " 1,";
                 $addSql .= " owner_user_id,  ";
                 $addSqlValue .= " " . $opUserIdValue . ",";
                 $getConsultant = SysOsbConsultants::getConsultantIdForCompany(array('category_id' => 1));
                 if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                     $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                 } else {
                     $ConsultantId = 1001;
                 }
                 $addSql .= " consultant_id,  ";
                 $addSqlValue .= " " . intval($ConsultantId) . ",";
                 if (isset($params['foundation_year']) && $params['foundation_year'] != "") {
                     $foundationYear = $params['foundation_year'];
                     $addSql .= " foundation_year,  ";
                     $addSqlValue .= " '" . $foundationYear . "',";
                 }
                 $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                 if (\Utill\Dal\Helper::haveRecord($languageId)) {
                     $languageIdValue = $languageId['resultSet'][0]['id'];
                 } else {
                     $languageIdValue = 647;
                 }
                 $addSql .= " language_id, ";
                 $addSqlValue .= " " . intval($languageIdValue) . ",";
                 $sql = " \n                   INSERT INTO info_firm_profile(\n                        profile_public, \n                        country_id,                    \n                        firm_name, \n                        web_address, \n                        tax_office, \n                        tax_no, \n                        sgk_sicil_no, \n                        ownership_status_id,                         \n                        language_code,                         \n                         " . $addSql . "                     \n                        firm_name_short,\n                        act_parent_id,                      \n                        description,\n                        description_eng,\n                        duns_number\n                        )\n                VALUES (\n                        " . intval($params['profile_public']) . ", \n                        " . intval($params['country_id']) . ",                     \n                        :firm_name, \n                        :web_address, \n                        :tax_office, \n                        :tax_no, \n                        :sgk_sicil_no, \n                        " . intval($params['ownership_status_id']) . ",                         \n                        :language_code,                         \n                         " . $addSqlValue . "                     \n                        :firm_name_short,\n                        (SELECT last_value FROM info_firm_profile_id_seq),                   \n                        :description,\n                        :description_eng,\n                        :duns_number\n                                            )    ";
                 $statementInsert = $pdo->prepare($sql);
                 $statementInsert->bindValue(':firm_name', $params['firm_name'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':web_address', $params['web_address'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':tax_office', $params['tax_office'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':tax_no', $params['tax_no'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':sgk_sicil_no', $params['sgk_sicil_no'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':language_code', $params['language_code'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':firm_name_short', $params['firm_name_short'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':description', $params['description'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':description_eng', $params['description_eng'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':duns_number', $params['duns_number'], \PDO::PARAM_STR);
                 $result = $statementInsert->execute();
                 $insertID = $pdo->lastInsertId('info_firm_profile_id_seq');
                 $errorInfo = $statementInsert->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
                 $pdo->commit();
                 return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
             } else {
                 // 23505  unique_violation
                 $errorInfo = '23505';
                 $errorInfoColumn = 'firm_name';
                 $pdo->rollback();
                 return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ info_firm_machine_tool tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  18.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->getServiceLocator()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $kontrol = $this->haveRecords($params);
             if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                 $addSql = " op_user_id, ";
                 $addSqlValue = " " . $opUserIdValue . ",";
                 $addSql .= " operation_type_id,  ";
                 if (isset($params['operation_type_id']) && $params['operation_type_id'] != "") {
                     $addSqlValue .= " " . intval($params['operation_type_id']) . ",";
                 } else {
                     $addSqlValue .= " 29,";
                 }
                 $getConsultant = SysOsbConsultants::getConsultantIdForCompany(array('category_id' => 1));
                 if (\Utill\Dal\Helper::haveRecord($getConsultant['resultSet'][0]['consultant_id'])) {
                     $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                 } else {
                     $ConsultantId = 1001;
                 }
                 $addSql .= " consultant_id,  ";
                 $addSqlValue .= " " . intval($ConsultantId) . ",";
                 if (isset($params['profile_public'])) {
                     $addSql .= " profile_public, ";
                     $addSqlValue .= intval($params['profile_public']) . ", ";
                 }
                 $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                 if (\Utill\Dal\Helper::haveRecord($languageId)) {
                     $languageIdValue = $languageId['resultSet'][0]['id'];
                 } else {
                     $languageIdValue = 647;
                 }
                 $addSql .= " language_id, ";
                 $addSqlValue .= " " . $languageIdValue . ",";
                 $statement = $pdo->prepare("\n                   INSERT INTO info_firm_machine_tool(\n                        firm_id,                         \n                        sys_machine_tool_id,\n                        language_code,\n                        availability_id,\n                         " . $addSql . "\n                        act_parent_id\n                        )\n                VALUES (\n                        :firm_id,                        \n                        :sys_machine_tool_id,\n                        :language_code, \n                        :availability_id, \n                         " . $addSqlValue . "\n                        (SELECT last_value FROM info_firm_machine_tool_id_seq)\n                        ");
                 $statement->bindValue(':firm_id', $params['firm_id'], \PDO::PARAM_INT);
                 $statement->bindValue(':sys_machine_tool_id', $params['machine_id'], \PDO::PARAM_INT);
                 $statement->bindValue(':availability_id', $params['availability_id'], \PDO::PARAM_INT);
                 $statement->bindValue(':language_code', $params['language_code'], \PDO::PARAM_STR);
                 $result = $statement->execute();
                 $insertID = $pdo->lastInsertId('info_firm_machine_tool_id_seq');
                 $errorInfo = $statement->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
                 $pdo->commit();
                 return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
             } else {
                 // 23505  unique_violation
                 $errorInfo = '23505';
                 $errorInfoColumn = 'sys_machine_tool_id';
                 $pdo->rollback();
                 // $result = $kontrol;
                 return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
Ejemplo n.º 8
0
 /**
  * @author Okan CIRAN
  * @ info_firm_profile tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  06.01.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insertTemp($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserIdTemp(array('pktemp' => $params['pktemp']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $kontrol = $this->haveRecords($params);
             if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                 $operationIdValue = -1;
                 $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 23, 'type_id' => 1));
                 if (\Utill\Dal\Helper::haveRecord($operationId)) {
                     $operationIdValue = $operationId['resultSet'][0]['id'];
                 }
                 $ConsultantId = 1001;
                 $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_firm_profile', 'operation_type_id' => $operationIdValue));
                 if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                     $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                 }
                 $foundationYearx = NULL;
                 if (isset($params['foundation_yearx']) && $params['foundation_yearx'] != "") {
                     $foundationYearx = $params['foundation_yearx'];
                 }
                 //to_timestamp(1451599200 )
                 $languageId = NULL;
                 $languageIdValue = 647;
                 if (isset($params['language_code']) && $params['language_code'] != "") {
                     $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                     if (\Utill\Dal\Helper::haveRecord($languageId)) {
                         $languageIdValue = $languageId['resultSet'][0]['id'];
                     }
                 }
                 $sql = " \n                   INSERT INTO info_firm_profile(\n                        profile_public, \n                        country_id,                    \n                        firm_name, \n                        web_address, \n                        tax_office, \n                        tax_no, \n                        sgk_sicil_no, \n                        ownership_status_id,                         \n                        language_code, \n                        language_id,\n                        op_user_id, \n                        consultant_id,\n                        operation_type_id,                      \n                        foundation_yearx, \n                        firm_name_short,\n                        act_parent_id,                      \n                        description,\n                        description_eng,\n                        duns_number,\n                        logo\n                        )\n                VALUES (\n                        " . intval($params['profile_public']) . ", \n                        " . intval($params['country_id']) . ",\n                        :firm_name, \n                        :web_address, \n                        :tax_office, \n                        :tax_no,\n                        :sgk_sicil_no, \n                        " . intval($params['ownership_status_id']) . ",\n                        :language_code,  \n                        " . intval($languageIdValue) . ",\n                        " . intval($opUserIdValue) . ",\n                        " . intval($ConsultantId) . ",\n                        " . intval($operationIdValue) . ",\n                        " . intval($foundationYearx) . " ,\n                        :firm_name_short,\n                        (SELECT last_value FROM info_firm_profile_id_seq),\n                        :description,\n                        :description_eng,\n                        :duns_number,\n                        :logo\n                                            )    ";
                 $statementInsert = $pdo->prepare($sql);
                 $statementInsert->bindValue(':firm_name', $params['firm_name'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':web_address', $params['web_address'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':tax_office', $params['tax_office'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':tax_no', $params['tax_no'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':sgk_sicil_no', $params['sgk_sicil_no'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':language_code', $params['language_code'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':firm_name_short', $params['firm_name_short'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':description', $params['description'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':description_eng', $params['description_eng'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':duns_number', $params['duns_number'], \PDO::PARAM_STR);
                 $statementInsert->bindValue(':logo', $params['logo'], \PDO::PARAM_STR);
                 // echo debugPDO($sql, $params);
                 $result = $statementInsert->execute();
                 $insertID = $pdo->lastInsertId('info_firm_profile_id_seq');
                 $errorInfo = $statementInsert->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
                 InfoFirmKeys::insert(array('firm_id' => $insertID, 'country_id' => $params['country_id']));
                 $this->insertCompanyUser(array('firm_id' => $insertID, 'language_id' => $languageIdValue, 'consultant_id' => $ConsultantId, 'user_id' => $opUserIdValue, 'op_user_id' => $opUserIdValue));
                 $pdo->commit();
                 return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
             } else {
                 $errorInfo = '23505';
                 // 23505  unique_violation
                 $errorInfoColumn = 'firm_name';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
Ejemplo n.º 9
0
 /**
  * info_users tablosundaki urge ci personel kaydı oluşturur  !!
  * @author Okan CIRAN
  * @version v 1.0  31.08.2016
  * @param array | null $args
  * @return array
  * @throws PDOException
  */
 public function insertUrgePerson($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $kontrol = $this->haveRecords($params);
         // username kontrolu
         if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
             $userId = $this->getUserId(array('pk' => $params['pk']));
             // bı pk var mı
             if (\Utill\Dal\Helper::haveRecord($userId)) {
                 $opUserIdValue = $userId['resultSet'][0]['user_id'];
                 $roleId = 64;
                 if (isset($params['role_id']) && $params['role_id'] != "") {
                     $roleId = $params['role_id'];
                 }
                 $languageIdValue = 647;
                 if (isset($params['preferred_language']) && $params['preferred_language'] != "") {
                     $languageIdValue = $params['preferred_language'];
                 }
                 $operationIdValue = -1;
                 $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 43, 'type_id' => 1));
                 if (\Utill\Dal\Helper::haveRecord($operationId)) {
                     $operationIdValue = $operationId['resultSet'][0]['id'];
                 }
                 $ConsultantId = 1001;
                 $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_users', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                 if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                     $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                 }
                 $CountryCode = NULL;
                 $CountryCodeValue = 'TR';
                 if (isset($params['country_id']) && $params['country_id'] != "") {
                     $CountryCode = SysCountrys::getCountryCode(array('country_id' => $params['country_id']));
                     if (\Utill\Dal\Helper::haveRecord($CountryCode)) {
                         $CountryCodeValue = $CountryCode['resultSet'][0]['country_code'];
                     }
                 }
                 $password = '******';
                 $sql = " \n                    INSERT INTO info_users(\n                               operation_type_id, \n                               username,\n                               language_id,\n                               op_user_id,\n                               role_id,\n                               password,\n                               consultant_id,\n                               network_key\n                                )\n                    VALUES (    " . intval($operationIdValue) . ", \n                                '" . $params['username'] . "',                               \n                                " . intval($languageIdValue) . ",\n                                " . intval($opUserIdValue) . ",\n                                " . intval($roleId) . ",\n                                '" . $password . "',       \n                                " . intval($ConsultantId) . ",\n                                CONCAT('U','" . $CountryCodeValue . "',ostim_userid_generator())\n                        )";
                 $statement = $pdo->prepare($sql);
                 // echo debugPDO($sql, $params);
                 $result = $statement->execute();
                 $insertID = $pdo->lastInsertId('info_users_id_seq');
                 $errorInfo = $statement->errorInfo();
                 if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                     throw new \PDOException($errorInfo[0]);
                 }
                 /*
                  * kullanıcı için gerekli olan private key ve value değerleri yaratılılacak.                       
                  */
                 $xc = $this->setPrivateKey(array('id' => $insertID));
                 if ($xc['errorInfo'][0] != "00000" && $xc['errorInfo'][1] != NULL && $xc['errorInfo'][2] != NULL) {
                     throw new \PDOException($xc['errorInfo']);
                 }
                 /*
                  * kullanıcı bilgileri info_users_detail tablosuna kayıt edilecek.   
                  */
                 $xc = $this->insertUrgePersonDetail(array('id' => $insertID, 'op_user_id' => $opUserIdValue, 'role_id' => $roleId, 'language_id' => $languageIdValue, 'name' => $params['name'], 'surname' => $params['surname'], 'auth_email' => $params['auth_email'], 'root_id' => $insertID, 'consultant_id' => $ConsultantId, 'password' => $password));
                 if ($xc['errorInfo'][0] != "00000" && $xc['errorInfo'][1] != NULL && $xc['errorInfo'][2] != NULL) {
                     throw new \PDOException($xc['errorInfo']);
                 }
                 $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                 if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                     throw new \PDOException($xjobs['errorInfo']);
                 }
                 $logDbData = $this->getUsernamePrivateKey(array('id' => $insertID));
                 if ($logDbData['errorInfo'][0] != "00000" && $logDbData['errorInfo'][1] != NULL && $logDbData['errorInfo'][2] != NULL) {
                     throw new \PDOException($logDbData['errorInfo']);
                 }
                 $this->insertLogUser(array('oid' => $insertID, 'username' => $logDbData['resultSet'][0]['username'], 'sf_private_key_value' => $logDbData['resultSet'][0]['sf_private_key_value'], 'sf_private_key_value_temp' => $logDbData['resultSet'][0]['sf_private_key_value_temp']));
                 /*
                  * danısman tablosuna kaydedelim.
                  */
                 $xc = $this->insertUrgePersonSysOsbPerson(array('op_user_id' => intval($opUserIdValue), 'user_id' => intval($insertID), 'osb_cluster_id' => intval($params['cluster_id'])));
                 if ($xc['errorInfo'][0] != "00000" && $xc['errorInfo'][1] != NULL && $xc['errorInfo'][2] != NULL) {
                     throw new \PDOException($xc['errorInfo']);
                 }
                 $userInfo = $this->getUrgePersonRoleAndClusterInformation(array('id' => $insertID));
                 if (\Utill\Dal\Helper::haveRecord($userInfo)) {
                     $kumeValue = $userInfo['resultSet'][0]['clusters'];
                     $roleValue = $userInfo['resultSet'][0]['role'];
                     $keyValue = $userInfo['resultSet'][0]['key'];
                     $xcSendingMail = InfoUsersSendingMail::insertSendingMail(array('user_id' => intval($insertID), 'auth_email' => $params['auth_email'], 'act_email_template_id' => 1, 'op_user_id' => intval($opUserIdValue), 'key' => $keyValue));
                     if ($xcSendingMail['errorInfo'][0] != "00000" && $xcSendingMail['errorInfo'][1] != NULL && $xcSendingMail['errorInfo'][2] != NULL) {
                         throw new \PDOException($xcSendingMail['errorInfo']);
                     }
                     /*
                      * email gönderelim
                      */
                     $xcUserInfo = InfoUsersSendingMail::sendMailUrgeNewPerson(array('auth_email' => $params['auth_email'], 'herkimse' => $params['name'] . ' ' . $params['surname'], 'kume' => $kumeValue, 'rol' => $roleValue, 'key' => $keyValue));
                     if ($xcUserInfo['errorInfo'][0] != "00000" && $xcUserInfo['errorInfo'][1] != NULL && $xcUserInfo['errorInfo'][2] != NULL) {
                         throw new \PDOException($xcUserInfo['errorInfo']);
                     }
                 }
                 $insertID = $xc['lastInsertId'];
                 $pdo->commit();
                 return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
             } else {
                 $errorInfo = '23502';
                 // 23502  not_null_violation
                 $errorInfoColumn = 'pk';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23505';
             // 23505  unique_violation
             $errorInfoColumn = 'username';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ kullanıcı info_firm_machine_tool tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  18.02.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $getFirm = InfoFirmProfile::getFirmIdsForNetworkKey(array('network_key' => $params['network_key']));
             if (\Utill\Dal\Helper::haveRecord($getFirm)) {
                 $getFirmId = $getFirm['resultSet'][0]['firm_id'];
                 $kontrol = $this->haveRecords(array('firm_id' => $getFirmId, 'machine_id' => $params['machine_id']));
                 if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                     $addSql = " op_user_id, ";
                     $addSqlValue = " " . $opUserIdValue . ",";
                     $operationIdValue = -1;
                     $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 41, 'type_id' => 1));
                     if (\Utill\Dal\Helper::haveRecord($operationId)) {
                         $operationIdValue = $operationId['resultSet'][0]['id'];
                     }
                     $languageId = NULL;
                     $languageIdValue = 647;
                     if (isset($params['language_code']) && $params['language_code'] != "") {
                         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                         if (\Utill\Dal\Helper::haveRecord($languageId)) {
                             $languageIdValue = $languageId['resultSet'][0]['id'];
                         }
                     }
                     $ConsultantId = 1001;
                     $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_firm_machine_tool', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                     if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                         $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                     }
                     $profilePublic = 0;
                     if (isset($params['profile_public']) && $params['profile_public'] != "") {
                         $profilePublic = intval($params['profile_public']);
                     }
                     $ownerShipId = 1;
                     if (isset($params['ownership_id']) && $params['ownership_id'] != "") {
                         $ownerShipId = intval($params['ownership_id']);
                     }
                     $addSql .= " language_id, ";
                     $addSqlValue .= " " . $languageIdValue . ",";
                     $sql = " \n                        INSERT INTO info_firm_machine_tool(\n                             firm_id, \n                             consultant_id,\n                             operation_type_id, \n                             sys_machine_tool_id,                           \n                             availability_id,\n                             ownership_id,\n                             profile_public,\n                              " . $addSql . "\n                             act_parent_id,\n                             total,\n                             picture\n                             )\n                        VALUES (\n                             :firm_id, \n                             " . intval($ConsultantId) . ",\n                             :operation_type_id, \n                             :sys_machine_tool_id,                        \n                             :availability_id, \n                              " . intval($ownerShipId) . ",\n                              " . intval($profilePublic) . ",\n                              " . $addSqlValue . "\n                             (SELECT last_value FROM info_firm_machine_tool_id_seq),\n                             :total,\n                             :picture\n\n                             )";
                     $statement = $pdo->prepare($sql);
                     $statement->bindValue(':firm_id', $getFirmId, \PDO::PARAM_INT);
                     $statement->bindValue(':operation_type_id', $operationIdValue, \PDO::PARAM_INT);
                     $statement->bindValue(':sys_machine_tool_id', $params['machine_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':availability_id', $params['availability_id'], \PDO::PARAM_INT);
                     $statement->bindValue(':total', $params['total'], \PDO::PARAM_INT);
                     $statement->bindValue(':language_code', $params['language_code'], \PDO::PARAM_STR);
                     $statement->bindValue(':picture', $params['picture'], \PDO::PARAM_STR);
                     //  echo debugPDO($sql, $params);
                     $result = $statement->execute();
                     $insertID = $pdo->lastInsertId('info_firm_machine_tool_id_seq');
                     $errorInfo = $statement->errorInfo();
                     if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                         throw new \PDOException($errorInfo[0]);
                     }
                     $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                     if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                         throw new \PDOException($xjobs['errorInfo']);
                     }
                     $pdo->commit();
                     return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
                 } else {
                     // 23505  unique_violation
                     $errorInfo = '23505';
                     $errorInfoColumn = 'machine_id';
                     $pdo->rollback();
                     // $result = $kontrol;
                     return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
                 }
             } else {
                 $errorInfo = '23502';
                 // 23502  not_null_violation
                 $errorInfoColumn = 'npk';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }
 /**
  * @author Okan CIRAN
  * @ info_firm_working_personnel_education tablosuna yeni bir kayıt oluşturur.  !!
  * @version v 1.0  19.07.2016
  * @param array | null $args
  * @return array
  * @throws \PDOException
  */
 public function insert($params = array())
 {
     try {
         $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory');
         $pdo->beginTransaction();
         $opUserId = InfoUsers::getUserId(array('pk' => $params['pk']));
         if (\Utill\Dal\Helper::haveRecord($opUserId)) {
             $opUserIdValue = $opUserId['resultSet'][0]['user_id'];
             $getFirm = InfoFirmProfile::getCheckIsThisFirmRegisteredUser(array('cpk' => $params['cpk'], 'op_user_id' => $opUserIdValue));
             if (\Utill\Dal\Helper::haveRecord($getFirm)) {
                 //   $getFirmId = $getFirm ['resultSet'][0]['firm_id'];
                 $kontrol = $this->haveRecords(array('working_personnel_id' => $params['working_personnel_id'], 'diploma_name' => $params['diploma_name']));
                 if (!\Utill\Dal\Helper::haveRecord($kontrol)) {
                     $operationIdValue = -1;
                     $operationId = SysOperationTypes::getTypeIdToGoOperationId(array('parent_id' => 3, 'main_group' => 3, 'sub_grup_id' => 49, 'type_id' => 1));
                     if (\Utill\Dal\Helper::haveRecord($operationId)) {
                         $operationIdValue = $operationId['resultSet'][0]['id'];
                     }
                     $languageId = NULL;
                     $languageIdValue = 647;
                     if (isset($params['language_code']) && $params['language_code'] != "") {
                         $languageId = SysLanguage::getLanguageId(array('language_code' => $params['language_code']));
                         if (\Utill\Dal\Helper::haveRecord($languageId)) {
                             $languageIdValue = $languageId['resultSet'][0]['id'];
                         }
                     }
                     $ConsultantId = 1001;
                     $getConsultant = SysOsbConsultants::getConsultantIdForTableName(array('table_name' => 'info_firm_working_personnel_education', 'operation_type_id' => $operationIdValue, 'language_id' => $languageIdValue));
                     if (\Utill\Dal\Helper::haveRecord($getConsultant)) {
                         $ConsultantId = $getConsultant['resultSet'][0]['consultant_id'];
                     }
                     $profilePublic = 0;
                     if (isset($params['profile_public']) && $params['profile_public'] != "") {
                         $profilePublic = $params['profile_public'];
                     }
                     $UniversityId = 0;
                     if (isset($params['university_id']) && $params['university_id'] != "") {
                         $UniversityId = $params['university_id'];
                     }
                     $sql = " \n                        INSERT INTO info_firm_working_personnel_education(                          \n                            consultant_id,\n                            operation_type_id,\n                            language_id,\n                            op_user_id, \n                            profile_public,\n                            act_parent_id,                            \n                            \n                            working_personnel_id,\n                            diploma_name, \n                            country_id, \n                            university_id, \n                            graduation_date\n                            )\n                        VALUES (                           \n                            " . intval($ConsultantId) . ",\n                            " . intval($operationIdValue) . ",                       \n                            " . intval($languageIdValue) . ",\n                            " . intval($opUserIdValue) . ",\n                            " . intval($profilePublic) . ",                            \n                            (SELECT last_value FROM info_firm_working_personnel_education_id_seq), \n                            " . intval($params['working_personnel_id']) . ", \n                            '" . $params['diploma_name'] . "', \n                            " . intval($params['country_id']) . ", \n                            " . intval($UniversityId) . ", \n                            " . intval($params['graduation_date']) . "                      \n                             )";
                     $statement = $pdo->prepare($sql);
                     //  echo debugPDO($sql, $params);
                     $result = $statement->execute();
                     $insertID = $pdo->lastInsertId('info_firm_working_personnel_education_id_seq');
                     $errorInfo = $statement->errorInfo();
                     if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
                         throw new \PDOException($errorInfo[0]);
                     }
                     $xjobs = ActProcessConfirm::insert(array('op_user_id' => intval($opUserIdValue), 'operation_type_id' => intval($operationIdValue), 'table_column_id' => intval($insertID), 'cons_id' => intval($ConsultantId), 'preferred_language_id' => intval($languageIdValue)));
                     if ($xjobs['errorInfo'][0] != "00000" && $xjobs['errorInfo'][1] != NULL && $xjobs['errorInfo'][2] != NULL) {
                         throw new \PDOException($xjobs['errorInfo']);
                     }
                     $pdo->commit();
                     return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID);
                 } else {
                     // 23505  unique_violation
                     $errorInfo = '23505';
                     $errorInfoColumn = 'diploma_name';
                     $pdo->rollback();
                     // $result = $kontrol;
                     return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
                 }
             } else {
                 $errorInfo = '23502';
                 // 23502  not_null_violation
                 $errorInfoColumn = 'cpk';
                 $pdo->rollback();
                 return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
             }
         } else {
             $errorInfo = '23502';
             // 23502  not_null_violation
             $errorInfoColumn = 'pk';
             $pdo->rollback();
             return array("found" => false, "errorInfo" => $errorInfo, "resultSet" => '', "errorInfoColumn" => $errorInfoColumn);
         }
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
 }