2
0
forked from Wavyzz/dolibarr

Add link with order when invoice made for a shioppoing

This commit is contained in:
jean
2014-09-26 10:11:38 +02:00
parent 82a2bb1690
commit 16facc81aa

View File

@@ -865,6 +865,16 @@ else if ($action == 'add' && $user->rights->facture->creer)
// Possibility to add external linked objects with hooks
$object->linked_objects [$object->origin] = $object->origin_id;
// link with order if it is a shipping invoice
if ($object->origin == 'shipping')
{
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
$exp = new Expedition($db);
$exp->fetch($object->origin_id);
$exp->fetchObjectLinked();
if (count ($exp->linkedObjectsIds['commande']) > 0) $object->linked_objects['commande'] = $exp->linkedObjectsIds['commande'][0];
}
if (is_array($_POST['other_linked_objects']) && ! empty($_POST['other_linked_objects'])) {
$object->linked_objects = array_merge($object->linked_objects, $_POST['other_linked_objects']);
}