forked from Wavyzz/dolibarr
Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -210,7 +210,7 @@ print '<div class="clearboth"></div>';
|
||||
$showpromotemessage = 1;
|
||||
if ($showpromotemessage) {
|
||||
$tmp = versiondolibarrarray();
|
||||
if (is_numeric($tmp[2])) { // Not alpha, beta or rc
|
||||
if (is_numeric($tmp[2]) && !isset($tmp[3])) { // Not alpha, beta or rc
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
@@ -38,6 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
|
||||
@@ -70,12 +71,12 @@ print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionProgram").'</
|
||||
// If current version differs from last upgrade
|
||||
if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) {
|
||||
// Compare version with last install database version (upgrades never occurred)
|
||||
if (DOL_VERSION != getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) {
|
||||
if (in_array(versioncompare(versiondolibarrarray(), preg_split('/[\-\.]/', getDolGlobalString('MAIN_VERSION_LAST_INSTALL'))), array(-2, -1, 1, 2))) {
|
||||
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL')));
|
||||
}
|
||||
} else {
|
||||
// Compare version with last upgrade database version
|
||||
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) {
|
||||
if (in_array(versioncompare(versiondolibarrarray(), preg_split('/[\-\.]/', getDolGlobalString('MAIN_VERSION_LAST_UPGRADE'))), array(-2, -1, 1, 2))) {
|
||||
print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,7 +812,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($conf->main_checkbox_left_column) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
@@ -855,7 +855,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if (!$conf->main_checkbox_left_column) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
@@ -870,7 +870,7 @@ if ($object->fetch($id) >= 0) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($conf->main_checkbox_left_column) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@@ -885,7 +885,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', '', $sortfield, $sortorder, 'center ');
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if (!$conf->main_checkbox_left_column) {
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
@@ -912,7 +912,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if ($conf->main_checkbox_left_column) {
|
||||
print '<td class="center nowraponall">';
|
||||
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
|
||||
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 '</td>';
|
||||
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
if (!$conf->main_checkbox_left_column) {
|
||||
print '<td class="center nowraponall">';
|
||||
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
|
||||
if ($obj->status == $object::STATUS_DRAFT) { // If status of target line is not sent yet
|
||||
|
||||
@@ -3434,6 +3434,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");
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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.
|
||||
@@ -118,7 +120,7 @@ function versioncompare($versionarray1, $versionarray2)
|
||||
}
|
||||
}
|
||||
//print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'<br>'."\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<int<0,2>,string> Tableau de version (vermajeur,vermineur,autre)
|
||||
* @return array<int<0,2>,string> Array of version (vermajor,verminor,vermaintenance,other)
|
||||
* @see versioncompare()
|
||||
*/
|
||||
function versiondolibarrarray()
|
||||
{
|
||||
return explode('.', DOL_VERSION);
|
||||
return preg_split('/[\-\.]/', DOL_VERSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -410,13 +410,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").': <b><span class="ok">'.(!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).'</span></b> - ';
|
||||
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE', getDolGlobalString('MAIN_VERSION_LAST_INSTALL')).'</span></b> - ';
|
||||
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
|
||||
//print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
|
||||
print '<br>';
|
||||
|
||||
@@ -688,7 +688,7 @@ if ($id > 0 || $ref) {
|
||||
|
||||
|
||||
// AWP
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<tr><td class="titlefieldmiddle">';
|
||||
print $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
|
||||
@@ -638,6 +638,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]);
|
||||
@@ -1756,7 +1757,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;
|
||||
@@ -1913,7 +1915,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]);
|
||||
@@ -2046,6 +2047,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]);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user