From c555d1274b354e0731db9b488e144bfd3ac2b6a0 Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Thu, 28 Jun 2018 08:22:50 +0000 Subject: [PATCH 01/17] Creating SVN branch for iTop 2.5 SVN:2.5[5920] From 774ecb4003ec1c9ed5d57fe34b80a3e7c6e5388f Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 5 Jul 2018 13:02:10 +0000 Subject: [PATCH 02/17] (retrofit from trunk) Do not check if the organizations are allowed if there is no user logged in (use case: automatic synchro of users at connection time) SVN:2.5[5931] --- addons/userrights/userrightsprofile.class.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/userrights/userrightsprofile.class.inc.php b/addons/userrights/userrightsprofile.class.inc.php index ea2ac63a8..cf943fb5d 100644 --- a/addons/userrights/userrightsprofile.class.inc.php +++ b/addons/userrights/userrightsprofile.class.inc.php @@ -402,9 +402,9 @@ class URP_UserOrg extends UserRightsBaseClassGUI */ protected function CheckIfOrgIsAllowed() { - if (UserRights::IsAdministrator()) { return; } + if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; } - $oUser = UserRights::GetUserObject(); + $oUser = UserRights::GetUserObject(); $oAddon = UserRights::GetModuleInstance(); $aOrgs = $oAddon->GetUserOrgs($oUser, ''); if (count($aOrgs) > 0) From 6e9fcb81f0a7b12ce9852f59a8369f9085051e72 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 12 Jul 2018 07:46:36 +0000 Subject: [PATCH 03/17] (Retrofit from trunk) Fix setup for PHP 5.5 (cannot use expression as default field value) (r5933) SVN:2.5[5934] --- core/attributedef.class.inc.php | 30 +++++++++++++++--------------- core/cmdbsource.class.inc.php | 28 ++++++++++++++++------------ 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 16bf152a5..b4ac8205b 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -1578,7 +1578,7 @@ class AttributeDBFieldVoid extends AttributeDefinition protected function GetSQLCol($bFullSpec = false) { return 'VARCHAR(255)' - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } protected function GetSQLColSpec() @@ -2205,7 +2205,7 @@ class AttributeString extends AttributeDBField protected function GetSQLCol($bFullSpec = false) { return 'VARCHAR(255)' - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } @@ -2606,7 +2606,7 @@ class AttributePassword extends AttributeString protected function GetSQLCol($bFullSpec = false) { return "VARCHAR(64)" - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } @@ -2739,7 +2739,7 @@ class AttributeText extends AttributeString protected function GetSQLCol($bFullSpec = false) { - return "TEXT".CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + return "TEXT".CMDBSource::GetSqlStringColumnDefinition(); } public function GetSQLColumns($bFullSpec = false) @@ -2749,7 +2749,7 @@ class AttributeText extends AttributeString if ($this->GetOptional('format', null) != null ) { // Add the extra column only if the property 'format' is specified for the attribute - $aColumns[$this->Get('sql').'_format'] = "ENUM('text','html')".CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + $aColumns[$this->Get('sql').'_format'] = "ENUM('text','html')".CMDBSource::GetSqlStringColumnDefinition(); if ($bFullSpec) { $aColumns[$this->Get('sql').'_format'].= " DEFAULT 'text'"; // default 'text' is for migrating old records @@ -3072,7 +3072,7 @@ class AttributeLongText extends AttributeText { protected function GetSQLCol($bFullSpec = false) { - return "LONGTEXT".CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + return "LONGTEXT".CMDBSource::GetSqlStringColumnDefinition(); } public function GetMaxSize() @@ -3254,7 +3254,7 @@ class AttributeCaseLog extends AttributeLongText { $aColumns = array(); $aColumns[$this->GetCode()] = 'LONGTEXT' // 2^32 (4 Gb) - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + .CMDBSource::GetSqlStringColumnDefinition(); $aColumns[$this->GetCode().'_index'] = 'BLOB'; return $aColumns; } @@ -3642,13 +3642,13 @@ class AttributeEnum extends AttributeString // make sure that this string will match the field type returned by the DB // (used to perform a comparison between the current DB format and the data model) return "ENUM(".implode(",", $aValues).")" - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } else { return "VARCHAR(255)" - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? " DEFAULT ''" : ""); // ENUM() is not an allowed syntax! } } @@ -5463,7 +5463,7 @@ class AttributeURL extends AttributeString protected function GetSQLCol($bFullSpec = false) { return "VARCHAR(2048)" - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } @@ -5640,8 +5640,8 @@ class AttributeBlob extends AttributeDefinition { $aColumns = array(); $aColumns[$this->GetCode().'_data'] = 'LONGBLOB'; // 2^32 (4 Gb) - $aColumns[$this->GetCode().'_mimetype'] = 'VARCHAR(255)'.CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; - $aColumns[$this->GetCode().'_filename'] = 'VARCHAR(255)'.CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + $aColumns[$this->GetCode().'_mimetype'] = 'VARCHAR(255)'.CMDBSource::GetSqlStringColumnDefinition(); + $aColumns[$this->GetCode().'_filename'] = 'VARCHAR(255)'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; } @@ -6779,7 +6779,7 @@ class AttributeOneWayPassword extends AttributeDefinition public function GetImportColumns() { $aColumns = array(); - $aColumns[$this->GetCode()] = 'TINYTEXT'.CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + $aColumns[$this->GetCode()] = 'TINYTEXT'.CMDBSource::GetSqlStringColumnDefinition(); return $aColumns; } @@ -6853,7 +6853,7 @@ class AttributeTable extends AttributeDBField protected function GetSQLCol($bFullSpec = false) { - return "LONGTEXT".CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION; + return "LONGTEXT".CMDBSource::GetSqlStringColumnDefinition(); } public function GetMaxSize() @@ -7261,7 +7261,7 @@ class AttributeRedundancySettings extends AttributeDBField protected function GetSQLCol($bFullSpec = false) { return "VARCHAR(20)" - .CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION + .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } diff --git a/core/cmdbsource.class.inc.php b/core/cmdbsource.class.inc.php index 86f62c07d..0bdeab500 100644 --- a/core/cmdbsource.class.inc.php +++ b/core/cmdbsource.class.inc.php @@ -108,16 +108,6 @@ class MySQLHasGoneAwayException extends MySQLException */ class CMDBSource { - /** - * SQL charset & collation declaration for text columns - * - * Using an attribute instead of a constant to avoid crash in the setup for older PHP versions - * - * @see https://dev.mysql.com/doc/refman/5.7/en/charset-column.html - * @since 2.5 #1001 switch to utf8mb4 - */ - public static $SQL_STRING_COLUMNS_CHARSET_DEFINITION = ' CHARACTER SET '.DEFAULT_CHARACTER_SET.' COLLATE '.DEFAULT_COLLATION; - protected static $m_sDBHost; protected static $m_sDBUser; protected static $m_sDBPwd; @@ -136,6 +126,20 @@ class CMDBSource /** @var mysqli $m_oMysqli */ protected static $m_oMysqli; + /** + * SQL charset & collation declaration for text columns + * + * Using a function instead of a constant or attribute to avoid crash in the setup for older PHP versions (cannot + * use expression as value) + * + * @see https://dev.mysql.com/doc/refman/5.7/en/charset-column.html + * @since 2.5 #1001 switch to utf8mb4 + */ + public static function GetSqlStringColumnDefinition() + { + return ' CHARACTER SET '.DEFAULT_CHARACTER_SET.' COLLATE '.DEFAULT_COLLATION; + } + /** * @param Config $oConfig * @@ -1059,7 +1063,7 @@ class CMDBSource } - return 'ALTER TABLE `'.$sTableName.'` '.self::$SQL_STRING_COLUMNS_CHARSET_DEFINITION.';'; + return 'ALTER TABLE `'.$sTableName.'` '.self::GetSqlStringColumnDefinition().';'; } @@ -1205,6 +1209,6 @@ class CMDBSource return null; } - return 'ALTER DATABASE'.CMDBSource::$SQL_STRING_COLUMNS_CHARSET_DEFINITION.';'; + return 'ALTER DATABASE'.CMDBSource::GetSqlStringColumnDefinition().';'; } } From e184eb6aaef7264610b87f6cde7c33b1ed480cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Tue, 17 Jul 2018 12:19:26 +0000 Subject: [PATCH 04/17] Retrofit from trunk DBObject->GetOriginal() hardening (now support attributes not set: for example sla_tto_passed for UserRequest until it is closed) [from revision 5932] SVN:2.5[5942] --- core/dbobject.class.php | 3 ++- test/ItopDataTestCase.php | 20 ++++++++++++++++++++ test/core/DBObjectTest.php | 16 +++++++++++----- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/core/dbobject.class.php b/core/dbobject.class.php index cc55628e8..79bce7ff8 100644 --- a/core/dbobject.class.php +++ b/core/dbobject.class.php @@ -568,7 +568,8 @@ abstract class DBObject implements iDisplay { throw new CoreException("Unknown attribute code '$sAttCode' for the class ".get_class($this)); } - return $this->m_aOrigValues[$sAttCode]; + $aOrigValues = $this->m_aOrigValues; + return isset($aOrigValues[$sAttCode]) ? $aOrigValues[$sAttCode] : null; } /** diff --git a/test/ItopDataTestCase.php b/test/ItopDataTestCase.php index 9a7ec5d35..0123f3bae 100644 --- a/test/ItopDataTestCase.php +++ b/test/ItopDataTestCase.php @@ -112,6 +112,26 @@ class ItopDataTestCase extends ItopTestCase return $oMyObj; } + /** + * @param string $sClass + * @param $iKey + * @param array $aParams + * + * @return DBObject + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + */ + protected static function updateObject($sClass, $iKey, $aParams) + { + $oMyObj = MetaModel::GetObject($sClass, $iKey); + foreach($aParams as $sAttCode => $oValue) + { + $oMyObj->Set($sAttCode, $oValue); + } + $oMyObj->DBUpdate(); + return $oMyObj; + } /** * Create an Organization in database diff --git a/test/core/DBObjectTest.php b/test/core/DBObjectTest.php index 24afa0904..a6e2ea25c 100644 --- a/test/core/DBObjectTest.php +++ b/test/core/DBObjectTest.php @@ -26,9 +26,8 @@ namespace Combodo\iTop\Test\UnitTest\Core; -use Combodo\iTop\Test\UnitTest\ItopTestCase; +use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use DBObject; -use PHPUnit\Framework\TestCase; /** @@ -36,7 +35,7 @@ use PHPUnit\Framework\TestCase; * @preserveGlobalState disabled * @backupGlobals disabled */ -class DBObjectTest extends ItopTestCase +class DBObjectTest extends ItopDataTestCase { protected function setUp() { @@ -50,7 +49,7 @@ class DBObjectTest extends ItopTestCase */ public function testGetUIPage() { - $this->assertEquals('UI.php', DBObject::GetUIPage()); + static::assertEquals('UI.php', DBObject::GetUIPage()); } /** @@ -61,7 +60,7 @@ class DBObjectTest extends ItopTestCase */ public function testIsValidPKeyOK($key, $res) { - $this->assertEquals(DBObject::IsValidPKey($key), $res); + static::assertEquals(DBObject::IsValidPKey($key), $res); } public function keyProviderOK() @@ -80,4 +79,11 @@ class DBObjectTest extends ItopTestCase array('PHP_INT_MIN', false)); } + public function testGetOriginal() + { + $oObject = $this->CreateUserRequest(190664); + + static::assertNull($oObject->GetOriginal('sla_tto_passed')); + } + } From efa1f4ee43517367f822f8cd9c39c2f27767574f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Tue, 17 Jul 2018 12:22:09 +0000 Subject: [PATCH 05/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01551=20-?= =?UTF-8?q?=20Search:=20selected=20org=20&=20default=20criteria=20Display?= =?UTF-8?q?=20the=20default=20search=20criteria=20also=20when=20an=20org?= =?UTF-8?q?=20is=20selected.=20The=20org=20restriction=20criterion=20is=20?= =?UTF-8?q?read=20only.=20[from=20revision=205939]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5943] --- application/displayblock.class.inc.php | 3 +- .../search/searchform.class.inc.php | 63 +++++++++++++++++-- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 9c69f1caf..476b34b4a 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -326,7 +326,8 @@ class DisplayBlock { $aQueryParams = $aExtraParams['query_params']; } - if ($this->m_sStyle != 'links') + // In case of search, the context filtering is done by the search itself + if (($this->m_sStyle != 'links') && ($this->m_sStyle != 'search')) { $oAppContext = new ApplicationContext(); $sClass = $this->m_oFilter->GetClass(); diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php index 2c0700def..6e4a9db6c 100644 --- a/sources/application/search/searchform.class.inc.php +++ b/sources/application/search/searchform.class.inc.php @@ -480,13 +480,12 @@ class SearchForm { $aOrCriterion = array(); $bIsEmptyExpression = true; + $aArgs = MetaModel::PrepareQueryArguments($aArgs, $oSearch->GetInternalParams()); if (method_exists($oSearch, 'GetCriteria')) { $oExpression = $oSearch->GetCriteria(); - $aArgs = MetaModel::PrepareQueryArguments($aArgs, $oSearch->GetInternalParams()); - if (!empty($aArgs)) { try @@ -521,12 +520,50 @@ class SearchForm } } + // Context induced criteria are read-only + $oAppContext = new ApplicationContext(); + $sClass = $oSearch->GetClass(); + $aCallSpec = array($sClass, 'MapContextParam'); + $aContextParams = array(); + if (is_callable($aCallSpec)) + { + foreach($oAppContext->GetNames() as $sContextParam) + { + $sParamCode = call_user_func($aCallSpec, $sContextParam); //Map context parameter to the value/filter code depending on the class + if (!is_null($sParamCode)) + { + $sParamValue = $oAppContext->GetCurrentValue($sContextParam, null); + if (!is_null($sParamValue)) + { + $aContextParams[$sParamCode] = $sParamValue; + } + } + } + } + if ($bIsEmptyExpression) { // Add default criterion - $aOrCriterion = $this->GetDefaultCriterion($oSearch); + $aOrCriterion = $this->GetDefaultCriterion($oSearch, $aContextParams); } + foreach($aContextParams as $sParamCode => $sParamValue) + { + // Add Context criteria in read only mode + $sAlias = $oSearch->GetClassAlias(); + $oFieldExpression = new FieldExpression($sParamCode, $sAlias); + $oScalarExpression = new \ScalarExpression($sParamValue); + $oExpression = new \BinaryExpression($oFieldExpression, '=', $oScalarExpression); + $aCriterion = $oExpression->GetCriterion($oSearch, $aArgs); + $aCriterion['is_removable'] = false; + foreach($aOrCriterion as &$aAndExpression) + { + $aAndExpression['and'][] = $aCriterion; + } + } + + + return array('or' => $aOrCriterion); } @@ -640,9 +677,11 @@ class SearchForm /** * @param DBObjectSearch $oSearch + * @param $aContextParams + * * @return array */ - protected function GetDefaultCriterion($oSearch) + protected function GetDefaultCriterion($oSearch, &$aContextParams = array()) { $aAndCriterion = array(); $sClass = $oSearch->GetClass(); @@ -661,8 +700,20 @@ class SearchForm $sAlias = $oSearch->GetClassAlias(); foreach($aList as $sAttCode) { - $oFieldExpression = new FieldExpression($sAttCode, $sAlias); - $aCriterion = $oFieldExpression->GetCriterion($oSearch); + $oExpression = new FieldExpression($sAttCode, $sAlias); + $bIsRemovable = true; + if (isset($aContextParams[$sAttCode])) + { + // When a context parameter exists, use it with the default search criteria + $oFieldExpression = $oExpression; + $oScalarExpression = new \ScalarExpression($aContextParams[$sAttCode]); + $oExpression = new \BinaryExpression($oFieldExpression, '=', $oScalarExpression); + unset($aContextParams[$sAttCode]); + // Read only mode for search criteria from context + $bIsRemovable = false; + } + $aCriterion = $oExpression->GetCriterion($oSearch); + $aCriterion['is_removable'] = $bIsRemovable; if (isset($aCriterion['widget']) && ($aCriterion['widget'] != AttributeDefinition::SEARCH_WIDGET_TYPE_RAW)) { $aAndCriterion[] = $aCriterion; From 0bbb5860946081b43e2eaef29906e8f59ce4b1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Tue, 17 Jul 2018 12:23:27 +0000 Subject: [PATCH 06/17] Retrofit from trunk Advanced search: Fix an error when using search form from an union. [from revision 5940] SVN:2.5[5944] --- core/oql/expression.class.inc.php | 46 ++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/core/oql/expression.class.inc.php b/core/oql/expression.class.inc.php index 8f0e9ec22..3d3f4e80e 100644 --- a/core/oql/expression.class.inc.php +++ b/core/oql/expression.class.inc.php @@ -461,15 +461,23 @@ class BinaryExpression extends Expression public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array()) { $bReverseOperator = false; + if (method_exists($oSearch, 'GetJoinedClasses')) + { + $aClasses = $oSearch->GetJoinedClasses(); + } + else + { + $aClasses = array($oSearch->GetClass()); + } $oLeftExpr = $this->GetLeftExpr(); if ($oLeftExpr instanceof FieldExpression) { - $oAttDef = $oLeftExpr->GetAttDef($oSearch->GetJoinedClasses()); + $oAttDef = $oLeftExpr->GetAttDef($aClasses); } $oRightExpr = $this->GetRightExpr(); if ($oRightExpr instanceof FieldExpression) { - $oAttDef = $oRightExpr->GetAttDef($oSearch->GetJoinedClasses()); + $oAttDef = $oRightExpr->GetAttDef($aClasses); $bReverseOperator = true; } @@ -523,17 +531,33 @@ class BinaryExpression extends Expression return Dict::S('Expression:Operator:'.$sOperator, " $sOperator "); } + /** + * @param DBSearch $oSearch + * @param null $aArgs + * @param bool $bRetrofitParams + * @param null $oAttDef + * + * @return array + */ public function GetCriterion($oSearch, &$aArgs = null, $bRetrofitParams = false, $oAttDef = null) { $bReverseOperator = false; $oLeftExpr = $this->GetLeftExpr(); $oRightExpr = $this->GetRightExpr(); - $oAttDef = $oLeftExpr->GetAttDef($oSearch->GetJoinedClasses()); + if (method_exists($oSearch, 'GetJoinedClasses')) + { + $aClasses = $oSearch->GetJoinedClasses(); + } + else + { + $aClasses = array($oSearch->GetClass()); + } + $oAttDef = $oLeftExpr->GetAttDef($aClasses); if (is_null($oAttDef)) { - $oAttDef = $oRightExpr->GetAttDef($oSearch->GetJoinedClasses()); + $oAttDef = $oRightExpr->GetAttDef($aClasses); $bReverseOperator = true; } @@ -547,7 +571,7 @@ class BinaryExpression extends Expression { $aCriteriaRight = $oRightExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef); // $oAttDef can be different now - $oAttDef = $oRightExpr->GetAttDef($oSearch->GetJoinedClasses()); + $oAttDef = $oRightExpr->GetAttDef($aClasses); $aCriteriaLeft = $oLeftExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef); // switch left and right expressions so reverse the operator @@ -576,7 +600,7 @@ class BinaryExpression extends Expression { $aCriteriaLeft = $oLeftExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef); // $oAttDef can be different now - $oAttDef = $oLeftExpr->GetAttDef($oSearch->GetJoinedClasses()); + $oAttDef = $oLeftExpr->GetAttDef($aClasses); $aCriteriaRight = $oRightExpr->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef); $aCriteria = self::MergeCriteria($aCriteriaLeft, $aCriteriaRight, $this->GetOperator()); @@ -937,7 +961,15 @@ class FieldExpression extends UnaryExpression { return "`{$this->m_sName}`"; } - $sClass = $this->GetClassName($oSearch->GetJoinedClasses()); + if (method_exists($oSearch, 'GetJoinedClasses')) + { + $aClasses = $oSearch->GetJoinedClasses(); + } + else + { + $aClasses = array($oSearch->GetClass()); + } + $sClass = $this->GetClassName($aClasses); $sAttName = MetaModel::GetLabel($sClass, $this->m_sName); if ($sClass != $oSearch->GetClass()) { From c630676792b202bbba9ef8ff9f14af5e34e27263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Thu, 19 Jul 2018 08:06:39 +0000 Subject: [PATCH 07/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01555=20-?= =?UTF-8?q?=20Search:=20ExternalField=20label=20not=20displayed.=20The=20s?= =?UTF-8?q?earch=20is=20not=20restricted=20for=20external=20fields=20anymo?= =?UTF-8?q?re.=20[from=20revision=205945]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5953] --- sources/application/search/searchform.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php index 6e4a9db6c..4493f154a 100644 --- a/sources/application/search/searchform.class.inc.php +++ b/sources/application/search/searchform.class.inc.php @@ -400,7 +400,7 @@ class SearchForm protected function IsSubAttribute($oAttDef) { - return (($oAttDef instanceof AttributeFriendlyName) || ($oAttDef instanceof AttributeExternalField) || ($oAttDef instanceof AttributeSubItem)); + return (($oAttDef instanceof AttributeFriendlyName) || ($oAttDef instanceof AttributeSubItem)); } /** From 8ffea22f0e4e357b9cd558007aab717d5a76cd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Thu, 19 Jul 2018 08:10:32 +0000 Subject: [PATCH 08/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01561=20-?= =?UTF-8?q?=20Fix=20auto-complete=20error=20when=20the=20friendlyname=20de?= =?UTF-8?q?pends=20on=20other=20classes=20[from=20revision=205948]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5954] --- core/valuesetdef.class.inc.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/core/valuesetdef.class.inc.php b/core/valuesetdef.class.inc.php index 855507104..5ac87bfaa 100644 --- a/core/valuesetdef.class.inc.php +++ b/core/valuesetdef.class.inc.php @@ -228,10 +228,23 @@ class ValueSetObjects extends ValueSetDefinition } } + $oExpression = DBObjectSearch::GetPolymorphicExpression($oFilter->GetClass(), 'friendlyname'); + $aFields = $oExpression->ListRequiredFields(); + $sClass = $oFilter->GetClass(); + foreach($aFields as $sField) + { + $aFieldItems = explode('.', $sField); + if ($aFieldItems[0] != $sClass) + { + $sOperation = 'contains'; + break; + } + } + switch ($sOperation) { case 'equals': - $aAttributes = MetaModel::GetFriendlyNameAttributeCodeList($oFilter->GetClass()); + $aAttributes = MetaModel::GetFriendlyNameAttributeCodeList($sClass); $sClassAlias = $oFilter->GetClassAlias(); $aFilters = array(); $oValueExpr = new ScalarExpression($sContains); @@ -247,7 +260,7 @@ class ValueSetObjects extends ValueSetDefinition $oFilter = new DBUnionSearch($aFilters); break; case 'start_with': - $aAttributes = MetaModel::GetFriendlyNameAttributeCodeList($oFilter->GetClass()); + $aAttributes = MetaModel::GetFriendlyNameAttributeCodeList($sClass); $sClassAlias = $oFilter->GetClassAlias(); $aFilters = array(); $oValueExpr = new ScalarExpression($sContains.'%'); From 045f58144ea077f9718f89c8711a4cac8bd667c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Thu, 19 Jul 2018 08:14:26 +0000 Subject: [PATCH 09/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01553=20-?= =?UTF-8?q?=20Search:=20Fix=20operator=20on=20indexed=20attributes.=20It?= =?UTF-8?q?=20was=20previously=20always=20forced=20to=20'=3D',=20now=20it'?= =?UTF-8?q?s=20only=20defaulted=20to=20'=3D'=20[from=20revision=205950]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5955] --- js/search/search_form_criteria.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/search/search_form_criteria.js b/js/search/search_form_criteria.js index 569e5fffb..11df536c6 100644 --- a/js/search/search_form_criteria.js +++ b/js/search/search_form_criteria.js @@ -152,7 +152,7 @@ $(function() _initChooseDefaultOperator: function() { //if the class has an index, in order to maximize the performance, we force the default operator to "equal" - if (this.options.field.has_index && typeof this.options.available_operators['='] == 'object') + if (this.options.field.has_index && typeof this.options.available_operators['='] == 'object' && this.options.values.length == 0) { this.options.operator = '='; this.options.available_operators['='].rank = -1;//we want it to be the first displayed From a454a4311186f9d48240065f465df9f9e9043a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Thu, 19 Jul 2018 08:17:46 +0000 Subject: [PATCH 10/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01556=20-?= =?UTF-8?q?=20Search:=20Fix=20removing=20last=20criterion=20on=20a=20'or'?= =?UTF-8?q?=20line=20resulted=20in=20'OR=201'.=20The=20empty=20OR=20condit?= =?UTF-8?q?ion=20is=20now=20removed=20completely=20from=20the=20screen=20a?= =?UTF-8?q?nd=20the=20criterion=20list.=20[from=20revision=205951]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5956] --- js/search/search_form_handler.js | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/js/search/search_form_handler.js b/js/search/search_form_handler.js index 38f2e5e39..ec32d43fe 100644 --- a/js/search/search_form_handler.js +++ b/js/search/search_form_handler.js @@ -238,15 +238,30 @@ $(function() this.elements.criterion_area.find('.sf_criterion_row').each(function(iIdx){ var oCriterionRowElem = $(this); - oCriterion['or'][iIdx] = {'and': []}; - oCriterionRowElem.find('.search_form_criteria').each(function(){ - var oCriteriaData = $(this).triggerHandler('itop.search.criteria.get_data'); - - if (null != oCriteriaData) + if (oCriterionRowElem.find('.search_form_criteria').length == 0 && iIdx > 0) + { + $(this).remove(); + } + else + { + oCriterionRowElem.find('.search_form_criteria').each(function () { - oCriterion['or'][iIdx]['and'].push(oCriteriaData); - } - }); + var oCriteriaData = $(this).triggerHandler('itop.search.criteria.get_data'); + + if (null != oCriteriaData) + { + if (!oCriterion['or'][iIdx]) + { + oCriterion['or'][iIdx] = {'and': []}; + } + oCriterion['or'][iIdx]['and'].push(oCriteriaData); + } + else + { + $(this).remove(); + } + }); + } }); // - Update search this.options.search.criterion = oCriterion; From e276587fdc6fb0a9c3f25cbbb55741eae5f3366d Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 25 Jul 2018 07:57:31 +0000 Subject: [PATCH 11/17] =?UTF-8?q?N=C2=B0931=20change=20iTop=202.6=20MySQL?= =?UTF-8?q?=20requirements=20from=205.5.3=20to=205.6=20(to=20have=20fullte?= =?UTF-8?q?xt=20on=20InnoDB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5978] --- setup/setuputils.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index 34c2e2a43..a27ebd6e2 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -54,7 +54,7 @@ class SetupUtils const MYSQL_MIN_VERSION = '5.5.3'; // 5.5 branch that is shipped with most distribution, and 5.5.3 to have utf8mb4 (see N°942) // -- versions that will be the minimum in next iTop major release (warning if not met) const PHP_NEXT_MIN_VERSION = ''; // no new PHP requirement for now in iTop 2.6 - const MYSQL_NEXT_MIN_VERSION = ''; // no new MySQL requirement for now in iTop 2.6 + const MYSQL_NEXT_MIN_VERSION = '5.6.0'; // 5.6 to have fulltext on InnoDB for Tags fields (N°931) // -- First recent version that is not yet validated by Combodo (warning) const PHP_NOT_VALIDATED_VERSION = '7.3.0'; From 821eb4df8cdf7aa7f89b8436981fddc16c5ad440 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 30 Jul 2018 10:31:22 +0000 Subject: [PATCH 12/17] (Retrofit from trunk) PHP 7.2 compatibility: fix another count(null) (r5988) SVN:2.5[5989] --- application/cmdbabstract.class.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index e19a985b6..9059107e6 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -3505,7 +3505,7 @@ EOF foreach (MetaModel::EnumPlugins('iApplicationObjectExtension') as $oExtensionInstance) { $aNewIssues = $oExtensionInstance->OnCheckToDelete($this); - if (count($aNewIssues) > 0) + if (is_array($aNewIssues) && count($aNewIssues) > 0) { $this->m_aDeleteIssues = array_merge($this->m_aDeleteIssues, $aNewIssues); } From c3f80a58763efee72020d8963c847ff738e52cfb Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 1 Aug 2018 09:13:15 +0000 Subject: [PATCH 13/17] =?UTF-8?q?(Retrofit=20from=20trunk)=20N=C2=B01582?= =?UTF-8?q?=20Fix=20audit=20when=20a=20current=20organization=20is=20set?= =?UTF-8?q?=20and=20there=20is=20an=20audit=20rule=20with=20valid=3Dtrue?= =?UTF-8?q?=20Was=20generating=20an=20OQL=20missing=20query=20argument=20e?= =?UTF-8?q?rror=20(r5991)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[5992] --- core/coreexception.class.inc.php | 2 -- core/dbobjectsearch.class.php | 38 +++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/core/coreexception.class.inc.php b/core/coreexception.class.inc.php index fe1f58b6c..ae1a18af8 100644 --- a/core/coreexception.class.inc.php +++ b/core/coreexception.class.inc.php @@ -127,5 +127,3 @@ class SecurityException extends CoreException class ArchivedObjectException extends CoreException { } - -?> diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index 8c2b24eb0..ce6153aa4 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -497,6 +497,8 @@ class DBObjectSearch extends DBSearch * @param bool $bPositiveMatch if true will add a IN filter, else a NOT IN * * @throws \CoreException + * + * @since 2.5 N°1418 */ public function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true) { @@ -506,7 +508,7 @@ class DBObjectSearch extends DBSearch $sInParamName = $this->GenerateUniqueParamName(); $oParamExpression = new VariableExpression($sInParamName); - $this->SetInternalParams(array($sInParamName => $aValues)); + $this->GetInternalParamsByRef()[$sInParamName] = $aValues; $oListExpression = new ListExpression(array($oParamExpression)); @@ -1086,11 +1088,45 @@ class DBObjectSearch extends DBSearch return $this->m_aParams = $aParams; } + /** + * @return array warning : array returned by value + * @see self::GetInternalParamsByRef to get the attribute by reference + */ public function GetInternalParams() { return $this->m_aParams; } + /** + * @return array + * @see http://php.net/manual/en/language.references.return.php + * @since 2.5.1 N°1582 + */ + public function &GetInternalParamsByRef() + { + return $this->m_aParams; + } + + /** + * @param string $sKey + * @param mixed $value + * @param bool $bDoNotOverride + * + * @throws \CoreUnexpectedValue if $bDoNotOverride and $sKey already exists + */ + public function AddInternalParam($sKey, $value, $bDoNotOverride = false) + { + if ($bDoNotOverride) + { + if (array_key_exists($sKey, $this->m_aParams)) + { + throw new CoreUnexpectedValue("The key $sKey already exists with value : ".$this->m_aParams[$sKey]); + } + } + + $this->m_aParams[$sKey] = $value; + } + public function GetQueryParams($bExcludeMagicParams = true) { $aParams = array(); From 7092dc6f862d680879316cb54ffb52915d19633f Mon Sep 17 00:00:00 2001 From: Stephen Abello Date: Wed, 8 Aug 2018 10:12:43 +0000 Subject: [PATCH 14/17] (Retrofit from trunk) German Translation: typos (UserRequest #18704) SVN:2.5[6002] --- .../itop-config-mgmt/de.dict.itop-config-mgmt.php | 12 ++++++------ .../de.dict.itop-service-mgmt-provider.php | 4 ++++ datamodels/2.x/itop-tickets/de.dict.itop-tickets.php | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/datamodels/2.x/itop-config-mgmt/de.dict.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/de.dict.itop-config-mgmt.php index f65b2ff51..97d904775 100755 --- a/datamodels/2.x/itop-config-mgmt/de.dict.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/de.dict.itop-config-mgmt.php @@ -129,7 +129,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ApplicationSolution+' => '', 'Class:ApplicationSolution/Attribute:functionalcis_list' => 'CIs', 'Class:ApplicationSolution/Attribute:functionalcis_list+' => '', - 'Class:ApplicationSolution/Attribute:businessprocess_list' => 'Geschäftsprozesse', + 'Class:ApplicationSolution/Attribute:businessprocess_list' => 'Business-Prozesse', 'Class:ApplicationSolution/Attribute:businessprocess_list+' => '', 'Class:ApplicationSolution/Attribute:status' => 'Status', 'Class:ApplicationSolution/Attribute:status+' => '', @@ -139,7 +139,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ApplicationSolution/Attribute:status/Value:inactive+' => '', 'Class:BusinessProcess' => 'Business-Prozess', 'Class:BusinessProcess+' => '', - 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Applikationslösungen', + 'Class:BusinessProcess/Attribute:applicationsolutions_list' => 'Anwendungslösungen', 'Class:BusinessProcess/Attribute:applicationsolutions_list+' => '', 'Class:BusinessProcess/Attribute:status' => 'Status', 'Class:BusinessProcess/Attribute:status+' => '', @@ -373,9 +373,9 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:applicationsolution_id+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id' => 'FunctionalCI', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_id+' => '', - 'Class:lnkApplicationSolutionToBusinessProcess' => 'Verknüpfung Anwendungslösung/Geschäftsprozess', + 'Class:lnkApplicationSolutionToBusinessProcess' => 'Verknüpfung Anwendungslösung/Business-Prozess', 'Class:lnkApplicationSolutionToBusinessProcess+' => '', - 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_id' => 'Geschäftsprozes', + 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_id' => 'Business-Prozess', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_id+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id' => 'Anwendungslösung', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_id+' => '', @@ -999,7 +999,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:applicationsolution_name+' => '', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name' => 'FunctionalCI-Name', 'Class:lnkApplicationSolutionToFunctionalCI/Attribute:functionalci_name+' => '', - 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_name' => 'Geschäftsprozess-Name', + 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_name' => 'Business-Prozess-Name', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:businessprocess_name+' => '', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name' => 'Applikationslösungs-Name', 'Class:lnkApplicationSolutionToBusinessProcess/Attribute:applicationsolution_name+' => '', @@ -1039,7 +1039,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Menu:ConfigManagementOverview+' => 'Übersicht', 'Menu:Contact' => 'Kontakte', 'Menu:Contact+' => 'Kontakte', - 'Menu:Contact:Count' => '%1$d Kontakte', + 'Menu:Contact:Count' => '%1$d kontakten', 'Menu:Person' => 'Personen', 'Menu:Person+' => 'Alle Personen', 'Menu:Team' => 'Teams', diff --git a/datamodels/2.x/itop-service-mgmt-provider/de.dict.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/de.dict.itop-service-mgmt-provider.php index 03b3d9dcc..ff4dee483 100644 --- a/datamodels/2.x/itop-service-mgmt-provider/de.dict.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/de.dict.itop-service-mgmt-provider.php @@ -79,6 +79,10 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:Service/Attribute:org_id+' => '', 'Class:Service/Attribute:organization_name' => 'Provider Name', 'Class:Service/Attribute:organization_name+' => '', + 'Class:Service/Attribute:servicefamily_id' => 'Service-Familie', + 'Class:Service/Attribute:servicefamily_id+' => '', + 'Class:Service/Attribute:servicefamily_name' => 'Service-Familien-Name', + 'Class:Service/Attribute:servicefamily_name+' => '', 'Class:Service/Attribute:description' => 'Beschreibung', 'Class:Service/Attribute:description+' => '', 'Class:Service/Attribute:documents_list' => 'Dokumente', diff --git a/datamodels/2.x/itop-tickets/de.dict.itop-tickets.php b/datamodels/2.x/itop-tickets/de.dict.itop-tickets.php index 93bcc3f14..ada0401c4 100755 --- a/datamodels/2.x/itop-tickets/de.dict.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/de.dict.itop-tickets.php @@ -199,7 +199,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'Brick:Portal:OngoingRequests:Tab:OnGoing' => 'Offen', 'Brick:Portal:OngoingRequests:Tab:Resolved' => 'Gelöst', 'Brick:Portal:ClosedRequests:Title' => 'Geschlossene Störungen/Anfragen', - 'Class:Ticket/Attribute:operational_status' => 'Status', + 'Class:Ticket/Attribute:operational_status' => 'Betriebsstatus', 'Class:Ticket/Attribute:operational_status+' => 'Berechnet nach detailliertem Status', 'Class:Ticket/Attribute:operational_status/Value:ongoing' => 'In Bearbeitung', 'Class:Ticket/Attribute:operational_status/Value:ongoing+' => 'In Bearbeitung', From 931593a59e28270167c59108e5bb7f62f17c4380 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 17 Aug 2018 08:42:41 +0000 Subject: [PATCH 15/17] =?UTF-8?q?(Retrofit=20from=20trunk)=20N=C2=B01572?= =?UTF-8?q?=20Add=20composer.json=20for=20PHP=20language=20level=20(r5967)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[6007] --- composer.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 000000000..dbe0c210d --- /dev/null +++ b/composer.json @@ -0,0 +1,16 @@ +{ + "require": { + "php": ">=5.6.0", + "ext-mysql": "*", + "ext-ldap": "*", + "ext-mcrypt": "*", + "ext-cli": "*", + "ext-soap": "*", + "ext-json": "*" + }, + "config": { + "platform": { + "php": "5.6.0" + } + } +} \ No newline at end of file From 22df5d09fb25d14a18c39ed655047ec3a9088f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Tue, 28 Aug 2018 12:14:56 +0000 Subject: [PATCH 16/17] =?UTF-8?q?Retrofit=20from=20trunk=20N=C2=B01595=20-?= =?UTF-8?q?=20Setup=20:=20Blocking=20error=20on=20backup=20failure=20[from?= =?UTF-8?q?=20revision=206010]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:2.5[6023] --- composer.json | 4 +++- setup/backup.class.inc.php | 16 +++++++++------- setup/tar.php | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index dbe0c210d..8bd34a0a7 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,9 @@ "ext-mcrypt": "*", "ext-cli": "*", "ext-soap": "*", - "ext-json": "*" + "ext-json": "*", + "ext-zip": "*", + "ext-mysqli": "*" }, "config": { "platform": { diff --git a/setup/backup.class.inc.php b/setup/backup.class.inc.php index 25bdbeae3..cb1816814 100644 --- a/setup/backup.class.inc.php +++ b/setup/backup.class.inc.php @@ -235,18 +235,20 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the " /** * Create a normalized backup name, depending on the current date/time and Database * - * @param sNameSpec string Name and path, eventually containing itop placeholders + time formatting specs + * @param string sMySQLBinDir Name and path, eventually containing itop placeholders + time formatting specs */ public function SetMySQLBinDir($sMySQLBinDir) { $this->sMySQLBinDir = $sMySQLBinDir; } - /** - * Create a normalized backup name, depending on the current date/time and Database - * - * @param string sNameSpec Name and path, eventually containing itop placeholders + time formatting specs - */ + /** + * Create a normalized backup name, depending on the current date/time and Database + * + * @param string sNameSpec Name and path, eventually containing itop placeholders + time formatting specs + * + * @return string + */ public function MakeName($sNameSpec = "__DB__-%Y-%m-%d") { $sFileName = $sNameSpec; @@ -646,7 +648,7 @@ if (class_exists('ZipArchive')) // The setup must be able to start even if the " { if (empty($sData)) { - return; + return ''; } return ' --'.$sCliArgName.'='.self::EscapeShellArg($sData); diff --git a/setup/tar.php b/setup/tar.php index b07589715..72c074bc5 100644 --- a/setup/tar.php +++ b/setup/tar.php @@ -680,7 +680,7 @@ class ArchiveTar */ public function _error($p_message) { - $this->error_object = $this->raiseError($p_message); + IssueLog::Error($p_message); } /** @@ -688,7 +688,7 @@ class ArchiveTar */ public function _warning($p_message) { - $this->error_object = $this->raiseError($p_message); + IssueLog::Warning($p_message); } /** From 10683d943ff53163ee99c324b08d3ff907797874 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 3 Sep 2018 16:50:30 +0200 Subject: [PATCH 17/17] =?UTF-8?q?N=C2=B01620:=20Fix=20'forgot=20your=20pas?= =?UTF-8?q?sword=3F'=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/loginwebpage.class.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 246f0d826..8b7b3a95a 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -230,7 +230,8 @@ class LoginWebPage extends NiceWebPage try { UserRights::Login($sAuthUser); // Set the user's language (if possible!) - $oUser = UserRights::GetUserObject(); + /** @var UserInternal $oUser */ + $oUser = UserRights::GetUserObject(); if ($oUser == null) { throw new Exception(Dict::Format('UI:ResetPwd-Error-WrongLogin', $sAuthUser)); @@ -254,6 +255,7 @@ class LoginWebPage extends NiceWebPage $sToken = substr(md5(APPROOT.uniqid()), 0, 16); $oUser->Set('reset_pwd_token', $sToken); CMDBObject::SetTrackInfo('Reset password'); + $oUser->AllowWrite(true); $oUser->DBUpdate(); $oEmail = new Email();