|
@@ -279,6 +279,8 @@ class Facture extends CommonInvoice
|
|
|
// Create invoice from a template invoice
|
|
|
if ($this->fac_rec > 0)
|
|
|
{
|
|
|
+ $this->fk_fac_rec_source = $this->fac_rec;
|
|
|
+
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
|
|
$_facrec = new FactureRec($this->db);
|
|
|
$result=$_facrec->fetch($this->fac_rec);
|
|
@@ -386,7 +388,7 @@ class Facture extends CommonInvoice
|
|
|
$sql.= ", note_public";
|
|
|
$sql.= ", ref_client, ref_int";
|
|
|
$sql.= ", fk_account";
|
|
|
- $sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
|
|
+ $sql.= ", fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet";
|
|
|
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
|
|
|
$sql.= ", situation_cycle_ref, situation_counter, situation_final";
|
|
|
$sql.= ", fk_incoterms, location_incoterms";
|
|
@@ -410,6 +412,7 @@ class Facture extends CommonInvoice
|
|
|
$sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null");
|
|
|
$sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null");
|
|
|
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
|
|
+ $sql.= ", ".($this->fk_fac_rec_source?"'".$this->db->escape($this->fk_fac_rec_source)."'":"null");
|
|
|
$sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null");
|
|
|
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
|
|
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|