mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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
|
||||
$i=0;
|
||||
$objectArray = array();
|
||||
|
||||
if ($conf->commande->enabled) {
|
||||
$elementArray[$i] = 'order';
|
||||
$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;
|
||||
}
|
||||
}
|
||||
$objects = getLinkedObjects($_GET['transaction_id']);
|
||||
if (! empty($objects)) $return_arr['element_created'] = true;
|
||||
|
||||
$soc = new Societe($db);
|
||||
$ret = $soc->fetchObjectFromRefExt($soc->table_element, $_SESSION[$_GET['transaction_id']]['PAYERID']);
|
||||
|
|
|
|||
|
|
@ -149,6 +149,36 @@ function paypaladmin_prepare_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
|
||||
|
|
|
|||
|
|
@ -295,6 +295,8 @@ else
|
|||
while (isset($resArray["L_TRANSACTIONID".$i]))
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
$objects = getLinkedObjects($resArray["L_TRANSACTIONID".$i]);
|
||||
|
||||
$transactionID = $resArray["L_TRANSACTIONID".$i];
|
||||
$timeStamp = dol_stringtotime($resArray["L_TIMESTAMP".$i]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user