FIX source template invoice not loaded/shown
This commit is contained in:
parent
a70a14b145
commit
e3812e3b0c
@ -3806,6 +3806,13 @@ elseif ($id > 0 || ! empty($ref))
|
||||
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->fk_fac_rec_source > 0)
|
||||
{
|
||||
$tmptemplate = new FactureRec($db);
|
||||
$result = $tmptemplate->fetch($object->fk_fac_rec_source);
|
||||
if ($result > 0) print '. '.$langs->trans("GeneratedFromTemplate", $tmptemplate->ref);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Relative and absolute discounts
|
||||
@ -4018,9 +4025,8 @@ elseif ($id > 0 || ! empty($ref))
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
print '<table class="border bordertop tableforfield centpercent">';
|
||||
|
||||
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
|
||||
{
|
||||
|
||||
@ -349,7 +349,7 @@ class Facture extends CommonInvoice
|
||||
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(); // This load $_facrec->linkedObjectsIds
|
||||
$result=$_facrec->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); // This load $_facrec->linkedObjectsIds
|
||||
|
||||
// Define some dates
|
||||
$originaldatewhen = $_facrec->date_when;
|
||||
@ -392,6 +392,8 @@ class Facture extends CommonInvoice
|
||||
$this->brouillon = 1;
|
||||
|
||||
$this->linked_objects = $_facrec->linkedObjectsIds;
|
||||
// We do not add link to template invoice or next invoice will be linked to all generated invoices
|
||||
//$this->linked_objects['facturerec'][0] = $this->fac_rec;
|
||||
|
||||
$forceduedate = $this->calculate_date_lim_reglement();
|
||||
|
||||
@ -436,7 +438,6 @@ class Facture extends CommonInvoice
|
||||
|
||||
//var_dump($substitutionarray);exit;
|
||||
|
||||
$substitutionisok=true;
|
||||
complete_substitutions_array($substitutionarray, $outputlangs);
|
||||
|
||||
$this->note_public=make_substitutions($this->note_public, $substitutionarray);
|
||||
@ -564,7 +565,7 @@ class Facture extends CommonInvoice
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
$exp->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
{
|
||||
foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
|
||||
@ -1323,7 +1324,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.date_valid as datev';
|
||||
$sql.= ', f.tms as datem';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc';
|
||||
$sql.= ', f.fk_facture_source';
|
||||
$sql.= ', f.fk_facture_source, f.fk_fac_rec_source';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams';
|
||||
$sql.= ', f.situation_cycle_ref, f.situation_counter, f.situation_final';
|
||||
$sql.= ', f.fk_account';
|
||||
@ -1391,6 +1392,7 @@ class Facture extends CommonInvoice
|
||||
$this->fk_account = ($obj->fk_account>0)?$obj->fk_account:null;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
$this->fk_facture_source = $obj->fk_facture_source;
|
||||
$this->fk_fac_rec_source = $obj->fk_fac_rec_source;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
|
||||
@ -365,6 +365,7 @@ InvoiceAutoValidate=Validate invoices automatically
|
||||
GeneratedFromRecurringInvoice=Generated from template recurring invoice %s
|
||||
DateIsNotEnough=Date not reached yet
|
||||
InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s
|
||||
GeneratedFromTemplate=Generated from template invoice %s
|
||||
WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date
|
||||
WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date
|
||||
ViewAvailableGlobalDiscounts=View available discounts
|
||||
|
||||
Loading…
Reference in New Issue
Block a user