Skip to content
Snippets Groups Projects
Commit d593878c authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: big problem with linked elements

parent 95c30de0
No related branches found
No related tags found
No related merge requests found
......@@ -1646,7 +1646,7 @@ abstract class CommonObject
$sourceid = (! empty($sourceid) ? $sourceid : $this->id);
$targetid = (! empty($targetid) ? $targetid : $this->id);
$sourcetype = (! empty($sourcetype) ? $sourcetype : (! empty($this->origin) ? $this->origin : $this->element));
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
$targettype = (! empty($targettype) ? $targettype : $this->element);
// Links beetween objects are stored in this table
......
......@@ -45,12 +45,17 @@ function shipping_prepare_head($object)
$head[$h][2] = 'shipping';
$h++;
if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire && ! empty($object->linkedObjectsIds['delivery'][0]))
if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)
{
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
$head[$h][1] = $langs->trans("DeliveryCard");
$head[$h][2] = 'delivery';
$h++;
// delivery link
$object->fetchObjectLinked($object->id,$object->element);
if (! empty($object->linkedObjectsIds['delivery'][0]))
{
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
$head[$h][1] = $langs->trans("DeliveryCard");
$head[$h][2] = 'delivery';
$h++;
}
}
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
......
......@@ -872,9 +872,6 @@ else
$soc = new Societe($db);
$soc->fetch($object->socid);
// delivery link
$object->fetchObjectLinked($object->id,$object->element,-1,-1);
$head=shipping_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("Sending"), 0, 'sending');
......
......@@ -345,7 +345,7 @@ class Livraison extends CommonObject
if (is_readable(DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php'))
{
require_once DOL_DOCUMENT_ROOT .'/core/modules/livraison/'.$modName.'.php';
$now=dol_now();
// Recuperation de la nouvelle reference
......@@ -552,7 +552,7 @@ class Livraison extends CommonObject
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$this->db->begin();
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."livraisondet";
......@@ -562,7 +562,7 @@ class Livraison extends CommonObject
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."livraison";
......@@ -807,7 +807,7 @@ class Livraison extends CommonObject
global $langs;
// Get the linked object
$this->fetchObjectLinked(-1,-1,$this->id,$this->element);
$this->fetchObjectLinked('','',$this->id,$this->element);
//var_dump($this->linkedObjectIds);
// Get the product ref and qty in source
$sqlSourceLine = "SELECT st.rowid, st.description, st.qty";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment