From 6379b74099f95ee4b9e581a8f74fc3178848ef6b Mon Sep 17 00:00:00 2001
From: fhenry <florian.henry@open-concept.pro>
Date: Mon, 8 Apr 2013 18:02:12 +0200
Subject: [PATCH] Fix bug on ODT template path for order and projects

---
 htdocs/admin/commande.php               | 14 +++++++++++---
 htdocs/admin/project.php                |  9 ++++++++-
 htdocs/core/modules/modProjet.class.php |  2 +-
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 47b16c11e49..ebcb94110e9 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -146,7 +146,7 @@ else if ($action == 'setdoc')
 	}
 }
 
-if ($action == 'setmod')
+else if ($action == 'setmod')
 {
 	// TODO Verifier si module numerotation choisi peut etre active
 	// par appel methode canBeActivated
@@ -154,7 +154,7 @@ if ($action == 'setmod')
 	dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
 }
 
-if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
+else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
 {
 	$draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
 	$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
@@ -171,7 +171,7 @@ if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
     }
 }
 
-if ($action == 'set_COMMANDE_FREE_TEXT')
+else if ($action == 'set_COMMANDE_FREE_TEXT')
 {
 	$freetext = GETPOST("COMMANDE_FREE_TEXT");	// No alpha here, we want exact string
 
@@ -188,6 +188,14 @@ if ($action == 'set_COMMANDE_FREE_TEXT')
         $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
     }
 }
+else if ($action='setModuleOptions') {
+	if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
+	{
+		// La constante qui a ete lue en avant du nouveau set
+		// on passe donc par une variable pour avoir un affichage coherent
+		$conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1');
+	}
+}
 
 
 /*
diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php
index 8bb1baae575..9f28b57be5b 100644
--- a/htdocs/admin/project.php
+++ b/htdocs/admin/project.php
@@ -152,7 +152,14 @@ else if ($action == 'setmod')
 
 	dolibarr_set_const($db, "PROJECT_ADDON",$value,'chaine',0,'',$conf->entity);
 }
-
+else if ($action='setModuleOptions') {
+	if (dolibarr_set_const($db, "PROJECT_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
+	{
+		// La constante qui a ete lue en avant du nouveau set
+		// on passe donc par une variable pour avoir un affichage coherent
+		$conf->global->PROJECT_ADDON_PDF_ODT_PATH = GETPOST('value1');
+	}
+}
 /*
  * View
 */
diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php
index a17835ddcc6..9bd71e50dce 100644
--- a/htdocs/core/modules/modProjet.class.php
+++ b/htdocs/core/modules/modProjet.class.php
@@ -89,7 +89,7 @@ class modProjet extends DolibarrModules
 		$r++;
 		$this->const[$r][0] = "PROJECT_ADDON_PDF_ODT_PATH";
 		$this->const[$r][1] = "chaine";
-		$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/project";
+		$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/projects";
 		$this->const[$r][3] = "";
 		$this->const[$r][4] = 0;
 
-- 
GitLab