*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -99,7 +99,7 @@ else if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
- $file=dol_buildpath($reldir."core/modules/project/pdf/pdf_".$modele.".modules.php",0);
+ $file=dol_buildpath($reldir."core/modules/project/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@@ -144,7 +144,7 @@ else if ($action == 'specimentask')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
- $file=dol_buildpath($reldir."core/modules/project/task/pdf/pdf_".$modele.".modules.php",0);
+ $file=dol_buildpath($reldir."core/modules/project/task/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@@ -177,6 +177,35 @@ else if ($action == 'specimentask')
}
}
+// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
+if ($action == 'setModuleOptions')
+{
+ $post_size=count($_POST);
+
+ $db->begin();
+
+ for($i=0;$i < $post_size;$i++)
+ {
+ if (array_key_exists('param'.$i,$_POST))
+ {
+ $param=GETPOST("param".$i,'alpha');
+ $value=GETPOST("value".$i,'alpha');
+ if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
+ if (! $res > 0) $error++;
+ }
+ }
+ if (! $error)
+ {
+ $db->commit();
+ setEventMessage($langs->trans("SetupSaved"));
+ }
+ else
+ {
+ $db->rollback();
+ setEventMessage($langs->trans("Error"),'errors');
+ }
+}
+
// Activate a model
else if ($action == 'set')
{
@@ -256,26 +285,10 @@ else if ($action == 'setmodtask')
dolibarr_set_const($db, "PROJECT_TASK_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');
- }
-}
-else if ($action=='setModuleOptionsTask') {
- if (dolibarr_set_const($db, "PROJECT_TASK_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_TASK_ADDON_PDF_ODT_PATH = GETPOST('value1');
- }
-}
/*
* View
-*/
+ */
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
@@ -542,99 +555,108 @@ clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
- $dir = dol_buildpath($reldir."core/modules/project/pdf/");
-
- if (is_dir($dir))
+ foreach (array('','/doc') as $valdir)
{
- $handle=opendir($dir);
- if (is_resource($handle))
+ $dir = dol_buildpath($reldir."core/modules/project/".$valdir);
+
+ if (is_dir($dir))
{
- while (($file = readdir($handle))!==false)
+ $handle=opendir($dir);
+ if (is_resource($handle))
{
- if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
+ while (($file = readdir($handle))!==false)
{
- if (file_exists($dir.'/'.$file))
+ $filelist[]=$file;
+ }
+ closedir($handle);
+ arsort($filelist);
+
+ foreach($filelist as $file)
+ {
+ if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
- $name = substr($file, 4, dol_strlen($file) -16);
- $classname = substr($file, 0, dol_strlen($file) -12);
-
- require_once $dir.'/'.$file;
- $module = new $classname($db);
-
- $modulequalified=1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
-
- if ($modulequalified)
+ if (file_exists($dir.'/'.$file))
{
- $var=!$var;
- print '| ';
- print (empty($module->name)?$name:$module->name);
- print " | \n";
- if (method_exists($module,'info')) print $module->info($langs);
- else print $module->description;
- print " | \n";
+ $name = substr($file, 4, dol_strlen($file) -16);
+ $classname = substr($file, 0, dol_strlen($file) -12);
- // Active
- if (in_array($name, $def))
- {
- print "\n";
- print 'scandir.'&label='.urlencode($module->name).'">';
- print img_picto($langs->trans("Enabled"),'switch_on');
- print '';
- print " | ";
- }
- else
- {
- print "\n";
- print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'';
- print " | ";
- }
+ require_once $dir.'/'.$file;
+ $module = new $classname($db);
- // Default
- print "";
- if ($conf->global->PROJECT_ADDON_PDF == "$name")
- {
- print img_picto($langs->trans("Default"),'on');
- }
- else
- {
- print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'';
- }
- print ' | ';
+ $modulequalified=1;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
- // Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
- if ($module->type == 'pdf')
+ if ($modulequalified)
{
- $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
- }
- $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
-
- print '';
- print $form->textwithpicto('',$htmltooltip,1,0);
- print ' | ';
+ $var=!$var;
+ print '
| ';
+ print (empty($module->name)?$name:$module->name);
+ print " | \n";
+ if (method_exists($module,'info')) print $module->info($langs);
+ else print $module->description;
+ print " | \n";
- // Preview
- print '';
- if ($module->type == 'pdf')
- {
- print ''.img_object($langs->trans("Preview"),'bill').'';
- }
- else
- {
- print img_object($langs->trans("PreviewNotAvailable"),'generic');
- }
- print ' | ';
+ // Active
+ if (in_array($name, $def))
+ {
+ print "\n";
+ print 'scandir.'&label='.urlencode($module->name).'">';
+ print img_picto($langs->trans("Enabled"),'switch_on');
+ print '';
+ print " | ";
+ }
+ else
+ {
+ print "\n";
+ print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'';
+ print " | ";
+ }
- print "
\n";
- }
+ // Default
+ print "";
+ if ($conf->global->PROJECT_ADDON_PDF == "$name")
+ {
+ print img_picto($langs->trans("Default"),'on');
+ }
+ else
+ {
+ print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'';
+ }
+ print ' | ';
+
+ // Info
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ if ($module->type == 'pdf')
+ {
+ $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ }
+ $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
+
+ print '';
+ print $form->textwithpicto('',$htmltooltip,1,0);
+ print ' | ';
+
+ // Preview
+ print '';
+ if ($module->type == 'pdf')
+ {
+ print ''.img_object($langs->trans("Preview"),'bill').'';
+ }
+ else
+ {
+ print img_object($langs->trans("PreviewNotAvailable"),'generic');
+ }
+ print ' | ';
+
+ print "\n";
+ }
+ }
}
}
}
- closedir($handle);
}
}
}
@@ -688,98 +710,107 @@ clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
- $dir = dol_buildpath($reldir."core/modules/project/task/pdf/");
-
- if (is_dir($dir))
+ foreach (array('','/doc') as $valdir)
{
- $handle=opendir($dir);
- if (is_resource($handle))
+ $dir = dol_buildpath($reldir."core/modules/project/task/".$valdir);
+
+ if (is_dir($dir))
{
- while (($file = readdir($handle))!==false)
+ $handle=opendir($dir);
+ if (is_resource($handle))
{
- if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
+ while (($file = readdir($handle))!==false)
{
- if (file_exists($dir.'/'.$file))
+ $filelist[]=$file;
+ }
+ closedir($handle);
+ arsort($filelist);
+
+ foreach($filelist as $file)
+ {
+ if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
- $name = substr($file, 4, dol_strlen($file) -16);
- $classname = substr($file, 0, dol_strlen($file) -12);
-
- require_once $dir.'/'.$file;
- $module = new $classname($db);
-
- $modulequalified=1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
-
- if ($modulequalified)
+ if (file_exists($dir.'/'.$file))
{
- $var = !$var;
- print '| ';
- print (empty($module->name)?$name:$module->name);
- print " | \n";
- if (method_exists($module,'info')) print $module->info($langs);
- else print $module->description;
- print " | \n";
+ $name = substr($file, 4, dol_strlen($file) -16);
+ $classname = substr($file, 0, dol_strlen($file) -12);
- // Active
- if (in_array($name, $def))
- {
- print "\n";
- print 'scandir.'&label='.urlencode($module->name).'">';
- print img_picto($langs->trans("Enabled"),'switch_on');
- print '';
- print " | ";
- }
- else
- {
- print "\n";
- print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'';
- print " | ";
- }
+ require_once $dir.'/'.$file;
+ $module = new $classname($db);
- // Defaut
- print "";
- if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
- {
- print img_picto($langs->trans("Default"),'on');
- }
- else
- {
- print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'';
- }
- print ' | ';
+ $modulequalified=1;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
- // Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
- if ($module->type == 'pdf')
+ if ($modulequalified)
{
- $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
- }
- $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
-
- print '';
- print $form->textwithpicto('',$htmltooltip,1,0);
- print ' | ';
+ $var = !$var;
+ print '
| ';
+ print (empty($module->name)?$name:$module->name);
+ print " | \n";
+ if (method_exists($module,'info')) print $module->info($langs);
+ else print $module->description;
+ print " | \n";
- // Preview
- print '';
- if ($module->type == 'pdf')
- {
- print ''.img_object($langs->trans("Preview"),'bill').'';
+ // Active
+ if (in_array($name, $def))
+ {
+ print " | \n";
+ print 'scandir.'&label='.urlencode($module->name).'">';
+ print img_picto($langs->trans("Enabled"),'switch_on');
+ print '';
+ print " | ";
+ }
+ else
+ {
+ print "\n";
+ print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'';
+ print " | ";
+ }
+
+ // Defaut
+ print "";
+ if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name")
+ {
+ print img_picto($langs->trans("Default"),'on');
+ }
+ else
+ {
+ print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'';
+ }
+ print ' | ';
+
+ // Info
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ if ($module->type == 'pdf')
+ {
+ $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+ }
+ $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
+
+ print '';
+ print $form->textwithpicto('',$htmltooltip,1,0);
+ print ' | ';
+
+ // Preview
+ print '';
+ if ($module->type == 'pdf')
+ {
+ print ''.img_object($langs->trans("Preview"),'bill').'';
+ }
+ else
+ {
+ print img_object($langs->trans("PreviewNotAvailable"),'generic');
+ }
+ print ' | ';
+ print "
\n";
}
- else
- {
- print img_object($langs->trans("PreviewNotAvailable"),'generic');
- }
- print '';
- print "\n";
}
}
}
}
- closedir($handle);
}
}
}
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index fb7da8636b2..9659eb2ffe8 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1368,7 +1368,7 @@ class Project extends CommonObject
}
}
- $modelpath = "core/modules/project/pdf/";
+ $modelpath = "core/modules/project/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 2f4cc85cf7f..13360110310 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1343,7 +1343,7 @@ class Task extends CommonObject
}
}
- $modelpath = "core/modules/project/task/pdf/";
+ $modelpath = "core/modules/project/task/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php
index 3f20b99fd14..3ed7a6524c7 100644
--- a/test/phpunit/BuildDocTest.php
+++ b/test/phpunit/BuildDocTest.php
@@ -42,7 +42,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/lib/pdf.lib.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/facture/doc/pdf_crabe.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/doc/pdf_azur.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/doc/pdf_einstein.modules.php';
-require_once dirname(__FILE__).'/../../htdocs/core/modules/project/pdf/pdf_baleine.modules.php';
+require_once dirname(__FILE__).'/../../htdocs/core/modules/project/doc/pdf_baleine.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php';
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php';