New: Ajout posibilit de controler version Dolibarr a activation des modules
This commit is contained in:
parent
d5b2913b44
commit
dc79ff70b8
10
ChangeLog
10
ChangeLog
@ -3,6 +3,7 @@ English Dolibarr changelog
|
||||
|
||||
***** Changelog for 2.4 compared to 2.2 *****
|
||||
|
||||
For users:
|
||||
- Removed useless code:
|
||||
Replaced phplot and phplot5 librairies by artichow.
|
||||
Removed cryptograph library replaced by artichow.
|
||||
@ -13,15 +14,18 @@ English Dolibarr changelog
|
||||
- Changes for compatibility with PHP6/Mysql6.
|
||||
- Add an ical export link in webcalendar module.
|
||||
- Reduce memory usage.
|
||||
- Now triggers are enabled/disabled according to module they
|
||||
refers to.
|
||||
- Now triggers are enabled/disabled according to module they refers to.
|
||||
- Fix infinite loop on popup calendar.
|
||||
- Change in tanslation to make Dolibarr easier to understand.
|
||||
- Add a warning when sending a mail from a user with no email defined.
|
||||
- A lot of other minor changes (features, look, fixes)
|
||||
- Added clicktodial module.
|
||||
|
||||
For developers:
|
||||
- Update code skeletons examples.
|
||||
- Add a tool to generate PHP classes mapped to a table.
|
||||
- Add a tool to generate PHP classes completely mapped to a table.
|
||||
- Added a check to enable external modules only if dolibarr version is high
|
||||
enough.
|
||||
|
||||
|
||||
***** Changelog for 2.2 compared to 2.1 *****
|
||||
|
||||
@ -82,6 +82,8 @@ class modMyModule extends DolibarrModules
|
||||
// Dependencies
|
||||
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of modules id to disable if this one is disabled
|
||||
$this->phpmin = array(4,1); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
|
||||
|
||||
// Constants
|
||||
$this->const = array(); // List of parameters
|
||||
|
||||
@ -17,18 +17,16 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/modules.php
|
||||
\brief Page de configuration et activation des modules
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
|
||||
$mode=isset($_GET["mode"])?$_GET["mode"]:0;
|
||||
$mesg=isset($_GET["mesg"])?urldecode($_GET["mesg"]):"";
|
||||
@ -66,44 +64,52 @@ if ($_GET["action"] == 'reset' && $user->admin)
|
||||
*/
|
||||
function Activate($value,$withdeps=1)
|
||||
{
|
||||
global $db, $modules, $langs;
|
||||
global $db, $modules, $langs;
|
||||
|
||||
$modName = $value;
|
||||
|
||||
// Activation du module
|
||||
if ($modName)
|
||||
{
|
||||
$file = $modName . ".class.php";
|
||||
include_once(DOL_DOCUMENT_ROOT."/includes/modules/$file");
|
||||
$objMod = new $modName($db);
|
||||
|
||||
// Test si version PHP ok
|
||||
$verphp=versionphp();
|
||||
$vermin=$objMod->phpmin;
|
||||
if (is_array($vermin) && versioncompare($verphp,$vermin) < 0)
|
||||
{
|
||||
return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin));
|
||||
}
|
||||
|
||||
$objMod->init();
|
||||
}
|
||||
|
||||
if ($withdeps)
|
||||
{
|
||||
// Activation des modules dont le module dépend
|
||||
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
||||
{
|
||||
Activate($objMod->depends[$i]);
|
||||
}
|
||||
|
||||
// Desactivation des modules qui entrent en conflit
|
||||
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
||||
$modName = $value;
|
||||
|
||||
// Activation du module
|
||||
if ($modName)
|
||||
{
|
||||
UnActivate($objMod->conflictwith[$i],0);
|
||||
$file = $modName . ".class.php";
|
||||
include_once(DOL_DOCUMENT_ROOT."/includes/modules/".$file);
|
||||
$objMod = new $modName($db);
|
||||
|
||||
// Test si version PHP ok
|
||||
$verphp=versionphparray();
|
||||
$vermin=$objMod->phpmin;
|
||||
if (is_array($vermin) && versioncompare($verphp,$vermin) < 0)
|
||||
{
|
||||
return $langs->trans("ErrorModuleRequirePHPVersion",versiontostring($vermin));
|
||||
}
|
||||
|
||||
// Test si version Dolibarr ok
|
||||
$verdol=versiondolibarrarray();
|
||||
$vermin=$objMod->need_dolibarr_version;
|
||||
if (is_array($vermin) && versioncompare($verdol,$vermin) < 0)
|
||||
{
|
||||
return $langs->trans("ErrorModuleRequireDolibarrVersion",versiontostring($vermin));
|
||||
}
|
||||
|
||||
$objMod->init();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
if ($withdeps)
|
||||
{
|
||||
// Activation des modules dont le module dépend
|
||||
for ($i = 0; $i < sizeof($objMod->depends); $i++)
|
||||
{
|
||||
Activate($objMod->depends[$i]);
|
||||
}
|
||||
|
||||
// Desactivation des modules qui entrent en conflit
|
||||
for ($i = 0; $i < sizeof($objMod->conflictwith); $i++)
|
||||
{
|
||||
UnActivate($objMod->conflictwith[$i],0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@
|
||||
\brief Fichier de description et activation du module de Telephonie
|
||||
*/
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/includes/modules/DolibarrModules.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -16,24 +16,22 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/check.php
|
||||
\ingroup install
|
||||
\brief Test si le fichier conf est modifiable et si il n'existe pas, test la possibilité de le créer
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
include_once("./inc.php");
|
||||
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||
|
||||
$err = 0;
|
||||
$allowinstall = 0;
|
||||
$allowupgrade = 0;
|
||||
$checksok = 1;
|
||||
|
||||
include_once("./inc.php");
|
||||
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:$langs->getDefaultLang());
|
||||
$langs->setDefaultLang($setuplang);
|
||||
|
||||
@ -55,14 +53,14 @@ print '<b>'.$langs->trans("MiscellanousChecks")."</b>:<br>\n";
|
||||
|
||||
|
||||
// Check PHP version
|
||||
if (versioncompare(versionphp(),array(4,1)) < 0)
|
||||
if (versioncompare(versionphparray(),array(4,1)) < 0)
|
||||
{
|
||||
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'4.1');
|
||||
$checksok=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphp());
|
||||
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray());
|
||||
}
|
||||
print ' (<a href="phpinfo.php" target="_info">'.$langs->trans("MoreInformation").'</a>)';
|
||||
print "<br>\n";
|
||||
|
||||
@ -15,19 +15,18 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/etape2.php
|
||||
\brief Cree les tables, cles primaires, cles etrangeres, index et fonctions en base puis charge les donnees de reference
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
include("./inc.php");
|
||||
require_once($dolibarr_main_document_root . "/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
require_once($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||
require_once($dolibarr_main_document_root."/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
require_once($dolibarr_main_document_root."/conf/conf.class.php");
|
||||
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||
|
||||
$etape = 2;
|
||||
$ok = 0;
|
||||
|
||||
@ -18,18 +18,17 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/fileconf.php
|
||||
\ingroup install
|
||||
\brief Demande les infos qui constituerons le contenu du fichier conf.php. Ce fichier sera remplie à l'étape suivante
|
||||
\version $Revision$
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
include_once("./inc.php");
|
||||
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||
|
||||
$err=0;
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ GUISetup=Display
|
||||
SetupArea=Setup area
|
||||
SecuritySetup=Security setup
|
||||
ErrorModuleRequirePHPVersion=Error, this module requires PHP version %s or higher
|
||||
ErrorModuleRequireDolibarrVersion=Error, this module requires Dolibarr version %s or higher
|
||||
ErrorDecimalLargerThanAreForbidden=Error, precision higher than <b>%s</b> are not supported.
|
||||
DictionnarySetup=Dictionnary setup
|
||||
DisableJavascript=Disable JavaScript and Ajax functions
|
||||
|
||||
@ -14,6 +14,7 @@ GUISetup=Affichage
|
||||
SetupArea=Zone de configuration
|
||||
SecuritySetup=Configuration de sécurité
|
||||
ErrorModuleRequirePHPVersion=Erreur, ce module nécessite PHP version %s ou supérieure
|
||||
ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou supérieure de Dolibarr
|
||||
DictionnarySetup=Dictionnaires
|
||||
DisableJavascript=Désactiver les fonctions JavaScript et Ajax
|
||||
UseSearchToSelectProduct=Utiliser un formulaire de recherche pour choisir un produit (plutôt que d'utiliser une liste déroulante)
|
||||
|
||||
@ -21,6 +21,7 @@ GUISetup=Affichage
|
||||
SetupArea=Espace configuration
|
||||
SecuritySetup=Configuration de la sécurité
|
||||
ErrorModuleRequirePHPVersion=Erreur, ce module requiert une version %s ou supérieure de PHP
|
||||
ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou supérieure de Dolibarr
|
||||
ErrorDecimalLargerThanAreForbidden=Erreur, les précisions supérieures à <b>%s</b> ne sont pas supportées.
|
||||
DictionnarySetup=Dictionnaires
|
||||
DisableJavascript=Désactiver les fonctions Javascript et Ajax
|
||||
|
||||
@ -1,4 +1,84 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/admin.lib.php
|
||||
\brief Library of admin functions
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoi une version en chaine depuis une version en tableau
|
||||
\param versionarray Tableau de version (vermajeur,vermineur,autre)
|
||||
\return string Chaine version
|
||||
*/
|
||||
function versiontostring($versionarray)
|
||||
{
|
||||
$string='?';
|
||||
if (isset($versionarray[0])) $string=$versionarray[0];
|
||||
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
||||
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Compare 2 versions
|
||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||
*/
|
||||
function versioncompare($versionarray1,$versionarray2)
|
||||
{
|
||||
$ret=0;
|
||||
$i=0;
|
||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
{
|
||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||
$i++;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Return version PHP
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
function versionphparray()
|
||||
{
|
||||
return split('\.',PHP_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Return version Dolibarr
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
function versiondolibarrarray()
|
||||
{
|
||||
return split('\.',DOL_VERSION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Launch a sql file
|
||||
|
||||
@ -21,13 +21,12 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/functions.inc.php
|
||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
\file htdocs/lib/functions.inc.php
|
||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
// Pour compatibilité lors de l'upgrade
|
||||
@ -39,51 +38,6 @@ if (! defined('DOL_DOCUMENT_ROOT'))
|
||||
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoi une version en chaine depuis une version en tableau
|
||||
\param versionarray Tableau de version (vermajeur,vermineur,autre)
|
||||
\return string Chaine version
|
||||
*/
|
||||
function versiontostring($versionarray)
|
||||
{
|
||||
$string='?';
|
||||
if (isset($versionarray[0])) $string=$versionarray[0];
|
||||
if (isset($versionarray[1])) $string.='.'.$versionarray[1];
|
||||
if (isset($versionarray[2])) $string.='.'.$versionarray[2];
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Compare 2 versions
|
||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||
*/
|
||||
function versioncompare($versionarray1,$versionarray2)
|
||||
{
|
||||
$ret=0;
|
||||
$i=0;
|
||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
{
|
||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||
$i++;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoie version PHP
|
||||
\return array Tableau de version (vermajeur,vermineur,autre)
|
||||
*/
|
||||
function versionphp()
|
||||
{
|
||||
return split('\.',PHP_VERSION);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Renvoi vrai si l'email est syntaxiquement valide
|
||||
|
||||
Loading…
Reference in New Issue
Block a user