From 652cd83e0c3d025cec2d5cb94321119b8fd10acc Mon Sep 17 00:00:00 2001 From: sanjeev Date: Tue, 30 Nov 2021 16:10:51 +0530 Subject: [PATCH] is_smc_vendor flag in api : ps --- api/application/controllers/PD_Controller.php | 15 ++++++------ api/application/models/PD_Model.php | 24 +++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index cb8dbac1..eae2536c 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2094,7 +2094,7 @@ public function assignPDTempalate($data) if($this->get('status')) { $status = $this->get('status'); } if($this->get('user_type')) { $user_type = $this->get('user_type'); } if($this->get('client')) { $client = $this->get('client'); } - + $is_smc_vendor = $this->get('is_smc_vendor') ? $this->get('is_smc_vendor') : null; //if lender id exists, then make custom filter for only SMC usage if($this->get('createdby')) { $createdby = $this->get('createdby'); } @@ -2125,7 +2125,7 @@ public function assignPDTempalate($data) } // die(); - $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby,$client); + $result_data = $this->PD_Model->listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby,$client,$is_smc_vendor); // echo count($result_data['data']);die(); if($result_data['data_status'] == true) { @@ -2235,6 +2235,7 @@ public function assignPDTempalate($data) // echo "After date_type ".$date_type." and my return type is ".gettype($date_type)."\n"; $client = isset($records['client']) ? $records['client'] : null; // $smc_agency_id = isset($records['smc_agency_id']) ? $records['smc_agency_id'] : null; + $is_smc_vendor = isset($records['is_smc_vendor']) ? $records['is_smc_vendor'] : null; $lender_details = array(); //if lender id exists, then make custom filter for only SMC usage @@ -2265,7 +2266,7 @@ public function assignPDTempalate($data) } - $result_data = $this->PD_Model->PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id,$vendor_pdofficer,$user_type,$createdby,$date_type,$client); + $result_data = $this->PD_Model->PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id,$vendor_pdofficer,$user_type,$createdby,$date_type,$client,$is_smc_vendor); if(count($result_data)) { @@ -11301,11 +11302,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $result_data = (new video_grabber_helper)->shortenVideoURL($id,$fk_lender_id); $result_data = json_decode($result_data,true); //print_r($result_data);die(); - if($result_data->datastatus == 200) + if($result_data['datastatus'] == 200) { - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['shorten_url'] = $result_data->data; + // $data['dataStatus'] = true; + // $data['status'] = REST_Controller::HTTP_OK; + // $data['shorten_url'] = $result_data->data; } else { diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 3826047b..2634b77f 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -11,7 +11,7 @@ class PD_Model extends SPARQ_Model { } - public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby,$client)// $page represents mysql offset + public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status,$lender_details,$pdagencyid,$vendor_pdofficer,$user_type,$createdby,$client,$is_smc_vendor)// $page represents mysql offset { // echo $lenderid;die(); $this->db->SELECT('PDTRIGGER.pd_id,PDTRIGGER.imgc_fin_institute,PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as master_updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,AGENCY.is_qc_enabled, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.encrypted_url,PDTRIGGER.random_string,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,PDTRIGGER.is_notify_enabled,(SELECT DATE_FORMAT(createdon,"%d/%m/%Y") FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,AGENCYLIST.agency_name as SMC_vendor_agency_name,AGENCYLIST.agency_abbr as SMC_vendor_agency_short_name'); @@ -119,10 +119,15 @@ class PD_Model extends SPARQ_Model { //$this->db->WHERE('PDTRIGGER.vendor_status',TRIGGERED); //$this->db->WHERE("if(vendor_status = 'TRIGGERED', if( pd_status in ('ALLOCATED'),1,0),0)=0"); } - if($status != "" || $status != null) + + if($is_smc_vendor == true && $status != "" || $status != null){ + $this->db->WHERE('PDTRIGGER.vendor_status',strtoupper($status)); + }else{ + if($status != "" || $status != null) { $this->db->WHERE('PDTRIGGER.pd_status',strtoupper($status)); } + } if($datetype != "" || $datetype != null) { @@ -171,7 +176,7 @@ class PD_Model extends SPARQ_Model { //$this->db->LIMIT($limit,$page); $result_array = $this->db->GET()->result_array(); // echo count($result_array); - // print_r($this->db->last_query());die(); + if(count($result_array) != 0) { @@ -213,7 +218,7 @@ class PD_Model extends SPARQ_Model { //PD List with Common Filters - public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id,$vendor_pdofficer,$user_type,$createdby,$date_type,$client) + public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref,$pd_officer_name,$include_archive,$pd_officer_id,$pd_agency_id,$vendor_pdofficer,$user_type,$createdby,$date_type,$client,$is_smc_vendor) { $limit = 1000; @@ -269,9 +274,14 @@ class PD_Model extends SPARQ_Model { $this->db->WHERE('PDTRIGGER.fk_createdby',$createdby); } - if(!empty($pd_status)) - { - $this->db->WHERE_IN('PDTRIGGER.pd_status',$pd_status); + + if($is_smc_vendor == true && $pd_status != "" || $pd_status != null){ + $this->db->WHERE('PDTRIGGER.vendor_status',$status); + }else{ + if(!empty($pd_status)) + { + $this->db->WHERE_IN('PDTRIGGER.pd_status',$pd_status); + } } if(($pd_from_date != "" || $pd_from_date != null) && ($pd_to_date != "" || $pd_to_date != null)) {