parent
2e5634e60f
commit
017b18d5c6
@ -875,9 +875,13 @@ class Commande extends CommonOrder
|
|||||||
$this->ref = $initialref;
|
$this->ref = $initialref;
|
||||||
|
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
foreach($this->linked_objects as $origin => $origin_id)
|
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
|
{
|
||||||
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
|
{
|
||||||
|
foreach($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
@ -885,16 +889,30 @@ class Commande extends CommonOrder
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
}
|
||||||
|
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||||
{
|
{
|
||||||
$originforcontact = $origin;
|
$origin_id = $tmp_origin_id;
|
||||||
$originidforcontact = $origin_id;
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
|
if (! $ret)
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||||
|
{
|
||||||
|
$originforcontact = $this->origin;
|
||||||
|
$originidforcontact = $this->origin_id;
|
||||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||||
$exp = new Expedition($db);
|
$exp = new Expedition($db);
|
||||||
$exp->fetch($origin_id);
|
$exp->fetch($this->origin_id);
|
||||||
$exp->fetchObjectLinked();
|
$exp->fetchObjectLinked();
|
||||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||||
{
|
{
|
||||||
@ -922,8 +940,6 @@ class Commande extends CommonOrder
|
|||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -409,7 +409,7 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
{
|
{
|
||||||
if (is_array($tmp_origin_id)) // New baheviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
{
|
{
|
||||||
foreach($tmp_origin_id as $origin_id)
|
foreach($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
@ -431,16 +431,18 @@ class Facture extends CommonInvoice
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||||
{
|
{
|
||||||
$originforcontact = $origin;
|
$originforcontact = $this->origin;
|
||||||
$originidforcontact = $origin_id;
|
$originidforcontact = $this->origin_id;
|
||||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||||
$exp = new Expedition($this->db);
|
$exp = new Expedition($this->db);
|
||||||
$exp->fetch($origin_id);
|
$exp->fetch($this->origin_id);
|
||||||
$exp->fetchObjectLinked();
|
$exp->fetchObjectLinked();
|
||||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||||
{
|
{
|
||||||
@ -467,8 +469,6 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert lines of invoices into database
|
* Insert lines of invoices into database
|
||||||
|
|||||||
@ -934,9 +934,13 @@ class Contrat extends CommonObject
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Add object linked
|
// Add object linked
|
||||||
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
{
|
{
|
||||||
foreach($this->linked_objects as $origin => $origin_id)
|
foreach($this->linked_objects as $origin => $tmp_origin_id)
|
||||||
|
{
|
||||||
|
if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||||
|
{
|
||||||
|
foreach($tmp_origin_id as $origin_id)
|
||||||
{
|
{
|
||||||
$ret = $this->add_object_linked($origin, $origin_id);
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if (! $ret)
|
if (! $ret)
|
||||||
@ -944,16 +948,30 @@ class Contrat extends CommonObject
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
|
}
|
||||||
|
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||||
{
|
{
|
||||||
$originforcontact = $origin;
|
$origin_id = $tmp_origin_id;
|
||||||
$originidforcontact = $origin_id;
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
|
if (! $ret)
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
|
||||||
|
{
|
||||||
|
$originforcontact = $this->origin;
|
||||||
|
$originidforcontact = $this->origin_id;
|
||||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||||
$exp = new Expedition($db);
|
$exp = new Expedition($db);
|
||||||
$exp->fetch($origin_id);
|
$exp->fetch($this->origin_id);
|
||||||
$exp->fetchObjectLinked();
|
$exp->fetchObjectLinked();
|
||||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||||
{
|
{
|
||||||
@ -983,8 +1001,6 @@ class Contrat extends CommonObject
|
|||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -487,5 +487,5 @@ ToCreateARecurringInvoiceGene=To generate future invoices regularly and manually
|
|||||||
ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated automatically, ask you administrator to enable and setup module <strong>%s</strong>. Note that both method (manual and automatic) can be used together with no risk of duplication.
|
ToCreateARecurringInvoiceGeneAuto=If you need to have such invoices generated automatically, ask you administrator to enable and setup module <strong>%s</strong>. Note that both method (manual and automatic) can be used together with no risk of duplication.
|
||||||
DeleteRepeatableInvoice=Delete template invoice
|
DeleteRepeatableInvoice=Delete template invoice
|
||||||
ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice?
|
ConfirmDeleteRepeatableInvoice=Are your sure you want to delete the template invoice?
|
||||||
CreateOneBillByThird=Create one invoice per third (otherwise, one invoice per order)
|
CreateOneBillByThird=Create one invoice per third party (otherwise, one invoice per order)
|
||||||
BillCreated=%s bill(s) created
|
BillCreated=%s bill(s) created
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user