Fix: use "doc" instead "pdf" dir and uniformize code
This commit is contained in:
parent
4124ee6bc4
commit
f1f4fc18e9
@ -192,7 +192,6 @@ if ($action == 'setModuleOptions')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Activate a model
|
// Activate a model
|
||||||
if ($action == 'set')
|
if ($action == 'set')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php
|
* \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief File of class to build ODT documents for third parties
|
* \brief File of class to build ODT documents for third parties
|
||||||
*/
|
*/
|
||||||
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/project/pdf/pdf_baleine.modules.php
|
* \file htdocs/core/modules/project/doc/pdf_baleine.modules.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief Fichier de la classe permettant de generer les projets au modele Baleine
|
* \brief Fichier de la classe permettant de generer les projets au modele Baleine
|
||||||
* \author Regis Houssin
|
* \author Regis Houssin
|
||||||
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php
|
* \file htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief File of class to build ODT documents for third parties
|
* \brief File of class to build ODT documents for third parties
|
||||||
*/
|
*/
|
||||||
@ -304,7 +304,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
$texte = $this->description.".<br>\n";
|
$texte = $this->description.".<br>\n";
|
||||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
$texte.= '<input type="hidden" name="action" value="setModuleOptionsTask">';
|
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
$texte.= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
|
$texte.= '<input type="hidden" name="param1" value="PROJECT_TASK_ADDON_PDF_ODT_PATH">';
|
||||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class doc_generic_task_odt extends ModelePDFTask
|
|||||||
*/
|
*/
|
||||||
function write_file($object,$outputlangs,$srctemplatepath)
|
function write_file($object,$outputlangs,$srctemplatepath)
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf,$mysoc;
|
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||||
|
|
||||||
if (empty($srctemplatepath))
|
if (empty($srctemplatepath))
|
||||||
{
|
{
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
@ -99,7 +99,7 @@ else if ($action == 'specimen')
|
|||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
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))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$filefound=1;
|
||||||
@ -144,7 +144,7 @@ else if ($action == 'specimentask')
|
|||||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
foreach($dirmodels as $reldir)
|
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))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound=1;
|
$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
|
// Activate a model
|
||||||
else if ($action == 'set')
|
else if ($action == 'set')
|
||||||
{
|
{
|
||||||
@ -256,23 +285,7 @@ else if ($action == 'setmodtask')
|
|||||||
dolibarr_set_const($db, "PROJECT_TASK_ADDON",$value,'chaine',0,'',$conf->entity);
|
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
|
* View
|
||||||
*/
|
*/
|
||||||
@ -542,7 +555,9 @@ clearstatcache();
|
|||||||
$var=true;
|
$var=true;
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/project/pdf/");
|
foreach (array('','/doc') as $valdir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/project/".$valdir);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -550,6 +565,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
$filelist[]=$file;
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
arsort($filelist);
|
||||||
|
|
||||||
|
foreach($filelist as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||||
{
|
{
|
||||||
@ -634,7 +656,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -688,7 +710,9 @@ clearstatcache();
|
|||||||
$var=true;
|
$var=true;
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/project/task/pdf/");
|
foreach (array('','/doc') as $valdir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/project/task/".$valdir);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -696,6 +720,13 @@ foreach ($dirmodels as $reldir)
|
|||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
$filelist[]=$file;
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
arsort($filelist);
|
||||||
|
|
||||||
|
foreach($filelist as $file)
|
||||||
{
|
{
|
||||||
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||||
{
|
{
|
||||||
@ -779,7 +810,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($handle);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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/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/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/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/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_merou.modules.php';
|
||||||
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php';
|
require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_rouget.modules.php';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user