diff --git a/api/application/config/constants.php b/api/application/config/constants.php index a50ae377..57974136 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // 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', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getQuestionsForTemplateCreation'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'schdulePD'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -309,5 +309,8 @@ defined('ENTITYPDPRICEINFOID') OR define('ENTITYPDPRICEINFOID','entity_pdprice_i defined('VENDORCITYMAP') OR define('VENDORCITYMAP','m_vendor_city_map'); defined('VENDORCITYMAPID') OR define('VENDORCITYMAPID','vendor_city_map_id'); +defined('PDCATEGORYWEIGHTAGE') OR define('PDCATEGORYWEIGHTAGE','t_pd_category_weightage'); +defined('PDCATEGORYWEIGHTAGEID') OR define('PDCATEGORYWEIGHTAGEID','pd_category_weightage_id'); + diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index e5e34bb7..02320417 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -352,6 +352,7 @@ class Common_Masters_Controller extends REST_Controller { { $records = $this->post('records'); // print_r($records);die; + $result = array(); if(!empty($records)) { foreach($records['teamDetails'] as $users) @@ -364,6 +365,8 @@ class Common_Masters_Controller extends REST_Controller { $result = $this->Common_Masters_Model->updateRecords($record,PDOFFICIERSDETAILS,$where_condition_array); } } + + if(count($result) > 0) { $data['dataStatus'] = true; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 2a4de417..d5f0e590 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -593,6 +593,28 @@ class PD_Controller extends REST_Controller { */ public function schdulePD_post() { + + $records['fk_pd_id'] = 40; + $fields = array('fk_pd_template_id'); + $where_condition_array = array('pd_id'=>$records['fk_pd_id']); + $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); + //print_r($res_array); + if(count($res_array)) + { + $template_id = $res_array[0]['fk_pd_template_id']; + echo $template_id; + $fields = array('fk_question_category_id','weightage'); + $where_condition_array = array('fk_template_id'=>$template_id); + $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATECATEGORYWEIGHTAGE); + print_r($res_array); + + foreach($res_array as $key => $category) + { + $temp_data = array('fk_pd_id'=>$records['fk_pd_id'],'fk_category_id'=>$category['fk_question_category_id'],'pd_category_weightage'=>$category['weightage']); + $this->PD_Model->saveRecords($temp_data,PDCATEGORYWEIGHTAGE); + } + } + die(); $records = $this->post('records'); if($records['schedule_time'] != "" || $records['schedule_time'] != null) { @@ -602,6 +624,35 @@ class PD_Controller extends REST_Controller { $temp_array = array('pd_status' => SCHEDULED,'fk_updatedby'=>$records['fk_scheduled_by'],'updatedon'=>$records['createdon'],'scheduled_on'=>$records['schedule_time']); $pd_id_modified = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array); + /******* Code Snippt for Save Template Category Weightage info to PD category Info*/ + $fields = array('fk_pd_template_id'); + $where_condition_array = array('pd_id'=>$records['fk_pd_id']); + $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); + + if(count($res_array)) + { + $fields = array('fk_pd_template_id'); + $where_condition_array = array('pd_id'=>$records['fk_pd_id']); + $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); + + if(count($res_array)) + { + $template_id = $res_array[0]['fk_pd_template_id']; + + $fields = array('fk_question_category_id','weightage'); + $where_condition_array = array('fk_template_id'=>$template_id); + $template_categories = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATECATEGORYWEIGHTAGE); + + foreach($template_categories as $key => $category) + { + $temp_data = array('fk_pd_id'=>$records['fk_pd_id'],'fk_category_id'=>$category['fk_question_category_id'],'pd_category_weightage'=>$category['weightage']); + $this->PD_Model->saveRecords($temp_data,PDCATEGORYWEIGHTAGE); + } + } + } + /******* End of Code Snippt Save Template Category Weightage info to PD category Info*/ + + if($pd_id_modified != "" || $pd_id_modified != null) { PDALERTS::pdnotification($records['fk_pd_id']);