You are browsing the documentation for iTop 3.1 which is not the current version.

Consider browsing to iTop 3.2 documentation

Migrate an Extension to 3.1

XML datamodel

Breaking changes

Added <constants /> node in itop-structure

Since iTop 3.1.0, the <constants /> node is now defined in the itop-structure module. If you added / redefined constants, move the _delta flag from the <constants /> node to the <constant /> child nodes.

Bad example, defining a whole collection node instead of its child nodes.

/itop_design
<constants _delta="define">
  <constant id="foo">FOO</constant>
  <constant id="bar">BAR</constant>
</constants>

Good example, _delta flag is on the child nodes.

/itop_design
<constants>
  <constant id="foo" _delta="define">FOO</constant>
  <constant id="bar" _delta="define">BAR</constant>
</constants>

Covered by migration audit N°137

Added "chat" / "in_person" values for "origin" in tickets

Attribute origin of classes UserRequest and Incident now have both chat and in_person values in the standard datamodel. If you added them, you should ensure that you use the define_if_not_exists flag to avoid conflicts during compilation while keeping your module compatible with older versions of iTop.

Bad example, defining the values with define flag.

/itop_design/classes
<class id="UserRequest">
  <fields>
    <field id="origin">
      <values>
        <value id="chat" _delta="define">
          [...]
        </value>
        <value id="in_person" _delta="define">
          [...]
        </value>
      </values>
    </field>
  </fields>
</class>

Good example, use of define_if_not_exists to ensure backward compatibility

/itop_design/classes
<class id="UserRequest">
  <fields>
    <field id="origin">
      <values>
        <value id="chat" _delta="define_if_not_exists">
          [...]
        </value>
        <value id="in_person" _delta="define_if_not_exists">
          [...]
        </value>
      </values>
    </field>
  </fields>
</class>

Covered by migration audit N°134

Added complementary name on some classes out of the box

While the complementary name feature was introduced in iTop 3.0, it wasn't used out of the box in the standard datamodel. iTop 3.1.0 now uses it on all relevant classes (70+ classes including Person, Ticket, FunctionalCI, …) to enable it on both external key selection widgets and the new summary cards feature.

If you already defined a complementary name in your module, adapt your XML to avoid conflicts.

Covered by migration audit N°156

Added dependencies on various attributes out of the box

Dependencies have been added on the following attributes. If you already added some, adjust your XML to avoid conflcts.

  • Problem→priority
  • lnkContactToContract→contact_id
  • lnkContractToDocument→document_id
  • lnkCustomerContractToService→document_id
  • lnkCustomerContractToService→service_id

Covered by migration audits N°103 & N°173

Other nodes added to the standard datamodel

The following nodes have been added to the standard datamodel, if you already added some of these, adjust your XML to avoid conflicts.

  • /itop_design/classes/class[@id='Contract']/presentation/default_search/items/item[@id=“status”]
  • /itop_design/classes/class[@id='FiberChannelInterface']/presentation/details/items/item[@id='speed']
  • /itop_design/classes/class[@id='lnkContactToContract']/fields/field[@id='provider_id' or @id='customer_id']
  • /itop_design/classes/class[@id='lnkContactToContract']/fields/field[@id='contact_id']/filter
  • /itop_design/classes/class[@id='lnkContractToDocument']/fields/field[@id='provider_id' or @id='customer_id']
  • /itop_design/classes/class[@id='lnkContractToDocument']/fields/field[@id='document_id']/filter
  • /itop_design/classes/class[@id='lnkCustomerContractToService']/fields/field[@id='service_id']/filter
  • /itop_design/classes/class[@id='lnkCustomerContractToService']/fields/field[@id='provider_id' or @id='customer_id']
  • /itop_design/classes/class[@id='lnkProviderContractToService']/fields/field[@id='service_id']/filter
  • /itop_design/classes/class[@id='lnkProviderContractToService']/fields/field[@id='provider_id' or @id='customer_id']
  • /itop_design/classes/class[@id='LogicalVolume']/presentation/details/items/item[@id='description' or @id='org_id']
  • /itop_design/classes/class[@id='LogicalVolume']/presentation/search/items/item[@id='location_id']
  • /itop_design/classes/class[@id='LogicalVolume']/presentation/list/items/item[@id='location_id' or @id = 'org_id']
  • /itop_design/classes/class[@id='NASFileSystem']/presentation/details/items/item[@id='description' or @id='org_id']
  • /itop_design/classes/class[@id='PhysicalInterface']/presentation/details/items/item[@id='speed' or @id='vlans_list']
  • /itop_design/classes/class[@id='ProviderContract']/fields/field[@id=“services_list”]
  • /itop_design/classes/class[@id='SLA']/presentation/default_search
  • /itop_design/classes/class[@id='SLT']/fields/field[@id='slas_list']
  • /itop_design/classes/class[@id='SLT']/presentation/default_search

Covered by migration audits N°174 & N°106

Other nodes removed from the standard datamodel

The following nodes have been removed from the standard datamodel, if you have any XML alteration on these nodes, adjust your XML to avoid crashes during compilation.

  • /itop_design/classes/class[@id=“SLA”]/methods/method[@id=“DoCheckToWrite”]

Covered by migration audit N°149

Removed file

No XML file removed.

Removed dictionary entries

Entry code Replaced by Covered by migration audit
Menu:Notification:Title None N°166

Deprecations

Other nodes deprecated in the standard datamodel

The following nodes have been deprecated in the standard datamodel and will be removed in a future version. If you have any XML alteration on these nodes, adjust your XML to avoid crashes during compilation in the future.

  • /itop_design/branding/themes/theme/*[name()='imports' or name()='stylesheets']/*[contains(., 'css-variables.scss')]
  • /itop_design/branding/themes/theme/*[name()='imports' or name()='stylesheets']/*[contains(., 'light-grey.scss')]

Covered by migration audit N°129

PHP APIs

Breaking changes

Symfony lib. updated to v5.4

Symfony library has been upgraded from v3.4 (previous LTS) to v5.4 (current LTS); this requires some changes in any module using the Symfony APIs (end-users portal, Twig base); here is what you need to check / migrate.

What changed Why was it removed What to search for What to do if found Covered by migration audit
Portal: Access to user's allowed portals Global app variables are not a good pratice app['combodo.current_user.allowed_portals'] Replace with allowed_portals N°147
Portal: Access to SF services container within a controller Direct access to the container is deprecated $this→GetContainer( or $this→SetContainer( Use service injection instead (see portal controllers for examples) N°130
Portal: Access to SF services within a controller Direct access to the services is deprecated $this→get('router or any $this→get(<SERVICE_CODE> Use service injection instead (see portal controllers for examples) N°122
Also, custom portal controllers MUST be registered via the ItopExtensionsExtraRoutes::AddControllersClasses() API.
if (version_compare(ITOP_DESIGN_LATEST_VERSION, 3.1, '>=')) {
    /** @noinspection PhpUnhandledExceptionInspection */
    ItopExtensionsExtraRoutes::AddControllersClasses(
        array(
            'Combodo\iTop\Portal\Controller\CommunicationBrickController'
        )
    );
}

Usage of \iApplicationObjectExtension::OnDBUpdate()

This API is no longer called when no attribute of the object has been modified. If you were using this \iApplicationObjectExtension::OnDBUpdate() API to either:

  • Process extra inputs of a custom tab in the object details
  • Do some side processing when an object form is submitted

You should rather use the \iApplicationUIExtension::OnFormSubmit() API which is deigned for this, as the previous behavior unsupported.

Usage of "zlist" parameter in \DisplayBlock

When using a \DisplayBlock, the zlist extra parameter no longer accepts false as a value. It must be a valid zlist or the default one 'list'.

iTop 3.0 and older, zlist set to false
$aExtraParams = [
  'foo' => 'bar',
  'zlist' => false,
];
$oBlock = new DisplayBlock($sOQL, 'list', false);
$oBlock->Display($oPage, 'some objects list', $aExtraParam);
iTop 3.1 and newer, zlist set to a valid zlist
// If zlist can be specified
$aExtraParams = [
  'foo' => 'bar',
  'zlist' => 'list',
];
$oBlock = new DisplayBlock($sOQL, 'list', false);
$oBlock->Display($oPage, 'some objects list', $aExtraParam);
iTop 3.1 while keep compatibility with iTop 3.0 and older
// If zlist cannot be specified and we need to keep BC with iTop 2.7 and older
$aExtraParams = [
  'foo' => 'bar',
  'zlist' => version_compare(ITOP_DESIGN_LATEST_VERSION, 3.1, '<') ? false : 'list',
];
$oBlock = new DisplayBlock($sOQL, 'list', false);
$oBlock->Display($oPage, 'some objects list', $aExtraParam);

Covered by migration audit N°172

Usage of \DBObjectSet::Seek()

In order to be fully compatible with PHP 8.1+, the \DBObjectSet::Seek() method doesn't return an object anymore. If you retrieved an object directly from it you must now use \DBObjectSet::Fetch() after to retrieve it.

Bad usage, retrieve object directly from method
$oObj = $oSet->Seek(0);
Good usage, retrieve object from Fetch() method after seeking to desired position
$oSet->Seek(0);
$oObj = $oSet->Fetch();

Covered by migration audit N°120

Usage of \DBObject key to determine if an object is new

In some cases, \DBObject::GetKey() and \DBObject::m_iKey returned null. This is no longer the case, so if you used it to determine whether an object is new or not it will no longer work. Use \DBObject::IsNew() instead.

Bad usages
empty($this->GetKey())
$this->GetKey() == null
$this->GetKey() === null
 
empty($this->m_iKey)
$this->m_iKey == null
$this->m_iKey === null
Good usage
empty($this->IsNew())

Covered by migration audit N°149

Case change in /sources folder

The directories under /sources were named with case inconsistencies, this was fixed in 3.1.0. The corresponding files should be loaded using the autoloader, but if you called one of them directly you should update your path.

X-Content-Type-Options HTTP header and CORB protection

Since iTop 2.7.10 / 3.0.4 / 3.1.2 / 3.2.0, the X-Content-Type-Options HTTP header is sent with the nosniff value. This could trigger CORB protection for certain resources, preventing them from loading (see https://chromium.googlesource.com/chromium/src/+/master/services/network/cross_origin_read_blocking_explainer.md#determining-whether-a-response-is-corb_protected).

To mitigate the issue, sending this HTTP header is disabled in AjaxPage, JsonPage and XMLPage.

Make sure that every JSON, XML, HTML and text/plain content you're sending is either output directly or using one of those WebPage implementation !
If you developed a newsroom provider, beware to use the application/javascript MIME type to send your JSONP content, as application/jsonp will trigger CORB protection.
Note a JsonPPage was introduced in iTop 3.1.0

Removed APIs

As announced in the previous migration notes, the following APIs have been removed. Refer to the previous migration notes to know what replaced them.

Domain Type Name Covered by migration audit
History PHP class HistoryBlock None yet
History PHP method cmdbAbstractObject::DisplayBareHistory() None yet
History PHP endpoint ajax.render.php operation “history” None yet
History PHP endpoint ajax.render.php operation “history_from_filter” None yet
OQL PHP file core/legacy/querybuilderexpressionslegacy.class.inc.php N°118
OQL PHP file core/legacy/querybuildercontextlegacy.class.inc.php N°118
OQL PHP file core/legacy/querybuildersearchlegacy.class.php N°118

Deprecations

What changed Why was it deprecated What to search for What to do if found Covered by migration audit
\Combodo\iTop\Form\Validator\Validator class N°6414 - Field and validator refactoring new Validator( Replace with new CustomRegexpValidator( None yet
SelectObjectField::VerifyCurrentValue N°6414 - Field and validator refactoring →VerifyCurrentValue( Replace with →ResetCurrentValueIfNotAmongAllowedValues( None yet
\CMDBObject::DBCloneTracked N°5232 - Deprecate \CMDBObject::DBCloneTracked →DBCloneTracked($oChange, $iNewKey Replace with →DBClone($iNewKey N°125
Refactored TWIG extensions classes N°4034 - Deprecate duplicated TWIG extensions class Combodo\iTop\TwigExtension
application/twigextension.class.inc.php
TwigExtension::RegisterTwigExtensions(
Combodo\iTop\Application\TwigBase\Twig\Extension
sources/Application/TwigBase/Twig/Extension.php
Extension::RegisterTwigExtensions(
N°116
\DataTableUIBlockFactory::MakeForRenderingObject() N°6261 - Deprecate \DataTableUIBlockFactory::MakeForRenderingObject() method DataTableUIBlockFactory::MakeForRenderingObject() Replace with DataTableUIBlockFactory::MakeForRendering() N°157
\WizardHelper::ParseJsonSet() N°2363 - Deprecate Old linkedset update pattern WizardHelper::ParseJsonSet($oNewLink) No replacement yet N°114
\CMDBObject::DBCloneTracked_Internal
\cmdbAbstractObject::DBCloneTracked_Internal
N°6966 - Deprecate cmdbAbstractObject::DBCloneTracked_Internal Methods names for calls and overrides Replace with DBClone N°182
\CMDBObject::DBDeleteTracked_Internal
\cmdbAbstractObject::DBDeleteTracked_Internal
N°6967 - Deprecated \cmdbAbstractObject::DBDeleteTracked_Internal Methods names for calls and overrides Replace with DBDelete N°183

Excel export operations

Old Excel export operations (xlsx_xxx) are used in the application for several versions now. They are now deprecated and will be removed in the next version. Instead you can adapt you code to use the standard export_xxx operations. Complete list of deprecated operations:

  • xlsx_export_dialog
  • xlsx_start
  • xlsx_run
  • xlsx_download
  • xlsx_abort

Covered by migration audit N°83

SimpleCrypt default engine change

Only developers using the encryption engine programmatically are concerned.
Developers using AttributeEncryptedString in their customizations are NOT concerned.

Currently the default engine for the \SimpleCrypt helper class is Mcrypt. As this library has been deprecated since PHP 7.1 and was removed since PHP 7.2, we will changed the default engine to Sodium to guarantee maximum security.

To keep your code and existing encrypted strings working, you'll need to adapt your code to specify Mcrypt as the engine.

What changed Why was it removed What to search for What to do if found
Default encryption engine Mcrypt removed since PHP 7.2 new SimpleCrypt() Replace with new SimpleCrypt('Mcrypt')

Other

Field and validator refactoring

Both the user portal and the request template extension are using generic Form / Field / Validator objects. We refactored those objects so that validation is now only done using validators and no more with Field::Validate method overrides, though this latest method has become final.

JS APIs

Breaking changes

Removed APIs

As announced in the previous migration notes, the following APIs have been removed. Refer to the previous migration notes to know what replaced them.

Domain Type Name
History JS method DisplayHistory()

Removed files

What changed Why was it removed What to search for What to do if found Covered by migration audit
Backoffice links handlers moved / renamed Refactored into new handlers js/linkswidget.js
js/linksdirectwidget.js
Replace with js/links/links_widget.js
Replace with js/links/links_direct_widget.js
N°146

Deprecations

Deprecated APIs

What changed Why was it deprecated What to search for What to do if found Covered by migration audit
Portal leave handler Added global leave handler for both the backoffice and portal js/portal_leave_handler.js
.portal_leave_handler(
register_blocker.portal.itop
Use js/leave_handler.js instead
Use .leave_handler( instead
Use register_blocker.itop instead
N°160

jQuery HotKeys plugin

The jQuery Hotkeys plugin (js/jquery.hotkeys.js) was deprecated and will be removed a future version. You must replace your consumer code. As a reference, you can see c3816c9d which was the replacement of the only call in iTop core (run_query screen)

CSS APIs

Breaking changes

Removed APIs

No deprecated APIs.

Removed files

No removed files.

Deprecations

Deprecated APIs

No deprecated APIs.

Deprecated files

iTop 2.7 backoffice theme

The following files were part of iTop 2.7 backoffice theme and are no longer used since iTop 3.0, they are therefore deprecated and will be removed in a future version. If you were customizing the backoffice theme or using it your own stylesheet, refer to this page on how to migrate themes.

  • css/css-variables.scss
  • css/light-grey.scss

Covered by migration audit N°128

3_1_0/release/developer.txt · Last modified: 2024/01/05 12:13 by 127.0.0.1
Back to top
Contact us