diff --git a/ChangeLog b/ChangeLog
index 75e3da2e0a9..7101d08c570 100644
--- a/ChangeLog
+++ b/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 *****
diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php
index fa7495878fd..69a355f89de 100644
--- a/dev/skeletons/modMyModule.class.php
+++ b/dev/skeletons/modMyModule.class.php
@@ -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
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index d434837b3fb..4287ce1688c 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -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;
}
diff --git a/htdocs/includes/modules/modTelephonie.class.php b/htdocs/includes/modules/modTelephonie.class.php
index 73c3cdaea93..ba0fce6d938 100644
--- a/htdocs/includes/modules/modTelephonie.class.php
+++ b/htdocs/includes/modules/modTelephonie.class.php
@@ -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");
/**
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index b48135bbb07..5136594fcc2 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.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 ''.$langs->trans("MiscellanousChecks").":
\n";
// Check PHP version
-if (versioncompare(versionphp(),array(4,1)) < 0)
+if (versioncompare(versionphparray(),array(4,1)) < 0)
{
print '
'.$langs->trans("ErrorPHPVersionTooLow",'4.1');
$checksok=0;
}
else
{
- print '
'.$langs->trans("PHPVersion")." ".versiontostring(versionphp());
+ print '
'.$langs->trans("PHPVersion")." ".versiontostring(versionphparray());
}
print ' ('.$langs->trans("MoreInformation").')';
print "
\n";
diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php
index 183ae7a7f75..39a47068a39 100644
--- a/htdocs/install/etape2.php
+++ b/htdocs/install/etape2.php
@@ -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;
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index cde27fd2f36..c507029fc66 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -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;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 63e87f53dfa..c3a679c4b01 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -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 %s are not supported.
DictionnarySetup=Dictionnary setup
DisableJavascript=Disable JavaScript and Ajax functions
diff --git a/htdocs/langs/fr_BE/admin.lang b/htdocs/langs/fr_BE/admin.lang
index d2b0cc939b0..4b1c6829c82 100644
--- a/htdocs/langs/fr_BE/admin.lang
+++ b/htdocs/langs/fr_BE/admin.lang
@@ -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)
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index cd5a37c607d..8acedeac8ac 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -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 à %s ne sont pas supportées.
DictionnarySetup=Dictionnaires
DisableJavascript=Désactiver les fonctions Javascript et Ajax
diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php
index b7da692d789..ee640688ff0 100644
--- a/htdocs/lib/admin.lib.php
+++ b/htdocs/lib/admin.lib.php
@@ -1,4 +1,84 @@
+ * Copyright (C) 2005-2007 Regis Houssin
+ *
+ * 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 versionarray10 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
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index afdf8d89bc3..9e10b81be85 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -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 versionarray10 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