Browse Source

Fix no document available on job candidature

Maxime Kohlhaas 3 years ago
parent
commit
e5c38572d1

+ 5 - 7
htdocs/core/modules/modRecruitment.class.php

@@ -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.")"
 				));
 			}
 		}

+ 1 - 1
htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php

@@ -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';