From 8b4415e1bacbd8d4bc31ca0288f76f075e04f3b1 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 6 May 2022 18:33:23 +0000 Subject: [PATCH] Sales_PD_Controller section CETAPI : ps --- .../controllers/Sales_PD_Controller.php | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 113c6fc2..2cc5b772 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -8,7 +8,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); -require_once APPPATH . '/libraries/REST_Controller.php'; + + require_once APPPATH . '/libraries/REST_Controller.php'; include_once APPPATH.'/vendor/autoload.php'; @@ -214,15 +215,29 @@ class Sales_PD_Controller extends REST_Controller { $view_data['section'.$section['section_id'] ] = $this->processSalesPDJSON($section);//die(); $section_fields['section'.$section['section_id'] ] = $this->processSalesPDJSON($section); } - salespd_cetapp::pushwithcetsalespdapi($common_fields,$section_fields,1); // print_r($view_data['section3']);die(); $view_data['section9'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS); if(count($view_data['section9'])>0){ - for ($i = 0; $i < count($view_data['section9']); $i++){ - $img_fields[0]['img_name'] = $view_data['section9'][$i]['img_name']; - $img_fields[0]['img'] = $view_data['section9'][$i]['img']; - salespd_cetapp::pushwithcetsalespdapi($common_fields,$img_fields,2); - }} + //for ($i = 0; $i < count($view_data['section9']); $i++){ + // $img_fields[0]['img_name'] = $view_data['section9'][$i]['img_name']; + // $img_fields[0]['img'] = $view_data['section9'][$i]['img']; + // salespd_cetapp::pushwithcetsalespdapi($common_fields,$img_fields,2); + //} + // "section9":{"selfie_with_person_met":"SAVED","approach_to_pd_location":["SAVED",""],"name_board_seen":["SAVED",""],"stock_image":["SAVED","SAVED","SAVED","SAVED",""],"workplace_interior_image":["SAVED","SAVED",""]}} + $arr1 =array();$arr2 =array(); + for ($i = 0; $i < count($view_data['section9']); $i++){ + $img_name = $view_data['section9'][$i]['img_name']; + if(!in_array($img_name, $arr1)){ + array_push($arr1,$img_name); + } + $k = array_search($img_name, $arr1); //$k = 1; + $arr2[$k][] = $view_data['section9'][$i]['img']; + for ($j = 0; $j < count($arr1); $j++) { + $section_fields['section9'][$arr1[$j]] = $arr2[$j]; + } + } + } + salespd_cetapp::pushwithcetsalespdapi($common_fields,$section_fields,1); $view_data['satellite_image'] = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $sales_pd_id,'img_name' => 'satellite','isactive' => 1),SALEPD_DOCS); if(!empty($view_data['satellite_image'])){ $stt_fields[0]['img_name'] = $view_data['satellite_image'][0]['img_name'];