-
Notifications
You must be signed in to change notification settings - Fork 1
/
module.itop-communications.php
97 lines (89 loc) · 2.89 KB
/
module.itop-communications.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* Copyright (C) 2013-2024 Combodo SAS
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
*/
//
// iTop module definition file
//
/** @noinspection PhpUnhandledExceptionInspection */
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-communications/1.3.4',
array(
// Identification
//
'label' => 'Communications to the Customers',
'category' => 'portal',
// Setup
//
'dependencies' => array(
'itop-portal-base/1.0.1',
'itop-service-mgmt/2.4.0||itop-service-mgmt-provider/2.4.0', // because of the menu
),
'mandatory' => false,
'visible' => true,
//'auto_select' => 'SetupInfo::ModuleIsSelected("itop-portal")',
// Components
//
'datamodel' => array(
// Explicitly load classes from DM
'model.itop-communications.php',
// Compatibility layer
'compatibilitybridge.php',
),
'webservice' => array(
),
'data.struct' => array(
// add your 'structure' definition XML files here,
),
'data.sample' => array(
// add your sample data XML files here,
),
'installer' => 'CommunicationsInstaller',
// Documentation
//
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
'doc.more_information' => '', // hyperlink to more information, if any
// Default settings
//
'settings' => array(
// Module specific settings go here, if any
),
)
);
class CommunicationsInstaller extends ModuleInstallerAPI
{
/**
* Handler called after the creation/update of the database schema
* @param $oConfiguration Config The new configuration of the application
* @param $sPreviousVersion string PRevious version number of the module (empty string in case of first install)
* @param $sCurrentVersion string Current version number of the module
*/
public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
{
if (version_compare($sPreviousVersion, '1.3.0', '<'))
{
$oDBSearch = DBSearch::FromOQL('SELECT Communication WHERE allowed_portals=""');
$oDBObjectSet = new DBObjectSet($oDBSearch);
while($oCommunications = $oDBObjectSet->Fetch()){
$oCommunications->Set('allowed_portals', ContextTag::TAG_PORTAL);
$oCommunications->DBWrite();
}
SetupLog::Info("Updated Communications with default allowed portals.");
}
}
}