Fix: missing contacts with order to invoice

This commit is contained in:
Regis Houssin 2012-03-11 11:57:15 +01:00
parent 733350f2b8
commit 3871f3a6dd
2 changed files with 32 additions and 2 deletions

View File

@ -38,8 +38,12 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php');
if ($conf->projet->enabled)
{
require_once(DOL_DOCUMENT_ROOT.'/projet/class/project.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php');
}
$langs->load('bills');
//print 'ee'.$langs->trans('BillsCustomer');exit;

View File

@ -253,6 +253,32 @@ class Facture extends CommonObject
dol_print_error($this->db);
$error++;
}
// TODO mutualiser
if ($origin == 'commande')
{
// On recupere les differents contact interne et externe
$order = new Commande($this->db);
$order->id = $origin_id;
// On recupere le commercial suivi propale
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
if ($this->userid)
{
//On passe le commercial suivi commande en commercial suivi paiement
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
}
// On recupere le contact client facturation commande
$this->contactid = $order->getIdcontact('external', 'BILLING');
if ($this->contactid)
{
//On passe le contact client facturation commande en contact client facturation
$this->add_contact($this->contactid[0], 'BILLING', 'external');
}
}
}
}