Skip to content

Commit

Permalink
#815 [Substitution] fix: fatal saturne_completesubstitutionarray func…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
nicolas-eoxia committed Jan 19, 2024
1 parent d46735a commit 79b9543
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions core/substitutions/functions_saturne.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,29 @@
*/
function saturne_completesubstitutionarray(array &$substitutionarray, Translate $langs, $object)
{
// Global variables definitions
global $conf, $db;
$signatoryID = GETPOST('signatoryID', 'int');

// Get module parameters
$moduleName = GETPOST('module_name', 'alpha');
$objectType = GETPOST('object_type', 'alpha');
$documentType = GETPOST('document_type', 'alpha');
if (GETPOSTISSET('signatoryID') && $signatoryID > 0) {
// Global variables definitions
global $conf, $db;

$moduleNameLowerCase = strtolower($moduleName);
// Get module parameters
$moduleName = GETPOST('module_name', 'alpha');
$objectType = GETPOST('object_type', 'alpha');
$documentType = GETPOST('document_type', 'alpha');

// Load Saturne libraries
require_once __DIR__ . '/../../class/saturnesignature.class.php';
$moduleNameLowerCase = strtolower($moduleName);

// Initialize technical objects
$signatory = new SaturneSignature($db, $moduleNameLowerCase, $object->element);
// Load Saturne libraries
require_once __DIR__ . '/../../class/saturnesignature.class.php';

$signatoryID = GETPOST('signatoryID', 'int');
$signatory->fetch($signatoryID);
// Initialize technical objects
$signatory = new SaturneSignature($db, $moduleNameLowerCase, $object->element);

$signatory->fetch($signatoryID);

$url = dol_buildpath('/custom/saturne/public/signature/add_signature.php?track_id=' . $signatory->signature_url . '&entity=' . $conf->entity . '&module_name=' . $moduleNameLowerCase . '&object_type=' . $object->element . '&document_type=' . $documentType . '&modal_to_open=modal-signature' . $signatory->id, 3);
$url = dol_buildpath('/custom/saturne/public/signature/add_signature.php?track_id=' . $signatory->signature_url . '&entity=' . $conf->entity . '&module_name=' . $moduleNameLowerCase . '&object_type=' . $object->element . '&document_type=' . $documentType . '&modal_to_open=modal-signature' . $signatory->id, 3);

$substitutionarray['__SATURNE_SIGNATORY_URL__'] = '<a href=' . $url . ' target="_blank">' . $langs->transnoentities('SignatureEmailURL') . '</a>';
$substitutionarray['__SATURNE_SIGNATORY_URL__'] = '<a href=' . $url . ' target="_blank">' . $langs->transnoentities('SignatureEmailURL') . '</a>';
}
}

0 comments on commit 79b9543

Please sign in to comment.