Finish 1.0.0

This commit is contained in:
Pierre Goiffon
2019-01-18 17:28:22 +01:00
10 changed files with 388 additions and 392 deletions

9
.gitflow Normal file
View File

@@ -0,0 +1,9 @@
[gitflow "branch"]
master = master
develop = develop
[gitflow "prefix"]
feature = feature/
release = release/
hotfix = hotfix/
versiontag =
support = support/

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.idea/**

View File

@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3"> <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3">
<!--
@copyright Copyright (C) 2010-2019 Combodo SARL
@license https://www.combodo.com/documentation/combodo-software-license.html
-->
<classes> <classes>
<class id="ExpirationRule" _delta="define"> <class id="ExpirationRule" _delta="define">
<parent>cmdbAbstractObject</parent> <parent>cmdbAbstractObject</parent>
@@ -25,12 +29,12 @@
<default_value/> <default_value/>
<is_null_allowed>false</is_null_allowed> <is_null_allowed>false</is_null_allowed>
</field> </field>
<field id="description" xsi:type="AttributeText"> <field id="description" xsi:type="AttributeText">
<sql>description</sql> <sql>description</sql>
<default_value/> <default_value/>
<is_null_allowed>true</is_null_allowed> <is_null_allowed>true</is_null_allowed>
<format>html</format> <format>html</format>
</field> </field>
<field id="class" xsi:type="AttributeString"> <field id="class" xsi:type="AttributeString">
<sql>class</sql> <sql>class</sql>
<default_value/> <default_value/>
@@ -282,7 +286,7 @@
$oBlock->Display($oPage, 'rel_preview_rule_'.$this->GetKey(), $aParams); $oBlock->Display($oPage, 'rel_preview_rule_'.$this->GetKey(), $aParams);
}]]></code> }]]></code>
</method> </method>
</methods> </methods>
<presentation> <presentation>
<list> <list>
<items> <items>

View File

@@ -1,78 +1,66 @@
<?php <?php
// Copyright (C) 2012-2018 Combodo SARL
// /**
// This program is free software; you can redistribute it and/or modify * Localized data
// it under the terms of the GNU General Public License as published by *
// the Free Software Foundation; version 3 of the License. * @copyright Copyright (C) 2010-2019 Combodo SARL
// * @license https://www.combodo.com/documentation/combodo-software-license.html
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @author Erwan Taloc <erwan.taloc@combodo.com>
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * @author Romain Quetiez <romain.quetiez@combodo.com>
// GNU General Public License for more details. * @author Denis Flaven <denis.flaven@combodo.com>
// * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
// You should have received a copy of the GNU General Public License * @author Vincent Dumas <vincent.dumas@combodo.com>
// along with this program; if not, write to the Free Software */
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ExpirationRule
/** Dict::Add('DE DE', 'German', 'Deutsch', array(
* Localized data // Class
* 'Class:ExpirationRule/Name' => '%1$s~~',
* @author Erwan Taloc <erwan.taloc@combodo.com> 'Class:ExpirationRule' => 'Expiration rule~~',
* @author Romain Quetiez <romain.quetiez@combodo.com> 'Class:ExpirationRule+' => '~~',
* @author Denis Flaven <denis.flaven@combodo.com> 'Class:ExpirationRule/Attribute:name' => 'Name~~',
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> 'Class:ExpirationRule/Attribute:name+' => '~~',
* @author Vincent Dumas <vincent.dumas@combodo.com> 'Class:ExpirationRule/Attribute:class' => 'Class~~',
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL 'Class:ExpirationRule/Attribute:class+' => '~~',
*/ 'Class:ExpirationRule/Attribute:description' => 'Description',
'Class:ExpirationRule/Attribute:description+' => '',
// ExpirationRule 'Class:ExpirationRule/Attribute:status' => 'Status~~',
Dict::Add('DE DE', 'German', 'Deutsch', array( 'Class:ExpirationRule/Attribute:status+' => '~~',
// Class 'Class:ExpirationRule/Attribute:status/Value:active' => 'Active~~',
'Class:ExpirationRule/Name' => '%1$s~~', 'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive~~',
'Class:ExpirationRule' => 'Expiration rule~~', 'Class:ExpirationRule/Attribute:type' => 'Applied option~~',
'Class:ExpirationRule+' => '~~', 'Class:ExpirationRule/Attribute:type+' => 'Which option will be used regarding the filled fields. If both are filled, advanced option is applied~~',
'Class:ExpirationRule/Attribute:name' => 'Name~~', 'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple~~',
'Class:ExpirationRule/Attribute:name+' => '~~', 'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Advanced~~',
'Class:ExpirationRule/Attribute:class' => 'Class~~', 'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date to check~~',
'Class:ExpirationRule/Attribute:class+' => '~~', 'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Attribute code of the date to check~~',
'Class:ExpirationRule/Attribute:description' => 'Description', 'Class:ExpirationRule/Attribute:term_of_notice' => 'Term of notice~~',
'Class:ExpirationRule/Attribute:description+' => '', 'Class:ExpirationRule/Attribute:term_of_notice+' => 'Number of days before the date to check, to trigger the notification~~',
'Class:ExpirationRule/Attribute:status' => 'Status~~', 'Class:ExpirationRule/Attribute:oql_scope' => 'OQL scope~~',
'Class:ExpirationRule/Attribute:status+' => '~~', 'Class:ExpirationRule/Attribute:oql_scope+' => 'OQL query to define which objects are concerned by this rule.~~',
'Class:ExpirationRule/Attribute:status/Value:active' => 'Active~~',
'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive~~', // Integrity errors
'Class:ExpirationRule/Attribute:type' => 'Applied option~~', 'Class:ExpirationRule/Error:ClassNotValid' => 'Class must be a valid class from datamodel, "%1$s" given~~',
'Class:ExpirationRule/Attribute:type+' => 'Which option will be used regarding the filled fields. If both are filled, advanced option is applied~~', 'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" is not a valid attribute for class "%1$s"~~',
'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple~~', 'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" must be a date attribute of class "%1$s"~~',
'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Advanced~~', 'Class:ExpirationRule/Error:NoOptionFilled' => 'Either option 1 or option 2 must be filled~~',
'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date to check~~', 'Class:ExpirationRule/Error:OptionOneMissingField' => 'All fields of option 1 must be filled~~',
'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Attribute code of the date to check~~',
'Class:ExpirationRule/Attribute:term_of_notice' => 'Term of notice~~', // Presentation
'Class:ExpirationRule/Attribute:term_of_notice+' => 'Number of days before the date to check, to trigger the notification~~', 'ExpirationRule:general' => 'General informations~~',
'Class:ExpirationRule/Attribute:oql_scope' => 'OQL scope~~', 'ExpirationRule:simple' => 'Fill either option 1 (simple) ...~~',
'Class:ExpirationRule/Attribute:oql_scope+' => 'OQL query to define which objects are concerned by this rule.~~', 'ExpirationRule:advanced' => '... or option 2 (advanced)~~',
// Integrity errors // Menus
'Class:ExpirationRule/Error:ClassNotValid' => 'Class must be a valid class from datamodel, "%1$s" given~~', 'Menu:ExpirationRule' => 'Expiration rules~~',
'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" is not a valid attribute for class "%1$s"~~', 'Menu:ExpirationRule+' => 'Expiration rules~~',
'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" must be a date attribute of class "%1$s"~~',
'Class:ExpirationRule/Error:NoOptionFilled' => 'Either option 1 or option 2 must be filled~~', // Tabs
'Class:ExpirationRule/Error:OptionOneMissingField' => 'All fields of option 1 must be filled~~', 'UI:AutocloseTicket:Preview' => 'Preview~~',
'UI:AutocloseTicket:Title' => '%1$s reach their term of notice today~~',
// Presentation
'ExpirationRule:general' => 'General informations~~', 'Class:TriggerOnExpirationRule' => 'Trigger (on expiration)~~',
'ExpirationRule:simple' => 'Fill either option 1 (simple) ...~~', 'Class:TriggerOnExpirationRule+' => 'Trigger activated when an object is in scope of an expiration rule~~',
'ExpirationRule:advanced' => '... or option 2 (advanced)~~',
));
// Menus
'Menu:ExpirationRule' => 'Expiration rules~~',
'Menu:ExpirationRule+' => 'Expiration rules~~',
// Tabs
'UI:AutocloseTicket:Preview' => 'Preview~~',
'UI:AutocloseTicket:Title' => '%1$s reach their term of notice today~~',
'Class:TriggerOnExpirationRule' => 'Trigger (on expiration)~~',
'Class:TriggerOnExpirationRule+' => 'Trigger activated when an object is in scope of an expiration rule~~',
));

View File

@@ -1,78 +1,66 @@
<?php <?php
// Copyright (C) 2012-2018 Combodo SARL
// /**
// This program is free software; you can redistribute it and/or modify * Localized data
// it under the terms of the GNU General Public License as published by *
// the Free Software Foundation; version 3 of the License. * @copyright Copyright (C) 2010-2019 Combodo SARL
// * @license https://www.combodo.com/documentation/combodo-software-license.html
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @author Erwan Taloc <erwan.taloc@combodo.com>
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * @author Romain Quetiez <romain.quetiez@combodo.com>
// GNU General Public License for more details. * @author Denis Flaven <denis.flaven@combodo.com>
// * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
// You should have received a copy of the GNU General Public License * @author Vincent Dumas <vincent.dumas@combodo.com>
// along with this program; if not, write to the Free Software */
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ExpirationRule
/** Dict::Add('EN US', 'English', 'English', array(
* Localized data // Class
* 'Class:ExpirationRule/Name' => '%1$s',
* @author Erwan Taloc <erwan.taloc@combodo.com> 'Class:ExpirationRule' => 'Expiration rule',
* @author Romain Quetiez <romain.quetiez@combodo.com> 'Class:ExpirationRule+' => '',
* @author Denis Flaven <denis.flaven@combodo.com> 'Class:ExpirationRule/Attribute:name' => 'Name',
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> 'Class:ExpirationRule/Attribute:name+' => '',
* @author Vincent Dumas <vincent.dumas@combodo.com> 'Class:ExpirationRule/Attribute:class' => 'Class',
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL 'Class:ExpirationRule/Attribute:class+' => '',
*/ 'Class:ExpirationRule/Attribute:description' => 'Description',
'Class:ExpirationRule/Attribute:description+' => '',
// ExpirationRule 'Class:ExpirationRule/Attribute:status' => 'Status',
Dict::Add('EN US', 'English', 'English', array( 'Class:ExpirationRule/Attribute:status+' => '',
// Class 'Class:ExpirationRule/Attribute:status/Value:active' => 'Active',
'Class:ExpirationRule/Name' => '%1$s', 'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive',
'Class:ExpirationRule' => 'Expiration rule', 'Class:ExpirationRule/Attribute:type' => 'Applied option',
'Class:ExpirationRule+' => '', 'Class:ExpirationRule/Attribute:type+' => 'Which option will be used regarding the filled fields. If both are filled, advanced option is applied',
'Class:ExpirationRule/Attribute:name' => 'Name', 'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple',
'Class:ExpirationRule/Attribute:name+' => '', 'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Advanced',
'Class:ExpirationRule/Attribute:class' => 'Class', 'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date to check',
'Class:ExpirationRule/Attribute:class+' => '', 'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Attribute code of the date to check',
'Class:ExpirationRule/Attribute:description' => 'Description', 'Class:ExpirationRule/Attribute:term_of_notice' => 'Term of notice',
'Class:ExpirationRule/Attribute:description+' => '', 'Class:ExpirationRule/Attribute:term_of_notice+' => 'Number of days before the date to check, to trigger the notification',
'Class:ExpirationRule/Attribute:status' => 'Status', 'Class:ExpirationRule/Attribute:oql_scope' => 'OQL scope',
'Class:ExpirationRule/Attribute:status+' => '', 'Class:ExpirationRule/Attribute:oql_scope+' => 'OQL query to define which objects are concerned by this rule (stimulus to apply). Note that the OQL will automatically be restricted to the states in which the stimulus is available.',
'Class:ExpirationRule/Attribute:status/Value:active' => 'Active',
'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive', // Integrity errors
'Class:ExpirationRule/Attribute:type' => 'Applied option', 'Class:ExpirationRule/Error:ClassNotValid' => 'Class must be a valid class from datamodel, "%1$s" given',
'Class:ExpirationRule/Attribute:type+' => 'Which option will be used regarding the filled fields. If both are filled, advanced option is applied', 'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" is not a valid attribute for class "%1$s"',
'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple', 'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" must be a date attribute of class "%1$s"',
'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Advanced', 'Class:ExpirationRule/Error:NoOptionFilled' => 'Either option 1 or option 2 must be filled',
'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date to check', 'Class:ExpirationRule/Error:OptionOneMissingField' => 'All fields of option 1 must be filled',
'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Attribute code of the date to check',
'Class:ExpirationRule/Attribute:term_of_notice' => 'Term of notice', // Presentation
'Class:ExpirationRule/Attribute:term_of_notice+' => 'Number of days before the date to check, to trigger the notification', 'ExpirationRule:general' => 'General informations',
'Class:ExpirationRule/Attribute:oql_scope' => 'OQL scope', 'ExpirationRule:simple' => 'Fill either option 1 (simple) ...',
'Class:ExpirationRule/Attribute:oql_scope+' => 'OQL query to define which objects are concerned by this rule (stimulus to apply). Note that the OQL will automatically be restricted to the states in which the stimulus is available.', 'ExpirationRule:advanced' => '... or option 2 (advanced)',
// Integrity errors // Menus
'Class:ExpirationRule/Error:ClassNotValid' => 'Class must be a valid class from datamodel, "%1$s" given', 'Menu:ExpirationRule' => 'Expiration rules',
'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" is not a valid attribute for class "%1$s"', 'Menu:ExpirationRule+' => 'Expiration rules',
'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" must be a date attribute of class "%1$s"',
'Class:ExpirationRule/Error:NoOptionFilled' => 'Either option 1 or option 2 must be filled', // Tabs
'Class:ExpirationRule/Error:OptionOneMissingField' => 'All fields of option 1 must be filled', 'UI:ExpiredObject:Preview' => 'Preview',
'UI:ExpiredObject:Title' => '%1$s will enter their term of notice today',
// Presentation
'ExpirationRule:general' => 'General informations', 'Class:TriggerOnExpirationRule' => 'Trigger (on expiration)',
'ExpirationRule:simple' => 'Fill either option 1 (simple) ...', 'Class:TriggerOnExpirationRule+' => 'Trigger activated when an object is in scope of an expiration rule',
'ExpirationRule:advanced' => '... or option 2 (advanced)',
));
// Menus
'Menu:ExpirationRule' => 'Expiration rules',
'Menu:ExpirationRule+' => 'Expiration rules',
// Tabs
'UI:ExpiredObject:Preview' => 'Preview',
'UI:ExpiredObject:Title' => '%1$s will enter their term of notice today',
'Class:TriggerOnExpirationRule' => 'Trigger (on expiration)',
'Class:TriggerOnExpirationRule+' => 'Trigger activated when an object is in scope of an expiration rule',
));

View File

@@ -1,78 +1,66 @@
<?php <?php
// Copyright (C) 2012-2018 Combodo SARL
// /**
// This program is free software; you can redistribute it and/or modify * Localized data
// it under the terms of the GNU General Public License as published by *
// the Free Software Foundation; version 3 of the License. * @copyright Copyright (C) 2010-2019 Combodo SARL
// * @license https://www.combodo.com/documentation/combodo-software-license.html
// This program is distributed in the hope that it will be useful, *
// but WITHOUT ANY WARRANTY; without even the implied warranty of * @author Erwan Taloc <erwan.taloc@combodo.com>
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * @author Romain Quetiez <romain.quetiez@combodo.com>
// GNU General Public License for more details. * @author Denis Flaven <denis.flaven@combodo.com>
// * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
// You should have received a copy of the GNU General Public License * @author Vincent Dumas <vincent.dumas@combodo.com>
// along with this program; if not, write to the Free Software */
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ClosingRule
/** Dict::Add('FR FR', 'French', 'Français', array(
* Localized data // Class
* 'Class:ExpirationRule/Name' => '%1$s',
* @author Erwan Taloc <erwan.taloc@combodo.com> 'Class:ExpirationRule' => 'Régle de Préavis',
* @author Romain Quetiez <romain.quetiez@combodo.com> 'Class:ExpirationRule+' => '',
* @author Denis Flaven <denis.flaven@combodo.com> 'Class:ExpirationRule/Attribute:name' => 'Nom',
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> 'Class:ExpirationRule/Attribute:name+' => '',
* @author Vincent Dumas <vincent.dumas@combodo.com> 'Class:ExpirationRule/Attribute:class' => 'Classe',
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL 'Class:ExpirationRule/Attribute:class+' => '',
*/ 'Class:ExpirationRule/Attribute:description' => 'Description',
'Class:ExpirationRule/Attribute:description+' => '',
// ClosingRule 'Class:ExpirationRule/Attribute:status' => 'Statut',
Dict::Add('FR FR', 'French', 'Français', array( 'Class:ExpirationRule/Attribute:status+' => '',
// Class 'Class:ExpirationRule/Attribute:status/Value:active' => 'Active',
'Class:ExpirationRule/Name' => '%1$s', 'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive',
'Class:ExpirationRule' => 'Régle de Préavis', 'Class:ExpirationRule/Attribute:type' => 'Option retenue',
'Class:ExpirationRule+' => '', 'Class:ExpirationRule/Attribute:type+' => 'Quelle option sera utilisée au regard des champs remplis. Si les 2 options sont remplies, l\'option avancée sera appliquée',
'Class:ExpirationRule/Attribute:name' => 'Nom', 'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple',
'Class:ExpirationRule/Attribute:name+' => '', 'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Avancée',
'Class:ExpirationRule/Attribute:class' => 'Classe', 'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date à utiliser',
'Class:ExpirationRule/Attribute:class+' => '', 'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Code du champ date à controler',
'Class:ExpirationRule/Attribute:description' => 'Description', 'Class:ExpirationRule/Attribute:term_of_notice' => 'Préavis en jours',
'Class:ExpirationRule/Attribute:description+' => '', 'Class:ExpirationRule/Attribute:term_of_notice+' => 'Nombre de jours avant la date pour déclencher la notification',
'Class:ExpirationRule/Attribute:status' => 'Statut', 'Class:ExpirationRule/Attribute:oql_scope' => 'Périmêtre en OQL',
'Class:ExpirationRule/Attribute:status+' => '', 'Class:ExpirationRule/Attribute:oql_scope+' => 'Requête OQL définissant les objets concernés par cette règle (trigger à déclencher).',
'Class:ExpirationRule/Attribute:status/Value:active' => 'Active',
'Class:ExpirationRule/Attribute:status/Value:inactive' => 'Inactive', // Integrity errors
'Class:ExpirationRule/Attribute:type' => 'Option retenue', 'Class:ExpirationRule/Error:ClassNotValid' => 'La classe doit faire partie du modèle de données, "%1$s" donnée',
'Class:ExpirationRule/Attribute:type+' => 'Quelle option sera utilisée au regard des champs remplis. Si les 2 options sont remplies, l\'option avancée sera appliquée', 'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" n\'est pas un attribut valide pour la classe "%1$s"',
'Class:ExpirationRule/Attribute:type/Value:simple' => 'Simple', 'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" doit être un attribut de type date pour la classe "%1$s"',
'Class:ExpirationRule/Attribute:type/Value:advanced' => 'Avancée', 'Class:ExpirationRule/Error:NoOptionFilled' => 'Une des 2 options doit être remplie',
'Class:ExpirationRule/Attribute:date_to_check_att' => 'Date à utiliser', 'Class:ExpirationRule/Error:OptionOneMissingField' => 'Tous les champs de l\'option 1 doivent être remplis',
'Class:ExpirationRule/Attribute:date_to_check_att+' => 'Code du champ date à controler',
'Class:ExpirationRule/Attribute:term_of_notice' => 'Préavis en jours', // Presentation
'Class:ExpirationRule/Attribute:term_of_notice+' => 'Nombre de jours avant la date pour déclencher la notification', 'ExpirationRule:general' => 'Informations générales',
'Class:ExpirationRule/Attribute:oql_scope' => 'Périmêtre en OQL', 'ExpirationRule:simple' => 'Remplir l\'option (simple) ...',
'Class:ExpirationRule/Attribute:oql_scope+' => 'Requête OQL définissant les objets concernés par cette règle (trigger à déclencher).', 'ExpirationRule:advanced' => '... oo l\'option 2 (avancée)',
// Integrity errors // Menus
'Class:ExpirationRule/Error:ClassNotValid' => 'La classe doit faire partie du modèle de données, "%1$s" donnée', 'Menu:ExpirationRule' => 'Régles de préavis',
'Class:ExpirationRule/Error:AttributeNotValid' => '"%2$s" n\'est pas un attribut valide pour la classe "%1$s"', 'Menu:ExpirationRule+' => 'Régles de préavis',
'Class:ExpirationRule/Error:AttributeMustBeDate' => '"%2$s" doit être un attribut de type date pour la classe "%1$s"',
'Class:ExpirationRule/Error:NoOptionFilled' => 'Une des 2 options doit être remplie', // Tabs
'Class:ExpirationRule/Error:OptionOneMissingField' => 'Tous les champs de l\'option 1 doivent être remplis', 'UI:ExpiredObject:Preview' => 'Aperçu',
'UI:ExpiredObject:Title' => '%1$s ont leur préavis qui démarre aujourd\'hui',
// Presentation
'ExpirationRule:general' => 'Informations générales', 'Class:TriggerOnExpirationRule' => 'Déclencheur sur préavis atteint',
'ExpirationRule:simple' => 'Remplir l\'option (simple) ...', 'Class:TriggerOnExpirationRule+' => 'Déclencheur activé lorsqu\'une régle de préavis est applicable à l\'objet',
'ExpirationRule:advanced' => '... oo l\'option 2 (avancée)',
// Menus
'Menu:ExpirationRule' => 'Régles de préavis',
'Menu:ExpirationRule+' => 'Régles de préavis',
// Tabs
'UI:ExpiredObject:Preview' => 'Aperçu',
'UI:ExpiredObject:Title' => '%1$s ont leur préavis qui démarre aujourd\'hui',
'Class:TriggerOnExpirationRule' => 'Déclencheur sur préavis atteint',
'Class:TriggerOnExpirationRule+' => 'Déclencheur activé lorsqu\'une régle de préavis est applicable à l\'objet',
)); ));

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<licenses>
<license>
<product>Notify on expiration</product>
<author>2010-2019 Combodo SARL</author>
<license_type>Combodo Software License</license_type>
<text><![CDATA[
<h3>Combodo Software License</h3>
<p>Version 1.0</p>
<p>Copyright (c) 2018 Combodo SARL. All rights reserved.</p>
<p>Redistribution and use in source and binary forms, with or without modification, of this software is permitted provided that the following conditions are met:</p>
<ol>
<li>Combodo grants you a non-exclusive, non-sublicensable and non-transferable license to install and use the software for your own business purposes, in accordance with this agreement, the documentation and all laws.</li>
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
<li>The redistribution of the software covered by this license is limited to the individual or the company who purchased the software and its affiliates.</li>
<li>You cannot rent, lease, distribute, sell, sublicense, or transfer the software.</li>
<li>The use of the software is <b>limited to only one set of production data</b> (i.e. only one instance of iTop managing production data).</li>
<li>In the context of this license, the interaction with the installed software across a computer network is not considered as a redistribution.</li>
<li>Combodo SARL may publish revised and/or new versions of the license from time to time. Each version will be given a distinguishing version number.</li>
Once covered code has been published under a particular version of the license, you may always continue to use it under the terms of that version. You may also choose to use such covered code under the terms of any subsequent version of the license published by Combodo SARL. No one other than Combodo SARL has the right to modify the terms applicable to covered code created under this License.</li>
</ol>
<p>THIS SOFTWARE IS PROVIDED BY COMBODO SARL “AS IS” AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COMBODO SARL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For more information on Combodo SARL, please see <a href="https://www.combodo.com">https://www.combodo.com</a>.</p>
]]></text>
</license>
</licenses>

View File

@@ -1,29 +1,15 @@
<?php <?php
// Copyright (C) 2012-2018 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** /**
* Module combodo-notify-on-expiration * Module combodo-notify-on-expiration
* *
* @copyright Copyright (C) 2010-2019 Combodo SARL
* @license https://www.combodo.com/documentation/combodo-software-license.html
*
* @author Erwan Taloc <erwan.taloc@combodo.com> * @author Erwan Taloc <erwan.taloc@combodo.com>
* @author Romain Quetiez <romain.quetiez@combodo.com> * @author Romain Quetiez <romain.quetiez@combodo.com>
* @author Denis Flaven <denis.flaven@combodo.com> * @author Denis Flaven <denis.flaven@combodo.com>
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com> * @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
* @author Vincent Dumas <vincent.dumas@combodo.com> * @author Vincent Dumas <vincent.dumas@combodo.com>
* @license http://www.opensource.org/licenses/gpl-3.0.html LGPL
*/ */
@@ -33,10 +19,11 @@
class NotifyOnExpiration implements iScheduledProcess class NotifyOnExpiration implements iScheduledProcess
{ {
const MODULE_CODE = 'combodo-notify-on-expiration'; const MODULE_CODE = 'combodo-notify-on-expiration';
const MODULE_SETTING_ENABLED = 'enabled';
const MODULE_SETTING_DEBUG = 'debug'; const KEY_MODULE_SETTING_ENABLED = 'enabled';
const MODULE_SETTING_WEEKDAYS = 'week_days'; const KEY_MODULE_SETTING_DEBUG = 'debug';
const MODULE_SETTING_TIME = 'time'; const KEY_MODULE_SETTING_WEEKDAYS = 'week_days';
const KEY_MODULE_SETTING_TIME = 'time';
const DEFAULT_MODULE_SETTING_ENABLED = true; const DEFAULT_MODULE_SETTING_ENABLED = true;
const DEFAULT_MODULE_SETTING_DEBUG = false; const DEFAULT_MODULE_SETTING_DEBUG = false;
@@ -50,17 +37,20 @@ class NotifyOnExpiration implements iScheduledProcess
*/ */
function __construct() function __construct()
{ {
$this->bDebug = (bool) MetaModel::GetModuleSetting(static::MODULE_CODE, static::MODULE_SETTING_DEBUG, static::DEFAULT_MODULE_SETTING_DEBUG); $this->bDebug = (bool)MetaModel::GetModuleSetting(static::MODULE_CODE, static::KEY_MODULE_SETTING_DEBUG,
static::DEFAULT_MODULE_SETTING_DEBUG);
} }
/** /**
* Gives the exact time at which the process must be run next time * Gives the exact time at which the process must be run next time
* *
* @return \DateTime * @return \DateTime
* @throws \CoreUnexpectedValue
*/ */
public function GetNextOccurrence() public function GetNextOccurrence()
{ {
$bEnabled = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::MODULE_SETTING_ENABLED, static::DEFAULT_MODULE_SETTING_ENABLED); $bEnabled = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::KEY_MODULE_SETTING_ENABLED,
static::DEFAULT_MODULE_SETTING_ENABLED);
if (!$bEnabled) if (!$bEnabled)
{ {
$oRet = new DateTime('3000-01-01'); $oRet = new DateTime('3000-01-01');
@@ -73,14 +63,15 @@ class NotifyOnExpiration implements iScheduledProcess
// 2nd - Find the next active week day // 2nd - Find the next active week day
// //
$sRunTime = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::MODULE_SETTING_TIME, static::DEFAULT_MODULE_SETTING_TIME); $sRunTime = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::KEY_MODULE_SETTING_TIME,
static::DEFAULT_MODULE_SETTING_TIME);
if (!preg_match('/^([01]?\d|2[0-3]):[0-5]?\d(:[0-5]?\d)?$/', $sRunTime, $aMatches)) if (!preg_match('/^([01]?\d|2[0-3]):[0-5]?\d(:[0-5]?\d)?$/', $sRunTime, $aMatches))
{ {
throw new Exception(static::MODULE_CODE.": wrong format for setting 'time' (found '$sRunTime')"); throw new CoreUnexpectedValue(static::MODULE_CODE.": wrong format for setting 'time' (found '$sRunTime')");
} }
$oNow = new DateTime(); $oNow = new DateTime();
$iNextPos = false; $iNextPos = false;
for ($iDay = $oNow->format('N') ; $iDay <= 7 ; $iDay++) for ($iDay = $oNow->format('N'); $iDay <= 7; $iDay++)
{ {
$iNextPos = array_search($iDay, $aDays); $iNextPos = array_search($iDay, $aDays);
if ($iNextPos !== false) if ($iNextPos !== false)
@@ -111,13 +102,21 @@ class NotifyOnExpiration implements iScheduledProcess
$oRet = clone $oNow; $oRet = clone $oNow;
$oRet->modify('+'.$iMove.' days'); $oRet->modify('+'.$iMove.' days');
} }
$oRet->setTime((int)$aMatches[1], (int) $aMatches[2]); $oRet->setTime((int)$aMatches[1], (int)$aMatches[2]);
} }
return $oRet; return $oRet;
} }
/** /**
* @inheritdoc * @inheritdoc
*
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/ */
public function Process($iTimeLimit) public function Process($iTimeLimit)
{ {
@@ -133,11 +132,11 @@ class NotifyOnExpiration implements iScheduledProcess
$this->Trace('Processing '.$oRulesSet->Count().' active expiration rules...'); $this->Trace('Processing '.$oRulesSet->Count().' active expiration rules...');
$iTotalProcessedObjectsCount = 0; $iTotalProcessedObjectsCount = 0;
while($oRule = $oRulesSet->Fetch()) while ($oRule = $oRulesSet->Fetch())
{ {
$iRuleProcessedObjectsCount = 0; $iRuleProcessedObjectsCount = 0;
$this->Trace('Processing rule "'.$oRule->Get('friendlyname').'" (#'.$oRule->GetKey().')...'); $this->Trace('Processing rule "'.$oRule->Get('friendlyname').'" (#'.$oRule->GetKey().')...');
try try
{ {
// Retrieving rule's params // Retrieving rule's params
@@ -149,32 +148,33 @@ class NotifyOnExpiration implements iScheduledProcess
// Prepare the Rule information to be passed to the notification // Prepare the Rule information to be passed to the notification
$aRuleContext = $oRule->ToArgs('rule'); $aRuleContext = $oRule->ToArgs('rule');
// Get applicable Triggers for this object class // Get applicable Triggers for this object class
$sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
$oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnExpirationRule AS t WHERE t.target_class IN ('$sClassList')")); $oTriggerSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnExpirationRule AS t WHERE t.target_class IN ('$sClassList')"));
$oSet = new DBObjectSet($oSearch); $oSet = new DBObjectSet($oSearch);
$this->Trace('|- Objects:'); $this->Trace('|- Objects:');
/** @var $oToTrigger DBObject */ /** @var DBObject $oToTrigger */
while ((time() < $iTimeLimit) && $oToTrigger = $oSet->Fetch()) while ((time() < $iTimeLimit) && $oToTrigger = $oSet->Fetch())
{ {
// Catching exceptions so the process don't get stucked on this object // Catching exceptions so the process don't get stucked on this object
try try
{ {
$aReport['reached_deadline']++; $aReport['reached_deadline']++;
// //
// $aContext['ruleName'] = $oRule->Get('name'); // $aContext['ruleName'] = $oRule->Get('name');
// Combine the current object :this and :rule to be available in the notification // Combine the current object :this and :rule to be available in the notification
$aContext = $oToTrigger->ToArgs('this'); $aContext = $oToTrigger->ToArgs('this');
$aContext = array_merge($aContext, $aRuleContext); $aContext = array_merge($aContext, $aRuleContext);
/** @var TriggerOnExpirationRule $oTrigger */
while ($oTrigger = $oTriggerSet->Fetch()) while ($oTrigger = $oTriggerSet->Fetch())
{ {
$oTrigger->DoActivate($aContext); $oTrigger->DoActivate($aContext);
} }
// The same set of Triggers is reused for each object returned by the Rule as they all belongs to the same class // The same set of Triggers is reused for each object returned by the Rule as they all belongs to the same class
$oTriggerSet->Rewind(); $oTriggerSet->Rewind();
$iRuleProcessedObjectsCount++; $iRuleProcessedObjectsCount++;
$iTotalProcessedObjectsCount++; $iTotalProcessedObjectsCount++;
@@ -184,7 +184,7 @@ class NotifyOnExpiration implements iScheduledProcess
} // Trigger was NOT applied because of an exception, which is NOT normal } // Trigger was NOT applied because of an exception, which is NOT normal
catch (Exception $e) catch (Exception $e)
{ {
$aReport['not_triggered'][] = $oToClose->Get('friendlyname'); $aReport['not_triggered'][] = $oToTrigger->Get('friendlyname');
$this->Trace('| |- [KO] /!\\ '.$sClass.' #'.$oToTrigger->GetKey().' exception raised! Error message: '.$e->getMessage()); $this->Trace('| |- [KO] /!\\ '.$sClass.' #'.$oToTrigger->GetKey().' exception raised! Error message: '.$e->getMessage());
} }
@@ -197,14 +197,14 @@ class NotifyOnExpiration implements iScheduledProcess
$this->Trace('Stopped because time limit exceeded!'); $this->Trace('Stopped because time limit exceeded!');
} }
} }
catch(Exception $e) catch (Exception $e)
{ {
$this->Trace('Skipping rule as there was an exception! ('.$e->getMessage().')'); $this->Trace('Skipping rule as there was an exception! ('.$e->getMessage().')');
} }
} }
// Report // Report
if($aReport['reached_deadline'] === 0) if ($aReport['reached_deadline'] === 0)
{ {
return 'No object to process'; return 'No object to process';
} }
@@ -213,17 +213,18 @@ class NotifyOnExpiration implements iScheduledProcess
$iClosedCount = count($aReport['triggered']); $iClosedCount = count($aReport['triggered']);
$iNotClosedCount = count($aReport['not_triggered']); $iNotClosedCount = count($aReport['not_triggered']);
$sReport = $aReport['reached_deadline'] . " objects reached triggering date"; $sReport = $aReport['reached_deadline']." objects reached triggering date";
$sReport .= " - ".$iClosedCount." were triggered"; $sReport .= " - ".$iClosedCount." were triggered";
if($iClosedCount > 0) if ($iClosedCount > 0)
{ {
$sReport .= " (".implode(", ", $aReport['triggered']).")"; $sReport .= " (".implode(", ", $aReport['triggered']).")";
} }
$sReport .= " - ".$iNotClosedCount." were not triggered"; $sReport .= " - ".$iNotClosedCount." were not triggered";
if($iNotClosedCount > 0) if ($iNotClosedCount > 0)
{ {
$sReport .= " (".implode(", ", $aReport['not_triggered']).")"; $sReport .= " (".implode(", ", $aReport['not_triggered']).")";
} }
return $sReport; return $sReport;
} }
} }
@@ -234,12 +235,22 @@ class NotifyOnExpiration implements iScheduledProcess
* Note: This comes from itop-backup scheduled task. * Note: This comes from itop-backup scheduled task.
* *
* @returns array of int (monday = 1) * @returns array of int (monday = 1)
* @throws \CoreUnexpectedValue
*/ */
public function InterpretWeekDays() public function InterpretWeekDays()
{ {
static $aWEEKDAYTON = array('monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7); static $aWEEKDAYTON = array(
'monday' => 1,
'tuesday' => 2,
'wednesday' => 3,
'thursday' => 4,
'friday' => 5,
'saturday' => 6,
'sunday' => 7,
);
$aDays = array(); $aDays = array();
$sWeekDays = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::MODULE_SETTING_WEEKDAYS, static::DEFAULT_MODULE_SETTING_WEEKDAYS); $sWeekDays = MetaModel::GetConfig()->GetModuleSetting(static::MODULE_CODE, static::KEY_MODULE_SETTING_WEEKDAYS,
static::DEFAULT_MODULE_SETTING_WEEKDAYS);
if ($sWeekDays != '') if ($sWeekDays != '')
{ {
$aWeekDaysRaw = explode(',', $sWeekDays); $aWeekDaysRaw = explode(',', $sWeekDays);
@@ -252,16 +263,17 @@ class NotifyOnExpiration implements iScheduledProcess
} }
else else
{ {
throw new Exception(static::MODULE_CODE.": wrong format for setting 'week_days' (found '$sWeekDay')"); throw new CoreUnexpectedValue(static::MODULE_CODE.": wrong format for setting 'week_days' (found '$sWeekDay')");
} }
} }
} }
if (count($aDays) == 0) if (count($aDays) == 0)
{ {
throw new Exception(static::MODULE_CODE.": missing setting 'week_days'"); throw new CoreUnexpectedValue(static::MODULE_CODE.": missing setting 'week_days'");
} }
$aDays = array_unique($aDays); $aDays = array_unique($aDays);
sort($aDays); sort($aDays);
return $aDays; return $aDays;
} }

View File

@@ -1,90 +1,81 @@
<?php <?php
// Copyright (C) 2012-2018 Combodo SARL /**
// *
// This program is free software; you can redistribute it and/or modify * @copyright Copyright (C) 2010-2019 Combodo SARL
// it under the terms of the GNU General Public License as published by * @license https://www.combodo.com/documentation/combodo-software-license.html
// the Free Software Foundation; version 3 of the License. *
// */
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of SetupWebPage::AddModule(
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the __FILE__, // Path to the current file, all other file names are relative to the directory containing this file
// GNU General Public License for more details. 'combodo-notify-on-expiration/1.0.0',
// array(
// You should have received a copy of the GNU General Public License // Identification
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 'label' => 'Notify on expiration',
'category' => 'business',
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file // Setup
'combodo-notify-on-expiration/0.1.0', //
array( 'dependencies' => array(
// Identification
// ),
'label' => 'Notify on expiration', 'mandatory' => false,
'category' => 'business', 'visible' => true,
'installer' => 'NotifyOnExpirationInstaller',
// Setup
// // Components
'dependencies' => array( //
'datamodel' => array(
), 'main.combodo-notify-on-expiration.php',
'mandatory' => false, 'triggerexpirationrule.class.inc.php',
'visible' => true, ),
'installer' => 'NotifyOnExpirationInstaller', 'webservice' => array(
// Components ),
// 'data.struct' => array(
'datamodel' => array( // add your 'structure' definition XML files here,
'model.combodo-notify-on-expiration.php', ),
'main.combodo-notify-on-expiration.php', 'data.sample' => array(
'triggerexpirationrule.class.inc.php', // add your sample data XML files here,
), ),
'webservice' => array(
// Documentation
), //
'data.struct' => array( 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any
// add your 'structure' definition XML files here, 'doc.more_information' => '', // hyperlink to more information, if any
),
'data.sample' => array( // Default settings
// add your sample data XML files here, //
), 'settings' => array(
// Module specific settings go here, if any
// Documentation 'time' => '03:00',
// 'enabled' => true,
'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any 'debug' => false
'doc.more_information' => '', // hyperlink to more information, if any ),
)
// Default settings );
//
'settings' => array( if (!class_exists('NotifyOnExpirationInstaller'))
// Module specific settings go here, if any {
'time' => '03:00', // Module installation handler
'enabled' => true, //
'debug' => false class NotifyOnExpirationInstaller extends ModuleInstallerAPI
), {
) public static function BeforeWritingConfig(Config $oConfiguration)
); {
return $oConfiguration;
if (!class_exists('NotifyOnExpirationInstaller')) }
{
// Module installation handler /**
// * Handler called after the creation/update of the database schema
class NotifyOnExpirationInstaller extends ModuleInstallerAPI * @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)
public static function BeforeWritingConfig(Config $oConfiguration) * @param $sCurrentVersion string Current version number of the module
{ */
return $oConfiguration; public static function AfterDatabaseCreation(Config $oConfiguration, $sPreviousVersion, $sCurrentVersion)
} {
/** }
* 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)
{
}
}
}

View File

@@ -1,21 +1,9 @@
<?php <?php
// Copyright (C) 2012-2016 Combodo SARL
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; version 3 of the License.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** /**
* @copyright Copyright (C) 2012-2016 Combodo SARL *
* @license http://opensource.org/licenses/AGPL-3.0 * @copyright Copyright (C) 2010-2019 Combodo SARL
* @license https://www.combodo.com/documentation/combodo-software-license.html
*
*/ */
/** /**