From a80159b79108e506816d021cd93ca4d9908edcde Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Jun 2011 07:00:09 +0000 Subject: [PATCH] Fix: paypal post treatment --- ...terface_modPaypal_PaypalWorkflow.class.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php index 6ae10e20f47..1d377343bd6 100644 --- a/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php +++ b/htdocs/includes/triggers/interface_modPaypal_PaypalWorkflow.class.php @@ -102,7 +102,27 @@ class InterfacePaypalWorkflow { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object['source']." ref=".$object['ref']); - + // Parse element/subelement (ex: project_task) + $element = $path = $filename = $_GET['element']; + if (preg_match('/^([^_]+)_([^_]+)/i',$_GET['element'],$regs)) + { + $element = $path = $regs[1]; + $filename = $regs[2]; + } + // For compatibility + if ($element == 'order') { $path = $filename = 'commande'; } + if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; } + + dol_include_once('/'.$path.'/class/'.$filename.'.class.php'); + + $classname = ucfirst($filename); + $obj = new $classname($db); + + $ret = $obj->fetch('',$object['ref']); + if ($ret < 0) return -1; + + $obj->updateObjectField($obj->table_element,$obj->id,'ref_int',$object['resArray']["TRANSACTIONID"]); + } return 0;