Commit d49c04d8 authored by Sebastien Robin's avatar Sebastien Robin

added address for persons


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1895 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59ea2a63
...@@ -333,6 +333,8 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -333,6 +333,8 @@ class ERP5ShopOrderConduit(ERP5Conduit):
# The object is a ShopOrder # The object is a ShopOrder
if kw.has_key('country'): if kw.has_key('country'):
object.setTargetStartDate(kw['target_start_date'])
object.setTargetStopDate(kw['target_stop_date'])
# Find the organisation and the person folder # Find the organisation and the person folder
person_path = erp5_site_path + '/person' person_path = erp5_site_path + '/person'
person_folder = erp5_site.restrictedTraverse(person_path) person_folder = erp5_site.restrictedTraverse(person_path)
...@@ -369,6 +371,10 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -369,6 +371,10 @@ class ERP5ShopOrderConduit(ERP5Conduit):
previous_owner_type += 'p' previous_owner_type += 'p'
if org_object != None: if org_object != None:
previous_owner_type += 'o' previous_owner_type += 'o'
# This is a particular case where the user put
# the name of an organisation in his own name
if not kw.has_key('organisation'):
kw['organisation'] = org_object.getId()
if len(previous_owner_type) == 0: if len(previous_owner_type) == 0:
previous_owner_type = None previous_owner_type = None
LOG("Previous customer structure >>>>>>>>",0,repr(previous_owner_type)) LOG("Previous customer structure >>>>>>>>",0,repr(previous_owner_type))
...@@ -493,7 +499,11 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -493,7 +499,11 @@ class ERP5ShopOrderConduit(ERP5Conduit):
# elif previous_address.strip().lower() != kw['address'].strip().lower(): # elif previous_address.strip().lower() != kw['address'].strip().lower():
# LOG('We have to make the fusion of previous address with the current one >>>>>>>', 0, '') # LOG('We have to make the fusion of previous address with the current one >>>>>>>', 0, '')
if kw.has_key('city') and kw['city']!=None:
person_object.setDefaultAddressCity(kw['city'].title()) person_object.setDefaultAddressCity(kw['city'].title())
if kw.has_key('address') and kw['address'] != None:
person_object.setDefaultAddressStreetAddress(kw['address'].title())
if kw.has_key('zipcode') and kw['zipcode']!=None:
person_object.setDefaultAddressZipCode(kw['zipcode']) person_object.setDefaultAddressZipCode(kw['zipcode'])
# # TODO : set the person products interest (storever, etc) # # TODO : set the person products interest (storever, etc)
# Search the country in the region category # Search the country in the region category
...@@ -525,12 +535,12 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -525,12 +535,12 @@ class ERP5ShopOrderConduit(ERP5Conduit):
# person_object.setSubordination("organisation/" + owner_id) # person_object.setSubordination("organisation/" + owner_id)
if kw.has_key('organisation') and kw['organisation'] != None: if kw.has_key('organisation') and kw['organisation'] != None:
org_object.setTitle(kw['organisation'].title()) org_object.setTitle(kw['organisation'].title())
org_object.setCorporateName(kw['organisation'].title())
if kw.has_key('eu_vat') and kw['eu_vat'] != None: if kw.has_key('eu_vat') and kw['eu_vat'] != None:
org_object.setEuVatCode(kw['eu_vat']) org_object.setEuVatCode(kw['eu_vat'])
# Test for debug # Test for debug
if (not (kw.has_key('organisation')) or (kw.has_key('organisation') and kw['organisation'] != None)) and (not (kw.has_key('eu_vat')) or (kw.has_key('eu_vat') and kw['eu_vat'] != None)): if (not (kw.has_key('organisation')) or (kw.has_key('organisation') and kw['organisation'] != None)) and (not (kw.has_key('eu_vat')) or (kw.has_key('eu_vat') and kw['eu_vat'] != None)):
LOG("AARRGG ! Big conflict detected : this organisation has no title or eu_vat. These properties are primary key to deduced that the storever member account was an organisation >>>>>>>>>>", 0, '') LOG("AARRGG ! Big conflict detected : this organisation has no title or eu_vat. These properties are primary key to deduced that the storever member account was an organisation >>>>>>>>>>", 0, '')
org_object.setCorporateName(kw['organisation'].title())
org_object.setRole("client") org_object.setRole("client")
# The customer is not a person or a person of an organisation, so the customer is an organisation... # The customer is not a person or a person of an organisation, so the customer is an organisation...
...@@ -539,11 +549,15 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -539,11 +549,15 @@ class ERP5ShopOrderConduit(ERP5Conduit):
object.setDestination("organisation/" + owner_id) object.setDestination("organisation/" + owner_id)
object.setDestinationDecision("organisation/" + owner_id) object.setDestinationDecision("organisation/" + owner_id)
# All informations describe the organisation # All informations describe the organisation
if kw.has_key('organisation') and kw['organisation'] != None:
org_object.setTitle(kw['organisation'].title()) org_object.setTitle(kw['organisation'].title())
org_object.setCorporateName(kw['organisation'].title()) org_object.setCorporateName(kw['organisation'].title())
org_object.setRole("client") org_object.setRole("client")
if kw.has_key('eu_vat') and kw['eu_vat'] != None:
org_object.setEuVatCode(kw['eu_vat']) org_object.setEuVatCode(kw['eu_vat'])
if kw.has_key('address') and kw['address'] != None:
org_object.setDefaultAddressStreetAddress(kw['address'].title()) org_object.setDefaultAddressStreetAddress(kw['address'].title())
if kw.has_key('city') and kw['city'] != None:
org_object.setDefaultAddressCity(kw['city'].title()) org_object.setDefaultAddressCity(kw['city'].title())
org_object.setDefaultAddressZipCode(kw['zipcode']) org_object.setDefaultAddressZipCode(kw['zipcode'])
# Search the country in the region category # Search the country in the region category
...@@ -553,7 +567,9 @@ class ERP5ShopOrderConduit(ERP5Conduit): ...@@ -553,7 +567,9 @@ class ERP5ShopOrderConduit(ERP5Conduit):
org_object.setDefaultAddressRegion(region_path) org_object.setDefaultAddressRegion(region_path)
# else: # else:
# # TODO : Ask the user to select an appropriate region # # TODO : Ask the user to select an appropriate region
if kw.has_key('email') and kw['email'] != None:
org_object.setDefaultEmailText(kw['email']) org_object.setDefaultEmailText(kw['email'])
if kw.has_key('phone') and kw['phone'] != None:
org_object.setDefaultTelephoneText(kw['phone']) org_object.setDefaultTelephoneText(kw['phone'])
# Save the billing address in the description, because there is no dedicated place for it # Save the billing address in the description, because there is no dedicated place for it
......
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