Merge pull request #11922 from laudeco/feature/11880_add_custom_element_in_project_export

[#11880] - support the referents also in the beluga export of a project
This commit is contained in:
Laurent Destailleur 2019-09-27 14:22:49 +02:00 committed by GitHub
commit 8e08636d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -383,6 +383,11 @@ class pdf_beluga extends ModelePDFProjects
'lang'=>'agenda')
);
$hookmanager->initHooks(array('completeListOfReferent'));
$hookmanager->executeHooks('completeListOfReferent', ['listofreferent'=>$listofreferent], $object, $action);
if(!empty($hookmanager->resArray)) {
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
}
foreach ($listofreferent as $key => $value)
{
@ -392,17 +397,13 @@ class pdf_beluga extends ModelePDFProjects
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$langstoload=$value['lang'];
$projectField=isset($value['project_field']) ? $value['project_field'] : 'fk_projet';
$langs->load($langstoload);
if (! $qualified) continue;
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
if ($key == 'agenda')
{
// var_dump($elementarray);
}
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, $projectField);
$num = count($elementarray);
if ($num >= 0)
@ -416,7 +417,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L');
$selectList = $formproject->select_element($tablename, $project->thirdparty->id);
$selectList = $formproject->select_element($tablename, $project->thirdparty->id, '', -2, $projectField);
$nexY = $pdf->GetY() + 1;
$curY = $nexY;
$pdf->SetXY($this->posxref, $curY);
@ -591,9 +592,9 @@ class pdf_beluga extends ModelePDFProjects
// Amount without tax
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : ' '), 1, 'R');
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : ''), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : ' '), 1, 'R');
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($element->total_ttc) : ''), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
if ($key == 'agenda')
@ -630,9 +631,9 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetXY($this->posxref, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxref, 3, "TOTAL", 1, 'L');
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : ' '), 1, 'R');
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($total_ht) : ''), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : ' '), 1, 'R');
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, (isset($element->total_ttc) ? price($total_ttc) : ''), 1, 'R');
$pdf->SetXY($this->posxstatut, $curY);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Nb") . " " . $num, 1, 'L');
}