From 582f4ff0363aad318dc146dab57c0fc6bc86d03b Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Wed, 11 Aug 2021 16:16:05 +0530 Subject: [PATCH] datadump fixes 1 : ps --- api/application/models/Data_Dump_Model.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index e71454c7..ca62b254 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -73,10 +73,12 @@ class Data_Dump_Model extends SPARQ_Model { } function getRequestForDataDump($arr){ - $pdid = $arr['pd_id']; - $fromd = $arr['from_date'];$tod= $arr['to_date']; - $type = $arr['pd_type_id'];$prod = $arr['product_id']; - $cseg = $arr['customer_segment_id']; + $pdid = isset($arr['pd_id'])?$arr['pd_id']:[]; + $fromd = $arr['from_date']; + $tod= $arr['to_date']; + $type = isset($arr['pd_type_id'])?$arr['pd_type_id']:null; + $prod = isset($arr['product_id'])?$arr['product_id']:null; + $cseg = isset($arr['customer_segment_id'])?$arr['customer_segment_id']:null; ### 2 tables t_pd_form_details_json and t_pd_triggered $this->db->select('PDFORMDETAILSJSON.pd_form_detail_json_id, PDFORMDETAILSJSON.fk_pd_id, PDFORMDETAILSJSON.fk_form_id, PDFORMDETAILSJSON.isactive, PDFORMDETAILSJSON.json, DATE_FORMAT(PDFORMDETAILSJSON.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDFORMDETAILSJSON.processed_json, PDFORMDETAILSJSON.updatedon,PDTRIGGER.completed_on,PDTRIGGER.fk_product_id, PDTRIGGER.fk_customer_segment,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.createdon'); $this->db->from(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON'); @@ -86,14 +88,14 @@ class Data_Dump_Model extends SPARQ_Model { { $this->db->where_in('PDFORMDETAILSJSON.fk_pd_id',$pdid); } - if(($fd != "" || $fd != null) && ($td != "" || $td != null)) { - $this->db->where('PDTRIGGER.createdon BETWEEN '. "'$fd'". ' AND '. "'$td'" ); + if(($fromd != "" || $fromd != null) && ($tod != "" || $tod != null)) { + $this->db->where('PDTRIGGER.createdon BETWEEN '. "'$fromd'". ' AND '. "'$tod'" ); } - else if($fd != "" && $fd != null) { - $this->db->where("DATE_FORMAT(PDTRIGGER.createdon,'%Y-%m-%d')",$fd); + else if($fromd != "" && $fromd != null) { + $this->db->where("DATE_FORMAT(PDTRIGGER.createdon,'%Y-%m-%d')",$fromd); } - else if($td != "" && $td != null) { - $this->db->where("DATE_FORMAT(PDTRIGGER.createdon,'%Y-%m-%d')",$td); + else if($tod != "" && $tod != null) { + $this->db->where("DATE_FORMAT(PDTRIGGER.createdon,'%Y-%m-%d')",$tod); } if($prod != ""){ $this->db->where('PDTRIGGER.fk_product_id',$prod);