Skip to content

Commit 696e2c9

Browse files
authored
N°4720 - Remove old unreferenced methods or pages that are @deprecated (#747)
* N°4720 - Remove old unreferenced methods that are @deprecated * N°4720-Config addson getter/setter removal * small deprecation removal * revert @Deprecation 3.3 removal: ResizeImageToFit * small deprecation removal * revert deprecation 3.3 removal: Config/GSetAddons
1 parent d728be1 commit 696e2c9

27 files changed

+126
-1135
lines changed

application/cmdbabstract.class.inc.php

Lines changed: 6 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -759,10 +759,10 @@ public function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
759759
$oPage->SetCurrentTab($sTabCode, $oAttDef->GetLabel().$sCount, $sTabDescription);
760760

761761
$aArgs = array('this' => $this);
762-
762+
763763
$sEditWhen = $oAttDef->GetEditWhen();
764764
// Calculate if edit_when allows to edit based on current $bEditMode
765-
$bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS) ||
765+
$bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS) ||
766766
($bEditMode ? $sEditWhen === LINKSET_EDITWHEN_ON_HOST_EDITION : $sEditWhen === LINKSET_EDITWHEN_ON_HOST_DISPLAY);
767767

768768
$bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)) || !$bIsEditableBasedOnEditWhen;
@@ -1218,35 +1218,6 @@ public static function GetDisplaySetForPrinting(WebPage $oPage, DBObjectSet $oSe
12181218
return DataTableUIBlockFactory::MakeForObject($oPage, $sTableId, $oSet, $aExtraParams);
12191219
}
12201220

1221-
/**
1222-
* Get the HTML fragment corresponding to the display of a table representing a set of objects
1223-
*
1224-
* @param WebPage $oPage The page object is used for out-of-band information (mostly scripts) output
1225-
* @param \DBObjectSet $oSet The set of objects to display
1226-
* @param array $aExtraParams key used :
1227-
* <ul>
1228-
* <li>view_link : if true then for extkey will display links with friendly name and make column sortable, default true
1229-
* <li>menu : if true prints DisplayBlock menu, default true
1230-
* <li>display_aliases : list of query aliases that will be printed, defaults to [] (displays all)
1231-
* <li>zlist : name of the zlist to use, false to disable zlist lookup, default to 'list'
1232-
* <li>extra_fields : list of <alias>.<attcode> to add to the result, separator ',', defaults to empty string
1233-
* </ul>
1234-
*
1235-
* @return String The HTML fragment representing the table of objects. <b>Warning</b> : no JS added to handled
1236-
* pagination or table sorting !
1237-
*
1238-
* @see DisplayBlock to get a similar table but with the JS for pagination & sorting
1239-
*
1240-
* @deprecated 3.0.0 use GetDisplaySetBlock
1241-
*/
1242-
public static function GetDisplaySet(WebPage $oPage, DBObjectSet $oSet, $aExtraParams = array())
1243-
{
1244-
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('use GetDisplaySetBlock');
1245-
$oPage->AddUiBlock(static::GetDisplaySetBlock($oPage, $oSet, $aExtraParams));
1246-
1247-
return "";
1248-
}
1249-
12501221
/**
12511222
* @param WebPage $oPage
12521223
* @param \DBObjectSet $oSet
@@ -1420,129 +1391,6 @@ public static function GetDataTableFromDBObjectSet(DBObjectSet $oSet, $aParams =
14201391
//DataTableUIBlockFactory::MakeForStaticData('', $aHeader, $aRows);
14211392
}
14221393

1423-
/**
1424-
* @param WebPage $oPage
1425-
* @param \CMDBObjectSet $oSet
1426-
* @param array $aExtraParams key used :
1427-
* <ul>
1428-
* <li>view_link : if true then for extkey will display links with friendly name and make column sortable, default true
1429-
* <li>menu : if true prints DisplayBlock menu, default true
1430-
* <li>display_aliases : list of query aliases that will be printed, defaults to [] (displays all)
1431-
* <li>zlist : name of the zlist to use, false to disable zlist lookup, default to 'list'
1432-
* <li>extra_fields : list of <alias>.<attcode> to add to the result, separator ',', defaults to empty string
1433-
* </ul>
1434-
*
1435-
* @return string
1436-
* @throws \CoreException
1437-
* @throws \DictExceptionMissingString
1438-
* @throws \MissingQueryArgument
1439-
* @throws \MySQLException
1440-
* @throws \MySQLHasGoneAwayException
1441-
* @deprecated 3.0.0
1442-
*/
1443-
public static function GetDisplayExtendedSet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array())
1444-
{
1445-
DeprecatedCallsLog::NotifyDeprecatedPhpMethod();
1446-
if (empty($aExtraParams['currentId'])) {
1447-
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
1448-
} else {
1449-
$iListId = $aExtraParams['currentId'];
1450-
}
1451-
$aList = array();
1452-
1453-
// Initialize and check the parameters
1454-
$bViewLink = isset($aExtraParams['view_link']) ? $aExtraParams['view_link'] : true;
1455-
$bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
1456-
// Check if there is a list of aliases to limit the display to...
1457-
$aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',',
1458-
$aExtraParams['display_aliases']) : array();
1459-
$sZListName = isset($aExtraParams['zlist']) ? ($aExtraParams['zlist']) : 'list';
1460-
1461-
$aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(',',
1462-
trim($aExtraParams['extra_fields'])) : array();
1463-
$aExtraFields = array();
1464-
$sAttCode = '';
1465-
foreach($aExtraFieldsRaw as $sFieldName)
1466-
{
1467-
// Ignore attributes not of the main queried class
1468-
if (preg_match('/^(.*)\.(.*)$/', $sFieldName, $aMatches))
1469-
{
1470-
$sClassAlias = $aMatches[1];
1471-
$sAttCode = $aMatches[2];
1472-
if (array_key_exists($sClassAlias, $oSet->GetSelectedClasses()))
1473-
{
1474-
$aExtraFields[$sClassAlias][] = $sAttCode;
1475-
}
1476-
}
1477-
else
1478-
{
1479-
$aExtraFields['*'] = $sAttCode;
1480-
}
1481-
}
1482-
1483-
$aClasses = $oSet->GetFilter()->GetSelectedClasses();
1484-
$aAuthorizedClasses = array();
1485-
foreach($aClasses as $sAlias => $sClassName)
1486-
{
1487-
if ((UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO) &&
1488-
((count($aDisplayAliases) == 0) || (in_array($sAlias, $aDisplayAliases))))
1489-
{
1490-
$aAuthorizedClasses[$sAlias] = $sClassName;
1491-
}
1492-
}
1493-
foreach($aAuthorizedClasses as $sAlias => $sClassName)
1494-
{
1495-
if (array_key_exists($sAlias, $aExtraFields))
1496-
{
1497-
$aList[$sAlias] = $aExtraFields[$sAlias];
1498-
}
1499-
else
1500-
{
1501-
$aList[$sAlias] = array();
1502-
}
1503-
if ($sZListName !== false)
1504-
{
1505-
$aDefaultList = self::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName));
1506-
1507-
$aList[$sAlias] = array_merge($aDefaultList, $aList[$sAlias]);
1508-
}
1509-
1510-
// Filter the list to removed linked set since we are not able to display them here
1511-
foreach ($aList[$sAlias] as $index => $sAttCode)
1512-
{
1513-
$oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode);
1514-
if ($oAttDef instanceof AttributeLinkedSet)
1515-
{
1516-
// Removed from the display list
1517-
unset($aList[$sAlias][$index]);
1518-
}
1519-
}
1520-
1521-
if (empty($aList[$sAlias]))
1522-
{
1523-
unset($aList[$sAlias], $aAuthorizedClasses[$sAlias]);
1524-
}
1525-
}
1526-
1527-
$sSelectMode = 'none';
1528-
1529-
$oDataTable = new DataTable($iListId, $oSet, $aAuthorizedClasses);
1530-
1531-
$oSettings = DataTableSettings::GetDataModelSettings($aAuthorizedClasses, $bViewLink, $aList);
1532-
1533-
$bDisplayLimit = isset($aExtraParams['display_limit']) ? $aExtraParams['display_limit'] : true;
1534-
if ($bDisplayLimit)
1535-
{
1536-
$iDefaultPageSize = appUserPreferences::GetPref('default_page_size',
1537-
MetaModel::GetConfig()->GetMinDisplayLimit());
1538-
$oSettings->iDefaultPageSize = $iDefaultPageSize;
1539-
}
1540-
1541-
$oSettings->aSortOrder = MetaModel::GetOrderByDefault($sClassName);
1542-
1543-
return $oDataTable->Display($oPage, $oSettings, $bDisplayMenu, $sSelectMode, $bViewLink, $aExtraParams);
1544-
}
1545-
15461394
/**
15471395
* @param WebPage $oPage
15481396
* @param \CMDBObjectSet $oSet
@@ -1731,7 +1579,7 @@ public static function DisplaySetAsHTMLSpreadsheet(WebPage $oPage, CMDBObjectSet
17311579
* @throws \MySQLException
17321580
* @throws \MySQLHasGoneAwayException
17331581
* @throws \Exception
1734-
*
1582+
*
17351583
* @internal Only to be used by `/webservices/export.php` : this is a legacy method that produces wrong HTML (no TR on table body rows)
17361584
*/
17371585
public static function GetSetAsHTMLSpreadsheet(DBObjectSet $oSet, $aParams = array())
@@ -2232,7 +2080,7 @@ public static function GetFormElementForField($oPage, $sClass, $sAttCode, $oAttD
22322080
);
22332081

22342082
// test query link
2235-
$sTestResId = 'query_res_'.$sFieldPrefix.$sAttCode.$sNameSuffix; //$oPage->GetUniqueId();
2083+
$sTestResId = 'query_res_'.$sFieldPrefix.$sAttCode.$sNameSuffix;
22362084
$sBaseUrl = utils::GetAbsoluteUrlAppRoot().'pages/run_query.php?expression=';
22372085
$sTestQueryLbl = Dict::S('UI:Edit:TestQuery');
22382086
$oTestQueryButton = ButtonUIBlockFactory::MakeIconAction(
@@ -2682,7 +2530,7 @@ public static function GetFormElementForField($oPage, $sClass, $sAttCode, $oAttD
26822530
}
26832531
break;
26842532
}
2685-
$sPattern = addslashes($oAttDef->GetValidationPattern()); //'^([0-9]+)$';
2533+
$sPattern = addslashes($oAttDef->GetValidationPattern()); //'^([0-9]+)$';
26862534
if (!empty($aEventsList))
26872535
{
26882536
if (!is_numeric($sNullValue))
@@ -3851,7 +3699,7 @@ public function DisplayDocumentInline(WebPage $oPage, $sAttCode)
38513699
public function GetHilightClass()
38523700
{
38533701
// Possible return values are:
3854-
// HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE
3702+
// HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE
38553703
$current = parent::GetHilightClass(); // Default computation
38563704

38573705
// Invoke extensions before the deletion (the deletion will do some cleanup and we might loose some information
@@ -4801,66 +4649,6 @@ public function DisplayCaseLogForBulkModify(WebPage $oPage, $sAttCode, $sComment
48014649
}
48024650
}
48034651

4804-
/**
4805-
* @param $sCurrentState
4806-
* @param $sStimulus
4807-
* @param $bOnlyNewOnes
4808-
*
4809-
* @return array
4810-
* @throws \ApplicationException
4811-
* @throws \CoreException
4812-
* @deprecated Since iTop 2.4, use DBObject::GetTransitionAttributes() instead.
4813-
*/
4814-
public function GetExpectedAttributes($sCurrentState, $sStimulus, $bOnlyNewOnes)
4815-
{
4816-
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('Since iTop 2.4, use DBObject::GetTransitionAttributes() instead');
4817-
$aTransitions = $this->EnumTransitions();
4818-
if (!isset($aTransitions[$sStimulus])) {
4819-
// Invalid stimulus
4820-
throw new ApplicationException(Dict::Format('UI:Error:Invalid_Stimulus_On_Object_In_State', $sStimulus,
4821-
$this->GetName(), $this->GetStateLabel()));
4822-
}
4823-
$aTransition = $aTransitions[$sStimulus];
4824-
$sTargetState = $aTransition['target_state'];
4825-
$aTargetStates = MetaModel::EnumStates(get_class($this));
4826-
$aTargetState = $aTargetStates[$sTargetState];
4827-
$aCurrentState = $aTargetStates[$this->GetState()];
4828-
$aExpectedAttributes = $aTargetState['attribute_list'];
4829-
$aCurrentAttributes = $aCurrentState['attribute_list'];
4830-
4831-
$aComputedAttributes = array();
4832-
foreach($aExpectedAttributes as $sAttCode => $iExpectCode)
4833-
{
4834-
if (!array_key_exists($sAttCode, $aCurrentAttributes))
4835-
{
4836-
$aComputedAttributes[$sAttCode] = $iExpectCode;
4837-
}
4838-
else
4839-
{
4840-
if (!($aCurrentAttributes[$sAttCode] & (OPT_ATT_HIDDEN | OPT_ATT_READONLY)))
4841-
{
4842-
$iExpectCode = $iExpectCode & ~(OPT_ATT_MUSTPROMPT | OPT_ATT_MUSTCHANGE); // Already prompted/changed, reset the flags
4843-
}
4844-
// Later: better check if the attribute is not *null*
4845-
if (($iExpectCode & OPT_ATT_MANDATORY) && ($this->Get($sAttCode) != ''))
4846-
{
4847-
$iExpectCode = $iExpectCode & ~(OPT_ATT_MANDATORY); // If the attribute is present, then no need to request its presence
4848-
}
4849-
4850-
$aComputedAttributes[$sAttCode] = $iExpectCode;
4851-
}
4852-
4853-
$aComputedAttributes[$sAttCode] = $aComputedAttributes[$sAttCode] & ~(OPT_ATT_READONLY | OPT_ATT_HIDDEN); // Don't care about this form now
4854-
4855-
if ($aComputedAttributes[$sAttCode] == 0)
4856-
{
4857-
unset($aComputedAttributes[$sAttCode]);
4858-
}
4859-
}
4860-
4861-
return $aComputedAttributes;
4862-
}
4863-
48644652
/**
48654653
* Display a form for modifying several objects at once
48664654
* The form will be submitted to the current page, with the specified additional values

0 commit comments

Comments
 (0)