Close #31219 - Better fix

This commit is contained in:
Laurent Destailleur 2024-10-03 16:47:38 +02:00
parent 7f946dcb4b
commit fa3c2fc870
2 changed files with 7 additions and 4 deletions

View File

@ -616,7 +616,8 @@ class FactureRec extends CommonInvoice
$this->fk_account = $obj->fk_account;
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author;
$this->user_author = $obj->fk_user_author; // deprecated
$this->user_creation_id = $obj->fk_user_author;
$this->model_pdf = $obj->model_pdf;
//$this->special_code = $obj->special_code;
$this->frequency = $obj->frequency;

View File

@ -554,14 +554,16 @@ class Facture extends CommonInvoice
if ($this->fac_rec > 0) {
$this->fk_fac_rec_source = $this->fac_rec;
if (getDolGlobalString('MODEL_FAC_REC_AUTHOR')) {
$origin_user_author_id = ($this->fk_user_author > 0 ? $this->fk_user_author : $origin_user_author_id);
}
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
$_facrec = new FactureRec($this->db);
$result = $_facrec->fetch($this->fac_rec);
$result = $_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds
if (getDolGlobalString('MODEL_FAC_REC_AUTHOR')) {
// If option MODEL_FAC_REC_AUTHOR is set, we want the same author than the author of recurring invoice instead of current user
$origin_user_author_id = ($_facrec->user_creation_id > 0 ? $_facrec->user_creation_id : $origin_user_author_id);
}
// Define some dates
$originaldatewhen = $_facrec->date_when;
$nextdatewhen = null;