From e58eb5aa709f8210184ca6ab54a0bf183a139d68 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 28 Sep 2018 15:28:36 +0530 Subject: [PATCH] COMPANY MAS --- api/application/config/constants.php | 4 +- api/application/config/routes.php | 2 + .../controllers/Common_Masters_Controller.php | 1011 +---------------- api/application/controllers/PD_Controller.php | 97 +- .../User_Management_Controller.php | 4 +- api/application/libraries/SPARQ_Model.php | 2 +- api/application/models/PD_Model.php | 15 +- 7 files changed, 133 insertions(+), 1002 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 80785b81..84a3e62f 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -85,8 +85,8 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code // define login route name for token verification -//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfProducts'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors +//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'triggerNewPD'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 105f5c6b..620d1a77 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -73,6 +73,7 @@ $route['saveMaster'] = 'Common_Masters_Controller/saveMaster'; $route['savePDAllocationType'] = 'Common_Masters_Controller/savePDAllocationType'; $route['savePDNotifications'] = 'Common_Masters_Controller/savePDNotifications'; $route['getPDNotificationsList'] = 'Common_Masters_Controller/getPDNotificationsList'; +$route['saveCompany'] = 'Common_Masters_Controller/saveCompany'; @@ -82,6 +83,7 @@ $route['getListOfUsers'] = 'User_Management_Controller/listAllUsers'; $route['saveNewUser'] = 'User_Management_Controller/saveNewUser'; $route['updateExistUser'] = 'User_Management_Controller/updateExistUser'; $route['getUsersDetails'] = 'User_Management_Controller/getUsersDetails'; +$route['getSingedProfilePicURL'] = 'User_Management_Controller/getSingedProfilePicURL'; // TEMPLATE MANAGEMENT $route['listAllTemplates'] = 'Template_Management_Controller/listAllTemplates'; diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index a62769a7..93239c25 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -18,958 +18,10 @@ class Common_Masters_Controller extends REST_Controller { // Construct the parent class parent::__construct(); $this->load->model('Common_Masters_Model'); + $this->load->library('AWS_S3'); } - - // /* Get List Of Mastsers for DropDown */ - // public function getListOfMasters_get() - // { - // $result = $this->Common_Masters_Model->getListOfMasters(); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - - // } - - // /* Industry Classification Masters */ - - - // public function getListOfIndustryClassifications_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_industry_classification'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveIndustryClassification_post() - // { - // $industryClassifications = $this->post('industryClassifications'); - - // if($industryClassifications['industry_classification_id']) //Update Record - // { - // $where_condition_array = array('industry_classification_id'=>$industryClassificationData['industry_classification_id']); - - // $result = $this->Common_Masters_Model->updateRecords($industryClassifications,'m_industry_classification',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($industryClassifications,'m_industry_classification'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - // /* End Of Industry Classification Masters */ - - - - - // /* Producsts Masters */ - - // public function getListOfProducts_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_products'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveProducts_post() - // { - // $products = $this->post('products'); - - // if($products['product_id']) //Update Record - // { - // $where_condition_array = array('product_id'=>$products['product_id']); - - // $result = $this->Common_Masters_Model->updateRecords($products,'m_products',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($products,'m_products'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Producsts Masters */ - - - - - // /* Sub - producsts Master */ - - // public function getListOfSubProducts_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_subproducts'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveSubProducts_post() - // { - // $subproducts = $this->post('subproducts'); - - // if($subproducts['subproduct_id']) //Update Record - // { - // $where_condition_array = array('subproduct_id'=>$subproducts['subproduct_id']); - - // $result = $this->Common_Masters_Model->updateRecords($subproducts,'m_subproducts',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($subproducts,'m_subproducts'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Sub - producsts Master */ - - - - // /* UOM Master */ - - // public function getListOfUOM_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_uom'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveUOM_post() - // { - // $uom = $this->post('uom'); - - // if($uom['uom_id']) //Update Record - // { - // $where_condition_array = array('uom_id'=>$uom['uom_id']); - - // $result = $this->Common_Masters_Model->updateRecords($uom,'m_uom',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($uom,'m_uom'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - // /* End Of UOM Master */ - - - - // /* Occupation_non_earning_members Master */ - - - // public function getListOfOccupationNonEarningMembers_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_occupation_non_earning_members'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveOccupationNonEarningMembers_post() - // { - // $occupationnonearningmembers = $this->post('occupationnonearningmembers'); - - // if($occupationnonearningmembers['occupation_non_earning_member_id']) //Update Record - // { - // $where_condition_array = array('occupation_non_earning_member_id'=>$occupationnonearningmembers['occupation_non_earning_member_id']); - - // $result = $this->Common_Masters_Model->updateRecords($occupationnonearningmembers,'m_occupation_non_earning_members',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($occupationnonearningmembers,'m_occupation_non_earning_members'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Occupation_non_earning_members Master */ - - - // /* Type Of Activity Master */ - - - // public function getListOfTypeOfActivities_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_type_of_activity'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveTypeOfActivity_post() - // { - // $typeofactivity = $this->post('typeofactivity'); - - // if($typeofactivity['type_of_activity_id']) //Update Record - // { - // $where_condition_array = array('type_of_activity_id'=>$typeofactivity['type_of_activity_id']); - - // $result = $this->Common_Masters_Model->updateRecords($typeofactivity,'m_type_of_activity',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($typeofactivity,'m_type_of_activity'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Type Of Activity Master */ - - - // /* Titles Master */ - - - // public function getListOfTitles_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_titles'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveTitle_post() - // { - // $title = $this->post('title'); - - // if($title['title_id']) //Update Record - // { - // $where_condition_array = array('title_id'=>$title['title_id']); - - // $result = $this->Common_Masters_Model->updateRecords($title,'m_titles',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($title,'m_titles'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Titles Master */ - - - - // /* Relationships Master */ - - - // public function getListOfRelationships_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_relationships'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveRelationship_post() - // { - // $relationship = $this->post('relationship'); - - // if($relationship['relationship_id']) //Update Record - // { - // $where_condition_array = array('relationships'=>$relationship['relationship_id']); - - // $result = $this->Common_Masters_Model->updateRecords($relationship,'m_relationship',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($relationship,'m_relationship'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Relationships Master */ - - - - // /* Frequency Master */ - - - // public function getListOfFrequencies_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_frequency'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveFrequency_post() - // { - // $frequency = $this->post('frequency'); - - // if($frequency['frequency_id']) //Update Record - // { - // $where_condition_array = array('frequency_id'=>$frequency['frequency_id']); - - // $result = $this->Common_Masters_Model->updateRecords($frequency,'m_frequency',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($frequency,'m_frequency'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Frequency Master */ - - - // /* Customer Behaviour Master */ - - - // public function getListOfCustomerBehaviours_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_customer_behaviour'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveCustomerBehaviour_post() - // { - // $customerbehaviour = $this->post('customerbehaviour'); - - // if($customerbehaviour['customer_behaviour_id']) //Update Record - // { - // $where_condition_array = array('customer_behaviour_id'=>$customerbehaviour['customer_behaviour_id']); - - // $result = $this->Common_Masters_Model->updateRecords($customerbehaviour,'m_customer_behaviour',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($customerbehaviour,'m_customer_behaviour'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Customer Behaviour Master */ - - - - // /* Zonal/Regional Master */ - - - // public function getListOfRegions_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_regions'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveRegion_post() - // { - // $region = $this->post('region'); - - // if($region['region_id']) //Update Record - // { - // $where_condition_array = array('region_id'=>$region['region_id']); - - // $result = $this->Common_Masters_Model->updateRecords($region,'m_regions',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($region,'m_regions'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of Zonal/Regional Master */ - - - - // /* States Master */ - - - // public function getListOfStates_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_states'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveState_post() - // { - // $state = $this->post('state'); - - // if($state['state_id']) //Update Record - // { - // $where_condition_array = array('state_id'=>$state['state_id']); - - // $result = $this->Common_Masters_Model->updateRecords($state,'m_states',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($state,'m_states'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - // /* End Of States Master */ - - - // /* City Master */ - - - // public function getListOfCites_get() - // { - // $result = $this->Common_Masters_Model->selectRecords('m_city'); - // if(count($result) > 0) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NO_CONTENT; - // $this->response($data,REST_Controller::HTTP_NO_CONTENT); - // } - // } - - // public function saveCity_post() - // { - // $city = $this->post('city'); - - // if($city['city_id']) //Update Record - // { - // $where_condition_array = array('city_id'=>$city['city_id']); - - // $result = $this->Common_Masters_Model->updateRecords($city,'m_city',$where_condition_array); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; - // $this->response($data,REST_Controller::HTTP_NOT_MODIFIED); - // } - // } - // else // Insert Record - // { - // $result = $this->Common_Masters_Model->saveRecords($city,'m_city'); - - // if($result) - // { - // $data['dataStatus'] = true; - // $data['status'] = REST_Controller::HTTP_OK; - // $data['records'] = $result; - // $this->response($data,REST_Controller::HTTP_OK); - // } - // else - // { - // $data['dataStatus'] = false; - // $data['status'] = REST_Controller::HTTP_SERVICE_UNAVAILABLE; - // $this->response($data,REST_Controller::HTTP_SERVICE_UNAVAILABLE); - // } - // } - - // } - - - - /* End Of City Master */ - - + /* For Save,Update and Retrieve all Master Tables*/ @@ -1287,5 +339,64 @@ class Common_Masters_Controller extends REST_Controller { } + + + ** + * Company File Upload + */ + public function saveCompany_post(){ + //echo "function in"; + $records = json_decode($this->post('records'),true); + + if(!empty($_FILES['logo']['tmp_name'])) + { + + $logo = $_FILES['logo']['tmp_name']; + $logoname = $_FILES['logo']['name']; + $logoname = strtolower($logoname); + $logos3path = ""; + $logos3path = 'sineedge/'.$logoname; + $bucketname = PROFILE_PICTURE_BUCKET_NAME; + $key = $logos3path; + $sourcefile = $logo; + + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); + $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + $records['logo'] = $logoname; + } + else + { + $records['logo'] = null; + } + + + + + + } + + + + $result = $this->Common_Masters_Model->saveRecords($records,'COMPANY'); + + if(count($result) > 0) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $this->response($data,REST_Controller::HTTP_OK); + } + } + + } \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e6d1f40e..35234721 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -170,12 +170,14 @@ class PD_Controller extends REST_Controller { /********For Save New PD while Trigger****/ + /* + sample data + { + "pd_details":{ "fk_lender_id": "1", "lender_applicant_id":"12458","fk_product_id":"2","fk_subproduct_id":"1","fk_pd_type":"2", "fk_pd_status":"2","pd_specific_clarification":"nothing","createdon":"2017","fk_createdby":"2","fk_pd_allocation_type":"3","fk_pd_allocated_to":"1","fk_pd_template_id":"2","fk_customer_segment":"1","pd_officier_final_judgement":"54561","pd_agency_id":"1","loan_amount":"1589655","addressline1":"1", "addressline2":"2", "addressline3":"3", "fk_city":"1", "fk_state":"2", "pincode":"966852"} + } + */ public function triggerNewPD_post() { - //echo "TRIGGER"; - //$this->aws_ses->verifyEmailIdentity('raro@spindl-e.com'); - //$this->aws_ses->sendMail('raro@spindl-e.com'); - //die(); $pd_details = json_decode($this->post('pd_details'),true); $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = json_decode($this->post('pd_document_titles'),true); @@ -207,55 +209,60 @@ class PD_Controller extends REST_Controller { $temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0); if(count($temp_city_id)) { - if($temp_city_id[0]['type'] == 0) // Allocate to Vendor + if(isset($temp_city_id[0]['type'])) { - $pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id']; - $pd_details['fk_pd_allocated_to'] = ALLOCATED_TO_PARTNER; - } - else //Allocate to SineEdge Team with allocation logics - { - $local_pd_allocation_type = $pd_details['fk_pd_allocation_type']; - if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation - { - - //select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED - $fields = array('fk_user_id,allocated'); + if($temp_city_id[0]['type'] == 0) // Allocate to Vendor + { + $pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id']; + $pd_details['fk_pd_allocated_to'] = ALLOCATED_TO_PARTNER; + } + else //Allocate to SineEdge Team with allocation logics + { + $local_pd_allocation_type = $pd_details['fk_pd_allocation_type']; + if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation + { - $where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1); + //select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED + $fields = array('fk_user_id,allocated'); + + $where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1); + + $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); + + $allocated_values = array_column($list_of_pd_officers,'allocated'); + + $min_allocated = min($allocated_values); + $key = array_search($min_allocated,$allocated_values); + $final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id']; + + //For Random Allocaiton not in use + // $key = mt_rand(0, count($list_of_pd_officers) - 1); + // $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null; + + $pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate; + $pd_details['fk_pd_status'] = ALLOCATED; - $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); - $allocated_values = array_column($list_of_pd_officers,'allocated'); + } + else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation + { - $min_allocated = min($allocated_values); - $key = array_search($min_allocated,$allocated_values); - $final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id']; - - //For Random Allocaiton not in use - // $key = mt_rand(0, count($list_of_pd_officers) - 1); - // $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null; - - $pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate; - $pd_details['fk_pd_status'] = ALLOCATED; - - - } - else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation - { - - } - else // Manual Allocation - { - // Do nothing, cause fk_pd_allocated_to value comes from front end. - } - - } + } + else // Manual Allocation + { + // Do nothing, cause fk_pd_allocated_to value comes from front end. + } + + } + }//End Of isset } /***********************END OF PD ALLOCATION TYPE AND PROCESS***********/ + + $pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details); @@ -300,7 +307,11 @@ class PD_Controller extends REST_Controller { } } - + // update into pd officer details + if($pd_details['fk_pd_allocated_to'] != null || $pd_details['fk_pd_allocated_to'] != '') + { + $this->PD_Model->updatePDofficersDetail($pd_details['fk_pd_allocated_to']); + } if($pd_id != null || $pd_id != '' && $count != 0) { // CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus diff --git a/api/application/controllers/User_Management_Controller.php b/api/application/controllers/User_Management_Controller.php index 8ac41641..1484a76b 100644 --- a/api/application/controllers/User_Management_Controller.php +++ b/api/application/controllers/User_Management_Controller.php @@ -129,7 +129,7 @@ class User_Management_Controller extends REST_Controller { if($pdofficer != ""){ $pdofficer['fk_user_id'] = $user_id; - print_r($pdofficer); + //print_r($pdofficer); $this->User_Management_Model->saveRecords($pdofficer,PDOFFICIERSDETAILS); } if($user_id != '' || $user_id != null) @@ -302,7 +302,7 @@ class User_Management_Controller extends REST_Controller { @params userid , entity id, profilepic name URL expires 5 min */ - public function getSingedProfilePicURL() + public function getSingedProfilePicURL_post() { $userid = $this->post('userid'); $entityid = $this->post('entityid'); diff --git a/api/application/libraries/SPARQ_Model.php b/api/application/libraries/SPARQ_Model.php index d4ea0233..71998183 100644 --- a/api/application/libraries/SPARQ_Model.php +++ b/api/application/libraries/SPARQ_Model.php @@ -13,7 +13,7 @@ class SPARQ_Model extends CI_Model { } - public function saveRecords($record_data = array(),$table_name,$print_query = '') + public function saveRecords($table_name,$record_data = array(),$print_query = '') { $this->db->insert($table_name,$record_data); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 36e0390f..d4b74fc6 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -22,27 +22,28 @@ class PD_Model extends SPARQ_Model { $this->db->JOIN(USERPROFILE.' as USERPROFILE','PDTRIGGER.fk_createdby = USERPROFILE.userid'); $this->db->JOIN(USERPROFILE.' as USERPROFILE1','PDTRIGGER.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->JOIN(PDALLOCATIONTYPE.' as PDALLOCATIONTYPE','PDTRIGGER.fk_pd_allocation_type = PDALLOCATIONTYPE.pd_allocation_type_id'); - $this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocation_type = USERPROFILE2.userid'); + $this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocated_to = USERPROFILE2.userid'); $this->db->JOIN(TEMPLATE.' as TEMPLATE','PDTRIGGER.fk_pd_template_id = TEMPLATE.template_id'); $this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','PDTRIGGER.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id'); $this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT'); $this->db->ORDER_BY('PDTRIGGER.pd_id',$sort); - $this->db->LIMIT($page,$limit); + $this->db->LIMIT($limit,$page); $result_array = $this->db->GET()->result_array(); if(count($result_array) != 0) { foreach($result_array as $key => $result) { + $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode'); $this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); $this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id '); $this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id'); - $this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id = $result["pd_id"]'); + $this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id ',$result['pd_id']); $result_child_array = $this->db->GET()->result_array(); if(count($result_child_array) != 0) { - array_push($result[$key],$result_child_array); + $result_array[$key]['applicat_details'] = $result_child_array; } } } @@ -72,4 +73,10 @@ class PD_Model extends SPARQ_Model { $this->db->WHERE_IN('fk_user_id',$lender_specific_pdofficers_list); $result = $this->db->get()->result_array(); } + + public function updatePDofficersDetail($userid) + { + $sql = 'UPDATE '.PDOFFICIERSDETAILS.' SET total = total+1, allocated = allocated+1 WHERE fk_user_id ='.$userid; + $modified = $this->db->query($sql); + } } \ No newline at end of file