diff --git a/bt5/erp5_configurator/ActionTemplateItem/portal_types/Alarm%20Configurator%20Item/view.xml b/bt5/erp5_configurator/ActionTemplateItem/portal_types/Alarm%20Configurator%20Item/view.xml new file mode 100644 index 0000000000000000000000000000000000000000..56391a5c36f1fe95dcd84bc47638ba88a0a09b2a --- /dev/null +++ b/bt5/erp5_configurator/ActionTemplateItem/portal_types/Alarm%20Configurator%20Item/view.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ActionInformation" module="Products.CMFCore.ActionInformation"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>action_type/object_view</string> + </tuple> + </value> + </item> + <item> + <key> <string>category</string> </key> + <value> <string>object_view</string> </value> + </item> + <item> + <key> <string>condition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>icon</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>view</string> </value> + </item> + <item> + <key> <string>permissions</string> </key> + <value> + <tuple> + <string>View</string> + </tuple> + </value> + </item> + <item> + <key> <string>priority</string> </key> + <value> <float>1.0</float> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>View</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Expression" module="Products.CMFCore.Expression"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>text</string> </key> + <value> <string>string:${object_url}/ConfiguratorItem_view</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml b/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml index 8e0a60f56e2dc16e629d818e4a7122ce77c7db9d..85eb9ff7f376b528fb413e757911f6e89bacd1d9 100644 --- a/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml +++ b/bt5/erp5_configurator/PortalTypeAllowedContentTypeTemplateItem/allowed_content_types.xml @@ -18,6 +18,7 @@ <portal_type id="Configuration Save"> <item>Account Configurator Item</item> <item>Accounting Period Configurator Item</item> + <item>Alarm Configurator Item</item> <item>Business Process Configurator Item</item> <item>Catalog Keyword Key Configurator Item</item> <item>Categories Spreadsheet Configurator Item</item> diff --git a/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Alarm%20Configurator%20Item.xml b/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Alarm%20Configurator%20Item.xml new file mode 100644 index 0000000000000000000000000000000000000000..8eacd820afcb14e79a09340f80175ca87e8c31ea --- /dev/null +++ b/bt5/erp5_configurator/PortalTypeTemplateItem/portal_types/Alarm%20Configurator%20Item.xml @@ -0,0 +1,60 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Base Type" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>content_icon</string> </key> + <value> <string>document.gif</string> </value> + </item> + <item> + <key> <string>content_meta_type</string> </key> + <value> <string>ERP5 Account Configurator Item</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string> Setup an Alarm</string> </value> + </item> + <item> + <key> <string>factory</string> </key> + <value> <string>addAccountConfiguratorItem</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Alarm Configurator Item</string> </value> + </item> + <item> + <key> <string>init_script</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>permission</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>type_class</string> </key> + <value> <string>AlarmConfiguratorItem</string> </value> + </item> + <item> + <key> <string>type_interface</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>type_mixin</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_configurator/bt/revision b/bt5/erp5_configurator/bt/revision index 135b797b482b39126c1ec5f2a02dbe67eea7b6ec..8be84ab6b426db47e608bd9a6caa4f99575fe2f0 100644 --- a/bt5/erp5_configurator/bt/revision +++ b/bt5/erp5_configurator/bt/revision @@ -1 +1 @@ -542 +544 \ No newline at end of file diff --git a/bt5/erp5_configurator/bt/template_action_path_list b/bt5/erp5_configurator/bt/template_action_path_list index 263250c61c9b16f5a8eb50fe5f02acca92c65403..4c45b78af4ef7c3216b4fc3901df0567b947b55e 100644 --- a/bt5/erp5_configurator/bt/template_action_path_list +++ b/bt5/erp5_configurator/bt/template_action_path_list @@ -1,5 +1,6 @@ Account Configurator Item | view Accounting Period Configurator Item | view +Alarm Configurator Item | view Business Configuration Module | view Business Configuration | view Business Process Configurator Item | view diff --git a/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list b/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list index e1afb0fbdc507cd3612ab80984c3d6dae5e0eea8..0491a7a13c698c4c5482feee0888a97495afedb6 100644 --- a/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list +++ b/bt5/erp5_configurator/bt/template_portal_type_allowed_content_type_list @@ -8,6 +8,7 @@ Categories Spreadsheet Configurator Item | Embedded File Categories Spreadsheet Configurator Item | File Configuration Save | Account Configurator Item Configuration Save | Accounting Period Configurator Item +Configuration Save | Alarm Configurator Item Configuration Save | Business Process Configurator Item Configuration Save | Catalog Keyword Key Configurator Item Configuration Save | Categories Spreadsheet Configurator Item diff --git a/bt5/erp5_configurator/bt/template_portal_type_id_list b/bt5/erp5_configurator/bt/template_portal_type_id_list index 47a8257eec09a681682ce1e4d6d0d997f105b094..4ef6d15ec332de2ea60ae8152df7a57d0ba7f25f 100644 --- a/bt5/erp5_configurator/bt/template_portal_type_id_list +++ b/bt5/erp5_configurator/bt/template_portal_type_id_list @@ -1,5 +1,6 @@ Account Configurator Item Accounting Period Configurator Item +Alarm Configurator Item Business Configuration Business Configuration Module Business Process Configurator Item diff --git a/product/ERP5Configurator/Document/AlarmConfiguratorItem.py b/product/ERP5Configurator/Document/AlarmConfiguratorItem.py new file mode 100644 index 0000000000000000000000000000000000000000..73051e90291bac0dc18268b1debad2edf152b690 --- /dev/null +++ b/product/ERP5Configurator/Document/AlarmConfiguratorItem.py @@ -0,0 +1,86 @@ +############################################################################## +# +# Copyright (c) 2012 Nexedi SARL and Contributors. All Rights Reserved. +# Rafael Monnerat <rafael@nexedi.com> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# 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; either version 2 +# of the License, or (at your option) any later version. +# +# 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. +# +############################################################################## + +import zope.interface +from AccessControl import ClassSecurityInfo +from Products.ERP5Type import Permissions, PropertySheet, interfaces +from Products.ERP5Type.XMLObject import XMLObject +from Products.ERP5Configurator.mixin.configurator_item import ConfiguratorItemMixin +from DateTime import DateTime + +class AlarmConfiguratorItem(ConfiguratorItemMixin, XMLObject): + """ Setup an Alarm """ + + meta_type = 'ERP5 Alarm Configurator Item' + portal_type = 'Alarm Configurator Item' + add_permission = Permissions.AddPortalContent + isPortalContent = 1 + isRADContent = 1 + + # Declarative security + security = ClassSecurityInfo() + security.declareObjectProtected(Permissions.AccessContentsInformation) + + # Declarative interfaces + zope.interface.implements(interfaces.IConfiguratorItem) + + # Declarative properties + property_sheets = ( PropertySheet.Base + , PropertySheet.XMLObject + , PropertySheet.CategoryCore + , PropertySheet.DublinCore + , PropertySheet.Alarm + , PropertySheet.Periodicity + ) + + def _build(self, business_configuration): + portal_alarms = self.getPortalObject().portal_alarms + property_dict = { + "active_sense_method_id" : self.getActiveSenseMethodId(), + "periodicity_minute_frequency" : self.getPeriodicityMinuteFrequency(), + "periodicity_hour" : self.getPeriodicityHour(), + "periodicity_minute": self.getPeriodicityMinute(), + "periodicity_minute_frequency": self.getPeriodicityMinuteFrequency(), + "periodicity_month": self.getPeriodicityMonth(), + "periodicity_month_day": self.getPeriodicityMonthDay(), + "periodicity_start_date": DateTime() - 1, + #"periodicity_stop_date": self.getPeriodicityStopDate(), + "periodicity_week": self.getPeriodicityWeek(), + } + + alarm = getattr(portal_alarms, self.getId(), None) + if alarm is None: + alarm = portal_alarms.newContent(id=self.getId(), + title=self.getTitle()) + alarm.edit(**property_dict) + + # Always enabled + alarm.setEnabled(True) + + ## add to customer template + self.install(alarm, business_configuration)