Debug v22

This commit is contained in:
ldestailleur
2025-06-04 19:15:15 +02:00
parent d713406667
commit 23e26d51a9
5 changed files with 80 additions and 60 deletions

View File

@@ -40,6 +40,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
*/
class doc_generic_proposal_odt extends ModelePDFPropales
{
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**
* @var array{0:int,1:int} Minimum version of PHP required by module.
* e.g.: PHP ≥ 7.0 = array(7, 0)
*/
public $phpmin = array(7, 0);
/**
* @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'dolibarr'|'experimental' Dolibarr version of the loaded document
*/
@@ -155,15 +167,6 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Scan directories
$nbofiles = count($listoffiles);
if (!empty($odtPath)) {
@@ -210,6 +213,17 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$texte .= '</table>';
}
}
$texte .= '<br><br>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dolPrintHTMLForAttribute($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -445,13 +459,15 @@ class doc_generic_proposal_odt extends ModelePDFPropales
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) { // Image
if (preg_match('/logo$/', $key)) {
// Image
if (file_exists($value)) {
$odfHandler->setImage($key, $value, $ratio);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
} else { // Text
} else {
// Text
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {

View File

@@ -103,7 +103,7 @@ class doc_generic_user_odt extends ModelePDFUser
*/
public function info($langs)
{
global $conf, $langs;
global $langs;
// Load translation files required by the page
$langs->loadLangs(array('companies', 'errors'));
@@ -124,7 +124,7 @@ class doc_generic_user_odt extends ModelePDFUser
$texte .= '<input type="hidden" name="param3" value="USER_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="USER_ADDON_PDF_ODT_CLOSED">';
}
$texte .= '<table class="nobordernopadding" width="100%">';
$texte .= '<table class="nobordernopadding centpercent">';
// List of directories area
$texte .= '<tr><td>';
@@ -153,15 +153,6 @@ class doc_generic_user_odt extends ModelePDFUser
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Scan directories
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
@@ -198,6 +189,17 @@ class doc_generic_user_odt extends ModelePDFUser
}
$texte .= '</div>';
}
$texte .= '<br>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -235,7 +237,7 @@ class doc_generic_user_odt extends ModelePDFUser
public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user, $langs, $conf, $mysoc, $hookmanager;
global $langs, $conf, $mysoc, $hookmanager;
if (empty($srctemplatepath)) {
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);

View File

@@ -154,15 +154,6 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Scan directories
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
@@ -199,6 +190,17 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
}
$texte .= '</div>';
}
$texte .= '<br>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= $odtPath;
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit reposition smallpaddingimp" name="modify" value="'.dol_escape_htmltag($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();

View File

@@ -160,20 +160,6 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
if (!getDolGlobalString('MAIN_NO_MULTIDIR_FOR_ODT')) {
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit smallpaddingimp reposition" name="modify" value="'.dolPrintHTMLForAttribute($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
} else {
$texte .= '<br>';
$texte .= '<input type="hidden" name="value1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
}
// Scan directories
$nbofiles = count($listoffiles);
if (getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH')) {
@@ -195,6 +181,21 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$texte .= '</div>';
}
if (!getDolGlobalString('MAIN_NO_MULTIDIR_FOR_ODT')) {
$texte .= '<br><br>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1, 3, $this->name);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= getDolGlobalString('MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit smallpaddingimp reposition" name="modify" value="'.dolPrintHTMLForAttribute($langs->trans("Modify")).'">';
$texte .= '<br></div></div>';
} else {
$texte .= '<br>';
$texte .= '<input type="hidden" name="value1" value="MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH">';
}
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -386,6 +387,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
//print html_entity_decode($odfHandler->__toString());
//print exit;
$object->fetch_optionals();
// Make substitutions into odt of freetext
try {

View File

@@ -155,19 +155,11 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
}
}
$texthelp = $langs->trans("ListOfDirectoriesForModelGenODT");
$texthelp .= '<br><br><span class="opacitymedium">'.$langs->trans("ExampleOfDirectoriesForModelGen").'</span>';
// Add list of substitution keys
$texthelp .= '<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
$texthelp .= $langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Scan directories
$nbofiles = count($listoffiles);
if (getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH')) {
@@ -188,6 +180,17 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
}
$texte .= '</div>';
}
$texte .= '<br><br>';
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat textareafordir" spellcheck="false" cols="60" name="value1">';
$texte .= getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button button-edit smallpaddingimp reposition" name="modify" value="'.$langs->trans("Modify").'">';
$texte .= '<br></div></div>';
// Add input to upload a new template file.
$texte .= '<div>'.$langs->trans("UploadNewTemplate");
$maxfilesizearray = getMaxFileSizeArray();
@@ -201,11 +204,6 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
$texte .= '</div>';
$texte .= '</td>';
$texte .= '<td rowspan="2" class="tdtop hideonsmartphone">';
$texte .= '<span class="opacitymedium">';
$texte .= $langs->trans("ExampleOfDirectoriesForModelGen");
$texte .= '</span>';
$texte .= '</td>';
$texte .= '</tr>';
$texte .= '</table>';