FIX we saw links to object on private not just after a save.
This commit is contained in:
parent
4e89f046d1
commit
6727d0c361
6 changed files with 22 additions and 15 deletions
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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 = '<div class="refidno">';
|
||||
// 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 .= '<br>'.$object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue