<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
    </pickle>
    <pickle>
      <dictionary>
        <item>
            <key> <string>Script_magic</string> </key>
            <value> <int>3</int> </value>
        </item>
        <item>
            <key> <string>_bind_names</string> </key>
            <value>
              <object>
                <klass>
                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
                </klass>
                <tuple/>
                <state>
                  <dictionary>
                    <item>
                        <key> <string>_asgns</string> </key>
                        <value>
                          <dictionary>
                            <item>
                                <key> <string>name_container</string> </key>
                                <value> <string>container</string> </value>
                            </item>
                            <item>
                                <key> <string>name_context</string> </key>
                                <value> <string>context</string> </value>
                            </item>
                            <item>
                                <key> <string>name_m_self</string> </key>
                                <value> <string>script</string> </value>
                            </item>
                            <item>
                                <key> <string>name_subpath</string> </key>
                                <value> <string>traverse_subpath</string> </value>
                            </item>
                          </dictionary>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>_body</string> </key>
            <value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
# XXX rafael: Hardcoded value is a convention on Vifib.\n
vifib = context.organisation_module[\'vifib_internet\']\n
\n
year = DateTime().year()\n
start_date = \'%s/01/01\' % year\n
stop_date = \'%s/12/31\' % (year + 1)\n
\n
accounting_period = context.portal_catalog.getResultValue(\n
   portal_type=\'Accounting Period\',\n
   parent_uid=vifib.getUid(),\n
   simulation_state=\'started\',\n
   **{\'delivery.start_date\': start_date,\n
      \'delivery.stop_date\': stop_date\n
      }\n
    )\n
\n
if accounting_period is None and fixit:\n
  accounting_period = vifib.newContent(portal_type=\'Accounting Period\',\n
       start_date=start_date, stop_date=stop_date)\n
  accounting_period.start()\n
\n
if accounting_period is None:\n
  summary = "Unable to find Accounting Plan for the current year."\n
  if fixit:\n
    summary += ", fixed."\n
    severity = 0\n
  else:\n
    severity = 1\n
  detail = "Period %s to %s" % (start_date, stop_date)\n
else:\n
  severity = 0\n
  summary = "Nothing to do."\n
  detail = ""\n
\n
active_result = ActiveResult()\n
active_result.edit(\n
  summary=summary, \n
  severity=severity,\n
  detail=detail)\n
\n
context.newActiveProcess().postResult(active_result)\n
</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>tag, fixit=False, **kw</string> </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Alarm_checkPromiseVifibAccountingPlan</string> </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
