Fix no document available on job candidature

This commit is contained in:
Maxime Kohlhaas 2022-05-22 00:23:16 +02:00
parent 812298f740
commit e5c38572d1
2 changed files with 6 additions and 8 deletions

View File

@ -423,7 +423,7 @@ class modRecruitment extends DolibarrModules
$sql = array();
// Document template
$moduledir = 'mymodule';
$moduledir = 'recruitment';
$myTmpObjects = array();
$myTmpObjects['RecruitmentJobPosition'] = array('includerefgeneration'=>1, 'includedocgeneration'=>1);
@ -431,10 +431,10 @@ class modRecruitment extends DolibarrModules
if ($myTmpObjectKey == 'MyObject') {
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
$dest = $dirodt.'/template_myobjects.odt';
if ($myTmpObjectArray['includedocgeneration']) {
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_recruitmentjobposition.odt';
$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_recruitmentjobposition.odt';
if (file_exists($src) && !file_exists($dest)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -450,8 +450,6 @@ class modRecruitment extends DolibarrModules
$sql = array_merge($sql, array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."','".strtolower($myTmpObjectKey)."',".$conf->entity.")",
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".strtolower($myTmpObjectKey)."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".strtolower($myTmpObjectKey)."', ".$conf->entity.")"
));
}
}

View File

@ -51,7 +51,7 @@ abstract class ModelePDFRecruitmentCandidature extends CommonDocGenerator
// phpcs:enable
global $conf;
$type = 'recruitmentjobposition';
$type = 'recruitmentjobcandidature';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';