diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 4d69cbf17ae..99a8c33cf63 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4019,10 +4019,7 @@ class Propal extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $langs; - - $langs->load("propale"); - $outputlangs->load("products"); + $outputlangs->loadLangs(array("propale", "products")); if (!dol_strlen($modele)) { $modele = 'azur'; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 310b365cdaf..43031a1c999 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -25,17 +25,11 @@ /** * \file htdocs/comm/propal/note.php * \ingroup propal - * \brief Fiche d'information sur une proposition commerciale + * \brief Page for notes on proposals */ // Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} - /** * @var Conf $conf * @var DoliDB $db @@ -43,6 +37,12 @@ if (isModEnabled('project')) { * @var Translate $langs * @var User $user */ +require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; +if (isModEnabled('project')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +} + // Load translation files required by the page $langs->loadLangs(array('propal', 'compta', 'bills', 'companies')); @@ -117,8 +117,8 @@ if ($object->id > 0) { $morehtmlref = '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_customer, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); // Project diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 4a307a8b42c..ac8c65a0670 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -76,7 +76,9 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', //see #21072: Update a public note with a "document model not found" is not really a problem : the PDF is not created/updated //but the note is saved, so just add a notification will be enough + $resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($resultGenDoc < 0) { setEventMessages($object->error, $object->errors, 'warnings'); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index dcb5eafe065..7e048c9d848 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1424,7 +1424,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ */ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size) { - $linkedobjects = pdf_getLinkedObjects($object, $outputlangs); + $linkedobjects = pdf_getLinkedObjects($object, $outputlangs); // May update $object->note_public + if (!empty($linkedobjects)) { foreach ($linkedobjects as $linkedobject) { $reftoshow = $linkedobject["ref_title"].' : '.$linkedobject["ref_value"]; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 279c59868d9..b6abb050e5c 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -348,6 +348,8 @@ class pdf_cyan extends ModelePDFPropales $heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) //print $heightforinfotot + $heightforsignature + $heightforfreetext + $heightforfooter;exit; + $save_note_public = $object->note_public; // Because $object->note_public may be modified by _pagehead() that calls pdf_writeLinkedObjects() that calls ... that modify $object->note_private + $top_shift = $this->_pagehead($pdf, $object, 1, $outputlangs, $outputlangsbis); $pdf->SetFont('', '', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 @@ -398,6 +400,8 @@ class pdf_cyan extends ModelePDFPropales } } + $object->note_public = $save_note_public; // Now that we have output the note_public, we can restore it to initial value. + // Extrafields in note $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); if (!empty($extranote)) { @@ -1856,7 +1860,7 @@ class pdf_cyan extends ModelePDFPropales $top_shift = 0; // Show list of linked objects $current_y = $pdf->getY(); - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); // May modify $object->note_public if ($current_y < $pdf->getY()) { $top_shift = $pdf->getY() - $current_y; } diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 6fa97abde4f..56db3ff5f29 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -25,6 +25,9 @@ * @var User $user * * @var ?int<0,1> $permissionnote + * @var ?int<0,1> $permission + * @var ?string $textNotePub + * @var ?string $textNotePrive * @var string $moreparam * @var ?int $colwidth * @var string $cssclass