From f3fa2bac06b552abb9358645b02885ecc30ef407 Mon Sep 17 00:00:00 2001 From: dmattke Date: Wed, 5 Oct 2016 08:48:46 +0200 Subject: [PATCH] GFDibsHook::dibsTransition(), ny parameter ordertext --- GFDibsHook.php | 24 +++++++++++++++++++++--- gravityformsdibs.php | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/GFDibsHook.php b/GFDibsHook.php index 7c58893..c91b27a 100755 --- a/GFDibsHook.php +++ b/GFDibsHook.php @@ -93,6 +93,11 @@ public static function changeColumnData($value, $lead_id, $index, $Entry){ $Transaction = $Dao->getTransactionByLeadId($Entry['id']); $value = $Transaction->transaction_id; } + else if ( $index == 'order_id'){ + $Dao = new GFDibsDao(); + $Transaction = $Dao->getTransactionByLeadId($Entry['id']); + $value = $Transaction->order_id; + } else if ( $index == 'payment_status'){ $Dao = new GFDibsDao(); $Transaction = $Dao->getTransactionByLeadId($Entry['id']); @@ -199,7 +204,6 @@ public static function dibsTransition($confirmation, $form, $lead, $ajax){ $Dao = new GFDibsDao(); _log('GFDibsHook::dibsTransition()'); - if ( $feed_id = $Dao->isDibsForm($form['id']) ){ $feed = $Dao->getDibsMeta($feed_id); @@ -250,10 +254,24 @@ public static function dibsTransition($confirmation, $form, $lead, $ajax){ if ( $key == 'billingEmail' ){ $_POST['email'] = $_POST[$key]; } - } } + // set ordertext + $_POST['ordertext'] = null; + if ( isset($_POST['billingFirstName']) ){ + $_POST['ordertext'] .= $_POST['billingFirstName']." "; + } + if ( isset($_POST['billingLastName']) ){ + $_POST['ordertext'] .= $_POST['billingLastName']." "; + } + + if ( isset($_POST['email']) ){ + $_POST['ordertext'] .= "(".$_POST['email'].")"; + } + $_POST['ordertext'] = trim($_POST['ordertext']); + + // $_POST['orderId'] = hexdec(uniqid()); $_POST['leadId'] = $lead['id']; @@ -303,7 +321,7 @@ public static function dibsTransition($confirmation, $form, $lead, $ajax){ $Dao->log($transaction_id); - $confirmation = '
'; + $confirmation = ''; foreach ($_POST as $key => $value) { if ( !is_numeric(strpos($key, 'input')) && !is_numeric(strpos($key, 'MAX_FILE_SIZE')) && !is_numeric(strpos($key, 'state')) && !is_numeric(strpos($key, 'gform')) ){ $confirmation .= sprintf('', $key, $key, $value ); diff --git a/gravityformsdibs.php b/gravityformsdibs.php index 38371a3..3200269 100755 --- a/gravityformsdibs.php +++ b/gravityformsdibs.php @@ -3,7 +3,7 @@ Plugin Name: Gravity Forms DIBS Plugin URI: http://nettbutikk.mediebruket.no Description: DIBS add-on for Gravity Forms. Supports D2 and DX platform. - Version: 1.2.1 + Version: 1.2.2 Author: Mediebruket Author URI: http://mediebruket.no */