Works on paypal module
Fix: add function to return linked object
This commit is contained in:
parent
8ef26ab887
commit
d562249fd2
@ -272,33 +272,9 @@ if (isset($_GET['action']) && ! empty($_GET['action']) && isset($_GET['transacti
|
|||||||
|
|
||||||
// Check if already import
|
// Check if already import
|
||||||
$i=0;
|
$i=0;
|
||||||
$objectArray = array();
|
|
||||||
|
|
||||||
if ($conf->commande->enabled) {
|
$objects = getLinkedObjects($_GET['transaction_id']);
|
||||||
$elementArray[$i] = 'order';
|
if (! empty($objects)) $return_arr['element_created'] = true;
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
if ($conf->facture->enabled) {
|
|
||||||
$elementArray[$i] = 'invoice';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($elementArray as $element)
|
|
||||||
{
|
|
||||||
if ($element == 'order') { $element = $subelement = 'commande'; }
|
|
||||||
if ($element == 'invoice') { $element = 'compta/facture'; $subelement = 'facture'; }
|
|
||||||
|
|
||||||
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
|
|
||||||
|
|
||||||
$classname = ucfirst($subelement);
|
|
||||||
$object = new $classname($db);
|
|
||||||
|
|
||||||
$res = $object->fetchObjectFromRefExt($object->table_element, $_GET['transaction_id']);
|
|
||||||
if ($res > 0)
|
|
||||||
{
|
|
||||||
$return_arr['element_created'] = true;
|
|
||||||
$objectArray[$element] = $object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$soc = new Societe($db);
|
$soc = new Societe($db);
|
||||||
$ret = $soc->fetchObjectFromRefExt($soc->table_element, $_SESSION[$_GET['transaction_id']]['PAYERID']);
|
$ret = $soc->fetchObjectFromRefExt($soc->table_element, $_SESSION[$_GET['transaction_id']]['PAYERID']);
|
||||||
|
|||||||
@ -149,6 +149,36 @@ function paypaladmin_prepare_head()
|
|||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getLinkedObjects($transactionID)
|
||||||
|
{
|
||||||
|
global $db, $conf;
|
||||||
|
|
||||||
|
$objectArray = array();
|
||||||
|
|
||||||
|
if ($conf->commande->enabled) {
|
||||||
|
$elementArray[$i] = 'order';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
if ($conf->facture->enabled) {
|
||||||
|
$elementArray[$i] = 'invoice';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($elementArray as $element)
|
||||||
|
{
|
||||||
|
if ($element == 'order') { $path = $subelement = 'commande'; }
|
||||||
|
if ($element == 'invoice') { $path = 'compta/facture'; $subelement = 'facture'; }
|
||||||
|
|
||||||
|
dol_include_once('/'.$path.'/class/'.$subelement.'.class.php');
|
||||||
|
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
|
$object = new $classname($db);
|
||||||
|
|
||||||
|
$res = $object->fetchObjectFromRefExt($object->table_element, $transactionID);
|
||||||
|
if ($res > 0) $objectArray[$element] = $object;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objectArray;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send redirect to paypal to browser
|
* Send redirect to paypal to browser
|
||||||
|
|||||||
@ -296,6 +296,8 @@ else
|
|||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
|
$objects = getLinkedObjects($resArray["L_TRANSACTIONID".$i]);
|
||||||
|
|
||||||
$transactionID = $resArray["L_TRANSACTIONID".$i];
|
$transactionID = $resArray["L_TRANSACTIONID".$i];
|
||||||
$timeStamp = dol_stringtotime($resArray["L_TIMESTAMP".$i]);
|
$timeStamp = dol_stringtotime($resArray["L_TIMESTAMP".$i]);
|
||||||
$payerName = $resArray["L_NAME".$i];
|
$payerName = $resArray["L_NAME".$i];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user