Commit 882f0022 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Vincent Pelletier

fixup! Use PAS API.

parent 09ddeb1c
...@@ -17,8 +17,7 @@ owner = object.getViewPermissionOwner() ...@@ -17,8 +17,7 @@ owner = object.getViewPermissionOwner()
owner_value = portal_catalog.getResultValue(portal_type='Person', reference=owner) owner_value = portal_catalog.getResultValue(portal_type='Person', reference=owner)
# Get the authenticated user # Get the authenticated user
user = portal.portal_membership.getAuthenticatedMember().getUserName() user_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
user_value = portal_catalog.getResultValue(portal_type='Person', reference=user)
# If users are not defined, we need to log and return # If users are not defined, we need to log and return
if not owner or owner_value is None: if not owner or owner_value is None:
...@@ -26,7 +25,7 @@ if not owner or owner_value is None: ...@@ -26,7 +25,7 @@ if not owner or owner_value is None:
# can do (preventing answers is even worse) # can do (preventing answers is even worse)
log("ERP5 Query Workflow", "No owner defined") log("ERP5 Query Workflow", "No owner defined")
return return
if not user or user_value is None: if user_value is None:
# We keep a trace because this is the best we # We keep a trace because this is the best we
# can do (preventing answers is even worse) # can do (preventing answers is even worse)
log("ERP5 Query Workflow", "Current user is not defined") log("ERP5 Query Workflow", "Current user is not defined")
...@@ -54,4 +53,4 @@ msg = translateString(msg, ...@@ -54,4 +53,4 @@ msg = translateString(msg,
# We can now notify the owner through the notification tool # We can now notify the owner through the notification tool
portal.portal_notifications.sendMessage( portal.portal_notifications.sendMessage(
sender=user, recipient=owner, subject=subject, message=msg) sender=user_value, recipient=owner, subject=subject, message=msg)
...@@ -11,8 +11,7 @@ if not person_list: ...@@ -11,8 +11,7 @@ if not person_list:
person_list = context.portal_selections.callSelectionFor(selection_name) person_list = context.portal_selections.callSelectionFor(selection_name)
# Find authenticated user # Find authenticated user
user = context.portal_membership.getAuthenticatedMember() user_person = context.portal_membership.getAuthenticatedMember().getUserValue()
user_person = context.portal_catalog.getResultValue(portal_type='Person', reference=str(user))
event_list = [] event_list = []
# For every person, create an event # For every person, create an event
......
...@@ -19,8 +19,7 @@ portal = context.getPortalObject() ...@@ -19,8 +19,7 @@ portal = context.getPortalObject()
# Be sure that the company haven't submitted the current form yet # Be sure that the company haven't submitted the current form yet
# If not do not permit to submit another one # If not do not permit to submit another one
portal_type='Declaration TVA' portal_type='Declaration TVA'
user_name = portal.portal_membership.getAuthenticatedMember().getUserName() user_obj = portal.portal_membership.getAuthenticatedMember().getUserValue()
user_obj = portal.ERP5Site_getPersonObjectFromUserName(user_name)
if user_obj: if user_obj:
vat_code = user_obj.getCareerSubordinationValue().getVatCode() vat_code = user_obj.getCareerSubordinationValue().getVatCode()
if len(vat_code)==7: if len(vat_code)==7:
......
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