From f7eeda7f733095649d30b2ff5d777d91c22052e1 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 8 Feb 2019 16:56:05 +0530 Subject: [PATCH] TINYURL STOCK ORDERING --- api/application/composer.json | 3 +- api/application/composer.lock | 69 +++++++++++++++- api/application/config/constants.php | 2 +- api/application/controllers/PD_Controller.php | 82 ++++++++++++++++--- api/application/helpers/pdalerts_helper.php | 3 +- 5 files changed, 142 insertions(+), 17 deletions(-) diff --git a/api/application/composer.json b/api/application/composer.json index 6490947c..d5ea17b9 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -20,7 +20,8 @@ "amphp/amp": "^1.2", "dompdf/dompdf" : "0.8.2", "tecnickcom/tcpdf": "^6.2", - "phpmailer/phpmailer": "^6.0" + "phpmailer/phpmailer": "^6.0", + "php-curl-class/php-curl-class": "^8.5" }, "suggest": { diff --git a/api/application/composer.lock b/api/application/composer.lock index f8926ec7..f69f909e 100644 --- a/api/application/composer.lock +++ b/api/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41e739a6decc9a048b148e7142286874", + "content-hash": "85528eeb9ef1cc95bba8240e50127495", "packages": [ { "name": "amphp/amp", @@ -645,6 +645,73 @@ "homepage": "https://github.com/PhenX/php-svg-lib", "time": "2018-06-03T10:10:03+00:00" }, + { + "name": "php-curl-class/php-curl-class", + "version": "8.5.0", + "source": { + "type": "git", + "url": "https://github.com/php-curl-class/php-curl-class.git", + "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-curl-class/php-curl-class/zipball/2b387e3ef1c8a1d6116a1459c0e3e71643f86806", + "reference": "2b387e3ef1c8a1d6116a1459c0e3e71643f86806", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3" + }, + "require-dev": { + "ext-gd": "*", + "phpunit/phpunit": "*", + "squizlabs/php_codesniffer": "*" + }, + "suggest": { + "ext-mbstring": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Curl\\": "src/Curl/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Unlicense" + ], + "authors": [ + { + "name": "Zach Borboa" + } + ], + "description": "PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.", + "homepage": "https://github.com/php-curl-class/php-curl-class", + "keywords": [ + "API-Client", + "api", + "class", + "client", + "curl", + "framework", + "http", + "http-client", + "http-proxy", + "json", + "php", + "php-curl", + "php-curl-library", + "proxy", + "requests", + "restful", + "web-scraper", + "web-scraping ", + "web-service", + "xml" + ], + "time": "2019-01-07T06:43:45+00:00" + }, { "name": "phpmailer/phpmailer", "version": "v6.0.6", diff --git a/api/application/config/constants.php b/api/application/config/constants.php index f808d3e2..96c7fcaa 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -86,7 +86,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', '(listAllEntites/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getPDOfficerCurrentLocation'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors /*********************AWS resources Constants*************************************************/ diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 128badea..1d27ef11 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -421,7 +421,18 @@ class PD_Controller extends REST_Controller { { $randomString .= $characters[rand(0, $charactersLength - 1)]; } - $pd_details['encrypted_url'] = $randomString; + $pd_details['random_string'] = $randomString; + + + $ch = curl_init(); + $timeout = 5; + $url = 'http://www.velzgroupz2020.com/'; + curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); + curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); + curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); + $tinyurl = curl_exec($ch); + curl_close($ch); + $pd_details['encrypted_url'] = $tinyurl; /************ASSIGN Random URL******************/ @@ -610,7 +621,7 @@ class PD_Controller extends REST_Controller { // OTP Generate Condition if($pd_details['pd_status'] == INITIATED) { - $msg = "Dear ".$pd_details['firstName'].", Officer ".$pd_details['officerName']." is on his way to meet you for a personal discussion with regards to your loan application. You can track his realtime location in this link.http://maps.google.com/?q=".$pd_details['link']; + //$msg = "Dear ".$pd_details['firstName'].", Officer ".$pd_details['officerName']." is on his way to meet you for a personal discussion with regards to your loan application. You can track his realtime location in this link.http://maps.google.com/?q=".$pd_details['link']; $no = (string)$pd_details['mobile_no']; unset($pd_details['mobile_no']); unset($pd_details['firstName']); @@ -637,8 +648,11 @@ class PD_Controller extends REST_Controller { if($pd_details['pd_status'] == COMPLETED) { + if(array_key_exists('link',$pd_details)) + { $pd_details['complete_location'] = $pd_details['link']; unset($pd_details['link']); + } } @@ -4205,7 +4219,8 @@ class PD_Controller extends REST_Controller { } $company_list[] = $temp_array; } - + // $company_list = array( array('company_order_id' => 1)); + //print_r($company_list); foreach($company_list as $list_key => $company) { $form_array = array( @@ -4219,7 +4234,9 @@ class PD_Controller extends REST_Controller { ); $temp = array(); - $business_form_status = 0; + $business_form_status = 0; + $supplier_form_status = 0; + $client_form_status = 0; foreach($form_array as $form) { $this->db->SELECT('count(*) as count'); @@ -4229,10 +4246,11 @@ class PD_Controller extends REST_Controller { $this->db->WHERE('PDFORMDETAILSJSON.company_id',$company['company_order_id']); $this->db->WHERE('PDFORMDETAILSJSON.isactive',1); $template_forms_count = $this->db->GET()->result_array(); - + // print_r($this->db->last_query()); + // print_r($template_forms_count);echo $form['form_id']; if($template_forms_count[0]['count'] != 0) { - - if($form['form_id'] == 13) + + if($form['form_id'] == 13 || $form['form_id'] == 22) { $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true); @@ -4242,6 +4260,26 @@ class PD_Controller extends REST_Controller { { if($business_form_status == 1){ $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true); + + if($form['form_id'] == 1)//if supplier form answered set supplier_form_status = 1 + { + $supplier_form_status = 1; + } + + if($form['form_id'] == 2)//if client form answered set client_form_status = 1 + { + $client_form_status = 1; + } + + if($form['form_id'] == 11) + { + + if($client_form_status == 1 && $supplier_form_status == 1) + { + $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => true,'isAnswerable'=>true); + } + } + } else { @@ -4249,9 +4287,10 @@ class PD_Controller extends REST_Controller { } } } - else + else //Not previously answered { - if($form['form_id'] == 13) + //echo "else-- " .$form['form_id']; + if($form['form_id'] == 13 || $form['form_id'] == 22) { $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true); @@ -4259,11 +4298,30 @@ class PD_Controller extends REST_Controller { } else{ if($business_form_status == 1){ - $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true); + + if($form['form_id'] == 11) + { + //echo "BUSISTOCk"; + if($client_form_status == 1 && $supplier_form_status == 1) + { + $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true); + } + else + { + $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>false); + } + } + else + { + $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>true); + } + } else { + $temp[] = array('form_id' => $form['form_id'],'form_name'=> $form['form_name'],'isAnswered' => false,'isAnswerable'=>false); + } } } @@ -4352,8 +4410,8 @@ class PD_Controller extends REST_Controller { public function getPDOfficerCurrentLocation_post() { $pdid = $this->post('pd_id'); - // PDALERTS::pdnotification($pdid); - // die(); + PDALERTS::pdnotification($pdid); + die(); $result_data = $this->db->SELECT('*')->FROM(PDOFFICERCURRENTLOCATION)->WHERE('fk_pd_id',$pdid)->ORDER_BY(PDOFFICERCURRENTLOCATIONID,'DESC')->LIMIT(1)->GET()->result_array(); if(count($result_data)) diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index b700e5ae..150bf3ae 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -1,5 +1,6 @@