Commit e7901e5b authored by Łukasz Nowak's avatar Łukasz Nowak

Setup correct periodicity later.

Periodicity is known when service is available.
parent 27525363
......@@ -86,6 +86,7 @@ for add_kw in add_kw_list:\n
add_kw_kw[add_kw[\'aggregate\']] = add_kw.copy()\n
\n
modify_kw_kw = {}\n
hs_modify_kw_kw = {}\n
for start_date_tuple in start_date_tuple_list:\n
start_date = getClosestDate(target_date=addToDate(start_date_tuple[1], to_add={\'day\': 1}), precision=\'day\')\n
if start_date.day() >= 29:\n
......@@ -97,6 +98,10 @@ for start_date_tuple in start_date_tuple_list:\n
modify_kw_kw[line.getAggregate(portal_type=\'Hosting Subscription\')] = {\'start_date\': start_date_tuple[1]}\n
elif start_date_tuple[0] in add_kw_kw:\n
add_kw_kw[start_date_tuple[0]][\'start_date\'] = start_date\n
hs = portal.restrictedTraverse(start_date_tuple[0])\n
if hs.getPeriodicityMonthDayList() != [start_date.day()]:\n
hs_modify_kw_kw.setdefault(start_date_tuple[0], {})\n
hs_modify_kw_kw[start_date_tuple[0]][\'periodicity_month_day_list\'] = [start_date.day()]\n
\n
if previous_open_sale_order is not None:\n
for line in previous_open_sale_order.contentValues(portal_type=\'Open Sale Order Line\'):\n
......@@ -133,7 +138,7 @@ if previous_open_sale_order is not None:\n
line = previous_open_sale_order[hosting_subscription_mapping.get(remove_hosting)]\n
if line.getStartDate() is not None and line.getStopDate() is not None and line.getStartDate() < line.getStopDate():\n
remove_id_list.add(line.getId())\n
return add_kw_kw, modify_kw_kw, list(remove_id_list)\n
return add_kw_kw, modify_kw_kw, hs_modify_kw_kw, list(remove_id_list)\n
]]></string> </value>
......
......@@ -62,12 +62,15 @@ if portal.portal_activities.countMessageWithTag(tag) > 0:\n
# nothing to do\n
return\n
\n
add_kw_kw, modify_kw_kw, remove_id_list = context.Person_getOpenOrderDifference(\n
add_kw_kw, modify_kw_kw, hs_modify_kw_kw, remove_id_list = context.Person_getOpenOrderDifference(\n
remove_hosting_list=remove_hosting_list, add_kw_list=add_kw_list,\n
stop_date=stop_date, start_date_tuple_list=start_date_tuple_list)\n
\n
if src__== 1:\n
return add_kw_kw, modify_kw_kw, remove_id_list\n
return add_kw_kw, modify_kw_kw, hs_modify_kw_kw, remove_id_list\n
\n
for hs, kw in hs_modify_kw_kw.iteritems():\n
portal.restrictedTraverse(hs).edit(**kw)\n
\n
if not(add_kw_kw or modify_kw_kw or remove_id_list):\n
return # nothing to do\n
......
......@@ -111,9 +111,6 @@ if (request_hosting_subscription is None):\n
root_software_release_url=software_release_url_string,\n
root_slave=is_slave,\n
root_state=state,\n
periodicity_hour_list=[0],\n
periodicity_minute_list=[0],\n
periodicity_month_day=[1],\n
activate_kw={\'tag\': tag},\n
)\n
request_hosting_subscription.portal_workflow.doActionFor(request_hosting_subscription,\n
......
649
\ No newline at end of file
650
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment