diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php
index aa552c5d052..3708d83e7df 100644
--- a/htdocs/admin/system/about.php
+++ b/htdocs/admin/system/about.php
@@ -210,7 +210,7 @@ print '
';
// Action column
- if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ if ($conf->main_checkbox_left_column) {
print '| ';
print '';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
@@ -996,7 +996,7 @@ if ($object->fetch($id) >= 0) {
print ' | ';
// Action column
- if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
+ if (!$conf->main_checkbox_left_column) {
print '';
print '';
if ($obj->status == $object::STATUS_DRAFT) { // If status of target line is not sent yet
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 768cc144700..670ecfa7ee3 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3431,6 +3431,7 @@ class Commande extends CommonOrder
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
+ $sql .= " fk_warehouse=".($this->warehouse_id > 0 ? $this->warehouse_id : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").",";
$sql .= " module_source = ".(isset($this->module_source) ? "'".$this->db->escape($this->module_source)."'" : "null").",";
$sql .= " pos_source = ".(isset($this->pos_source) ? "'".$this->db->escape($this->pos_source)."'" : "null");
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index d8fd72f1d8d..89d446dec4d 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -99,7 +99,6 @@ $form = new Form($db);
$formcompany = new FormCompany($db);
$formother = new FormOther($db);
-llxHeader();
$picto = 'bill';
$title = $langs->trans("BillsStatistics");
@@ -111,6 +110,7 @@ if ($mode == 'supplier') {
$dir = $conf->fournisseur->facture->dir_temp;
}
+llxHeader('', $title);
print load_fiche_titre($title, '', $picto);
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index f9a5e3ba0d8..f3cd4336586 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -185,6 +185,10 @@ class Interfaces
if (empty($modName)) {
continue;
}
+ if (!class_exists($modName)) {
+ dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger file was found with a name interfaces_*_*_".preg_replace('/^interface/', '', strtolower($modName)).".class.php, but the class ".$modName." seems to not exists even after the include of this interface file. Surely a bug in the trigger file or in its name.", LOG_ERR);
+ continue;
+ }
$objMod = new $modName($this->db);
'@phan-var-force DolibarrTriggers $objMod';
diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php
index f97e72c959d..8533e9419d9 100644
--- a/htdocs/core/lib/admin.lib.php
+++ b/htdocs/core/lib/admin.lib.php
@@ -52,8 +52,10 @@ function versiontostring($versionarray)
}
/**
- * Compare 2 versions (stored into 2 arrays).
- * To check if Dolibarr version is lower than (x,y,z), do "if versioncompare(versiondolibarrarray(), array(x.y.z)) <= 0"
+ * Compare 2 versions (stored into 2 arrays), to know if a version (a,b,c) is lower than (x,y,z)
+ * To check using a string version do a preg_split('/[\.\-]/', strinversion) to convert the string into an array.
+ * To check with Dolibarr version use versiondolibarrarray() to get the array of Dolibarr current version
+ *
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,-5)) >= 0) is true if version is 4.0 alpha or higher.
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,0)) >= 0) is true if version is 4.0 final or higher.
* For example: if (versioncompare(versiondolibarrarray(),array(4,0,1)) >= 0) is true if version is 4.0.1 or higher.
@@ -61,9 +63,9 @@ function versiontostring($versionarray)
*
* @param array $versionarray1 Array of version (vermajor,verminor,patch)
* @param array $versionarray2 Array of version (vermajor,verminor,patch)
- * @return int<-4,4> -4,-3,-2,-1 if versionarray1versionarray2 (value depends on level of difference)
+ * @return int<-4,4> -4,-3,-2,-1 if versionarray1versionarray2 (value depends on level of difference)
* @see versiontostring()
*/
function versioncompare($versionarray1, $versionarray2)
@@ -118,7 +120,7 @@ function versioncompare($versionarray1, $versionarray2)
}
}
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.' '."\n";
- return $ret;
+ return $ret; // return level=1 if difference is on the main version, level=2 on minor version, level=3 on maintenance version, level=4 on development phase version
}
@@ -136,12 +138,12 @@ function versionphparray()
/**
* Return version Dolibarr
*
- * @return array,string> Tableau de version (vermajeur,vermineur,autre)
+ * @return array,string> Array of version (vermajor,verminor,vermaintenance,other)
* @see versioncompare()
*/
function versiondolibarrarray()
{
- return explode('.', DOL_VERSION);
+ return preg_split('/[\-\.]/', DOL_VERSION);
}
diff --git a/htdocs/install/check.php b/htdocs/install/check.php
index 2514bb9a05d..e9cecca5aa8 100644
--- a/htdocs/install/check.php
+++ b/htdocs/install/check.php
@@ -409,13 +409,13 @@ if (!file_exists($conffile)) {
// Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
// Version to install is DOL_VERSION
- $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL) ? $conf->global->MAIN_VERSION_LAST_INSTALL : ''));
+ $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', getDolGlobalString('MAIN_VERSION_LAST_UPGRADE', getDolGlobalString('MAIN_VERSION_LAST_INSTALL')));
$dolibarrversiontoinstallarray = versiondolibarrarray();
}
// Show title
if (getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') || getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) {
- print $langs->trans("VersionLastUpgrade").': '.(!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).' - ';
+ print $langs->trans("VersionLastUpgrade").': '.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE', getDolGlobalString('MAIN_VERSION_LAST_INSTALL')).' - ';
print $langs->trans("VersionProgram").': '.DOL_VERSION.'';
//print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
print ' ';
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index 6dc3dde32e7..47797801705 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -688,7 +688,7 @@ if ($id > 0 || $ref) {
// AWP
- print '| ';
+ print ' | | ';
print $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc"));
print ' | ';
print '';
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 3bc9a292652..0afa2f94d29 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -631,6 +631,7 @@ class Reception extends CommonObject
if ($qty == 0 || ($qty < 0 && !getDolGlobalInt('RECEPTION_ALLOW_NEGATIVE_QTY'))) {
continue;
}
+
dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid);
//var_dump($this->lines[$i]);
@@ -1748,7 +1749,8 @@ class Reception extends CommonObject
if ($qty <= 0) {
continue;
}
- dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid." edb.rowid=".$obj->edbrowid);
+
+ dol_syslog(get_class($this)."::valid movement index ".$i." ed.rowid=".$obj->rowid);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
@@ -1905,7 +1907,6 @@ class Reception extends CommonObject
if ($qty <= 0) {
continue;
}
-
dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid);
//var_dump($this->lines[$i]);
@@ -2038,6 +2039,10 @@ class Reception extends CommonObject
$qty = $obj->qty;
+ if ($qty <= 0) {
+ continue;
+ }
+
dol_syslog(get_class($this)."::reopen reception movement index ".$i." ed.rowid=".$obj->rowid);
//var_dump($this->lines[$i]);
diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php
index a65234cecf0..2362afb5ae7 100644
--- a/test/phpunit/AdminLibTest.php
+++ b/test/phpunit/AdminLibTest.php
@@ -76,6 +76,38 @@ class AdminLibTest extends CommonClassTest
print __METHOD__." result=".$result."\n";
$this->assertEquals(0, $result);
+ // Upgrade required
+ $v1 = '21.0.0-beta'; $v2 = '21.0.0-rc';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
+ $v1 = '21.0.0-beta'; $v2 = '21.0.0';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
+ $v1 = '21.1.1'; $v2 = '21.0.1';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
+ $v1 = '22.0.1'; $v2 = '21.0.1';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(true, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
+ // Upgrade not required
+ $v1 = '21.0.0'; $v2 = '21.0.0';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(false, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
+ $v1 = '21.0.1'; $v2 = '21.0.0';
+ $versioncompared = abs(versioncompare(preg_split('/[\.\-]/', $v1), preg_split('/[\.\-]/', $v2)));
+ $upgraderequired = in_array($versioncompared, array(-4, -2, -1, 1, 2, 4));
+ $this->assertEquals(false, $upgraderequired, 'Error with v1='.$v1.' v2='.$v2.' versioncompared='.$versioncompared);
+
return $result;
}
| |