Commit b520edf5 authored by Aurel's avatar Aurel

put TioSafe product into trunk


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40413 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8341aa8c
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Herve Poulain <herve@nexedi.com>
# Aurelien Calonne <aurel@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.
#
##############################################################################
from Products.ERP5TioSafe.Conduit.TioSafeBaseConduit import TioSafeBaseConduit, \
ADDRESS_TAG_LIST
from DateTime import DateTime
from lxml import etree
from zLOG import LOG, INFO, ERROR
from base64 import b16encode
DEBUG=True
class ERP5NodeConduit(TioSafeBaseConduit):
"""
This is the conduit use to synchonize ERP5 Persons
"""
def __init__(self):
self.xml_object_tag = 'node'
def afterNewObject(self, object):
""" Realise actions after new object creation. """
object.validate()
object.updateLocalRolesOnSecurityGroups()
def _setRelation(self, document, previous_value, organisation_gid, domain, xml):
""" Retrieve the organisation from its gid and do the link """
# first check if there is any conflict
synchronization_list = self.getSynchronizationObjectListForType(domain, 'Organisation', 'publication')
if previous_value is not None and xml is not None:
current_relation = document.getCareerSubordinationValue()
for synchronization in synchronization_list:
current_value = synchronization.getGidFromObject(current_relation)
if current_value:
break
if current_value not in [organisation_gid, previous_value]:
return [self._generateConflict(document.getPhysicalPath(), 'relation', xml, current_value, organisation_gid),]
# now set the value
if organisation_gid is None:
document.setCareerSubordinationValue(None)
else:
for synchronization in synchronization_list:
link_object = synchronization.getObjectFromGid(b16encode(organisation_gid))
if link_object is not None:
break
if link_object is not None:
document.setCareerSubordinationValue(link_object)
else:
raise ValueError, "Impossible to find organisation %s in %s" %(organisation_gid, synchronization_list)
return []
def _createContent(self, xml=None, object=None, object_id=None, sub_object=None,
reset_local_roles=0, reset_workflow=0, simulate=0, **kw):
""" This is the method calling to create an object. """
if DEBUG:
LOG("ERP5NodeContuide._createContent", INFO, "xml = %s" %(etree.tostring(xml, pretty_print=True),))
if object_id is not None:
sub_object = None
if sub_object is None: # If so, it doesn't exist
sub_object, reset_local_roles, reset_workflow = self.constructContent(
object,
object_id,
self.getObjectType(xml),
)
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
default_address_created = False
# browse the xml
phone_list = []
cellphone = None
fax_list = []
relation = None
category_list = []
role_list =[]
relation_data_dict = {}
address_tag_mapping = {"street" : "street_address",
"zip" : "zip_code",
"country" : "region",}
for node in xml.getchildren():
# works on tags, no on comments
if type(node.tag) is not str:
continue
tag = node.tag.split('}')[index]
# specific for phone
if tag == "phone":
phone_list.append(node.text)
elif tag == "cellphone":
cellphone = node.text
elif tag == "fax":
fax_list.append(node.text)
elif tag == "relation":
relation = node.text
elif tag == "category":
if node.text.startswith('role'):
role_list.append(node.text[len("role/"):])
else:
category_list.append(node.text)
elif tag == 'address':
# Build dict of address properties
address_data_dict = {}
for element in node.getchildren():
if type(element.tag) is not str:
continue
element_tag = element.tag.split('}')[index]
address_data_dict[address_tag_mapping.get(element_tag, element_tag)] = element.text
# Create the address once we are sure it is well defined
if len(address_data_dict):
# Define address id
if not default_address_created:
address_id = "default_address"
default_address_created = True
else:
address_id = None
# Create the address object
address = sub_object.newContent(portal_type='Address', **address_data_dict)
# Rename to default if necessary
if address_id is not None:
sub_object.activate(activity="SQLQueue",
after_method_id="immediateReindexObject",
priority=5
).manage_renameObject(address.getId(), address_id)
# Set telephone
default_phone_set = False
if cellphone is not None:
sub_object.edit(mobile_telephone_text=cellphone)
for phone in phone_list:
if not default_phone_set:
sub_object.edit(default_telephone_text=phone)
default_phone_set = True
else:
# Create new subobject
sub_object.newContent(portal_type="Telephone",
telephone_number=phone)
# Set fax
default_fax_set = False
for fax in fax_list:
if not default_fax_set:
sub_object.edit(default_fax_text=fax)
default_fax_set = True
continue
# Create new subobject
sub_object.newContent(portal_type="Fax",
telephone_number=fax)
# Link to organisation
if relation is not None:
self._setRelation(sub_object, None, relation, kw.get('domain'), None)
# Set category
if len(category_list):
sub_object.setCategoryList(category_list)
if len(role_list):
if sub_object.getPortalType() == "Person":
sub_object.edit(career_role_list=role_list)
elif sub_object.getPortalType() == "Organisation":
sub_object.edit(role_list=role_list)
# build the content of the node
self.newObject(
object=sub_object,
xml=xml,
simulate=simulate,
reset_local_roles=reset_local_roles,
reset_workflow=reset_workflow,
)
return sub_object
def _deleteContent(self, object=None, object_id=None):
""" We do not delete nodes """
if object[object_id].getValidationState() == "validated":
object[object_id].invalidate()
def editDocument(self, object=None, **kw):
""" This editDocument method allows to set attributes of the object. """
if DEBUG:
LOG("ERP5NodeConduit.editDocument", INFO, "object = %s with %s" %(object, kw))
if kw.get('address_mapping') is None:
mapping = {
'title': 'title',
'firstname': 'first_name',
'lastname': 'last_name',
'email': 'default_email_text',
'birthday': 'start_date',
'description': 'description',
'phone' : 'default_telephone_text',
'cellphone' : 'mobile_telephone_text',
'fax' : 'default_fax_text',
}
else:
mapping = {
'street': 'street_address',
'zip': 'zip_code',
'city': 'city',
'country': 'region',
}
# translate kw with the good PropertySheet
property = {}
for k, v in kw.items():
k = mapping.get(k, k)
property[k] = v
object._edit(**property)
def checkAddressConflict(self, document, tag, xml, previous_value, new_value):
"""
"""
xpath_expression = xml.get('select')
try:
# work on the case: "/node/address[x]"
address_index = int(xpath_expression.split('address[')[-1].split(']')[0])
except ValueError:
# Work on the case: "/node/address"
address_index = 1
if address_index == 1:
address = document.getDefaultAddressValue()
else:
# the XUPDATE begin by one, so one is default_address and the
# first python index list is zero, so x-2
address_index -= 2
# address list of the person without default_address
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'],),
where_expression='id != "default_address"',
)
try:
address = address_list[address_index].getObject()
except IndexError:
return [self._generateConflict(document.getPhysicalPath(), tag, xml, None, new_value),]
# getter used to retrieve the current values and to check conflicts
getter_value_dict = {
'street': address.getStreetAddress(),
'zip': address.getZipCode(),
'city': address.getCity(),
'country': address.getRegion(),
}
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
current_value = getter_value_dict[tag]
if current_value not in [new_value, previous_value]:
return [self._generateConflict(document.getPhysicalPath(), tag, xml, current_value, new_value),]
else:
keyword = {'address_mapping': True, tag: new_value}
self.editDocument(object=address, **keyword)
return []
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
"""
This method is called in updateNode and allows to work on the update of
elements.
"""
if DEBUG:
LOG("ERP5NodeConduit._updateXupdateUpdate", INFO, "xml = %s" %(etree.tostring(xml, pretty_print=1),))
xpath_expression = xml.get('select')
tag = xpath_expression.split('/')[-1]
new_value = xml.text
keyword = {}
# retrieve the previous xml etree through xpath
selected_previous_xml = previous_xml.xpath(xpath_expression)
try:
previous_value = selected_previous_xml[0].text
except IndexError:
previous_value = None
# check if it'a work on person or on address
if tag in ADDRESS_TAG_LIST:
return self.checkAddressConflict(document, tag, xml, previous_value, new_value)
else:
return self.checkConflict(tag, document, previous_value, new_value, kw.get('domain'), xml)
return []
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to remove elements. """
if DEBUG:
LOG("ERP5NodeConduit._updateXupdateDel", INFO, "xml = %s" %(etree.tostring(xml, pretty_print=1),))
conflict_list = []
tag = xml.get('select').split('/')[-1]
# this variable is used to retrieve the id of address and to not remove the
# orginal tag (address, street, zip, city or country)
keyword = {}
# retrieve the previous xml etree through xpath
xpath_expression = xml.get('select')
selected_previous_xml = previous_xml.xpath(xpath_expression)
try:
previous_value = selected_previous_xml[0].text
except IndexError:
previous_value = None
# specific work for address and address elements
address_tag = tag.split('[')[0]
if address_tag == "address":
try:
# work on the case: "/node/address[x]"
address_index = int(tag.split('[')[-1].split(']')[0])
except ValueError:
# Work on the case: "/node/address"
address_index = 1
if address_index == 1:
address = document.getDefaultAddressValue()
else:
# the XUPDATE begin by one, so one is default_address and the
# first python index list is zero, so x-2
address_index -= 2
# address list of the person without default_address
address_list = document.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'], ),
where_expression='id != "default_address"',
)
try:
document.manage_delObjects(address_list[address_index].getId(),)
except IndexError:
conflict_list.append(self._generateConflict(document.getPhysicalPath(), tag, xml, None, None))
return conflict_list
elif address_tag in ADDRESS_TAG_LIST:
return self.checkAddressConflict(document, address_tag, xml, previous_value, None)
else:
return self.checkConflict(tag, document, previous_value, None, kw.get('domain'), xml)
return conflict_list
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to add elements. """
if DEBUG:
LOG("ERP5NodeConduit._updateXupdateInsertOrAdd", INFO, "xml = %s" %(etree.tostring(xml, pretty_print=1),))
conflict_list = []
keyword = {}
default_address_created = False
previous_value = ""
for subnode in xml.getchildren():
tag = subnode.attrib['name']
new_value = subnode.text
if tag == 'address':
address = document.newContent(portal_type='Address', )
keyword['address_mapping'] = True
for subsubnode in subnode.getchildren():
keyword[subsubnode.tag] = subsubnode.text
self.editDocument(object=address, **keyword)
if getattr(document, "default_address", None) is None and not default_address_created:
# This will become the default address
default_address_created = True
document.activate(activity="SQLQueue",
after_method_id="immediateReindexObject",
priority=5
).manage_renameObject(address.getId(), "default_address")
elif tag in ADDRESS_TAG_LIST:
return self.checkAddressConflict(document, tag, xml, previous_value, new_value)
else:
return self.checkConflict(tag, document, previous_value, new_value, kw.get('domain'), xml)
return conflict_list
def checkConflict(self, tag, document, previous_value, new_value, domain, xml):
"""
Check conflict for each tag
"""
if tag == "relation":
return self._setRelation(document, previous_value, new_value, domain, xml)
else:
if tag == "phone":
current_value = document.get('default_telephone', None) and \
document.default_telephone.getTelephoneNumber("")
elif tag == "cellphone":
current_value = document.get('mobile_telephone', None) and \
document.mobile_telephone.getTelephoneNumber("")
elif tag == "fax":
current_value = document.get('default_fax', None) and \
document.default_fax.getTelephoneNumber("")
elif tag == "birthday":
current_value = str(document.getStartDate(""))
else:
current_value = getattr(document, tag)
if current_value not in [new_value, previous_value, None]:
LOG("ERP5NodeConduit.checkConflict", ERROR, "Generating a conflict for tag %s, current is %s, previous is %s, new is %s" %(tag, current_value, new_value, previous_value))
return [self._generateConflict(document.getPhysicalPath(), tag, xml, current_value, new_value),]
else:
if new_value is None:
# We are deleting some properties
if tag == "fax":
document.manage_delObjects("default_fax")
elif tag == "phone":
document.manage_delObjects("default_telephone")
elif tag == "cellphone":
document.manage_delObjects("mobile_telephone")
else:
kw = {tag : new_value}
self.editDocument(object=document, **kw)
else:
if tag == 'birthday':
new_value = DateTime(new_value)
kw = {tag : new_value}
self.editDocument(object=document, **kw)
return []
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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.
#
##############################################################################
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5SyncML.Document.Conflict import Conflict
from Products.ERP5TioSafe.Conduit.TioSafeBaseConduit import TioSafeBaseConduit
from lxml import etree
parser = etree.XMLParser(remove_blank_text=True)
from zLOG import LOG
class ERP5ResourceConduit(TioSafeBaseConduit):
"""
This is the conduit use to synchonize ERP5 Products
"""
def __init__(self):
# Define the object_tag element to add object
self.xml_object_tag = 'resource'
self.system_pref = None
def _createContent(self, xml=None, object=None, object_id=None,
sub_object=None, reset_local_roles=0, reset_workflow=0, simulate=0,
**kw):
"""
This is the method calling to create an object
"""
if object_id is not None:
if sub_object is None:
sub_object = object._getOb(object_id, None)
if sub_object is None: # If so, it does not exist
portal_type = ''
portal_type = self.getObjectType(xml)
# Create a product object
sub_object, reset_local_roles, reset_workflow = self.constructContent(
object,
object_id,
portal_type,
)
# The initialization here is used to define our own base category, we
# don't want to use the default base categories
sub_object.edit(
variation_base_category_list = [],
optional_variation_base_category_list = [],
individual_variation_base_category = [],
)
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# Set the use value
sub_object.setUse('sale')
portal = object.getPortalObject()
# Browse the list to work on categories
for node in xml.getchildren():
# Only works on right tags, and no on the comments, ...
if type(node.tag) is not str:
continue
# Build the split list of the tag
split_tag = node.tag.split('}')
# Build the tag (without is Namespace)
tag = node.tag.split('}')[index]
# Treat sub-element
if tag == 'category':
category_xml_value = node.text.encode('utf-8')
category_split_list = category_xml_value.split('/')
base_category = category_split_list[0]
shared_variation = True
try:
# Try to access the category
category = portal.portal_categories.restrictedTraverse(category_xml_value)
except KeyError:
# This is an individual variation
shared_variation = False
if shared_variation:
if base_category not in sub_object._baseGetVariationBaseCategoryList():
base_category_list = sub_object._baseGetVariationBaseCategoryList()
base_category_list.append(base_category)
sub_object.setVariationBaseCategoryList(base_category_list)
self.updateSystemPreference(portal, base_category)
variation_list = sub_object.getVariationCategoryList()
if category_xml_value not in variation_list:
variation_list.append(category_xml_value)
sub_object.setVariationCategoryList(variation_list)
else:
if base_category not in sub_object.getIndividualVariationBaseCategoryList():
base_category_list = sub_object.getIndividualVariationBaseCategoryList()
base_category_list.append(base_category)
sub_object.setIndividualVariationBaseCategoryList(base_category_list)
self.updateSystemPreference(portal, base_category, True)
variation_category = "/".join(category_split_list[1:])
sub_object.newContent(
portal_type='Product Individual Variation',
title=variation_category,
variation_base_category=base_category,
)
self.newObject(
object=sub_object,
xml=xml,
simulate=simulate,
reset_local_roles=reset_local_roles,
reset_workflow=reset_workflow,
)
# add to sale supply
sync_name = self.getIntegrationSite(kw['domain']).getTitle()
ss = self.getSaleSupply(sync_name, portal)
if len(ss.searchFolder(resource_title=sub_object.getTitle())) == 0:
ss.newContent(resource_value=sub_object)
return sub_object
def getSaleSupply(self, name, portal):
"""
Retrieve the sale supply for the given synchronization
If not exist, create it
"""
if getattr(self, 'sale_supply', None) is None:
ss_list = portal.sale_supply_module.searchFolder(title=name,
validation_state='validated')
if len(ss_list) > 1:
raise ValueError, "Too many sale supplies, does not know which to choose"
if len(ss_list) == 0:
# Create a new one
ss = portal.sale_supply_module.newContent(title=name)
ss.validate()
else:
ss = ss_list[0].getObject()
self.sale_supply = ss
return self.sale_supply
def updateSystemPreference(self, portal, base_category, individual=False):
""" Update the system preference according to categories set on products
so that UI is well configured in the end """
if not self.system_pref:
pref_list = portal.portal_preferences.searchFolder(portal_type="System Preference",
validation_state="enabled")
if len(pref_list) > 1:
raise ValueError, "Too many system preferences, does not know which to choose"
elif len(pref_list) == 0:
pref = portal.portal_preferences.newContent(portal_type="System Preference",
title="default system preference for TioSafe",
priority=1)
pref.enable()
else:
pref = pref_list[0].getObject()
self.system_pref = pref
if individual:
cat_list = self.system_pref.getPreferredProductIndividualVariationBaseCategoryList()
if base_category not in cat_list:
cat_list.append(base_category)
self.system_pref.edit(preferred_product_individual_variation_base_category_list = cat_list)
else:
cat_list = self.system_pref.getPreferredProductVariationBaseCategoryList()
if base_category not in cat_list:
cat_list.append(base_category)
self.system_pref.edit(preferred_product_variation_base_category_list = cat_list)
def afterNewObject(self, object):
object.validate()
object.updateLocalRolesOnSecurityGroups()
def _deleteContent(self, object=None, object_id=None):
""" Move the product into "invalidated" state. """
document = object.product_module._getOb(object_id)
# dict which provides the list of transition to move into invalidated state
states_list_dict = {
'draft': ['validated_action', 'invalidate_action', ],
'validated': ['invalidate_action', ],
}
# move into the "invalidated" state
current_state = document.getValidationState()
if current_state in states_list_dict:
for action in states_list_dict[current_state]:
try:
document.portal_workflow.doActionFor(document, action)
except WorkflowException:
if current_state == 'draft':
document.activate().validate()
document.activate().invalidate()
def editDocument(self, object=None, **kw):
"""
This is the editDocument method inherit of ERP5Conduit. This method
is used to save the information of a Product.
"""
# Map the XML tags to the PropertySheet
mapping = {
'title': 'title',
'reference': 'reference',
'ean13': 'ean13_code',
'description': 'description',
}
# Translate kw with the PropertySheet
property = {}
for k, v in kw.items():
k = mapping.get(k, k)
property[k] = v
object._edit(**property)
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
"""
This method is called in updateNode and allows to work on the update of
elements.
"""
conflict_list = []
xpath_expression = xml.get('select')
tag = xpath_expression.split('/')[-1]
new_value = xml.text
keyword = {}
# retrieve the previous xml etree through xpath
previous_xml = previous_xml.xpath(xpath_expression)
try:
previous_value = previous_xml[0].text
except IndexError:
raise IndexError, 'Too little or too many value, only one is required for %s' % (
previous_xml,
)
if isinstance(previous_value, unicode):
previous_value = previous_value.encode('utf-8')
if isinstance(new_value, unicode):
new_value = new_value.encode('utf-8')
# check if it'a work on product or on categories
if tag.split('[')[0] == 'category':
# init base category, variation and boolean which check update
base_category, variation = new_value.split('/', 1)
old_base_category, old_variation = previous_value.split('/', 1)
# retrieve the base_categories and the variations
base_category_list = document.getVariationBaseCategoryList()
variation_list = document.getVariationCategoryList()
# about shared and individual variations, it's necessary to check the
# mapping existency
shared_variation = True
try:
# Try to access the category
category = document.getPortalObject().portal_categories.restrictedTraverse(new_value)
except KeyError:
# This is an individual variation
shared_variation = False
# the mapping of an element must only be defined one time
individual_variation = document.searchFolder(
portal_type='Product Individual Variation',
title=old_variation,
base_category=old_base_category,
)
# If this is badly defined, fix the objects
if len(individual_variation) > 1:
id_to_remove = []
for individual in individual_variation[1:]:
id_to_remove.append(individual.getId())
document.manage_delObjects(id_to_remove)
if len(individual_variation) and previous_value in variation_list:
for individual in individual_variation:
id_to_remove.append(individual.getId())
document.manage_delObjects(id_to_remove)
# Update variation
if not shared_variation:
# work on the cases :
# new = individual variation
# old = individual variation -> update
# old = shared variation -> remoce shared and add individual
# Fist check individual base
if base_category not in document.getIndividualVariationBaseCategoryList():
base_category_list = document.getIndividualVariationBaseCategoryList()
base_category_list.append(base_category)
document.setIndividualVariationBaseCategoryList(base_category_list)
self.updateSystemPreference(document.getPortalObject(), base_category, True)
# Then update or add variation
if len(individual_variation):
individual_variation = individual_variation[0].getObject()
individual_variation.setTitle(variation)
individual_variation.setVariationBaseCategory(base_category)
else:
# create the individual variation
document.newContent(
portal_type='Product Individual Variation',
title=variation,
base_category=base_category,
)
else:
# work on the cases :
# new = shared variation
# old = individual variation -> remove individual and add shared
# old = shared variation -> update shared
if len(individual_variation):
# remove individual if previous was that
document.manage_delObjects([individual_variation[0].getId(), ])
else:
# remove the shared from the list if it's a shared
variation_list.remove(previous_value)
# set the base category and the variations
if base_category not in document._baseGetVariationBaseCategoryList():
base_category_list = document._baseGetVariationBaseCategoryList()
base_category_list.append(base_category)
document.setVariationBaseCategoryList(base_category_list)
self.updateSystemPreference(document.getPortalObject(), base_category)
if new_value not in variation_list:
variation_list.append(new_value)
document.setVariationCategoryList(variation_list)
else:
# getter used to retrieve the current values and to check conflicts
getter_value_dict = {
'title': document.getTitle(),
'reference': document.getReference(),
'ean13': document.getEan13Code(),
'description': document.getDescription(),
}
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
current_value = getter_value_dict[tag]
if isinstance(current_value, float):
current_value = '%.6f' % current_value
if isinstance(current_value, unicode):
current_value = current_value.encode('utf-8')
if current_value not in [new_value, previous_value]:
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(current_value)
conflict.setRemoteValue(new_value)
conflict_list.append(conflict)
else:
keyword[tag] = new_value
self.editDocument(object=document, **keyword)
return conflict_list
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to remove elements. """
conflict_list = []
tag = xml.get('select').split('/')[-1]
keyword = {}
if tag.split('[')[0] == 'category':
# retrieve the previous xml etree through xpath
previous_xml = previous_xml.xpath(tag)
try:
previous_value = previous_xml[0].text
except IndexError:
raise IndexError, 'Too little or too many value, only one is required for %s' % (
previous_xml
)
# boolean which check update
updated = False
# check first in shared variations
shared_variation_list = document.getVariationCategoryList()
if previous_value in shared_variation_list:
updated = True
shared_variation_list.remove(previous_value)
document.setVariationCategoryList(shared_variation_list)
# if no update has occured, check in individual variations
if not updated:
individual_variation = document.portal_catalog(
portal_type='Product Individual Variation',
title=previous_value.split('/', 1)[-1],
parent_uid=document.getUid(),
)
if len(individual_variation) == 1:
individual_variation = individual_variation[0].getObject()
document.manage_delObjects([individual_variation.getId(), ])
else:
keyword[tag] = None
self.editDocument(object=document, **keyword)
return conflict_list
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to add elements. """
conflict_list = []
keyword = {}
# browse subnode of the insert and check what will be create
for subnode in xml.getchildren():
new_tag = subnode.attrib['name']
new_value = subnode.text
if new_tag == 'category':
# init base category, variation and boolean which check update
base_category, variation = new_value.split('/', 1)
updated = False
# check first in shared variations
shared_variation_list = document.getVariationCategoryList()
if new_value not in shared_variation_list:
# set variation if it's an existing shared variation, else
# it's an individual
base_category_object = document.portal_categories[base_category]
if getattr(base_category_object, variation, None) is not None:
updated = True
shared_variation_list.append(new_value)
document.setVariationCategoryList(shared_variation_list)
# if no update has occured, check in individual variations
if not updated and \
new_value not in document.getVariationCategoryList():
# individual variation list filtered on base_category
individual_variation = [individual
for individual in document.contentValues(
portal_type='Product Individual Variation',
)
if individual.getTitle() == variation and \
individual.getVariationBaseCategoryList() == \
[base_category, ]
]
if not individual_variation: # empty list
new_variation = document.newContent(
portal_type='Product Individual Variation',
title=variation,
)
new_variation.setVariationBaseCategoryList([base_category, ])
else:
keyword[new_tag] = new_value
self.editDocument(object=document, **keyword)
return conflict_list
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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.
#
##############################################################################
from Products.ERP5TioSafe.Conduit.TioSafeBaseConduit import TioSafeBaseConduit
from Products.ERP5SyncML.SyncMLConstant import XUPDATE_INSERT_OR_ADD_LIST
from base64 import b16encode
from zLOG import LOG
from copy import deepcopy
class ERP5TransactionConduit(TioSafeBaseConduit):
"""
This is the conduit use to synchonize tiosafe sale orders and ERP5
"""
def __init__(self):
# Define the object_tag element to add object
self.xml_object_tag = 'transaction'
def updateNode(self, xml=None, object=None, previous_xml=None, force=0,
simulate=0, **kw):
raise Exception('updateNode: Impossible to update transaction')
def deleteNode(self, xml=None, object=None, previous_xml=None, force=0,
simulate=0, **kw):
raise Exception('deleteNode: Impossible to delete transaction')
def _createContent(self, xml=None, object=None, object_id=None, sub_object=None,
reset_local_roles=0, reset_workflow=0, simulate=0, **kw):
"""
This is the method calling to create an object
"""
if object_id is None:
object_id = self.getAttribute(xml, 'id')
if object_id is not None:
if sub_object is None:
try:
sub_object = object._getOb(object_id)
except (AttributeError, KeyError, TypeError):
sub_object = None
if sub_object is None: # If so, it doesn't exist
portal_type = ''
if xml.xpath('local-name()') == self.xml_object_tag:
portal_type = self.getObjectType(xml)
elif xml.xpath('name()') in XUPDATE_INSERT_OR_ADD_LIST: # Deprecated ???
portal_type = self.getXupdateContentType(xml) # Deprecated ???
sub_object, reset_local_roles, reset_workflow = self.constructContent(
object,
object_id,
portal_type,
)
# Define the trade condition by using the one defined on IS
integration_site = self.getIntegrationSite(kw.get('domain'))
if portal_type == "Sale Order":
sub_object.setSpecialise(integration_site.getSourceTrade())
sub_object.SaleOrder_applySaleTradeCondition()
# Mapping between tag and element
node_dict = {
'arrow': self.visitArrow,
'movement': self.visitMovement,
}
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# Browse the list of arrows and movements
for node in xml.getchildren():
# Only works on right tags, and no on the comments, ...
if type(node.tag) is not str:
continue
# Build the slipt list of a tag to test
split_tag = node.tag.split('}')
# Build the tag (without is Namespace)
tag = node.tag.split('}')[index]
# Treat sub-element
if len(node.getchildren()):
if tag in node_dict:
node_dict[tag](document=sub_object, xml=node, **kw)
else:
raise ValueError, "This is an unknown sub-element %s on %s" %(tag, sub_object.getPath())
if tag == 'currency':
link_object = object.portal_catalog.getResultValue(
portal_type='Currency',
reference=node.text.encode('utf-8'),
)
sub_object.setPriceCurrencyValue(link_object)
elif tag in ['start_date', 'stop_date']:
if not node.text:
node.text = None
elif tag == "payment_mode":
sub_object.setPaymentConditionPaymentMode(node.text)
# Build the content of new Sale Order
self.newObject(
object=sub_object,
xml=xml,
simulate=simulate,
reset_local_roles=reset_local_roles,
reset_workflow=reset_workflow,
)
return sub_object
def afterNewObject(self, object):
""" Confirm the sale order and, add the grants on this one. """
if object.getPortalType() in ['Sale Order',]:
object.confirm()
object.updateLocalRolesOnSecurityGroups()
def visitArrow(self, document=None, xml=None, **kw):
""" Manage the addition of sources and destination in the Sale Orders. """
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# retrieve the integration site
domain = kw.get('domain')
integration_site = self.getIntegrationSite(domain
)
# use the setters of source and destination in terms of the category
sync_object_list = self.getSynchronizationObjectListForType(kw.get('domain'), 'Person', 'publication') + \
self.getSynchronizationObjectListForType(kw.get('domain'), 'Organisation', 'publication')
category = xml.get('type')
if category != "":
if category == 'Ownership':
arrow_dict = {
'source': {
'synchronization': sync_object_list,
'setter': document.setSourceSectionValue},
'destination': {
'synchronization': sync_object_list,
'setter': document.setDestinationSectionValue},
}
elif category == 'Payment':
arrow_dict = {
'source': {
'synchronization': sync_object_list,
'setter': document.setSourcePaymentValue},
'destination': {
'synchronization': sync_object_list,
'setter': document.setDestinationPaymentValue},
}
elif category == 'Administration':
arrow_dict = {
'source': {
'synchronization': sync_object_list,
'setter': document.setSourceAdministrationValue},
'destination': {
'synchronization': sync_object_list,
'setter': document.setDestinationAdministrationValue},
}
elif category == 'Decision':
arrow_dict = {
'source': {
'synchronization': sync_object_list,
'setter': document.setSourceDecisionValue},
'destination': {
'synchronization': sync_object_list,
'setter': document.setDestinationDecisionValue},
}
else:
raise Exception('visitArrow: Unexpected Category %s' %(category))
else:
arrow_dict = {
'source': {
'synchronization': sync_object_list,
'setter': document.setSourceValue},
'destination': {
'synchronization': sync_object_list,
'setter': document.setDestinationValue},
}
# browse the xml and save the source and destination in the sale order
integration_site = self.getIntegrationSite(kw.get('domain'))
default_source = integration_site.getSourceAdministrationValue()
default_org_gid = " %s %s" %(default_source.getTitle(), default_source.getDefaultEmailText())
for subnode in xml.getchildren():
# only works on tags, no on the comments or other kind of tag
if type(subnode.tag) is not str:
continue
tag = subnode.tag.split('}')[index]
if tag in arrow_dict:
# retrieve the corresponding
synchronization_list = arrow_dict[tag]['synchronization']
link_object = None
link_gid = subnode.text.encode('utf-8')
for synchronization in synchronization_list:
# encode to the output type
if getattr(synchronization, 'getObjectFromGid', None) is not None:
link_object = synchronization.getObjectFromGid(b16encode(link_gid))
#LOG("trying to get %s from %s, got %s" %(link_gid, synchronization.getPath(), link_object), 300, "This is for category type %s" %(category))
if link_object is not None:
break
# default organisation
# XXX-Aurel : must be changed on default organisation defined well
if link_object is None and link_gid == default_org_gid:
link_object = default_source
# unknown person if the link object is none
if link_object is None:
link_object = document.person_module['404']
# set person to the sale order
arrow_dict[tag]['setter'](link_object)
def visitMovement(self, document=None, xml=None, **kw):
""" Manage the addition of the Sale Order Line. """
# dictionary of the value of a movement
movement_dict_value = {'category': []}
# marker for checking property existency
MARKER = object()
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# browse the xml and save the sale order line values
for subnode in xml.getchildren():
# only works on tags, no on the comments or other kind of tag
if type(subnode.tag) is not str:
continue
tag = subnode.tag.split('}')[index]
if tag == 'resource':
synchronization_list = self.getSynchronizationObjectListForType(kw.get('domain'), 'Product', 'publication')
# encode to the output type
link_gid = subnode.text #.encode('utf-8')
# FIXME: Work on specific GID, what about this ???
integration_site = self.getIntegrationSite(kw.get('domain'))
if link_gid == ' Service Discount':
link_object = integration_site.getSourceCarrierValue()
elif link_gid == ' Service Delivery':
link_object = integration_site.getDestinationCarrierValue()
else:
for synchronization in synchronization_list:
link_object = synchronization.getObjectFromGid(b16encode(link_gid))
if link_object is not None:
break
# in the worse case save the line with the unknown product
if link_object is None:
link_object = document.product_module['404']
# set the resource in the dict
movement_dict_value[tag] = link_object
elif tag == "VAT":
vat_category = document.portal_categories.base_amount.trade.base.taxable['vat']
vat = vat_category[subnode.text]
movement_dict_value['vat'] = vat
elif tag == 'category':
# set categories in the list
if subnode.text is not None:
movement_dict_value[tag].append(subnode.text)
else:
# set line values in the dict
if subnode.text is not None:
movement_dict_value[tag] = subnode.text#.encode('utf-8')
if 'quantity' not in movement_dict_value:
return
# no variations will be use for the unknown product
if document.product_module.get('404', None) and movement_dict_value['resource'] == document.product_module['404']:
movement_dict_value['category'] = []
# Create the new Sale Order Line
sale_order_line = document.newContent(portal_type='Sale Order Line')
# define the setters of the sale order line
mapping_of_setter = {
'title': sale_order_line.setTitle,
'reference': sale_order_line.setReference,
'resource': sale_order_line.setResourceValue,
'description': sale_order_line.setDescription,
'vat': sale_order_line.setBaseContributionValue,
'quantity': sale_order_line.setQuantity,
'price': sale_order_line.setPrice,
}
# second, specific work on sale order line or on cell
if len(movement_dict_value['category']):
# set the resource on the sale order line
mapping_of_setter['resource'](movement_dict_value['resource'])
# work on variations
variation_category_list = list(set(
deepcopy(movement_dict_value['category'])
))
#variation_category_list.sort() # XXX: The set remove the order
sale_order_line.setVariationCategoryList(variation_category_list)
variation_category_list = sale_order_line.getVariationCategoryList()
# create the cell or raise if it's not possible
cell = sale_order_line.newCell(
base_id='movement',
portal_type='Sale Order Cell',
*variation_category_list
)
# set values on the cell
cell.setCategoryList(variation_category_list)
cell.setMembershipCriterionCategoryList(variation_category_list)
cell.setMembershipCriterionBaseCategoryList(
sale_order_line.getVariationBaseCategoryList(),
)
cell.setMappedValuePropertyList(['price', 'quantity'])
mapping_of_setter['quantity'] = cell.setQuantity
mapping_of_setter['price'] = cell.setPrice
# set on the sale order line or on cell the values
for key in movement_dict_value:
if key in mapping_of_setter:
mapping_of_setter[key](movement_dict_value[key])
def editDocument(self, object=None, **kw):
"""
This is the default editDocument method. This method
can easily be overwritten.
"""
# Mapping of the PropertySheet
mapping = {
'title': 'title',
'start_date': 'start_date',
'stop_date': 'stop_date',
'reference': 'reference',
'causality': 'comment',
}
property = {}
# Translate kw with the good PropertySheet
for k, v in kw.items():
k = mapping.get(k, k)
property[k] = v
object._edit(**property)
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@nexedi.com>
# Hervé Poulain <herve@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.
#
##############################################################################
from Products.ERP5SyncML.SyncMLConstant import XUPDATE_INSERT_OR_ADD_LIST, \
XUPDATE_DEL, XUPDATE_UPDATE
from Products.ERP5Type.XMLExportImport import MARSHALLER_NAMESPACE_URI
from zLOG import LOG, INFO, WARNING
from Products.ERP5SyncML.Conduit.ERP5Conduit import ERP5Conduit
from lxml import etree
from copy import deepcopy
from Products.ERP5SyncML.Document.Conflict import Conflict
parser = etree.XMLParser(remove_blank_text=True)
XUPDATE_INSERT_LIST = ('xupdate:insert-after', 'xupdate:insert-before')
ADDRESS_TAG_LIST = ('street', 'zip', 'city', 'country')
class TioSafeBaseConduit(ERP5Conduit):
"""
This class provides some tools used by different TioSafe Conduits.
"""
def _generateConflict(self, path, tag, xml, current_value, new_value):
"""
Generate the conflict object
"""
conflict = Conflict(
object_path=path,
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(current_value)
conflict.setRemoteValue(new_value)
return conflict
def addNode(self, xml=None, object=None, sub_object=None, reset=None,
simulate=None, **kw):
"""
A node is added
xml : the xml wich contains what we want to add
object : from where we want to add something
previous_xml : the previous xml of the object, if any
force : apply updates even if there's a conflict
This fucntion returns conflict_list, wich is of the form,
[conflict1,conflict2,...] where conclict1 is of the form :
[object.getPath(),keyword,local_and_actual_value,subscriber_value]
"""
conflict_list = []
xml = self.convertToXml(xml)
LOG('TioSafeBaseConduit.addNode', INFO, 'object path:%r' %(object.getPath(),))
LOG('TioSafeBaseConduit.addNode', INFO, '\n%s' % etree.tostring(xml, pretty_print=True))
if xml is None:
return {'conflict_list': conflict_list, 'object': sub_object}
# In the case where this new node is a object to add
xpath_expression = xml.get('select')
if xml.xpath('name()') in XUPDATE_INSERT_OR_ADD_LIST and\
MARSHALLER_NAMESPACE_URI not in xml.nsmap.values():
# change the context according select expression
get_target_parent = xml.xpath('name()') in XUPDATE_INSERT_LIST
context = self.getContextFromXpath(object, xpath_expression,
get_target_parent=get_target_parent)
for element in xml.findall('{%s}element' % xml.nsmap['xupdate']):
xml = self.getElementFromXupdate(element)
conflict_list += self.addNode(xml=xml, object=context, **kw)\
['conflict_list']
elif xml.xpath('local-name()') == self.xml_object_tag:
sub_object = self._createContent(xml=xml,
object=object,
sub_object=sub_object,
reset=reset,
simulate=simulate,
**kw)
else:
conflict_list += self.updateNode(xml=xml, object=object, reset=reset,
simulate=simulate, **kw)
# We must returns the object created
return {'conflict_list':conflict_list, 'object': sub_object}
def replaceIdFromXML(self, xml, attribute_name, new_id, as_string=True):
"""
return a xml with id replace by a new id
"""
if isinstance(xml, str):
xml = etree.XML(xml, parser=parser)
else:
xml = deepcopy(xml)
if as_string:
return etree.tostring(xml)
return xml
def applyXupdate(self, object=None, xupdate=None, previous_xml=None, **kw):
""" Parse the xupdate and then it will call the conduit. """
conflict_list = []
if isinstance(xupdate, (str, unicode)):
xupdate = etree.XML(xupdate, parser=parser)
if kw.get('conduit', None) is not None:
for subnode in xupdate:
conflict_list += self.updateNode(
xml=self.getContextFromXpath(subnode, subnode.get('select')),
object=object,
previous_xml=previous_xml,
**kw
)
return conflict_list
def getIntegrationSite(self, sync_object):
"""
Return the integration site based on the link with the pub/sub
"""
if getattr(self, 'integration_site', None) is None:
related_object_list = [x.getObject() for x in sync_object.Base_getRelatedObjectList()]
if len(related_object_list) != 1:
raise ValueError, "Impossible to find related object to %s : %s" %(sync_object.getPath(), related_object_list)
integration_site = related_object_list[0].getParentValue()
if integration_site.getPortalType() != "Integration Site":
raise ValueError, "Did not get an Integration Site object instead %s : %s" %(integration_site.getPortalType(),
integration_site.getPath())
self.integration_site = integration_site
return self.integration_site
def getSynchronizationObjectListForType(self, sync_object, object_type, synchronization_type):
"""
This method provides a Publication or Subscription base on the relation
set in integration site
"""
site = self.getIntegrationSite(sync_object)
module_id = "%s_module" %(object_type.lower())
module_list = []
for module in site.contentValues(portal_type="Integration Module"):
if module_id in module.getId():
module_list.append(module)
result_list = []
for module in module_list:
if synchronization_type == "publication":
result_list.append(module.getSourceSectionValue())
elif synchronization_type == "subscription":
result_list.append(module.getDestinationSectionValue())
else:
raise ValueError, 'Unknown type %s' %(synchronization_type,)
return result_list
def updateNode(self, xml=None, object=None, previous_xml=None, force=False,
simulate=False, reset=False, xpath_expression=None, **kw):
"""
This method browse the xml which allows to update data and update the
correpsonging object.
"""
conflict_list = []
if simulate:
return conflict_list
if xml is None:
return {'conflict_list': conflict_list, 'object': object}
xml = self.convertToXml(xml)
# we have an xupdate xml
if xml.xpath('name()') == 'xupdate:modifications':
conflict_list += self.applyXupdate(
object=object,
xupdate=xml,
conduit=self,
previous_xml=previous_xml,
force=force,
simulate=simulate,
reset=reset,
**kw
)
# we may have only the part of an xupdate
else:
# previous_xml is required as an etree type
if type(previous_xml) == str:
previous_xml = etree.XML(previous_xml, parser=parser)
if self.isProperty(xml):
xpath = xml.xpath('name()')
# XUPDATE_UPDATE -> update data or sub-object
if xpath in XUPDATE_UPDATE:
conflict_list += self._updateXupdateUpdate(
document=object,
xml=xml,
previous_xml=previous_xml,
**kw
)
# XUPDATE_DEL -> delete data or sub-object
elif xpath in XUPDATE_DEL:
conflict_list += self._updateXupdateDel(
document=object,
xml=xml,
previous_xml=previous_xml,
**kw
)
# XUPDATE_INSERT_OR_ADD_LIST -> add data or sub-object
elif xpath in XUPDATE_INSERT_OR_ADD_LIST:
conflict_list += self._updateXupdateInsertOrAdd(
document=object,
xml=xml,
previous_xml=previous_xml,
**kw
)
return conflict_list
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
"""
This method is called in updateNode and allows to work on the update of
elements.
"""
return []
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to remove elements. """
return []
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to add elements. """
return []
def getObjectType(self, xml):
""" Return the portal type from the xml. """
try:
return xml.attrib['type'].split('/')[-1]
except KeyError:
LOG("TioSafeBaseConduit.getObjectType", WARNING, "No type attribute for the xml : %s" % (
etree.tostring(xml,pretty_print=True),))
return
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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.
#
##############################################################################
from Products.ERP5TioSafe.Conduit.TioSafeBaseConduit import TioSafeBaseConduit
from Products.ERP5SyncML.Document.Conflict import Conflict
from lxml import etree
class TioSafeNodeConduit(TioSafeBaseConduit):
"""
This is the conduit use to synchonize TioSafe Persons
"""
def __init__(self):
self.xml_object_tag = 'node'
def _createContent(self, xml=None, object=None, object_id=None, sub_object=None,
reset_local_roles=0, reset_workflow=0, simulate=0, **kw):
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# this dict contains the element to set to the person
keyword = {}
address_list = []
# browse the xml
for node in xml:
# works on tags, no on comments
if type(node.tag) is not str:
continue
# Retrieve the tag
tag = node.tag.split('}')[index]
if tag == 'address':
# add the address
address_keyword = {}
for subnode in node.getchildren():
# through the mapping retrieve the country
if subnode.tag.split('{')[index] == 'country':
mapping = object.getMappingFromCategory('region/%s' % subnode.text)
country = mapping.split('/', 1)[-1]
address_keyword[subnode.tag.split('{')[index]] = country
else:
address_keyword[subnode.tag.split('{')[index]] = subnode.text
address_list.append(address_keyword)
else:
# XXX-AUREL : it might be necessary to use .encode('utf-8') here
keyword[tag] = node.text
# Create person once all xml has bee browsed
object.person_module.createPerson(**keyword)
# XXX-AUREL : following call must be changed
new_id = object.IntegrationSite_lastID(type='Person')[0].getId()
# Then create addresses
for address_keyword in address_list:
object.person_module.createPersonAddress(person_id=str(new_id), **address_keyword)
return object.person_module(person_id=new_id)[0]
def _deleteContent(self, object=None, object_id=None):
""" We do not delete nodes """
pass
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
"""
This method is called in updateNode and allows to work on the update of
elements.
"""
conflict_list = []
xpath_expression = xml.get('select')
tag = xpath_expression.split('/')[-1]
value = xml.text
# retrieve the previous xml etree through xpath
previous_xml = previous_xml.xpath(xpath_expression)
try:
previous_value = previous_xml[0].text
except IndexError:
raise IndexError, 'Too little or too many value, only one is required for %s' % (
previous_xml
)
# check if it'a work on person or on address
if tag in ['street', 'zip', 'city', 'country']:
try:
# work on the case: "/node/address[x]"
address_index = \
int(xpath_expression.split('address[')[-1].split(']')[0]) - 1
except ValueError:
# Work on the case: "/node/address"
address_index = 0
# build the address list
address_list = document.context.person_module.getPersonAddressList(
person_id=document.getId(),
)
# FIXME: Is the sort can be removed ???
# Build a list of tuple which contains :
# - first, the title build to realise the sort
# - the second element is the brain itself
sorted_address_list = [
(' '.join([address.street,
address.zip,
address.city,
address.country]),
address)
for address in address_list]
sorted_address_list.sort()
address_list = [t[1] for t in sorted_address_list]
try:
address = address_list[address_index]
except IndexError:
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(None)
conflict.setRemoteValue(value)
conflict_list.append(conflict)
return conflict_list
current_value = getattr(address, tag, None)
if current_value not in [value, previous_value]:
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(current_value)
conflict.setRemoteValue(value)
conflict_list.append(conflict)
else:
# set the keyword dict which defines what will be updated
keyword = {
'address_id': address.getId(),
'person_id': document.getId(),
}
if tag == 'country':
# through the mapping retrieve the country
mapping = document.context.getMappingFromCategory('region/%s' % value)
value = mapping.split('/', 1)[-1]
keyword[tag] = value
document.context.person_module.updatePersonAddress(**keyword)
else:
# getter used to retrieve the current values and to check conflicts
property_list = ['birthday', ]
getter_value_dict = dict([
(prop, getattr(document, prop))
for prop in property_list
if getattr(document, prop, None) is not None
])
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
current_value = getter_value_dict[tag]
if current_value not in [value, previous_value]:
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(current_value)
conflict.setRemoteValue(value)
conflict_list.append(conflict)
else:
# XXX: when the DateTime format will be required to sync date
# - 1 - retrieve the format through the integration site
# - 2 - through using of DateTime build the date and render it
# if tag == 'birthday':
# integration_site = self.getIntegrationSite(kw.get('domain'))
# date_format = integration_site.getDateFormat()
# # build the required format
# format = dict_format[date_format] -> render "%Y/%m/%d", ...
# value = DateTime(value).strftime(format)
keyword = {'person_id': document.getId(), tag: value, }
document.context.person_module.updatePerson(**keyword)
new_document = document.context.person_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to remove elements. """
conflict_list = []
tag = xml.get('select').split('/')[-1]
# this variable is used to retrieve the id of address and to not remove the
# orginal tag (address, street, zip, city or country)
tag_for_id = tag
# specific work for address and address elements
if tag.split('[')[0] in ['address', 'street', 'zip', 'city', 'country']:
# work on the good part of the xml to retrieve the address id
if tag_for_id.split('[')[0] != 'address':
tag_for_id = xml.get('select')
try:
# work on the case: "/node/address[x]"
address_index = int(tag_for_id.split('[')[-1].split(']')[0]) - 1
except ValueError:
# Work on the case: "/node/address"
address_index = 0
# build the address list
address_list = document.context.person_module.getPersonAddressList(
person_id=document.getId(),
)
# FIXME: Is the sort can be removed ???
# Build a list of tuple which contains :
# - first, the title build to realise the sort
# - the second element is the brain itself
sorted_address_list = [
(' '.join([
getattr(address, i, '')
for i in ['street', 'zip', 'city','country']]
), address)
for address in address_list
]
sorted_address_list.sort()
address_list = [t[1] for t in sorted_address_list]
try:
address = address_list[address_index]
except IndexError:
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(None)
conflict_list.append(conflict)
return conflict_list
# remove the corresponding address or the element of the address
keyword = {'person_id': document.getId(), 'address_id': address.getId()}
if tag.split('[')[0] == 'address':
document.context.person_module.deletePersonAddress(**keyword)
else:
# set the keyword dict which defines what will be updated
keyword[tag] = 'NULL'
document.context.person_module.updatePersonAddress(**keyword)
else:
keyword = {'person_id': document.getId(), tag: 'NULL', }
document.context.person_module.updatePerson(**keyword)
# it always return conflict_list but it's empty
new_document = document.context.person_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to add elements. """
conflict_list = []
for subnode in xml.getchildren():
tag = subnode.attrib['name']
value = subnode.text
if tag == 'address':
keyword = {'person_id': document.getId(), }
for subsubnode in subnode.getchildren():
if subsubnode.tag == 'country':
# through the mapping retrieve the country
keyword[subsubnode.tag] = document.context.getMappingFromCategory(
'region/%s' % subsubnode.text,
).split('/', 1)[-1]
else:
keyword[subsubnode.tag] = subsubnode.text
document.context.person_module.createPersonAddress(**keyword)
elif tag in ['street', 'zip', 'city', 'country']:
try:
# work on the case: "/node/address[x]"
address_index = int(xml.get('select').split('address[')[-1].split(']')[0]) - 1
except ValueError:
# Work on the case: "/node/address"
address_index = 0
# build the address list
address_list = document.context.person_module.getPersonAddressList(
person_id=document.getId(),
)
# FIXME: Is the sort can be removed ???
# Build a list of tuple which contains :
# - first, the title build to realise the sort
# - the second element is the brain itself
sorted_address_list = [
(' '.join([
getattr(address, i, '')
for i in ['street', 'zip', 'city','country']]
), address)
for address in address_list
]
sorted_address_list.sort()
address_list = [t[1] for t in sorted_address_list]
try:
address = address_list[address_index]
except IndexError:
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(None)
conflict.setRemoteValue(value)
conflict_list.append(conflict)
return conflict_list
# set the keyword dict which defines what will be updated
keyword = {
'person_id': document.getId(),
'address_id': address.getId(),
}
if tag == 'country':
# through the mapping retrieve the country
mapping = document.context.getMappingFromCategory('region/%s' % value)
value = mapping.split('/', 1)[-1]
keyword[tag] = value
document.context.person_module.updatePersonAddress(**keyword)
else:
# XXX: when the DateTime format will be required to sync date
# - 1 - retrieve the format through the integration site
# - 2 - through using of DateTime build the date and render it
# if tag == 'birthday':
# integration_site = self.getIntegrationSite(kw.get('domain'))
# date_format = integration_site.getDateFormat()
# # build the required format
# format = dict_format[date_format] -> render "%Y/%m/%d", ...
# value = DateTime(value).strftime(format)
keyword = {'person_id': document.getId(), tag:value, }
document.context.person_module.updatePerson(**keyword)
new_document = document.context.person_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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.
#
##############################################################################
from Products.ERP5Type.Utils import cartesianProduct
from Products.ERP5TioSafe.Conduit.TioSafeBaseConduit import TioSafeBaseConduit
from Products.ERP5SyncML.Document.Conflict import Conflict
from lxml import etree
from zLOG import LOG
class TioSafeResourceConduit(TioSafeBaseConduit):
"""
This is the conduit use to synchonize TioSafe Resources
"""
def __init__(self):
self.xml_object_tag = 'resource'
def _createContent(self, xml=None, object=None, object_id=None, sub_object=None,
reset_local_roles=0, reset_workflow=0, simulate=0, **kw):
LOG("TioSafeNodeConduit._createConten", 300, "xml = %s" %(etree.tostring(xml, pretty_print=1),))
# if exist namespace retrieve only the tag
index = 0
if xml.nsmap not in [None, {}]:
index = -1
# init the new_id of the product and the checker of the creation
new_id = None
product_created = False
# this dict contains the element to set to the product
keyword = {}
# this dict will contains a list of tuple (base_category, vairiation)
variation_dict = {}
resource_type = self.getObjectType(xml=xml).strip()
# browse the xml
for node in xml:
# works on tags, not on comments
if type(node.tag) is not str:
continue
tag = node.tag.split('}')[index]
LOG("browsing tag %s, value %s" %(tag, node.text), 300, "keyword = %s" %(keyword,))
if tag == 'category':
# retrieve through the mapping the base category and the variation
mapping = object.getMappingFromCategory(node.text)
base_category, variation = mapping.split('/', 1)
variation_dict.setdefault(base_category, []).append(variation)
else:
keyword[tag] = node.text.encode('utf-8')
# Create the product at the end of the xml browsing
create_method_id = "create%s" %(resource_type,)
create_method = getattr(object, create_method_id, None)
if create_method is not None:
create_result = create_method(**keyword)
else:
raise ValueError, 'Impossible to find a create method named %s and object %s' %(create_method_id, object.getPath(),)
if len(create_result):
# We suppose the id of the object created was returned by the plugin
new_id = create_result[0].getId()
else:
# We must ask for the id of the object previously created
# XXX-AUREL : this must be changed to use gid definition instead
new_id = object.IntegrationSite_lastID(type=resource_type)[0].getId()
# create the full variations in the integration site
if variation_dict:
# XXX-Aurel : This is too specific to prestashop, must be moved and
# replaced by generic code
# the cartesianProduct requires to build a list of list of variations
builder_variation_list = []
for key, value in variation_dict.items():
variation_list = []
for variation in value:
variation_list.append((key, variation))
builder_variation_list.append(variation_list)
# build and browse the list of variations
variation_list = cartesianProduct(builder_variation_list)
for var_list in variation_list:
object.createProductAttribute(id_product=new_id)
id_product_attribute = object.IntegrationSite_lastID(
type='Product Attribute',
)[0].getId()
for variation in var_list:
object.createProductAttributeCombination(
id_product_attribute=id_product_attribute,
id_product=new_id,
base_category=variation[0],
variation=variation[1],
)
return object[new_id]
def _deleteContent(self, object=None, object_id=None):
""" This method allows to remove a product in the integration site """
delete_method_id = "deleteProduct" # XXX-AUREL : must find a way to fix this
delete_method = getattr(object, delete_method_id, None)
if delete_method is not None:
return delete_method(product_id=object_id)
else:
raise ValueError, 'Impossible to find a delete method named %s and object %s' %(delete_method_id, object.getPath(),)
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
"""
This method is called in updateNode and allows to work on the update of
elements.
"""
conflict_list = []
xpath_expression = xml.get('select')
tag = xpath_expression.split('/')[-1]
integration_site = document.context.getParentValue()
new_value = xml.text
# retrieve the previous xml etree through xpath
previous_xml = previous_xml.xpath(xpath_expression)
try:
previous_value = previous_xml[0].text
except IndexError:
raise ValueError, 'Too little or too many value, only one is required for %s' % (
previous_xml
)
if isinstance(previous_value, unicode):
previous_value = previous_value.encode('utf-8')
if isinstance(new_value, unicode):
new_value = new_value.encode('utf-8')
# check if it'a work on product or on categories
if tag.split('[')[0] == 'category':
# call the method which allows to work on a specific part, the update of
# categories
conflict_list += self._updateCategory(document, xml, previous_value)
else:
# getter used to retrieve the current values and to check conflicts
property_list = ['sale_price', 'purchase_price', 'ean13']
getter_value_dict = dict(zip(
property_list, [
getattr(document, prop, None)
for prop in property_list
]
))
# create and fill a conflict when the integration site value, the erp5
# value and the previous value are differents
current_value = getter_value_dict[tag]
if type(current_value) == float:
current_value = '%.6f' % current_value
if isinstance(current_value, unicode):
current_value = current_value.encode('utf-8')
if current_value not in [new_value, previous_value]:
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(current_value)
conflict.setRemoteValue(new_value)
conflict_list.append(conflict)
else:
keyword = {'product_id': document.getId(), tag: new_value , }
document.context.product_module.updateProduct(**keyword)
new_document = document.context.product_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to remove elements. """
conflict_list = []
tag = xml.get('select').split('/')[-1]
integration_site = document.context.getParentValue()
if tag.split('[')[0] == 'category':
# retrieve the previous xml etree through xpath
previous_xml = previous_xml.xpath(tag)
try:
previous_value = integration_site.getMappingFromCategory(
previous_xml[0].text,
)
except IndexError:
raise IndexError, 'Too little or too many value, only one is required for %s' % (
previous_xml
)
# retrieve the current value to check if exists a conflict
current_value = etree.XML(document.asXML()).xpath(tag)[0].text
current_value = integration_site.getMappingFromCategory(current_value)
# work on variations
variation_brain_list = document.context.getProductCategoryList()
for brain in variation_brain_list:
if brain.category == current_value and previous_value == current_value:
base_category, variation = current_value.split('/', 1)
document.context.product_module.deleteProductAttributeCombination(
product_id=document.getId(),
base_category=base_category,
variation=variation,
)
else:
# previous value different from current value
conflict = Conflict(
object_path=document.getPhysicalPath(),
keyword=tag,
)
conflict.setXupdate(etree.tostring(xml, encoding='utf-8'))
conflict.setLocalValue(previous_value)
conflict.setRemoteValue(current_value)
conflict_list.append(conflict)
else:
keyword = {'product_id': document.getId(), tag: 'NULL' , }
document.context.product_module.updateProduct(**keyword)
new_document = document.context.product_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
""" This method is called in updateNode and allows to add elements. """
conflict_list = []
integration_site = document.context.getParentValue()
# browse subnode of the insert and check what will be create
for subnode in xml.getchildren():
new_tag = subnode.attrib['name']
new_value = subnode.text
if new_tag == 'category':
mapping = integration_site.getMappingFromCategory(new_value)
base_category, variation = mapping.split('/', 1)
# retrieve the variations which have a different axe from the updated
# and build the cartesian variation for this new variations
external_axe_list = [
tuple(x.category.split('/', 1))
for x in document.context.getProductCategoryList()
if x.category.split('/', 1)[0] != base_category
]
builder_variation_list = [
[(base_category, variation)], external_axe_list,
]
variation_list = cartesianProduct(builder_variation_list)
for var_list in variation_list:
document.context.product_module.createProductAttribute(
id_product=document.getId(),
)
id_product_attribute = document.context.IntegrationSite_lastID(
type='Product Attribute',
)[0].getId()
for variation in var_list:
document.context.product_module.createProductAttributeCombination(
id_product_attribute=id_product_attribute,
id_product=document.getId(),
base_category=variation[0],
variation=variation[1],
)
else:
keyword = {'product_id': document.getId(), new_tag: new_value, }
document.context.product_module.updateProduct(**keyword)
new_document = document.context.product_module[document.getId()]
document.updateProperties(new_document)
return conflict_list
def _updateCategory(self, document=None, xml=None, previous_value=None):
""" This method allows to update a Category in the Integration Site. """
conflict_list = []
return conflict_list
##############################################################################
#
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@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.
#
##############################################################################
from Products.ERP5Type.Tool.WebServiceTool import ConnectionError
from urllib import urlencode
from urllib2 import URLError, HTTPError, Request, \
urlopen, HTTPBasicAuthHandler, build_opener, \
install_opener
class MethodWrapper(object):
def __init__(self, method, conn):
self._method = method
self._conn = conn
def __call__(self, *args, **kw):
url = "%s/%s" % (self._conn.url, self._method)
data = urlencode(kw)
request = Request(url, data)
try:
response = urlopen(request)
return url, response.read()
except HTTPError, msg:
error = "Impossible to access to the plugin, error code is %s - %s" %(msg.msg, msg.code,)
raise ConnectionError(error)
except URLError, msg:
error = "Impossible to connect to the plugin, reason is %s" %(msg.reason,)
raise ConnectionError(error)
class HTTPConnection:
"""
Holds an HTTP connection to a remote HTTP server.
"""
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self, url, user_name = None, password = None, credentials = None):
"""
url (string)
The requested url
user_name (string or None)
password (string is None)
The transport-level (http) credentials to use.
credentials (AuthenticationBase subclass instance or None)
The interface-level (http) credentials to use.
"""
self.url = url
self._user_name = user_name
self._password = password
self._credentials = credentials
def connect(self):
"""Get a handle to a remote connection."""
auth_handler = HTTPBasicAuthHandler()
auth_handler.add_password(realm=self.url,
uri=self.url,
user=self._user_name,
passwd=self._password)
opener = build_opener(auth_handler)
install_opener(opener)
return self
def __getattr__(self, name):
if not name.startswith("_"):
return MethodWrapper(name, self)
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Ivan Tyagov <ivan@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.
#
##############################################################################
from xmlrpclib import Server, Fault
from Products.ERP5Type.Tool.WebServiceTool import ConnectionError
class MethodWrapper(object):
def __init__(self, method, conn):
self._method = method
self._conn = conn
def __call__(self, *args, **kw):
try:
if len(kw):
return self._method, self._conn.server.call(self._conn.session,
self._method, [kw])
else:
return self._method, self._conn.server.call(self._conn.session,
self._method, [args])
except Fault, msg:
error = "XMLRPC error, reason is %s : %s" %(msg.faultCode, msg.faultString,)
raise ConnectionError(error)
class MagentoXMLRPCConnection:
"""
Holds an XML-RPC connection to a remote Magento XML-RPC server.
"""
def __init__(self, url, user_name = None, password = None):
self.url = url
self._user_name = user_name
self._password = password
def connect(self):
"""Get a handle to a remote connection."""
url = self.url
self.server = Server(url)
if self._user_name is not None and self._password is not None:
self.session = self.server.login(self._user_name, self._password)
return self
def __getattr__(self, name):
""" Allow to call mehod on connection """
if not name.startswith("_"):
return MethodWrapper(name, self)
import subprocess
class MethodWrapper(object):
def __init__(self, method, conn):
self._method = method
self._conn = conn
def __call__(self, *args, **kw):
# build the php args and execute the php script
php_args = ''
for key, value in kw.items():
php_args += '$_POST["%s"] = "%s";' % (key, value)
php_args += 'include("%s/%s.php");' % (self._conn.url, self._method)
process = subprocess.Popen(
['php', '-r', php_args, ],
stdout=subprocess.PIPE,
)
return self._conn.url, process.stdout.read()
class PHPUnitTestConnection:
"""
This is a unit test connection class which allows to execute a PHP script.
"""
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self, url, user_name=None, password=None, credentials=None):
"""
url (string)
The requested url
user_name (string or None)
password (string is None)
The transport-level (http) credentials to use.
credentials (AuthenticationBase subclass instance or None)
The interface-level (http) credentials to use.
"""
self.url = url
self._user_name = user_name
self._password = password
self._credentials = credentials
def connect(self):
"""Get a handle to a remote connection."""
return self
def __getattr__(self, name):
if not name.startswith("_"):
return MethodWrapper(name, self)
##############################################################################
#
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@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.
#
##############################################################################
from urllib import urlencode
from urllib2 import URLError, HTTPError, Request, urlopen
from Products.ERP5Type.Tool.WebServiceTool import ConnectionError
class MethodWrapper(object):
def __init__(self, method, conn):
self._method = method
self._conn = conn
def __call__(self, *args, **kw):
data_kw = {'Method' : self._method,
'Token' : self._conn._password,
'Data' : kw.get('data')}
request_data = urlencode(data_kw)
request = Request(self._conn.url, request_data)
try:
response = urlopen(request)
return self._conn.url, response.read()
except HTTPError, msg:
error = "Impossible to access to the plugin, error code is %s - %s" %(msg.msg, msg.code,)
raise ConnectionError(error)
except URLError, msg:
error = "Impossible to connect to the plugin, reason is %s" %(msg.reason,)
raise ConnectionError(error)
class RESTConnection:
"""
Holds a REST connection to a remote web server.
"""
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self, url, user_name = None, password = None, credentials = None):
"""
url (string)
The requested url
user_name (string or None)
password (string is None)
The transport-level (http) credentials to use.
credentials (AuthenticationBase subclass instance or None)
The interface-level (http) credentials to use.
"""
self.url = url
self._user_name = user_name
self._password = password
self._credentials = credentials
def connect(self):
"""nothing to do here."""
return self
def __getattr__(self, name):
if not name.startswith("_"):
return MethodWrapper(name, self)
##############################################################################
#
# Copyright (c) 2002-2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
from Products.ERP5Type.XMLObject import XMLObject
class IntegrationMapping(XMLObject):
# CMF Type Definition
meta_type = 'TioSafe Integration Mapping'
portal_type = 'Integration Mapping'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Arrow
, PropertySheet.Reference
)
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2002-2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5TioSafe.Utils import EchoDictTarget
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from App.Extensions import getBrain
from lxml import etree
from zLOG import LOG, ERROR
from urllib2 import URLError, HTTPError
_MARKER = []
class IntegrationModule(XMLObject):
# CMF Type Definition
meta_type = 'TioSafe Integration Module'
portal_type = 'Integration Module'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.SortIndex
, PropertySheet.IntegrationModule
, PropertySheet.Arrow
)
def checkConsistency(self, fixit=False, filter=None, **kw):
"""
consistency is checked through a web service request
"""
# XXX-Aurel : result must be formatted here
try:
return self['checkDataConsistency']()
except KeyError:
# WSR not present
return []
def __call__(self, **kw):
"""
calling this object will call :
- retrieveObject if exists and parameters are pass
- getObjectList in other cases
as method to retrieve list of object can not always be used
to retrieve just one object
"""
if len(kw) and getattr(self, "retrieveObject", None) is not None:
return self.retrieveObject(**kw)
else:
return self.getObjectList(**kw)
def __getitem__(self, item):
"""
Simulate the traversable behaviour by retrieving the item through
the web service
"""
try:
if getattr(self, "retrieveObject", None) is not None:
return self.retrieveObject[item]
else:
return self.getObjectList[item]
except ValueError, msg:
raise KeyError, msg
def getGIDFor(self, item):
"""
Return the gid for a given local id
"""
raise NotImplementedError
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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.
#
##############################################################################
from Products.ERP5Type.Core.Folder import Folder
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from zLOG import LOG, INFO, ERROR, WARNING
class IntegrationSite(Folder):
"""
"""
meta_type = 'ERP5 Integration Site'
portal_type = 'Integration Site'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.DublinCore
, PropertySheet.SimpleItem
, PropertySheet.CategoryCore
, PropertySheet.Reference
, PropertySheet.Arrow
, PropertySheet.Task
, PropertySheet.DublinCore
)
def getCategoryFromMapping(self, category, product=None, create_mapping=False,
create_mapping_line=False):
"""
This method allows to retrieve the mapping in the integration site.
args:
category = string of the category we want the mapping
product = product object that can hold categories not mapped
create_mapping = boolean telling if we create an empty base mapping object if not found
create_mapping_line = boolean telling if we create an empty mapping line object if not found
return:
mapped_category as string
raise ValueError when not found
"""
if not category:
LOG("getCategoryFromMapping", ERROR, "empty category provided")
raise ValueError, "Empty category provided"
# Split the category to have the base and the variation category
base_category, variation_category = category.split('/', 1)
# Check the product variations if exists the product
if product is not None:
for variation in product.contentValues(
portal_type='Product Individual Variation'):
if variation.getTitle() == variation_category:
return '%s/%s' % (variation.getVariationBaseCategory(),
variation.getRelativeUrl(),
)
# mapping is defined with ID
# XXX-Aurel : replace should not be done here as title will not be well defined indeed
current_object = self
mapped_base_category = None
mapped_variation_category = []
missing_mapping = False
for cat in category.split('/'):
cat_id = cat.replace(' ', '').replace('-', '')
try:
cat_object = current_object[cat_id.encode('ascii', 'ignore')]
except KeyError:
#LOG("getCategoryFromMapping", WARNING, "Nothing found for %s , %s on %s" %(category, cat_id, current_object.getPath()))
if current_object.getPortalType() == "Integration Base Category Mapping":
if create_mapping_line is False:
# This is for the case of individual variation for example
# only the base category has to be mapped
return current_object.getDestinationReference() +'/'+ '/'.join(category.split('/')[1:])
else:
# Create default line that has to be mapped by user later
cat_object = current_object.newContent(id=cat_id.encode('ascii', 'ignore'), source_reference=cat, title=cat)
LOG("getCategoryFromMapping", INFO, "created mapping %s - %s" %(cat, cat_object),)
missing_mapping = True
else:
if create_mapping:
cat_object = current_object.newContent(portal_type="Integration Base Category Mapping",
id=cat_id.encode('ascii', 'ignore'), source_reference=cat, title=cat)
LOG("getCategoryFromMapping", INFO, "created base mapping %s - %s" %(cat, cat_object),)
missing_mapping = True
else:
LOG("getCategoryFromMapping", ERROR, "Mapping object for %s not found" %(cat,))
raise ValueError, "Mapping object for %s not found" %(cat,)
mapped_category = cat_object.getDestinationReference()
if mapped_category in ("", None) and cat_object.getPortalType() == "Integration Category Mapping":
LOG("getCategoryFromMapping", ERROR, "Mapping not defined for %s" % (cat,))
raise ValueError, "Mapping not defined for %s" % cat
if mapped_base_category is None:
mapped_base_category = mapped_category
else:
mapped_variation_category.append(mapped_category)
current_object = cat_object
## LOG("getCategoryFromMapping", INFO, "mapped category returned is %s - %s for %s" %(mapped_base_category,
## mapped_variation_category,
## category))
if missing_mapping:
# We do not want the process to go on if mappings are missing
raise ValueError, "Mapping not defined for %s" % category
return mapped_variation_category[-1]
def getMappingFromCategory(self, category):
"""
This method allows to retrieve through the mapping in the integration
site the corresponding value in the external site.
args:
category = string of the category we want the mapping
"""
# FIXME: currently they have only two levels, the category integration
# mapping and the category integration mapping line, if more levels are
# provides this script must be updated !
base_category, variation = category.split('/', 1)
# retrieve the corresponding integration base category mapping
mapping = self.searchFolder(
portal_type='Integration Base Category Mapping',
destination_reference=base_category,
)
if len(mapping) != 1:
raise IndexError, 'The integration base category mapping %s must be mapped and with only one base_category' % (base_category)
mapping = mapping[0].getObject()
# retrieve the corresponding category integration mapping
mapping_line = mapping.searchFolder(
portal_type='Integration Category Mapping',
destination_reference=category,
)
if len(mapping_line) > 1:
raise IndexError, 'The integration category mapping %s must be mapped with only one category' % (variation)
try:
# shared variation
return '/'.join(
[mapping.getSourceReference(), mapping_line[0].getObject().getSourceReference()]
)
except IndexError:
# individual variation
return '/'.join([mapping.getSourceReference(), variation])
def getMappingFromProperty(self, base_mapping, property_name):
"""
This method allows to retrieve throuhh the mapping in the integration
site the corresponding value in the external site.
args:
base_mapping = the base property mapping
property = string of the property we want the mapping
"""
mapping_line = base_mapping.searchFolder(portal_type='Integration Property Mapping',
path = "%s%%" %(base_mapping.getPath()),
destination_reference=property_name,
)
if len(mapping_line) > 1:
raise IndexError, 'The integration property mapping %s must be mapped with only one category' % (property_name)
elif len(mapping_line) == 0:
return property_name
else:
return mapping_line[0].getObject().getSourceReference()
##############################################################################
#
# Copyright (c) 2002-2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
class IntegrationModule:
"""
Integration Module properties
"""
_properties = (
{ 'id' : 'gid_prefix',
'description' : 'prefix added to the gid',
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'gid_property',
'description' : 'object properties used to generate the GID',
'type' : 'lines',
'mode' : 'w' },
)
_categories = ('source_section', 'destination_section')
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass, DTMLFile
from Products.ERP5 import _dtmldir
from Products.ERP5Type import Permissions
from Products.ERP5Type.Tool.BaseTool import BaseTool
""" ERP5 portal_integrations tool """
class IntegrationTool(BaseTool):
"""
The IntegrationTool is used to exchange with the differents external management systems.
"""
id = 'portal_integrations'
title = 'Integration Tool'
meta_type = 'ERP5 Integration Tool'
portal_type = 'Integration Tool'
allowed_type = ()
# Declarative Security
security = ClassSecurityInfo()
# ZMI Methods
security.declareProtected(Permissions.ManagePortal, 'manage_overview')
manage_overview = DTMLFile('explainIntegrationTool', _dtmldir)
InitializeClass(IntegrationTool)
# -*- coding: utf-8 -*-
#############################################################################
#
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@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.
#
##############################################################################
from zLOG import LOG, ERROR
class EchoDictTarget:
"""
This is an echo class used by lxml to parse xml data
See http://codespeak.net/lxml/parsing.html#the-target-parser-interface
This class takes a dict as init parameter defining how to parse the xml.
Dict must looks like :
{ xml_tag : (wanted_dict_key, is_root_element),...}
The result of the parsing will thus return a list of dictionnaries. Each time it finds an xml_tag which is a root element will create a new dict.
This allow to transform an xml string into a property dict wich can be used to easily create a new erp5 object
Parsing must be called this way :
parser = etree.XMLParser(target = EchoDictTarget(parser_dict))
result_list = etree.XML(str(xml), parser,)
"""
def __init__(self, parser_dict):
self.parser_dict = parser_dict
self.result_list = []
self._current_object = None
self._current_key = None
def start(self, tag, attrib):
try:
value, root = self.parser_dict[tag]
if root:
self._current_object = {}
if self._current_object is not None and \
not self._current_object.has_key(value):
self._current_object[value] = ""
self._current_key = value
else:
self._current_key = None
except KeyError:
self._current_key = None
except TypeError:
LOG("EchoTargetDict.start", ERROR,
"got a key for %s, but no root tag exists ! Check your property mapping definition" %(tag,))
self._current_key = None
def end(self, tag):
try:
value , root = self.parser_dict[tag]
if root:
self.result_list.append(self._current_object.copy())
except KeyError:
pass
def data(self, data):
if self._current_key and len(data.strip()):
# for the element browsed several time
if self._current_object.has_key(self._current_key):
data = self._current_object[self._current_key] + data
self._current_object[self._current_key] = data
def comment(self, text):
pass
def close(self):
return self.result_list
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Define the XML Schema of a node -->
<xs:element name="directory">
<xs:complexType>
<xs:sequence>
<xs:element name="node" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="firstname" type="xs:string" minOccurs="0"/>
<xs:element name="lastname" type="xs:string" minOccurs="0"/>
<xs:element name="email" type="xs:string" minOccurs="0"/>
<xs:element name="birthday" type="xs:string" minOccurs="0"/>
<xs:element name="address" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="street" type="xs:string"/>
<xs:element name="zip" type="xs:string" minOccurs="0"/>
<xs:element name="city" type="xs:string" minOccurs="0"/>
<xs:element name="country" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Define the XML Schema of a node -->
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element name="resource" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="reference" type="xs:string" minOccurs="0"/>
<xs:element name="sale_price" type="xs:float" minOccurs="0"/>
<xs:element name="purchase_price" type="xs:float" minOccurs="0"/>
<xs:element name="ean13" type="xs:string" minOccurs="0"/>
<xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Define the XML Schema of a transaction -->
<xs:element name="journal">
<xs:complexType>
<xs:sequence>
<xs:element name="transaction" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="start_date" type="xs:string"/>
<xs:element name="stop_date" type="xs:string"/>
<xs:element name="reference" type="xs:string"/>
<xs:element name="currency" type="xs:string"/>
<xs:element name="payment_mode" type="xs:string"/>
<xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="arrow" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="source" type="xs:string" minOccurs="0"/>
<xs:element name="destination" type="xs:string" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="type" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="movement" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="resource" type="xs:string"/>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="reference" type="xs:string" minOccurs="0"/>
<xs:element name="quantity" type="xs:float"/>
<xs:element name="price" type="xs:float"/>
<xs:element name="VAT" type="xs:string"/>
<xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
##############################################################################
#
# Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
#
# 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.
#
##############################################################################
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
from Tool import IntegrationTool
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Finish installation
def initialize( context ):
import Document
initializeProduct(context, this_module, globals(),
document_module = Document,
document_classes = document_classes,
object_classes = (),
portal_tools = (IntegrationTool.IntegrationTool,),
content_constructors = (),
content_classes = ())
# Initialize Connection plugins
from Products.ERP5Type.Tool.WebServiceTool import registerConnectionPlugin
from zLOG import LOG, WARNING
handler_module_dict = {
'http': 'HTTPConnection',
'php_unit_test': 'PHPUnitTestConnection',
'rest' : 'RESTConnection',
'magento_xmlrpc' : 'MagentoXMLRPCConnection',
}
for handler_id, module_id in handler_module_dict.iteritems():
# Ignore non-functionnal plugins.
# This is done to avoid adding strict dependencies.
# Code relying on the presence of a plugin will fail upon
# WebServiceTool.connect .
try:
module = __import__(
'Products.ERP5TioSafe.ConnectionPlugin.%s' % (module_id, ),
globals(), {}, [module_id])
except ImportError:
LOG('ERP5TioSafe.__init__', WARNING,
'Unable to import module %r. %r transport will not be available.' % \
(module_id, handler_id),
error=sys.exc_info())
else:
try:
registerConnectionPlugin(handler_id, getattr(module, module_id))
except ValueError, msg:
LOG('ERP5TioSafe.ConnectionPlugin.__init__', WARNING,
'Unable to register module %r. error is %r.' % \
(module_id, msg),
error=sys.exc_info())
##############################################################################
#
#
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5Type.Tool.ClassTool import ClassTool
COPYRIGHT = "Copyright (c) 2002-%s Nexedi SA and Contributors. All Rights Reserved." % DateTime().year()
def newConduit(self, class_id, REQUEST=None):
"""
Create a document class used as Conduit
"""
text = """\
##############################################################################
#
# %s
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from Products.ERP5SyncML.Conduit.ERP5Conduit import ERP5Conduit
from lxml import etree
parser = etree.XMLParser(remove_blank_text=True)
XUPDATE_INSERT_LIST = ('xupdate:insert-after', 'xupdate:insert-before')
class %s(TioSafeBaseConduit):
'''
This class provides some tools used by different TioSafe Conduits.
'''
def addNode(self, xml=None, object=None, sub_object=None, reset=None,
simulate=None, **kw):
'''
A node is added
xml : the xml wich contains what we want to add
object : from where we want to add something
previous_xml : the previous xml of the object, if any
force : apply updates even if there's a conflict
This fucntion returns conflict_list, wich is of the form,
[conflict1,conflict2,...] where conclict1 is of the form :
[object.getPath(),keyword,local_and_actual_value,subscriber_value]
'''
raise NotImplementedError
def _createContent(self, xml=None, object=None, object_id=None, sub_object=None,
reset_local_roles=0, reset_workflow=0, simulate=0, **kw):
''' This is a method called by the addNode that create object for the given xml'''
raise NotImplementedError
def _deleteContent(self, object=None, object_id=None):
''' This method allows to remove a product in the integration site '''
raise NotImplementedError
def updateNode(self, xml=None, object=None, previous_xml=None, force=False,
simulate=False, reset=False, xpath_expression=None, **kw):
'''
This method browse the xml which allows to update data and update the
correpsonging object.
'''
raise NotImplementedError
def _updateXupdateUpdate(self, document=None, xml=None, previous_xml=None, **kw):
'''
This method is called in updateNode and allows to work on the update of
elements.
'''
raise NotImplementedError
def _updateXupdateDel(self, document=None, xml=None, previous_xml=None, **kw):
''' This method is called in updateNode and allows to remove elements. '''
raise NotImplementedError
def _updateXupdateInsertOrAdd(self, document=None, xml=None, previous_xml=None, **kw):
''' This method is called in updateNode and allows to add elements. '''
raise NotImplementedError
""" % (COPYRIGHT, class_id)
self.writeLocalDocument(class_id, text)
if REQUEST is not None:
REQUEST.RESPONSE.redirect('%s/manage_editDocumentForm?class_id=%s&manage_tabs_message=Conduit+Created' % (self.absolute_url(), class_id))
ClassTool.newDocument = newConduit
<?php
define('_DB_SERVER_', 'localhost');
define('_DB_TYPE_', 'MySQL');
define('_DB_NAME_', 'test');
define('_DB_USER_', 'test');
define('_DB_PASSWD_', '');
define('_DB_PREFIX_', 'ps_');
define('__PS_BASE_URI__', '/prestashop/');
define('_THEME_NAME_', 'prestashop');
define('_COOKIE_KEY_', 'SMAJC64KCHQCUU5bDGjgRE0uifKmDjAqMEevNLnw2UFAB32KvZGZOdWZ');
define('_COOKIE_IV_', 'XVuoeWcY');
define('_PS_CREATION_DATE_', '2010-04-16');
define('_PS_VERSION_', '1.2.5.0');
?>
<?php
include_once(PS_ADMIN_DIR.'/../classes/AdminTab.php');
class AdminOneClickConnect extends AdminTab
{
private $module = 'oneclickconnect';
public function __construct()
{
global $cookie, $_LANGADM;
$langFile = _PS_MODULE_DIR_.$this->module.'/'.Language::getIsoById(intval($cookie->id_lang)).'.php';
if(file_exists($langFile))
{
require_once $langFile;
foreach($_MODULE as $key=>$value)
if(substr(strip_tags($key), 0, 5) == 'Admin')
$_LANGADM[str_replace('_', '', strip_tags($key))] = $value;
}
parent::__construct();
}
}
?>
\ No newline at end of file
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the query which render the count of variations which correspond
$sql = "SELECT ";
$sql .= constant('_DB_PREFIX_')."attribute.id_attribute AS id, name AS title";
# which tables are implied in the check of category existency
$sql .= " FROM ".constant('_DB_PREFIX_')."attribute ";
$sql .= " LEFT JOIN ".constant('_DB_PREFIX_')."attribute_lang ";
$sql .= " ON ".constant('_DB_PREFIX_')."attribute_lang.id_attribute=".constant('_DB_PREFIX_')."attribute.id_attribute ";
# check the good variation
$sql .= "WHERE ";
$sql .= "name='".$_POST['variation']."' AND ";
$sql .= "id_lang=".$_POST['language']." AND ";
$sql .= "id_attribute_group=(SELECT id_attribute_group FROM ".constant('_DB_PREFIX_')."attribute_group_lang WHERE name='".$_POST['base_category']."')";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the sql which create a person
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."address ( ";
$sql .= "id_country, id_customer, address1, postcode, city, active, deleted, date_add ";
$sql .= " ) VALUES ( ";
# first find the country in the tables and set the corresponding id
if (isset($_POST['country'])) {
$sql .= "(SELECT id_country FROM ".constant('_DB_PREFIX_')."country_lang ";
$sql .= "WHERE name='".$_POST['country']."' AND id_lang=".$_POST['language']."), ";
} else {
$sql .= "'NULL', ";
}
# finnaly set the other element of the address
$sql .= $_POST['person_id'].", ";
$sql .= (isset($_POST['street']) ? "'".$_POST['street']."'" : 'NULL').", ";
$sql .= (isset($_POST['zip']) ? "'".$_POST['zip']."'" : 'NULL').", ";
$sql .= (isset($_POST['city']) ? "'".$_POST['city']."'" : 'NULL').", ";
$sql .= "1, 0, '".$date."')";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the sql which create a person
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."customer ( ";
$sql .= "firstname, lastname, email, birthday, secure_key, passwd, active, deleted, date_add, date_upd";
$sql .= " ) VALUES ( ";
# set the values of the person and check if birthday is give
$sql .= "'".$_POST['firstname']."', ";
$sql .= "'".$_POST['lastname']."', ";
$sql .= "'".$_POST['email']."', ";
$sql .= (isset($_POST['birthday']) ? "'".$_POST['birthday']."'" : 'NULL').", ";
$sql .= "'544ba9e0c36cc903cedcdcad8773f7ff', ";
$sql .= "'4be012eb764d501233f79a33e1024042', ";
$sql .= "1, 0, ";
$sql .= "'".$date."', ";
$sql .= "'".$date."' ) ";
echo executeSQL($sql);
# TODO: See to add a request and it's this request which "echo" the last id
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the sql which create a product
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."product ( ";
$sql .= "ean13, reference, id_category_default, active, date_add, date_upd ";
$sql .= " ) VALUES ( ";
$sql .= (isset($_POST['ean13']) ? "'".$_POST['ean13']."'" : 'NULL').", ";
$sql .= (isset($_POST['reference']) ? "'".$_POST['reference']."'" : 'NULL').", ";
$sql .= "1, 1, '".$date."', '".$date."' ";
$sql .= ") ";
executeSQL($sql);
# add the product name in the corresponding languages
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."product_lang ( ";
$sql .= "id_product, id_lang, link_rewrite, name ";
$sql .= " ) VALUES ( ";
$sql .= "(SELECT MAX(id_product) FROM ".constant('_DB_PREFIX_')."product), ";
$sql .= $_POST['language'].', ';
$sql .= "'".$_POST['title']."', '".$_POST['title']."' ";
$sql .= ") ";
executeSQL($sql);
# add the product in the category
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."category_product ( ";
$sql .= "id_category, id_product, position ";
$sql .= " ) VALUES ( ";
$sql .= "1, ";
$sql .= "(SELECT MAX(id_product) FROM ".constant('_DB_PREFIX_')."product), ";
$sql .= "(SELECT MAX(id_product) FROM ".constant('_DB_PREFIX_')."product)";
$sql .= ") ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."product_attribute (";
$sql .= "id_product";
$sql .= " ) VALUES ( ";
$sql .= $_POST['id_product'];
$sql .= ")";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "INSERT INTO ".constant('_DB_PREFIX_')."product_attribute_combination VALUES ( ";
# to put values in the database base, first, retrieve the attribute variation
$sql .= "(";
$sql .= "SELECT ".constant('_DB_PREFIX_')."attribute_lang.id_attribute ";
$sql .= "FROM ".constant('_DB_PREFIX_')."attribute_lang ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute ON ";
$sql .= constant('_DB_PREFIX_')."attribute.id_attribute = ".constant('_DB_PREFIX_')."attribute_lang.id_attribute ";
$sql .= " WHERE name='".$_POST['variation']."' AND id_attribute_group=";
$sql .= "(SELECT id_attribute_group FROM ".constant('_DB_PREFIX_')."attribute_group_lang WHERE name='".$_POST['base_category']."')";
$sql .= "), ";
$sql .= $_POST['id_product_attribute'];
$sql .= ")";
echo executeSQL($sql);
?>
<?php
function executeSQL($sql)
{
$path = explode('/modules',dirname(__FILE__));
$db = mysql_connect(constant('_DB_SERVER_'), constant('_DB_USER_'), constant('_DB_PASSWD_'));
mysql_query("SET NAMES UTF8");
mysql_select_db(constant('_DB_NAME_'),$db);
$req = mysql_query($sql);
if (!$req) {
die('\nInvalid query: ' . mysql_error());
}
if (empty($req)) {
return mysql_error();
}
if (gettype($req) == 'boolean'){
return;
}
$result = "<xml>";
while($data = mysql_fetch_assoc($req))
{
$result .= "<object>";
foreach(array_keys($data) as $key)
{
$result .= "<$key>$data[$key]</$key>";
}
$result .= "</object>";
}
$result .= "</xml>";
mysql_close();
return $result;
}
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# to remove addresses of someone, put the deleted field to 1
$sql = "UPDATE ".constant('_DB_PREFIX_')."address SET ";
$sql .= "deleted=1, active=0 ";
$sql .= "WHERE id_customer=".$_POST['person_id'];
$sql .= (isset($_POST['address_id']) ? " AND id_address='".$_POST['address_id']."' " : '');
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# to remove someone, just put the deleted field to 1
$sql = "UPDATE ".constant('_DB_PREFIX_')."customer SET ";
$sql .= "deleted=1, active=0 ";
$sql .= "WHERE id_customer=".$_POST['person_id'];
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "UPDATE ".constant('_DB_PREFIX_')."product SET ";
$sql .= "active=0 WHERE id_product=".$_POST['product_id'];
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# create the view which contains the element to remove
$sql = "CREATE VIEW variation_combination_view AS ";
$sql .= "SELECT DISTINCT(id_product_attribute) ";
$sql .= "FROM ".constant('_DB_PREFIX_')."product_attribute_combination ";
$sql .= "WHERE id_attribute=( ";
$sql .= " SELECT ".constant('_DB_PREFIX_')."attribute.id_attribute ";
$sql .= " FROM ".constant('_DB_PREFIX_')."attribute ";
$sql .= " LEFT JOIN ".constant('_DB_PREFIX_')."attribute_lang ";
$sql .= " ON ".constant('_DB_PREFIX_')."attribute_lang.id_attribute=".constant('_DB_PREFIX_')."attribute.id_attribute ";
$sql .= " WHERE name='".$_POST['variation']."' ";
$sql .= " AND id_lang=".$_POST['language'];
$sql .= " AND id_attribute_group=( ";
$sql .= " SELECT id_attribute_group FROM ".constant('_DB_PREFIX_')."attribute_group_lang ";
$sql .= " WHERE name='".$_POST['base_category']."' AND id_lang=".$_POST['language'];
$sql .= " )";
$sql .= " ) AND id_product_attribute IN ( ";
$sql .= " SELECT id_product_attribute ";
$sql .= " FROM ".constant('_DB_PREFIX_')."product_attribute ";
$sql .= " WHERE id_product=".$_POST['product_id'];
$sql .= "); ";
executeSQL($sql);
# remove the element in the different tables
$sql = "DELETE FROM ".constant('_DB_PREFIX_')."product_attribute_combination ";
$sql .= "WHERE id_product_attribute IN (";
$sql .= " SELECT id_product_attribute FROM variation_combination_view";
$sql .= ") ";
executeSQL($sql);
$sql = "DELETE FROM ".constant('_DB_PREFIX_')."product_attribute ";
$sql .= "WHERE id_product_attribute IN (";
$sql .= " SELECT id_product_attribute FROM variation_combination_view";
$sql .= ") ";
executeSQL($sql);
# remove the view
$sql = "DROP VIEW variation_combination_view";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "SELECT ";
$sql .= constant('_DB_PREFIX_')."orders.id_order AS id, ";
$sql .= "'Service Delivery' AS id_product, ";
$sql .= "0 AS id_group, ";
$sql .= "' Service Delivery' AS resource, ";
$sql .= "'Delivery' AS title, ";
$sql .= "'Delivery' AS reference, ";
$sql .= "FORMAT(1, 2) AS quantity, ";
# build value without taxes
$sql .= "ROUND(";
$sql .= "(".constant('_DB_PREFIX_')."orders.total_shipping / (1 + ";
$sql .= "(IFNULL(".constant('_DB_PREFIX_')."tax.rate, 19.60) / 100)";
$sql .= "))";
$sql .= ", 6) AS price, ";
$sql .= "ROUND((IFNULL(".constant('_DB_PREFIX_')."tax.rate, 19.60)), 2) AS VAT ";
$sql .= "FROM ".constant('_DB_PREFIX_')."orders ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."carrier ";
$sql .= "ON ".constant('_DB_PREFIX_')."carrier.id_carrier=".constant('_DB_PREFIX_')."orders.id_carrier ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."tax ";
$sql .= "ON ".constant('_DB_PREFIX_')."tax.id_tax=".constant('_DB_PREFIX_')."carrier.id_tax ";
$sql .= "WHERE ";
$sql .= constant('_DB_PREFIX_')."orders.total_shipping != 0.0 ";
if (isset($_POST['sale_order_id'])){
$sql .= "AND ".constant('_DB_PREFIX_')."orders.id_order=".$_POST['sale_order_id'];
}
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "SELECT ";
$sql .= constant('_DB_PREFIX_')."order_discount.id_order_discount AS id, ";
$sql .= "'Service Discount' AS id_product, ";
$sql .= "0 AS id_group, ";
$sql .= "' Service Discount' AS resource, ";
$sql .= "'Discount' AS title, ";
$sql .= "'Discount' AS reference, ";
$sql .= "FORMAT(1, 2) AS quantity, ";
$sql .= "-(ROUND(value, 6)) AS price, ";
$sql .= "'0.00' AS VAT ";
$sql .= "FROM ".constant('_DB_PREFIX_')."order_discount ";
if (isset($_POST['sale_order_id'])){
$sql .= "WHERE ";
$sql .= "id_order=".$_POST['sale_order_id'];
}
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which render the language list
$sql = "SELECT id_lang AS id, name AS title FROM ".constant('_DB_PREFIX_')."lang";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# through the type render the id of the corresponding data
if ($_POST['type'] == 'Person') {
$sql = "SELECT MAX(id_customer) AS last_id ";
$sql .= "FROM ".constant('_DB_PREFIX_')."customer " ;
} else if ($_POST['type'] == 'Product') {
$sql = "SELECT MAX(id_product) AS last_id ";
$sql .= "FROM ".constant('_DB_PREFIX_')."product " ;
} else if ($_POST['type'] == 'Product Attribute') {
$sql = "SELECT MAX(id_product_attribute) AS last_id ";
$sql .= "FROM ".constant('_DB_PREFIX_')."product_attribute " ;
}
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which allows to retrieve the address of a person
$sql = "SELECT ";
$sql .= constant('_DB_PREFIX_')."address.id_address AS id, ";
$sql .= constant('_DB_PREFIX_')."address.address1 AS street, ";
$sql .= constant('_DB_PREFIX_')."address.postcode AS zip, ";
$sql .= constant('_DB_PREFIX_')."address.city AS city, ";
$sql .= constant('_DB_PREFIX_')."country_lang.name AS country ";
# which tables are implied in the retrieve of address
$sql .= "FROM ".constant('_DB_PREFIX_')."address " ;
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."country " ;
$sql .= "ON ".constant('_DB_PREFIX_')."country.id_country=".constant('_DB_PREFIX_')."address.id_country ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."country_lang " ;
$sql .= "ON ".constant('_DB_PREFIX_')."country_lang.id_country=".constant('_DB_PREFIX_')."country.id_country ";
# where clause which restrict to the good person
$sql .= "WHERE ";
if (isset($_POST['person_id'])){
$sql .= constant('_DB_PREFIX_')."address.id_customer=".$_POST['person_id']." AND ";
}
$sql .= constant('_DB_PREFIX_')."country_lang.id_lang=".$_POST['language']." AND ";
$sql .= "address1 IS NOT NULL AND ";
$sql .= "postcode IS NOT NULL AND ";
$sql .= "city IS NOT NULL AND ";
$sql .= constant('_DB_PREFIX_')."address.id_country IS NOT NULL AND ";
$sql .= constant('_DB_PREFIX_')."address.active=1 AND ";
$sql .= constant('_DB_PREFIX_')."address.deleted=0 ";
# group the address by data
$sql .= "GROUP BY address1, postcode, city, ".constant('_DB_PREFIX_')."address.id_country ";
# FIXME: Is the order is usefull, the brain doesn't work on it ???
# order by address id
$sql .= "ORDER BY ".constant('_DB_PREFIX_')."address.id_address ASC ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which render the persons or only one if the id is provided
$sql = "SELECT id_customer AS id, ";
$sql .= "firstname AS firstname, lastname AS lastname, email AS email, ";
$sql .= "DATE_FORMAT(birthday, '%Y/%m/%d') AS birthday ";
$sql .= "FROM ".constant('_DB_PREFIX_')."customer " ;
$sql .= "WHERE ";
if (isset($_POST['person_id'])) {
$sql .= "id_customer=".$_POST['person_id']." AND ";
}
$sql .= "firstname != '' AND lastname != '' AND email != '' AND deleted = 0 ";
$sql .= "GROUP BY firstname, lastname, email ";
# FIXME: Is the order is usefull, the brain doesn't work on it ???
$sql .= "ORDER BY firstname ASC, lastname ASC, email ASC";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which render the categories
$sql = "SELECT ";
$sql .= "DISTINCT(".constant('_DB_PREFIX_')."attribute_lang.name) AS distinction, ";
$sql .= constant('_DB_PREFIX_')."product_attribute.id_product_attribute AS id, ";
$sql .= "CONCAT(";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name, ";
$sql .= " '/', ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ";
$sql .= ") AS category ";
# which tables are implied in the retrieve of product variations
$sql .= "FROM ".constant('_DB_PREFIX_')."product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_lang.id_product=".constant('_DB_PREFIX_')."product.id_product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_attribute ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_attribute.id_product=".constant('_DB_PREFIX_')."product.id_product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_attribute_combination ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_attribute_combination.id_product_attribute=".constant('_DB_PREFIX_')."product_attribute.id_product_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute.id_attribute=".constant('_DB_PREFIX_')."product_attribute_combination.id_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute_lang.id_attribute=".constant('_DB_PREFIX_')."attribute.id_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute_group_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute_group_lang.id_attribute_group=".constant('_DB_PREFIX_')."attribute.id_attribute_group ";
# where clause which restrict to the good variations
$sql .= "WHERE ";
if (isset($_POST['product_id'])) {
$sql .= constant('_DB_PREFIX_')."product.id_product=".$_POST['product_id']." AND ";
} else if (isset($_POST['group_id'])) {
$sql .= constant('_DB_PREFIX_')."product_attribute.id_product_attribute=".$_POST['group_id']." AND ";
}
$sql .= constant('_DB_PREFIX_')."product_lang.id_lang=".$_POST['language']." AND ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.id_lang=".$_POST['language']." AND ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.id_lang=".$_POST['language']." ";
# group the render
$sql .= "GROUP BY ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name, ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ";
# FIXME: Is the order is usefull, the brain doesn't work on it ???
# order by group name and category name
$sql .= "ORDER BY ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name ASC, ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ASC ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which render the products or only one if the id is provided
$sql = "SELECT ";
$sql .= "DISTINCT(".constant('_DB_PREFIX_')."product.id_product) AS id_product, ";
$sql .= constant('_DB_PREFIX_')."product.ean13 AS ean13, ";
$sql .= constant('_DB_PREFIX_')."product.reference AS reference, ";
$sql .= "(SELECT name FROM ".constant('_DB_PREFIX_')."product_lang WHERE id_product=".constant('_DB_PREFIX_')."product.id_product AND id_lang=".$_POST['language'].") AS title ";
# which tables are implied in the render of products
$sql .= "FROM ".constant('_DB_PREFIX_')."product " ;
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_lang " ;
$sql .= "ON ".constant('_DB_PREFIX_')."product_lang.id_product=".constant('_DB_PREFIX_')."product.id_product ";
$sql .= "WHERE ".constant('_DB_PREFIX_')."product.active=1 ";
if (isset($_POST['product_id'])) {
$sql .= "AND ".constant('_DB_PREFIX_')."product.id_product=".$_POST['product_id']." ";
}
# FIXME: Is the order is usefull, the brain doesn't work on it ???
$sql .= "ORDER BY ";
$sql .= constant('_DB_PREFIX_')."product_lang.name ASC, ";
$sql .= constant('_DB_PREFIX_')."product.reference ASC ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql which render the categories
$sql = "SELECT ";
$sql .= "DISTINCT(".constant('_DB_PREFIX_')."attribute_lang.name) AS distinction, ";
$sql .= constant('_DB_PREFIX_')."product_attribute.id_product_attribute AS id, ";
$sql .= "CONCAT(";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name, ";
$sql .= " '/', ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ";
$sql .= ") AS category ";
# which tables are implied in the retrieve of product variations
$sql .= "FROM ".constant('_DB_PREFIX_')."product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_lang.id_product=".constant('_DB_PREFIX_')."product.id_product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_attribute ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_attribute.id_product=".constant('_DB_PREFIX_')."product.id_product ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_attribute_combination ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_attribute_combination.id_product_attribute=".constant('_DB_PREFIX_')."product_attribute.id_product_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute.id_attribute=".constant('_DB_PREFIX_')."product_attribute_combination.id_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute_lang.id_attribute=".constant('_DB_PREFIX_')."attribute.id_attribute ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."attribute_group_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."attribute_group_lang.id_attribute_group=".constant('_DB_PREFIX_')."attribute.id_attribute_group ";
# where clause which restrict to the good variations
$sql .= "WHERE ";
if (isset($_POST['sale_order_line_id'])) {
# use the product id from the sale order line
$sql .= constant('_DB_PREFIX_')."product.id_product=(";
$sql .= "SELECT product_id FROM ".constant('_DB_PREFIX_')."order_detail ";
$sql .= "WHERE id_order_detail=".$_POST['sale_order_line_id'];
$sql .= ") AND ";
# and add group id if exist in the order line
$sql .= "IFNULL(";
$sql .= constant('_DB_PREFIX_')."product_attribute.id_product_attribute=(";
$sql .= "SELECT product_attribute_id FROM ps_order_detail ";
$sql .= "WHERE id_order_detail=".$_POST['sale_order_line_id'];
$sql .= "), 1";
$sql .= ") AND ";
}
# if (isset($_POST['product_id'])) {
# $sql .= constant('_DB_PREFIX_')."product.id_product=".$_POST['product_id']." AND ";
# } else if (isset($_POST['group_id'])) {
# $sql .= constant('_DB_PREFIX_')."product_attribute.id_product_attribute=".$_POST['group_id']." AND ";
# }
$sql .= constant('_DB_PREFIX_')."product_lang.id_lang=".$_POST['language']." AND ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.id_lang=".$_POST['language']." AND ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.id_lang=".$_POST['language']." ";
# group the render
$sql .= "GROUP BY ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name, ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ";
# FIXME: Is the order is usefull, the brain doesn't work on it ???
# order by group name and category name
$sql .= "ORDER BY ";
$sql .= constant('_DB_PREFIX_')."attribute_group_lang.name ASC, ";
$sql .= constant('_DB_PREFIX_')."attribute_lang.name ASC ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the sql query which allows to render the sale order line
$sql = "SELECT ";
$sql .= "DISTINCT(".constant('_DB_PREFIX_')."order_detail.product_id) AS id_product, ";
$sql .= constant('_DB_PREFIX_')."order_detail.id_order_detail AS id, ";
$sql .= constant('_DB_PREFIX_')."order_detail.product_name AS title, ";
$sql .= constant('_DB_PREFIX_')."order_detail.product_reference AS reference, ";
$sql .= constant('_DB_PREFIX_')."order_detail.product_id AS resource, ";
$sql .= constant('_DB_PREFIX_')."order_detail.product_attribute_id AS id_group, ";
$sql .= "FORMAT(".constant('_DB_PREFIX_')."order_detail.product_quantity, 2) AS quantity, ";
$sql .= constant('_DB_PREFIX_')."order_detail.product_price AS price, ";
$sql .= constant('_DB_PREFIX_')."order_detail.tax_rate AS VAT ";
# from which tables data come
$sql .= "FROM ".constant('_DB_PREFIX_')."orders ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."order_detail ";
$sql .= "ON ".constant('_DB_PREFIX_')."order_detail.id_order=".constant('_DB_PREFIX_')."orders.id_order ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."currency ";
$sql .= "ON ".constant('_DB_PREFIX_')."currency.id_currency=".constant('_DB_PREFIX_')."orders.id_currency ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product_lang ";
$sql .= "ON ".constant('_DB_PREFIX_')."product_lang.id_product=".constant('_DB_PREFIX_')."order_detail.product_id ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."product ";
$sql .= "ON ".constant('_DB_PREFIX_')."product.id_product=".constant('_DB_PREFIX_')."order_detail.product_id ";
# restrict the render
if (isset($_POST['sale_order_id'])){
$sql .= "WHERE ";
$sql .= constant('_DB_PREFIX_')."orders.id_order=".$_POST['sale_order_id'];
if (isset($_POST['product_id'])){
$sql .= " AND ".constant('_DB_PREFIX_')."order_detail.product_id=".$_POST['product_id'];
}
}
# # CHECK: is it usefull to provie an order ?
# $sql .= " ORDER BY ";
# $sql .= constant('_DB_PREFIX_')."order_detail.product_name ASC, ";
# $sql .= constant('_DB_PREFIX_')."order_detail.product_reference ASC ";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
$sql = "SELECT ";
$sql .= "DISTINCT(".constant('_DB_PREFIX_')."orders.id_order) AS reference, ";
$sql .= constant('_DB_PREFIX_')."orders.id_order AS id, ";
$sql .= constant('_DB_PREFIX_')."currency.iso_code AS currency, ";
$sql .= "DATE_FORMAT(".constant('_DB_PREFIX_')."orders.invoice_date, '%Y/%m/%d') AS start_date, ";
$sql .= "DATE_FORMAT(".constant('_DB_PREFIX_')."orders.delivery_date, '%Y/%m/%d') AS stop_date, ";
# Source and Destination
$sql .= "CONCAT('', IFNULL(";
$sql .= "CONCAT(".constant('_DB_PREFIX_')."customer.id_customer), ' Unknown unknown@person.com'";
$sql .= ")) AS destination, ";
# Source and Destination for the Ownership
$sql .= "CONCAT('', IFNULL(";
$sql .= "CONCAT(".constant('_DB_PREFIX_')."customer.id_customer), ' Unknown unknown@person.com'";
$sql .= ")) AS destination_ownership, ";
# Payment mode
$sql .= constant('_DB_PREFIX_')."orders.payment AS payment_mode ";
# Join's list
$sql .= "FROM ".constant('_DB_PREFIX_')."orders " ;
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."customer " ;
$sql .= "ON ".constant('_DB_PREFIX_')."customer.id_customer=".constant('_DB_PREFIX_')."orders.id_customer ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."currency " ;
$sql .= "ON ".constant('_DB_PREFIX_')."currency.id_currency=".constant('_DB_PREFIX_')."orders.id_currency ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."order_history " ;
$sql .= "ON ".constant('_DB_PREFIX_')."order_history.id_order=".constant('_DB_PREFIX_')."orders.id_order ";
$sql .= "LEFT JOIN ".constant('_DB_PREFIX_')."order_detail " ;
$sql .= "ON ".constant('_DB_PREFIX_')."order_detail.id_order=".constant('_DB_PREFIX_')."orders.id_order ";
$sql .= "WHERE ";
if (isset($_POST['sale_order_id'])){
$sql .= constant('_DB_PREFIX_')."orders.id_order=".$_POST['sale_order_id']." AND ";
}
$sql .= constant('_DB_PREFIX_')."order_history.id_order_history=";
$sql .= "(SELECT MAX(id_order_history) FROM ".constant('_DB_PREFIX_')."order_history WHERE id_order=".constant('_DB_PREFIX_')."orders.id_order) AND ";
$sql .= constant('_DB_PREFIX_')."order_history.id_order_state IN (4, 5, 6, 7) ";
$sql .= "ORDER BY ".constant('_DB_PREFIX_')."orders.id_order ASC ";
echo executeSQL($sql);
?>
<?php
class oneclickconnect extends Module
{
public function __construct()
{
$this->name = 'oneclickconnect';
$this->tab = 'Products';
$this->version = '';
parent::__construct();
$this->displayName = $this->l('One Click Connect');
$this->description = $this->l('Synchronize all your data with the TioSafe platform.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall the module One Click Connect?');
}
public function install()
{
if(!parent::install()
|| !$this->registerHook('leftColumn')
|| !Configuration::updateValue('MOD_EXPORT_ONECLICKCONNECT_URL', 'https://www.tiolive.com/en/tiolive_image/logo.png')
|| !$this->installModuleTab('AdminOneClickConnect', array(1=>'One Click Connect', 2=>'One Click Connect'), 2)
|| !$this->installModuleTab('AdminOneClickConnect', array(1=>'One Click Connect', 2=>'One Click Connect'), 3)
|| !$this->installModuleTab('AdminOneClickConnect', array(1=>'One Click Connect', 2=>'One Click Connect'), 1))
return false;
return true;
}
private function installModuleTab($tabClass, $tabName, $idTabParent)
{
@copy(_PS_MODULE_DIR_.$this->name.'/logo.gif', _PS_IMG_DIR_.'t/'.$tabClass.'.gif');
$tab = new Tab();
$tab->name = $tabName;
$tab->class_name = $tabClass;
$tab->module = $this->name;
$tab->id_parent = $idTabParent;
if(!$tab->save())
return false;
return true;
}
public function uninstall()
{
if(!parent::uninstall()
|| !Configuration::deleteByName('MOD_EXPORT_ONECLICKCONNECT_URL')
|| !$this->uninstallModuleTab('AdminOneClickConnect'))
return false;
return true;
}
private function uninstallModuleTab($tabClass)
{
$idTab = Tab::getIdFromClassName($tabClass);
if($idTab != 0)
{
$tab = new Tab($idTab);
$tab->delete();
return true;
}
return false;
}
public function getContent()
{
$html = '';
$html .= '<h2>'.$this->l('One Click Connect: synchronize your data').'</h2>
<fieldset>
<legend>'.$this->l('Informations :').'</legend>'.$this->l("TioSafe allows you to synchronize your between multiple applications.").'<br />
<br />'.$this->l('blablabla.').'
<br />'.$this->l('bla.').'
<br clear="all" />
<br clear="all" />
<a href="http://www.tiolive.com" target="_blank"><img src="https://www.tiolive.com/en/tiolive_image/logo.png" alt="Solution TioSafe" border="0" /></a>
</fieldset>
<br clear="all" />
';
return $html;
}
public function secureDir($dir)
{
define('_ONECLICKCONNECT_DIR_','/oneclickconnect');
define('MSG_ALERT_MODULE_NAME',$this->l('Module One Click Connect should not be renamed'));
if($dir != _ONECLICKCONNECT_DIR_)
{
echo utf8_decode(MSG_ALERT_MODULE_NAME);
exit();
}
}
public function netoyage_html($CatList)
{
$CatList = strip_tags ($CatList);
$CatList = trim ($CatList);
$CatList = str_replace("&nbsp;"," ",$CatList);
$CatList = str_replace("&#39;","' ",$CatList);
$CatList = str_replace("&#150;","-",$CatList);
$CatList = str_replace(chr(9)," ",$CatList);
$CatList = str_replace(chr(10)," ",$CatList);
$CatList = str_replace(chr(13)," ",$CatList);
return $CatList;
}
}
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the update of address
$sql = "UPDATE ".constant('_DB_PREFIX_')."address SET ";
# check which property must be updated
$property_array = array(
'street' => 'address1',
'zip' => 'postcode',
'city' => 'city',
);
foreach ($property_array as $property => $field) {
if (isset($_POST[$property])) {
if ($_POST[$property] != 'NULL') {
$_POST[$property] = "'".$_POST[$property]."'";
}
$sql .= $field."=".$_POST[$property].", ";
}
}
if (isset($_POST['country'])) {
if ($_POST['country'] == 'NULL') {
$sql .= 'id_country=0, ';
} else {
$sql .= "id_country=(SELECT id_country FROM ".constant('_DB_PREFIX_')."country_lang ";
$sql .= "WHERE name='".$_POST['country']."' AND ";
$sql .= "id_lang=".$_POST['language']."), ";
}
}
$sql .= "date_upd='".$date."' ";
# where clause which restrict to the good address
$sql .= " WHERE id_address='".$_POST['address_id']."' AND id_customer='".$_POST['person_id']."'";
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the update of person
$sql = "UPDATE ".constant('_DB_PREFIX_')."customer SET ";
# check which property must be updated
$property_array = array(
'firstname' => 'firstname',
'lastname' => 'lastname',
'email' => 'email',
'birthday' => 'birthday',
);
foreach ($property_array as $property => $field) {
if (isset($_POST[$property])) {
if ($_POST[$property] != 'NULL') {
$_POST[$property] = "'".$_POST[$property]."'";
}
$sql .= $field."=".$_POST[$property].", ";
}
}
$sql .= "date_upd='".$date."' WHERE id_customer=".$_POST['person_id'];
echo executeSQL($sql);
?>
<?php
$path = explode('/modules',dirname(__FILE__));
$config = $path[0].'/config/settings.inc.php';
include($config);
include('database.php');
header('Content-Type: text/plain; charset=utf-8');
# build the date
$date = date('y-m-d H:i:s');
# build the update
$sql = "UPDATE ".constant('_DB_PREFIX_')."product SET ";
# check which property must be updated
$property_array = array(
'reference' => 'reference',
'ean13' => 'ean13',
);
foreach ($property_array as $property => $field) {
if (isset($_POST[$property])) {
if ($_POST[$property] != 'NULL') {
$_POST[$property] = "'".$_POST[$property]."'";
}
$sql .= $field."=".$_POST[$property].", ";
}
}
$sql .= "date_upd='".$date."' WHERE id_product=".$_POST['product_id'];
echo executeSQL($sql);
?>
-- MySQL dump 10.13 Distrib 5.1.34, for mandriva-linux-gnu (x86_64)
--
-- Host: localhost Database: dump_test
-- ------------------------------------------------------
-- Server version 5.1.34-Max
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ps_address`
--
DROP TABLE IF EXISTS `ps_address`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_address` (
`id_address` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_country` int(10) unsigned NOT NULL,
`id_state` int(10) unsigned DEFAULT NULL,
`id_customer` int(10) unsigned NOT NULL DEFAULT '0',
`id_manufacturer` int(10) unsigned NOT NULL DEFAULT '0',
`id_supplier` int(10) unsigned NOT NULL DEFAULT '0',
`alias` varchar(32) NOT NULL,
`company` varchar(32) DEFAULT NULL,
`lastname` varchar(32) NOT NULL,
`firstname` varchar(32) NOT NULL,
`address1` varchar(128) NOT NULL,
`address2` varchar(128) DEFAULT NULL,
`postcode` varchar(12) DEFAULT NULL,
`city` varchar(64) NOT NULL,
`other` text,
`phone` varchar(16) DEFAULT NULL,
`phone_mobile` varchar(16) DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_address`),
KEY `address_customer` (`id_customer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_address`
--
LOCK TABLES `ps_address` WRITE;
/*!40000 ALTER TABLE `ps_address` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_address` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_country`
--
DROP TABLE IF EXISTS `ps_country`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_country` (
`id_country` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_zone` int(10) unsigned NOT NULL,
`iso_code` varchar(3) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`contains_states` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_country`),
KEY `country_iso_code` (`iso_code`),
KEY `country_` (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_country`
--
LOCK TABLES `ps_country` WRITE;
/*!40000 ALTER TABLE `ps_country` DISABLE KEYS */;
INSERT INTO `ps_country` VALUES (1,1,'DE',1,0),(2,1,'AT',1,0),(3,1,'BE',1,0),(4,2,'CA',1,0),(5,3,'CN',1,0),(6,1,'ES',1,0),(7,1,'FI',1,0),(8,1,'FR',1,0),(9,1,'GR',1,0),(10,1,'IT',1,0),(11,3,'JP',1,0),(12,1,'LU',1,0),(13,1,'NL',1,0),(14,1,'PL',1,0),(15,1,'PT',1,0),(16,1,'CZ',1,0),(17,1,'GB',1,0),(18,1,'SE',1,0),(19,1,'CH',1,0),(20,1,'DK',1,0),(21,2,'US',1,1),(22,3,'HK',1,0),(23,1,'NO',1,0),(24,5,'AU',1,0),(25,3,'SG',1,0),(26,1,'IE',1,0),(27,5,'NZ',1,0),(28,3,'KR',1,0),(29,3,'IL',1,0),(30,4,'ZA',1,0),(31,4,'NG',1,0),(32,4,'CI',1,0),(33,4,'TG',1,0),(34,2,'BO',1,0);
/*!40000 ALTER TABLE `ps_country` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_country_lang`
--
DROP TABLE IF EXISTS `ps_country_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_country_lang` (
`id_country` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL,
UNIQUE KEY `country_lang_index` (`id_country`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_country_lang`
--
LOCK TABLES `ps_country_lang` WRITE;
/*!40000 ALTER TABLE `ps_country_lang` DISABLE KEYS */;
INSERT INTO `ps_country_lang` VALUES (1,1,'Germany'),(1,2,'Allemagne'),(2,1,'Austria'),(2,2,'Autriche'),(3,1,'Belgium'),(3,2,'Belgique'),(4,1,'Canada'),(4,2,'Canada'),(5,1,'China'),(5,2,'Chine'),(6,1,'Spain'),(6,2,'Espagne'),(7,1,'Finland'),(7,2,'Finlande'),(8,1,'France'),(8,2,'France'),(9,1,'Greece'),(9,2,'Grèce'),(10,1,'Italy'),(10,2,'Italie'),(11,1,'Japan'),(11,2,'Japon'),(12,1,'Luxemburg'),(12,2,'Luxembourg'),(13,1,'Netherlands'),(13,2,'Pays-bas'),(14,1,'Poland'),(14,2,'Pologne'),(15,1,'Portugal'),(15,2,'Portugal'),(16,1,'Czech Republic'),(16,2,'République Tchèque'),(17,1,'United Kingdom'),(17,2,'Royaume-Uni'),(18,1,'Sweden'),(18,2,'Suède'),(19,1,'Switzerland'),(19,2,'Suisse'),(20,1,'Denmark'),(20,2,'Danemark'),(21,1,'USA'),(21,2,'USA'),(22,1,'HongKong'),(22,2,'Hong-Kong'),(23,1,'Norway'),(23,2,'Norvège'),(24,1,'Australia'),(24,2,'Australie'),(25,1,'Singapore'),(25,2,'Singapour'),(26,1,'Ireland'),(26,2,'Eire'),(27,1,'New Zealand'),(27,2,'Nouvelle-Zélande'),(28,1,'South Korea'),(28,2,'Corée du Sud'),(29,1,'Israel'),(29,2,'Israël'),(30,1,'South Africa'),(30,2,'Afrique du Sud'),(31,1,'Nigeria'),(31,2,'Nigeria'),(32,1,'Ivory Coast'),(32,2,'Côte d\'Ivoire'),(33,1,'Togo'),(33,2,'Togo'),(34,1,'Bolivia'),(34,2,'Bolivie');
/*!40000 ALTER TABLE `ps_country_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_customer`
--
DROP TABLE IF EXISTS `ps_customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_customer` (
`id_customer` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_gender` int(10) unsigned NOT NULL,
`secure_key` varchar(32) NOT NULL DEFAULT '-1',
`email` varchar(128) NOT NULL,
`passwd` varchar(32) NOT NULL,
`last_passwd_gen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`birthday` date DEFAULT NULL,
`lastname` varchar(32) NOT NULL,
`newsletter` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ip_registration_newsletter` varchar(15) DEFAULT NULL,
`newsletter_date_add` datetime DEFAULT NULL,
`optin` tinyint(1) unsigned NOT NULL DEFAULT '0',
`firstname` varchar(32) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_customer`),
UNIQUE KEY `customer_email` (`email`),
KEY `customer_login` (`email`,`passwd`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_customer`
--
LOCK TABLES `ps_customer` WRITE;
/*!40000 ALTER TABLE `ps_customer` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_lang`
--
DROP TABLE IF EXISTS `ps_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_lang` (
`id_lang` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`active` tinyint(3) unsigned NOT NULL DEFAULT '0',
`iso_code` char(2) NOT NULL,
PRIMARY KEY (`id_lang`),
KEY `lang_iso_code` (`iso_code`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_lang`
--
LOCK TABLES `ps_lang` WRITE;
/*!40000 ALTER TABLE `ps_lang` DISABLE KEYS */;
INSERT INTO `ps_lang` VALUES (1,'English (English)',1,'en'),(2,'Français (French)',1,'fr');
/*!40000 ALTER TABLE `ps_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer`
--
DROP TABLE IF EXISTS `ps_manufacturer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer` (
`id_manufacturer` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_manufacturer`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer`
--
LOCK TABLES `ps_manufacturer` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer` DISABLE KEYS */;
INSERT INTO `ps_manufacturer` VALUES (1,'Apple Computer, Inc','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Incorporated','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_manufacturer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer_lang`
--
DROP TABLE IF EXISTS `ps_manufacturer_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer_lang` (
`id_manufacturer` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_manufacturer`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer_lang`
--
LOCK TABLES `ps_manufacturer_lang` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_manufacturer_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_state`
--
DROP TABLE IF EXISTS `ps_state`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_state` (
`id_state` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_country` int(11) NOT NULL,
`id_zone` int(11) NOT NULL,
`name` varchar(64) NOT NULL,
`iso_code` varchar(3) NOT NULL,
`tax_behavior` smallint(1) NOT NULL DEFAULT '0',
`active` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_state`)
) ENGINE=MyISAM AUTO_INCREMENT=53 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_state`
--
LOCK TABLES `ps_state` WRITE;
/*!40000 ALTER TABLE `ps_state` DISABLE KEYS */;
INSERT INTO `ps_state` VALUES (1,21,2,'Alabama','AL',0,1),(2,21,2,'Alaska','AK',0,1),(3,21,2,'Arizona','AZ',0,1),(4,21,2,'Arkansas','AR',0,1),(5,21,2,'California','CA',0,1),(6,21,2,'Colorado','CO',0,1),(7,21,2,'Connecticut','CT',0,1),(8,21,2,'Delaware','DE',0,1),(9,21,2,'Florida','FL',0,1),(10,21,2,'Georgia','GA',0,1),(11,21,2,'Hawaii','HI',0,1),(12,21,2,'Idaho','ID',0,1),(13,21,2,'Illinois','IL',0,1),(14,21,2,'Indiana','IN',0,1),(15,21,2,'Iowa','IA',0,1),(16,21,2,'Kansas','KS',0,1),(17,21,2,'Kentucky','KY',0,1),(18,21,2,'Louisiana','LA',0,1),(19,21,2,'Maine','ME',0,1),(20,21,2,'Maryland','MD',0,1),(21,21,2,'Massachusetts','MA',0,1),(22,21,2,'Michigan','MI',0,1),(23,21,2,'Minnesota','MN',0,1),(24,21,2,'Mississippi','MS',0,1),(25,21,2,'Missouri','MO',0,1),(26,21,2,'Montana','MT',0,1),(27,21,2,'Nebraska','NE',0,1),(28,21,2,'Nevada','NV',0,1),(29,21,2,'New Hampshire','NH',0,1),(30,21,2,'New Jersey','NJ',0,1),(31,21,2,'New Mexico','NM',0,1),(32,21,2,'New York','NY',0,1),(33,21,2,'North Carolina','NC',0,1),(34,21,2,'North Dakota','ND',0,1),(35,21,2,'Ohio','OH',0,1),(36,21,2,'Oklahoma','OK',0,1),(37,21,2,'Oregon','OR',0,1),(38,21,2,'Pennsylvania','PA',0,1),(39,21,2,'Rhode Island','RI',0,1),(40,21,2,'South Carolina','SC',0,1),(41,21,2,'South Dakota','SD',0,1),(42,21,2,'Tennessee','TN',0,1),(43,21,2,'Texas','TX',0,1),(44,21,2,'Utah','UT',0,1),(45,21,2,'Vermont','VT',0,1),(46,21,2,'Virginia','VA',0,1),(47,21,2,'Washington','WA',0,1),(48,21,2,'West Virginia','WV',0,1),(49,21,2,'Wisconsin','WI',0,1),(50,21,2,'Wyoming','WY',0,1),(51,21,2,'Puerto Rico','PR',0,1),(52,21,2,'US Virgin Islands','VI',0,1);
/*!40000 ALTER TABLE `ps_state` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier`
--
DROP TABLE IF EXISTS `ps_supplier`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier` (
`id_supplier` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_supplier`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier`
--
LOCK TABLES `ps_supplier` WRITE;
/*!40000 ALTER TABLE `ps_supplier` DISABLE KEYS */;
INSERT INTO `ps_supplier` VALUES (1,'AppleStore','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Online Store','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_supplier` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier_lang`
--
DROP TABLE IF EXISTS `ps_supplier_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier_lang` (
`id_supplier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_supplier`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier_lang`
--
LOCK TABLES `ps_supplier_lang` WRITE;
/*!40000 ALTER TABLE `ps_supplier_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_supplier_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_zone`
--
DROP TABLE IF EXISTS `ps_zone`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_zone` (
`id_zone` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_zone`
--
LOCK TABLES `ps_zone` WRITE;
/*!40000 ALTER TABLE `ps_zone` DISABLE KEYS */;
INSERT INTO `ps_zone` VALUES (1,'Europe',1,1),(2,'US',1,1),(3,'Asia',1,1),(4,'Africa',1,1),(5,'Oceania',1,1);
/*!40000 ALTER TABLE `ps_zone` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2009-10-15 8:39:34
This source diff could not be displayed because it is too large. You can view the blob instead.
-- MySQL dump 10.13 Distrib 5.1.34, for mandriva-linux-gnu (x86_64)
--
-- Host: localhost Database: dump_test
-- ------------------------------------------------------
-- Server version 5.1.34-Max
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ps_address`
--
DROP TABLE IF EXISTS `ps_address`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_address` (
`id_address` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_country` int(10) unsigned NOT NULL,
`id_state` int(10) unsigned DEFAULT NULL,
`id_customer` int(10) unsigned NOT NULL DEFAULT '0',
`id_manufacturer` int(10) unsigned NOT NULL DEFAULT '0',
`id_supplier` int(10) unsigned NOT NULL DEFAULT '0',
`alias` varchar(32) NOT NULL,
`company` varchar(32) DEFAULT NULL,
`lastname` varchar(32) NOT NULL,
`firstname` varchar(32) NOT NULL,
`address1` varchar(128) NOT NULL,
`address2` varchar(128) DEFAULT NULL,
`postcode` varchar(12) DEFAULT NULL,
`city` varchar(64) NOT NULL,
`other` text,
`phone` varchar(16) DEFAULT NULL,
`phone_mobile` varchar(16) DEFAULT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '1',
`deleted` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_address`),
KEY `address_customer` (`id_customer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_address`
--
LOCK TABLES `ps_address` WRITE;
/*!40000 ALTER TABLE `ps_address` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_address` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_country`
--
DROP TABLE IF EXISTS `ps_country`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_country` (
`id_country` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_zone` int(10) unsigned NOT NULL,
`iso_code` varchar(3) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`contains_states` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_country`),
KEY `country_iso_code` (`iso_code`),
KEY `country_` (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_country`
--
LOCK TABLES `ps_country` WRITE;
/*!40000 ALTER TABLE `ps_country` DISABLE KEYS */;
INSERT INTO `ps_country` VALUES (1,1,'DE',1,0),(2,1,'AT',1,0),(3,1,'BE',1,0),(4,2,'CA',1,0),(5,3,'CN',1,0),(6,1,'ES',1,0),(7,1,'FI',1,0),(8,1,'FR',1,0),(9,1,'GR',1,0),(10,1,'IT',1,0),(11,3,'JP',1,0),(12,1,'LU',1,0),(13,1,'NL',1,0),(14,1,'PL',1,0),(15,1,'PT',1,0),(16,1,'CZ',1,0),(17,1,'GB',1,0),(18,1,'SE',1,0),(19,1,'CH',1,0),(20,1,'DK',1,0),(21,2,'US',1,1),(22,3,'HK',1,0),(23,1,'NO',1,0),(24,5,'AU',1,0),(25,3,'SG',1,0),(26,1,'IE',1,0),(27,5,'NZ',1,0),(28,3,'KR',1,0),(29,3,'IL',1,0),(30,4,'ZA',1,0),(31,4,'NG',1,0),(32,4,'CI',1,0),(33,4,'TG',1,0),(34,2,'BO',1,0);
/*!40000 ALTER TABLE `ps_country` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_country_lang`
--
DROP TABLE IF EXISTS `ps_country_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_country_lang` (
`id_country` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL,
UNIQUE KEY `country_lang_index` (`id_country`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_country_lang`
--
LOCK TABLES `ps_country_lang` WRITE;
/*!40000 ALTER TABLE `ps_country_lang` DISABLE KEYS */;
INSERT INTO `ps_country_lang` VALUES (1,1,'Germany'),(1,2,'Allemagne'),(2,1,'Austria'),(2,2,'Autriche'),(3,1,'Belgium'),(3,2,'Belgique'),(4,1,'Canada'),(4,2,'Canada'),(5,1,'China'),(5,2,'Chine'),(6,1,'Spain'),(6,2,'Espagne'),(7,1,'Finland'),(7,2,'Finlande'),(8,1,'France'),(8,2,'France'),(9,1,'Greece'),(9,2,'Grèce'),(10,1,'Italy'),(10,2,'Italie'),(11,1,'Japan'),(11,2,'Japon'),(12,1,'Luxemburg'),(12,2,'Luxembourg'),(13,1,'Netherlands'),(13,2,'Pays-bas'),(14,1,'Poland'),(14,2,'Pologne'),(15,1,'Portugal'),(15,2,'Portugal'),(16,1,'Czech Republic'),(16,2,'République Tchèque'),(17,1,'United Kingdom'),(17,2,'Royaume-Uni'),(18,1,'Sweden'),(18,2,'Suède'),(19,1,'Switzerland'),(19,2,'Suisse'),(20,1,'Denmark'),(20,2,'Danemark'),(21,1,'USA'),(21,2,'USA'),(22,1,'HongKong'),(22,2,'Hong-Kong'),(23,1,'Norway'),(23,2,'Norvège'),(24,1,'Australia'),(24,2,'Australie'),(25,1,'Singapore'),(25,2,'Singapour'),(26,1,'Ireland'),(26,2,'Eire'),(27,1,'New Zealand'),(27,2,'Nouvelle-Zélande'),(28,1,'South Korea'),(28,2,'Corée du Sud'),(29,1,'Israel'),(29,2,'Israël'),(30,1,'South Africa'),(30,2,'Afrique du Sud'),(31,1,'Nigeria'),(31,2,'Nigeria'),(32,1,'Ivory Coast'),(32,2,'Côte d\'Ivoire'),(33,1,'Togo'),(33,2,'Togo'),(34,1,'Bolivia'),(34,2,'Bolivie');
/*!40000 ALTER TABLE `ps_country_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_customer`
--
DROP TABLE IF EXISTS `ps_customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_customer` (
`id_customer` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_gender` int(10) unsigned NOT NULL,
`secure_key` varchar(32) NOT NULL DEFAULT '-1',
`email` varchar(128) NOT NULL,
`passwd` varchar(32) NOT NULL,
`last_passwd_gen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`birthday` date DEFAULT NULL,
`lastname` varchar(32) NOT NULL,
`newsletter` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ip_registration_newsletter` varchar(15) DEFAULT NULL,
`newsletter_date_add` datetime DEFAULT NULL,
`optin` tinyint(1) unsigned NOT NULL DEFAULT '0',
`firstname` varchar(32) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_customer`),
UNIQUE KEY `customer_email` (`email`),
KEY `customer_login` (`email`,`passwd`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_customer`
--
LOCK TABLES `ps_customer` WRITE;
/*!40000 ALTER TABLE `ps_customer` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_lang`
--
DROP TABLE IF EXISTS `ps_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_lang` (
`id_lang` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`active` tinyint(3) unsigned NOT NULL DEFAULT '0',
`iso_code` char(2) NOT NULL,
PRIMARY KEY (`id_lang`),
KEY `lang_iso_code` (`iso_code`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_lang`
--
LOCK TABLES `ps_lang` WRITE;
/*!40000 ALTER TABLE `ps_lang` DISABLE KEYS */;
INSERT INTO `ps_lang` VALUES (1,'English (English)',1,'en'),(2,'Français (French)',1,'fr');
/*!40000 ALTER TABLE `ps_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer`
--
DROP TABLE IF EXISTS `ps_manufacturer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer` (
`id_manufacturer` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_manufacturer`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer`
--
LOCK TABLES `ps_manufacturer` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer` DISABLE KEYS */;
INSERT INTO `ps_manufacturer` VALUES (1,'Apple Computer, Inc','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Incorporated','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_manufacturer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer_lang`
--
DROP TABLE IF EXISTS `ps_manufacturer_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer_lang` (
`id_manufacturer` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_manufacturer`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer_lang`
--
LOCK TABLES `ps_manufacturer_lang` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_manufacturer_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_state`
--
DROP TABLE IF EXISTS `ps_state`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_state` (
`id_state` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_country` int(11) NOT NULL,
`id_zone` int(11) NOT NULL,
`name` varchar(64) NOT NULL,
`iso_code` varchar(3) NOT NULL,
`tax_behavior` smallint(1) NOT NULL DEFAULT '0',
`active` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_state`)
) ENGINE=MyISAM AUTO_INCREMENT=53 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_state`
--
LOCK TABLES `ps_state` WRITE;
/*!40000 ALTER TABLE `ps_state` DISABLE KEYS */;
INSERT INTO `ps_state` VALUES (1,21,2,'Alabama','AL',0,1),(2,21,2,'Alaska','AK',0,1),(3,21,2,'Arizona','AZ',0,1),(4,21,2,'Arkansas','AR',0,1),(5,21,2,'California','CA',0,1),(6,21,2,'Colorado','CO',0,1),(7,21,2,'Connecticut','CT',0,1),(8,21,2,'Delaware','DE',0,1),(9,21,2,'Florida','FL',0,1),(10,21,2,'Georgia','GA',0,1),(11,21,2,'Hawaii','HI',0,1),(12,21,2,'Idaho','ID',0,1),(13,21,2,'Illinois','IL',0,1),(14,21,2,'Indiana','IN',0,1),(15,21,2,'Iowa','IA',0,1),(16,21,2,'Kansas','KS',0,1),(17,21,2,'Kentucky','KY',0,1),(18,21,2,'Louisiana','LA',0,1),(19,21,2,'Maine','ME',0,1),(20,21,2,'Maryland','MD',0,1),(21,21,2,'Massachusetts','MA',0,1),(22,21,2,'Michigan','MI',0,1),(23,21,2,'Minnesota','MN',0,1),(24,21,2,'Mississippi','MS',0,1),(25,21,2,'Missouri','MO',0,1),(26,21,2,'Montana','MT',0,1),(27,21,2,'Nebraska','NE',0,1),(28,21,2,'Nevada','NV',0,1),(29,21,2,'New Hampshire','NH',0,1),(30,21,2,'New Jersey','NJ',0,1),(31,21,2,'New Mexico','NM',0,1),(32,21,2,'New York','NY',0,1),(33,21,2,'North Carolina','NC',0,1),(34,21,2,'North Dakota','ND',0,1),(35,21,2,'Ohio','OH',0,1),(36,21,2,'Oklahoma','OK',0,1),(37,21,2,'Oregon','OR',0,1),(38,21,2,'Pennsylvania','PA',0,1),(39,21,2,'Rhode Island','RI',0,1),(40,21,2,'South Carolina','SC',0,1),(41,21,2,'South Dakota','SD',0,1),(42,21,2,'Tennessee','TN',0,1),(43,21,2,'Texas','TX',0,1),(44,21,2,'Utah','UT',0,1),(45,21,2,'Vermont','VT',0,1),(46,21,2,'Virginia','VA',0,1),(47,21,2,'Washington','WA',0,1),(48,21,2,'West Virginia','WV',0,1),(49,21,2,'Wisconsin','WI',0,1),(50,21,2,'Wyoming','WY',0,1),(51,21,2,'Puerto Rico','PR',0,1),(52,21,2,'US Virgin Islands','VI',0,1);
/*!40000 ALTER TABLE `ps_state` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier`
--
DROP TABLE IF EXISTS `ps_supplier`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier` (
`id_supplier` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_supplier`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier`
--
LOCK TABLES `ps_supplier` WRITE;
/*!40000 ALTER TABLE `ps_supplier` DISABLE KEYS */;
INSERT INTO `ps_supplier` VALUES (1,'AppleStore','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Online Store','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_supplier` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier_lang`
--
DROP TABLE IF EXISTS `ps_supplier_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier_lang` (
`id_supplier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_supplier`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier_lang`
--
LOCK TABLES `ps_supplier_lang` WRITE;
/*!40000 ALTER TABLE `ps_supplier_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_supplier_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_zone`
--
DROP TABLE IF EXISTS `ps_zone`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_zone` (
`id_zone` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_zone`
--
LOCK TABLES `ps_zone` WRITE;
/*!40000 ALTER TABLE `ps_zone` DISABLE KEYS */;
INSERT INTO `ps_zone` VALUES (1,'Europe',1,1),(2,'US',1,1),(3,'Asia',1,1),(4,'Africa',1,1),(5,'Oceania',1,1);
/*!40000 ALTER TABLE `ps_zone` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2009-10-15 8:39:34
INSERT INTO `ps_product` (id_product, id_tax, ean13, reference, active, date_add, date_upd) VALUES (1, 1, '1234567890128', 'myShort123', 1, '2009-09-1414:00:00', '2009-09-1414:00:00');
INSERT INTO `ps_product_lang` (id_product, id_lang, description, link_rewrite, name) VALUES (1, 1, 'This is a magnificient tee-shirt Tux', 'tee-shirt', 'Tee-Shirt Tux'), (1, 2, 'Voici un sublime tee-shirt Tux', 'tee-shirt', 'Tee-Shirt Tux');
INSERT INTO `ps_category_product` (id_category, id_product, position) VALUES (1, 1, 1);
-- MySQL dump 10.13 Distrib 5.1.34, for mandriva-linux-gnu (x86_64)
--
-- Host: localhost Database: dump_test
-- ------------------------------------------------------
-- Server version 5.1.34-Max
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ps_attribute`
--
DROP TABLE IF EXISTS `ps_attribute`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_attribute` (
`id_attribute` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_attribute_group` int(10) unsigned NOT NULL,
`color` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id_attribute`),
KEY `attribute_group` (`id_attribute_group`)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_attribute`
--
LOCK TABLES `ps_attribute` WRITE;
/*!40000 ALTER TABLE `ps_attribute` DISABLE KEYS */;
INSERT INTO `ps_attribute` VALUES (1,1,NULL),(2,1,NULL),(3,2,'#D2D6D5'),(4,2,'#008CB7'),(5,2,'#F3349E'),(6,2,'#93D52D'),(7,2,'#FD9812'),(8,1,NULL),(9,1,NULL),(10,3,NULL),(11,3,NULL),(12,1,NULL),(13,1,NULL),(14,2,NULL),(15,1,''),(16,1,''),(17,1,''),(18,2,'#7800F0'),(19,2,'#F6EF04'),(20,2,'#F60409'),(21,5,'#000000'),(22,5,'#000000'),(23,5,'#000000'),(24,5,'#000000'),(25,5,'#000000');
/*!40000 ALTER TABLE `ps_attribute` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_attribute_group`
--
DROP TABLE IF EXISTS `ps_attribute_group`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_attribute_group` (
`id_attribute_group` int(10) unsigned NOT NULL AUTO_INCREMENT,
`is_color_group` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_attribute_group`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_attribute_group`
--
LOCK TABLES `ps_attribute_group` WRITE;
/*!40000 ALTER TABLE `ps_attribute_group` DISABLE KEYS */;
INSERT INTO `ps_attribute_group` VALUES (1,0),(2,1),(3,0),(5,0);
/*!40000 ALTER TABLE `ps_attribute_group` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_attribute_group_lang`
--
DROP TABLE IF EXISTS `ps_attribute_group_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_attribute_group_lang` (
`id_attribute_group` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
`public_name` varchar(64) NOT NULL,
PRIMARY KEY (`id_attribute_group`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_attribute_group_lang`
--
LOCK TABLES `ps_attribute_group_lang` WRITE;
/*!40000 ALTER TABLE `ps_attribute_group_lang` DISABLE KEYS */;
INSERT INTO `ps_attribute_group_lang` VALUES (1,1,'Disk space','Disk space'),(1,2,'Capacité','Capacité'),(2,1,'Color','Color'),(2,2,'Couleur','Couleur'),(3,1,'ICU','Processor'),(3,2,'ICU','Processeur'),(5,2,'size','Taille'),(5,1,'size','Taille');
/*!40000 ALTER TABLE `ps_attribute_group_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_attribute_lang`
--
DROP TABLE IF EXISTS `ps_attribute_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_attribute_lang` (
`id_attribute` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
UNIQUE KEY `attribute_lang_index` (`id_attribute`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_attribute_lang`
--
LOCK TABLES `ps_attribute_lang` WRITE;
/*!40000 ALTER TABLE `ps_attribute_lang` DISABLE KEYS */;
INSERT INTO `ps_attribute_lang` VALUES (1,1,'2GB'),(1,2,'2Go'),(2,1,'4GB'),(2,2,'4Go'),(3,1,'Metal'),(3,2,'Metal'),(4,1,'Blue'),(4,2,'Bleu'),(5,1,'Pink'),(5,2,'Rose'),(6,1,'Green'),(6,2,'Vert'),(7,1,'Orange'),(7,2,'Orange'),(8,1,'Optional 64GB solid-state drive'),(8,2,'Disque dur SSD (solid-state drive) de 64 Go '),(9,1,'80GB Parallel ATA Drive @ 4200 rpm'),(9,2,'Disque dur PATA de 80 Go Ã| 4 200 tr/min'),(10,1,'1.60GHz Intel Core 2 Duo'),(10,2,'Intel Core 2 Duo Ã| 1,6 GHz'),(11,1,'1.80GHz Intel Core 2 Duo'),(11,2,'Intel Core 2 Duo Ã| 1,8 GHz'),(12,1,'80GB: 20,000 Songs'),(12,2,'80 Go : 20 000 chansons'),(13,1,'160GB: 40,000 Songs'),(13,2,'160 Go : 40 000 chansons'),(14,2,'Noir'),(14,1,'Black'),(15,1,'8Go'),(15,2,'8Go'),(16,1,'16Go'),(16,2,'16Go'),(17,1,'32Go'),(17,2,'32Go'),(18,1,'Purple'),(18,2,'Violet'),(19,1,'Yellow'),(19,2,'Jaune'),(20,1,'Red'),(20,2,'Rouge'),(21,1,'S'),(21,2,'S'),(22,1,'M'),(22,2,'M'),(23,1,'L'),(23,2,'L'),(24,1,'XL'),(24,2,'XL'),(25,1,'XXL'),(25,2,'XXL');
/*!40000 ALTER TABLE `ps_attribute_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_category_product`
--
DROP TABLE IF EXISTS `ps_category_product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_category_product` (
`id_category` int(10) unsigned NOT NULL,
`id_product` int(10) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL DEFAULT '0',
KEY `category_product_index` (`id_category`,`id_product`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_category_product`
--
LOCK TABLES `ps_category_product` WRITE;
/*!40000 ALTER TABLE `ps_category_product` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_category_product` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_image`
--
DROP TABLE IF EXISTS `ps_image`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_image` (
`id_image` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_product` int(10) unsigned NOT NULL,
`position` tinyint(2) unsigned NOT NULL DEFAULT '0',
`cover` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_image`),
KEY `image_product` (`id_product`)
) ENGINE=MyISAM AUTO_INCREMENT=58 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_image`
--
LOCK TABLES `ps_image` WRITE;
/*!40000 ALTER TABLE `ps_image` DISABLE KEYS */;
INSERT INTO `ps_image` VALUES (40,1,4,0),(39,1,3,0),(38,1,2,0),(37,1,1,1),(48,2,3,0),(47,2,2,0),(49,2,4,0),(46,2,1,1),(15,5,1,1),(16,5,2,0),(17,5,3,0),(18,6,4,0),(19,6,5,0),(20,6,1,1),(24,7,1,1),(33,8,1,1),(27,7,3,0),(26,7,2,0),(29,7,4,0),(30,7,5,0),(32,7,6,0),(36,9,1,1),(41,1,5,0),(42,1,6,0),(44,1,7,0),(45,1,8,0),(50,51,1,1),(51,53,1,1),(54,59,1,1),(53,58,1,1),(56,174,1,1),(57,173,1,1);
/*!40000 ALTER TABLE `ps_image` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_lang`
--
DROP TABLE IF EXISTS `ps_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_lang` (
`id_lang` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL,
`active` tinyint(3) unsigned NOT NULL DEFAULT '0',
`iso_code` char(2) NOT NULL,
PRIMARY KEY (`id_lang`),
KEY `lang_iso_code` (`iso_code`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_lang`
--
LOCK TABLES `ps_lang` WRITE;
/*!40000 ALTER TABLE `ps_lang` DISABLE KEYS */;
INSERT INTO `ps_lang` VALUES (1,'English (English)',1,'en'),(2,'Français (French)',1,'fr');
/*!40000 ALTER TABLE `ps_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer`
--
DROP TABLE IF EXISTS `ps_manufacturer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer` (
`id_manufacturer` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_manufacturer`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer`
--
LOCK TABLES `ps_manufacturer` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer` DISABLE KEYS */;
INSERT INTO `ps_manufacturer` VALUES (1,'Apple Computer, Inc','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Incorporated','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_manufacturer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_manufacturer_lang`
--
DROP TABLE IF EXISTS `ps_manufacturer_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_manufacturer_lang` (
`id_manufacturer` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_manufacturer`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_manufacturer_lang`
--
LOCK TABLES `ps_manufacturer_lang` WRITE;
/*!40000 ALTER TABLE `ps_manufacturer_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_manufacturer_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_product`
--
DROP TABLE IF EXISTS `ps_product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_product` (
`id_product` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_supplier` int(10) unsigned DEFAULT NULL,
`id_manufacturer` int(10) unsigned DEFAULT NULL,
`id_tax` int(10) unsigned NOT NULL,
`id_category_default` int(10) unsigned DEFAULT NULL,
`id_color_default` int(10) unsigned DEFAULT NULL,
`on_sale` tinyint(1) unsigned NOT NULL DEFAULT '0',
`ean13` varchar(13) DEFAULT NULL,
`ecotax` decimal(10,2) NOT NULL DEFAULT '0.00',
`quantity` int(10) unsigned NOT NULL DEFAULT '0',
`price` decimal(13,6) NOT NULL DEFAULT '0.000000',
`wholesale_price` decimal(13,6) NOT NULL DEFAULT '0.000000',
`reduction_price` decimal(10,2) DEFAULT NULL,
`reduction_percent` float DEFAULT NULL,
`reduction_from` date DEFAULT NULL,
`reduction_to` date DEFAULT NULL,
`reference` varchar(32) DEFAULT NULL,
`supplier_reference` varchar(32) DEFAULT NULL,
`location` varchar(64) DEFAULT NULL,
`weight` float NOT NULL DEFAULT '0',
`out_of_stock` int(10) unsigned NOT NULL DEFAULT '2',
`quantity_discount` tinyint(1) DEFAULT '0',
`customizable` tinyint(2) NOT NULL DEFAULT '0',
`uploadable_files` tinyint(4) NOT NULL DEFAULT '0',
`text_fields` tinyint(4) NOT NULL DEFAULT '0',
`active` tinyint(1) unsigned NOT NULL DEFAULT '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_product`),
KEY `product_supplier` (`id_supplier`),
KEY `product_manufacturer` (`id_manufacturer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_product`
--
LOCK TABLES `ps_product` WRITE;
/*!40000 ALTER TABLE `ps_product` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_product` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_product_attribute`
--
DROP TABLE IF EXISTS `ps_product_attribute`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_product_attribute` (
`id_product_attribute` int(10) unsigned NOT NULL AUTO_INCREMENT,
`id_image` int(10) unsigned DEFAULT NULL,
`id_product` int(10) unsigned NOT NULL,
`reference` varchar(32) DEFAULT NULL,
`supplier_reference` varchar(32) DEFAULT NULL,
`location` varchar(64) DEFAULT NULL,
`ean13` varchar(13) DEFAULT NULL,
`wholesale_price` decimal(13,6) NOT NULL DEFAULT '0.000000',
`price` decimal(10,2) NOT NULL DEFAULT '0.00',
`ecotax` decimal(10,2) NOT NULL DEFAULT '0.00',
`quantity` int(10) unsigned NOT NULL DEFAULT '0',
`weight` float NOT NULL DEFAULT '0',
`default_on` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id_product_attribute`),
KEY `product_attribute_product` (`id_product`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_product_attribute`
--
LOCK TABLES `ps_product_attribute` WRITE;
/*!40000 ALTER TABLE `ps_product_attribute` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_product_attribute` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_product_attribute_combination`
--
DROP TABLE IF EXISTS `ps_product_attribute_combination`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_product_attribute_combination` (
`id_attribute` int(10) unsigned NOT NULL,
`id_product_attribute` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_attribute`,`id_product_attribute`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_product_attribute_combination`
--
LOCK TABLES `ps_product_attribute_combination` WRITE;
/*!40000 ALTER TABLE `ps_product_attribute_combination` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_product_attribute_combination` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_product_lang`
--
DROP TABLE IF EXISTS `ps_product_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_product_lang` (
`id_product` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
`description_short` text,
`link_rewrite` varchar(128) NOT NULL,
`meta_description` varchar(255) DEFAULT NULL,
`meta_keywords` varchar(255) DEFAULT NULL,
`meta_title` varchar(128) DEFAULT NULL,
`name` varchar(128) NOT NULL,
`available_now` varchar(255) DEFAULT NULL,
`available_later` varchar(255) DEFAULT NULL,
UNIQUE KEY `product_lang_index` (`id_product`,`id_lang`),
FULLTEXT KEY `fts` (`name`,`description_short`,`description`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_product_lang`
--
LOCK TABLES `ps_product_lang` WRITE;
/*!40000 ALTER TABLE `ps_product_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_product_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier`
--
DROP TABLE IF EXISTS `ps_supplier`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier` (
`id_supplier` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_supplier`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier`
--
LOCK TABLES `ps_supplier` WRITE;
/*!40000 ALTER TABLE `ps_supplier` DISABLE KEYS */;
INSERT INTO `ps_supplier` VALUES (1,'AppleStore','2009-06-09 11:36:02','2009-06-09 11:36:02'),(2,'Shure Online Store','2009-06-09 11:36:02','2009-06-09 11:36:02');
/*!40000 ALTER TABLE `ps_supplier` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_supplier_lang`
--
DROP TABLE IF EXISTS `ps_supplier_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_supplier_lang` (
`id_supplier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
PRIMARY KEY (`id_supplier`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_supplier_lang`
--
LOCK TABLES `ps_supplier_lang` WRITE;
/*!40000 ALTER TABLE `ps_supplier_lang` DISABLE KEYS */;
/*!40000 ALTER TABLE `ps_supplier_lang` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_tax`
--
DROP TABLE IF EXISTS `ps_tax`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_tax` (
`id_tax` int(10) unsigned NOT NULL AUTO_INCREMENT,
`rate` float NOT NULL,
PRIMARY KEY (`id_tax`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_tax`
--
LOCK TABLES `ps_tax` WRITE;
/*!40000 ALTER TABLE `ps_tax` DISABLE KEYS */;
INSERT INTO `ps_tax` VALUES (1,19.6),(2,5.5),(3,17.5);
/*!40000 ALTER TABLE `ps_tax` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ps_tax_lang`
--
DROP TABLE IF EXISTS `ps_tax_lang`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ps_tax_lang` (
`id_tax` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL,
UNIQUE KEY `tax_lang_index` (`id_tax`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ps_tax_lang`
--
LOCK TABLES `ps_tax_lang` WRITE;
/*!40000 ALTER TABLE `ps_tax_lang` DISABLE KEYS */;
INSERT INTO `ps_tax_lang` VALUES (1,1,'VAT 19.6%'),(1,2,'TVA 19.6%'),(2,1,'VAT 5.5%'),(2,2,'TVA 5.5%'),(3,1,'VAT 17.5%'),(3,2,'TVA UK 17.5%');
/*!40000 ALTER TABLE `ps_tax_lang` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2009-10-15 8:44:23
DROP TABLE IF EXISTS `ps_address`;
CREATE TABLE `ps_address` (
`id_address` int(10) unsigned NOT NULL auto_increment,
`id_country` int(10) unsigned NOT NULL,
`id_state` int(10) unsigned default NULL,
`id_customer` int(10) unsigned NOT NULL default '0',
`id_manufacturer` int(10) unsigned NOT NULL default '0',
`id_supplier` int(10) unsigned NOT NULL default '0',
`alias` varchar(32) NOT NULL,
`company` varchar(32) default NULL,
`lastname` varchar(32) NOT NULL,
`firstname` varchar(32) NOT NULL,
`address1` varchar(128) NOT NULL,
`address2` varchar(128) default NULL,
`postcode` varchar(12) default NULL,
`city` varchar(64) NOT NULL,
`other` text,
`phone` varchar(16) default NULL,
`phone_mobile` varchar(16) default NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '1',
`deleted` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_address`),
KEY `address_customer` (`id_customer`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_address` WRITE;
INSERT INTO `ps_address` VALUES (1,21,5,0,1,0,'manufacturer',NULL,'JOBS','STEVE','1 Infinite Loop',NULL,'95014','Cupertino',NULL,'(800) 275-2273',NULL,'2009-09-17 09:48:51','2009-09-17 09:48:51',1,0),(2,8,0,1,0,0,'Mon adresse','My Company','DOE','John','16, Main street','2nd floor','75000','Paris ',NULL,'0102030405',NULL,'2009-09-17 09:48:51','2009-09-17 09:48:51',1,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_attribute`;
CREATE TABLE `ps_attribute` (
`id_attribute` int(10) unsigned NOT NULL auto_increment,
`id_attribute_group` int(10) unsigned NOT NULL,
`color` varchar(32) default NULL,
PRIMARY KEY (`id_attribute`),
KEY `attribute_group` (`id_attribute_group`)
) ENGINE=MyISAM AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_attribute` WRITE;
INSERT INTO `ps_attribute` VALUES (1,1,NULL),(2,1,NULL),(3,2,'#D2D6D5'),(4,2,'#008CB7'),(5,2,'#F3349E'),(6,2,'#93D52D'),(7,2,'#FD9812'),(8,1,NULL),(9,1,NULL),(10,3,NULL),(11,3,NULL),(12,1,NULL),(13,1,NULL),(14,2,NULL),(15,1,''),(16,1,''),(17,1,''),(18,2,'#7800F0'),(19,2,'#F6EF04'),(20,2,'#F60409'),(21,4,'#000000'),(22,4,'#000000'),(23,4,'#000000'),(24,4,'#000000'),(25,4,'#000000');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_attribute_group`;
CREATE TABLE `ps_attribute_group` (
`id_attribute_group` int(10) unsigned NOT NULL auto_increment,
`is_color_group` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_attribute_group`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_attribute_group` WRITE;
INSERT INTO `ps_attribute_group` VALUES (1,0),(2,1),(3,0),(4,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_attribute_group_lang`;
CREATE TABLE `ps_attribute_group_lang` (
`id_attribute_group` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
`public_name` varchar(64) NOT NULL,
PRIMARY KEY (`id_attribute_group`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_attribute_group_lang` WRITE;
INSERT INTO `ps_attribute_group_lang` VALUES (1,1,'Disk space','Disk space'),(1,2,'Capacite','Capacite'),(2,1,'Color','Color'),(2,2,'Couleur','Couleur'),(3,1,'ICU','Processor'),(3,2,'ICU','Processeur'),(4,1,'Size','Size'),(4,2,'Size','Size');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_attribute_impact`;
CREATE TABLE `ps_attribute_impact` (
`id_attribute_impact` int(10) unsigned NOT NULL auto_increment,
`id_product` int(11) NOT NULL,
`id_attribute` int(11) NOT NULL,
`weight` float NOT NULL,
`price` decimal(10,2) NOT NULL,
PRIMARY KEY (`id_attribute_impact`),
UNIQUE KEY `id_product` (`id_product`,`id_attribute`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_attribute_impact` WRITE;
INSERT INTO `ps_attribute_impact` VALUES (1,1,2,0,'60.00'),(2,1,5,0,'0.00'),(3,1,16,0,'50.00'),(4,1,15,0,'0.00'),(5,1,4,0,'0.00'),(6,1,19,0,'0.00'),(7,1,3,0,'0.00'),(8,1,14,0,'0.00'),(9,1,7,0,'0.00'),(10,1,20,0,'0.00'),(11,1,6,0,'0.00'),(12,1,18,0,'0.00');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_attribute_lang`;
CREATE TABLE `ps_attribute_lang` (
`id_attribute` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
PRIMARY KEY (`id_attribute`,`id_lang`),
KEY `id_lang` (`id_lang`,`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_attribute_lang` WRITE;
INSERT INTO `ps_attribute_lang` VALUES (1,1,'2GB'),(1,2,'2Go'),(2,1,'4GB'),(2,2,'4Go'),(3,1,'Metal'),(3,2,'Metal'),(4,1,'Blue'),(4,2,'Bleu'),(5,1,'Pink'),(5,2,'Rose'),(6,1,'Green'),(6,2,'Vert'),(7,1,'Orange'),(7,2,'Orange'),(8,1,'Optional 64GB solid-state drive'),(8,2,'Disque dur SSD (solid-state drive) de 64 Go '),(9,1,'80GB Parallel ATA Drive @ 4200 rpm'),(9,2,'Disque dur PATA de 80 Go a 4 200 tr/min'),(10,1,'1.60GHz Intel Core 2 Duo'),(10,2,'Intel Core 2 Duo a 1,6 GHz'),(11,1,'1.80GHz Intel Core 2 Duo'),(11,2,'Intel Core 2 Duo a 1,8 GHz'),(12,1,'80GB: 20,000 Songs'),(12,2,'80 Go : 20 000 chansons'),(13,1,'160GB: 40,000 Songs'),(13,2,'160 Go : 40 000 chansons'),(14,2,'Noir'),(14,1,'Black'),(15,1,'8Go'),(15,2,'8Go'),(16,1,'16Go'),(16,2,'16Go'),(17,1,'32Go'),(17,2,'32Go'),(18,1,'Purple'),(18,2,'Violet'),(19,1,'Yellow'),(19,2,'Jaune'),(20,1,'Red'),(20,2,'Rouge'),(21,1,'S'),(21,2,'S'),(22,1,'M'),(22,2,'M'),(23,1,'L'),(23,2,'L'),(24,1,'L'),(24,2,'XL'),(25,1,'XS'),(25,2,'XS');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_carrier`;
CREATE TABLE `ps_carrier` (
`id_carrier` int(10) unsigned NOT NULL auto_increment,
`id_tax` int(10) unsigned default '0',
`name` varchar(64) NOT NULL,
`url` varchar(255) default NULL,
`active` tinyint(1) unsigned NOT NULL default '0',
`deleted` tinyint(1) unsigned NOT NULL default '0',
`shipping_handling` tinyint(1) unsigned NOT NULL default '1',
`range_behavior` tinyint(1) unsigned NOT NULL default '0',
`is_module` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_carrier`),
KEY `deleted` (`deleted`,`active`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_carrier` WRITE;
INSERT INTO `ps_carrier` VALUES (1,0,'0',NULL,1,0,0,0,0),(2,1,'My carrier',NULL,1,0,1,0,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_carrier_lang`;
CREATE TABLE `ps_carrier_lang` (
`id_carrier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`delay` varchar(128) default NULL,
UNIQUE KEY `shipper_lang_index` (`id_lang`,`id_carrier`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_carrier_lang` WRITE;
INSERT INTO `ps_carrier_lang` VALUES (1,1,'Pick up in-store'),(1,2,'Retrait au magasin'),(2,1,'Delivery next day!'),(2,2,'Livraison le lendemain !');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_carrier_zone`;
CREATE TABLE `ps_carrier_zone` (
`id_carrier` int(10) unsigned NOT NULL,
`id_zone` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_carrier`,`id_zone`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_carrier_zone` WRITE;
INSERT INTO `ps_carrier_zone` VALUES (1,1),(2,1),(2,2);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_category`;
CREATE TABLE `ps_category` (
`id_category` int(10) unsigned NOT NULL auto_increment,
`id_parent` int(10) unsigned NOT NULL,
`level_depth` tinyint(3) unsigned NOT NULL default '0',
`active` tinyint(1) unsigned NOT NULL default '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_category`),
KEY `category_parent` (`id_parent`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_category` WRITE;
INSERT INTO `ps_category` VALUES (1,0,0,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(2,1,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(3,1,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(4,1,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_category_group`;
CREATE TABLE `ps_category_group` (
`id_category` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL,
KEY `category_group_index` (`id_category`,`id_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_category_group` WRITE;
INSERT INTO `ps_category_group` VALUES (1,1),(2,1),(3,1),(4,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_category_lang`;
CREATE TABLE `ps_category_lang` (
`id_category` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
`description` text,
`link_rewrite` varchar(128) NOT NULL,
`meta_title` varchar(128) default NULL,
`meta_keywords` varchar(128) default NULL,
`meta_description` varchar(128) default NULL,
UNIQUE KEY `category_lang_index` (`id_category`,`id_lang`),
KEY `category_name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_category_lang` WRITE;
INSERT INTO `ps_category_lang` VALUES (1,1,'Home','','home',NULL,NULL,NULL),(1,2,'Accueil','','home',NULL,NULL,NULL),(2,1,'iPods','Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater.','music-ipods','','',''),(2,2,'iPods','Il est temps, pour le meilleur lecteur de musique, de remonter sur scene pour un rappel. Avec le nouvel iPod, le monde est votre scene.','musique-ipods','','',''),(3,1,'Accessories','Wonderful accessories for your iPod','accessories-ipod','','',''),(3,2,'Accessoires','Tous les accessoires a la mode pour votre iPod','accessoires-ipod','','',''),(4,1,'Laptops','The latest Intel processor, a bigger hard drive, plenty of memory, and even more new features all fit inside just one liberating inch. The new Mac laptops have the performance, power, and connectivity of a desktop computer. Without the desk part.','laptops','Apple laptops','Apple laptops MacBook Air','Powerful and chic Apple laptops'),(4,2,'Portables','Le tout dernier processeur Intel, un disque dur plus spacieux, de la memoire a profusion et d\'autres nouveautes. Le tout, dans a peine 2,59 cm qui vous liberent de toute entrave. Les nouveaux portables Mac reunissent les performances, la puissance et la connectivite d\'un ordinateur de bureau. Sans la partie bureau.','portables-apple','Portables Apple','portables apple macbook air','portables apple puissants et design');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_category_product`;
CREATE TABLE `ps_category_product` (
`id_category` int(10) unsigned NOT NULL,
`id_product` int(10) unsigned NOT NULL,
`position` int(10) unsigned NOT NULL default '0',
KEY `category_product_index` (`id_category`,`id_product`),
KEY `id_product` (`id_product`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_category_product` WRITE;
INSERT INTO `ps_category_product` VALUES (1,1,0),(1,2,1),(1,6,2),(1,7,3),(2,1,0),(2,2,1),(2,7,2),(3,8,0),(3,9,1),(4,5,0),(4,6,1),(1,10,4),(1,11,5);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_country`;
CREATE TABLE `ps_country` (
`id_country` int(10) unsigned NOT NULL auto_increment,
`id_zone` int(10) unsigned NOT NULL,
`iso_code` varchar(3) NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '0',
`contains_states` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_country`),
KEY `country_iso_code` (`iso_code`),
KEY `country_` (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=245 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_country` WRITE;
INSERT INTO `ps_country` VALUES (1,1,'DE',1,0),(2,1,'AT',1,0),(3,1,'BE',1,0),(4,2,'CA',1,0),(5,3,'CN',1,0),(6,1,'ES',1,0),(7,1,'FI',1,0),(8,1,'FR',1,0),(9,1,'GR',1,0),(10,1,'IT',1,0),(11,3,'JP',1,0),(12,1,'LU',1,0),(13,1,'NL',1,0),(14,1,'PL',1,0),(15,1,'PT',1,0),(16,1,'CZ',1,0),(17,1,'GB',1,0),(18,1,'SE',1,0),(19,1,'CH',1,0),(20,1,'DK',1,0),(21,2,'US',1,1),(22,3,'HK',1,0),(23,1,'NO',1,0),(24,5,'AU',1,0),(25,3,'SG',1,0),(26,1,'IE',1,0),(27,5,'NZ',1,0),(28,3,'KR',1,0),(29,3,'IL',1,0),(30,4,'ZA',1,0),(31,4,'NG',1,0),(32,4,'CI',1,0),(33,4,'TG',1,0),(34,2,'BO',1,0),(35,4,'MU',1,0),(143,1,'HU',1,0),(36,1,'RO',1,0),(37,1,'SK',1,0),(38,4,'DZ',1,0),(39,2,'AS',1,0),(40,1,'AD',1,0),(41,4,'AO',1,0),(42,2,'AI',1,0),(43,2,'AG',1,0),(44,2,'AR',1,0),(45,3,'AM',1,0),(46,2,'AW',1,0),(47,3,'AZ',1,0),(48,2,'BS',1,0),(49,3,'BH',1,0),(50,3,'BD',1,0),(51,2,'BB',1,0),(52,1,'BY',1,0),(53,2,'BZ',1,0),(54,4,'BJ',1,0),(55,2,'BM',1,0),(56,3,'BT',1,0),(57,4,'BW',1,0),(58,2,'BR',1,0),(59,3,'BN',1,0),(60,4,'BF',1,0),(61,3,'MM',1,0),(62,4,'BI',1,0),(63,3,'KH',1,0),(64,4,'CM',1,0),(65,4,'CV',1,0),(66,4,'CF',1,0),(67,4,'TD',1,0),(68,2,'CL',1,0),(69,2,'CO',1,0),(70,4,'KM',1,0),(71,4,'CD',1,0),(72,4,'CG',1,0),(73,2,'CR',1,0),(74,1,'HR',1,0),(75,2,'CU',1,0),(76,1,'CY',1,0),(77,4,'DJ',1,0),(78,2,'DM',1,0),(79,2,'DO',1,0),(80,3,'TL',1,0),(81,2,'EC',1,0),(82,4,'EG',1,0),(83,2,'SV',1,0),(84,4,'GQ',1,0),(85,4,'ER',1,0),(86,1,'EE',1,0),(87,4,'ET',1,0),(88,2,'FK',1,0),(89,1,'FO',1,0),(90,5,'FJ',1,0),(91,4,'GA',1,0),(92,4,'GM',1,0),(93,3,'GE',1,0),(94,4,'GH',1,0),(95,2,'GD',1,0),(96,1,'GL',1,0),(97,1,'GI',1,0),(98,2,'GP',1,0),(99,2,'GU',1,0),(100,2,'GT',1,0),(101,1,'GG',1,0),(102,4,'GN',1,0),(103,4,'GW',1,0),(104,2,'GY',1,0),(105,2,'HT',1,0),(106,5,'HM',1,0),(107,1,'VA',1,0),(108,2,'HN',1,0),(109,1,'IS',1,0),(110,3,'IN',1,0),(111,3,'ID',1,0),(112,3,'IR',1,0),(113,3,'IQ',1,0),(114,1,'IM',1,0),(115,2,'JM',1,0),(116,1,'JE',1,0),(117,3,'JO',1,0),(118,3,'KZ',1,0),(119,4,'KE',1,0),(120,1,'KI',1,0),(121,3,'KP',1,0),(122,3,'KW',1,0),(123,3,'KG',1,0),(124,3,'LA',1,0),(125,1,'LV',1,0),(126,3,'LB',1,0),(127,4,'LS',1,0),(128,4,'LR',1,0),(129,4,'LY',1,0),(130,1,'LI',1,0),(131,1,'LT',1,0),(132,3,'MO',1,0),(133,1,'MK',1,0),(134,4,'MG',1,0),(135,4,'MW',1,0),(136,3,'MY',1,0),(137,3,'MV',1,0),(138,4,'ML',1,0),(139,1,'MT',1,0),(140,5,'MH',1,0),(141,2,'MQ',1,0),(142,4,'MR',1,0),(144,4,'YT',1,0),(145,2,'MX',1,0),(146,5,'FM',1,0),(147,1,'MD',1,0),(148,1,'MC',1,0),(149,3,'MN',1,0),(150,1,'ME',1,0),(151,2,'MS',1,0),(152,4,'MA',1,0),(153,4,'MZ',1,0),(154,4,'NA',1,0),(155,5,'NR',1,0),(156,3,'NP',1,0),(157,2,'AN',1,0),(158,5,'NC',1,0),(159,2,'NI',1,0),(160,4,'NE',1,0),(161,5,'NU',1,0),(162,5,'NF',1,0),(163,5,'MP',1,0),(164,3,'OM',1,0),(165,3,'PK',1,0),(166,5,'PW',1,0),(167,3,'PS',1,0),(168,2,'PA',1,0),(169,5,'PG',1,0),(170,2,'PY',1,0),(171,2,'PE',1,0),(172,3,'PH',1,0),(173,5,'PN',1,0),(174,2,'PR',1,0),(175,3,'QA',1,0),(176,4,'RE',1,0),(177,1,'RU',1,0),(178,4,'RW',1,0),(179,2,'BL',1,0),(180,2,'KN',1,0),(181,2,'LC',1,0),(182,2,'MF',1,0),(183,2,'PM',1,0),(184,2,'VC',1,0),(185,5,'WS',1,0),(186,1,'SM',1,0),(187,4,'ST',1,0),(188,3,'SA',1,0),(189,4,'SN',1,0),(190,1,'RS',1,0),(191,4,'SC',1,0),(192,4,'SL',1,0),(193,1,'SI',1,0),(194,5,'SB',1,0),(195,4,'SO',1,0),(196,2,'GS',1,0),(197,3,'LK',1,0),(198,4,'SD',1,0),(199,2,'SR',1,0),(200,1,'SJ',1,0),(201,4,'SZ',1,0),(202,3,'SY',1,0),(203,3,'TW',1,0),(204,3,'TJ',1,0),(205,4,'TZ',1,0),(206,3,'TH',1,0),(207,5,'TK',1,0),(208,5,'TO',1,0),(209,2,'TT',1,0),(210,4,'TN',1,0),(211,1,'TR',1,0),(212,3,'TM',1,0),(213,2,'TC',1,0),(214,5,'TV',1,0),(215,4,'UG',1,0),(216,1,'UA',1,0),(217,3,'AE',1,0),(218,2,'UY',1,0),(219,3,'UZ',1,0),(220,5,'VU',1,0),(221,2,'VE',1,0),(222,3,'VN',1,0),(223,2,'VG',1,0),(224,2,'VI',1,0),(225,5,'WF',1,0),(226,4,'EH',1,0),(227,3,'YE',1,0),(228,4,'ZM',1,0),(229,4,'ZW',1,0),(230,1,'AL',1,0),(231,3,'AF',1,0),(232,5,'AQ',1,0),(233,1,'BA',1,0),(234,5,'BV',1,0),(235,5,'IO',1,0),(236,1,'BG',1,0),(237,2,'KY',1,0),(238,3,'CX',1,0),(239,3,'CC',1,0),(240,5,'CK',1,0),(241,2,'GF',1,0),(242,5,'PF',1,0),(243,5,'TF',1,0),(244,1,'AX',1,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_country_lang`;
CREATE TABLE `ps_country_lang` (
`id_country` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL,
UNIQUE KEY `country_lang_index` (`id_country`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_country_lang` WRITE;
INSERT INTO `ps_country_lang` VALUES (1,1,'Germany'),(1,2,'Allemagne'),(2,1,'Austria'),(2,2,'Autriche'),(3,1,'Belgium'),(3,2,'Belgique'),(4,1,'Canada'),(4,2,'Canada'),(5,1,'China'),(5,2,'Chine'),(6,1,'Spain'),(6,2,'Espagne'),(7,1,'Finland'),(7,2,'Finlande'),(8,1,'France'),(8,2,'France'),(9,1,'Greece'),(9,2,'Grece'),(10,1,'Italy'),(10,2,'Italie'),(11,1,'Japan'),(11,2,'Japon'),(12,1,'Luxemburg'),(12,2,'Luxembourg'),(13,1,'Netherlands'),(13,2,'Pays-bas'),(14,1,'Poland'),(14,2,'Pologne'),(15,1,'Portugal'),(15,2,'Portugal'),(16,1,'Czech Republic'),(16,2,'Republique Tcheque'),(17,1,'United Kingdom'),(17,2,'Royaume-Uni'),(18,1,'Sweden'),(18,2,'Suede'),(19,1,'Switzerland'),(19,2,'Suisse'),(20,1,'Denmark'),(20,2,'Danemark'),(21,1,'USA'),(21,2,'USA'),(22,1,'HongKong'),(22,2,'Hong-Kong'),(23,1,'Norway'),(23,2,'Norvege'),(24,1,'Australia'),(24,2,'Australie'),(25,1,'Singapore'),(25,2,'Singapour'),(26,1,'Ireland'),(26,2,'Eire'),(27,1,'New Zealand'),(27,2,'Nouvelle-Zelande'),(28,1,'South Korea'),(28,2,'Coree du Sud'),(29,1,'Israel'),(29,2,'Israel'),(30,1,'South Africa'),(30,2,'Afrique du Sud'),(31,1,'Nigeria'),(31,2,'Nigeria'),(32,1,'Ivory Coast'),(32,2,'Cote d\'Ivoire'),(33,1,'Togo'),(33,2,'Togo'),(34,1,'Bolivia'),(34,2,'Bolivie'),(35,1,'Mauritius'),(35,2,'Ile Maurice'),(143,1,'Hungary'),(143,2,'Hongrie'),(36,1,'Romania'),(36,2,'Roumanie'),(37,1,'Slovakia'),(37,2,'Slovaquie'),(38,1,'Algeria'),(38,2,'Algerie'),(39,1,'American Samoa'),(39,2,'Samoa Americaines'),(40,1,'Andorra'),(40,2,'Andorre'),(41,1,'Angola'),(41,2,'Angola'),(42,1,'Anguilla'),(42,2,'Anguilla'),(43,1,'Antigua and Barbuda'),(43,2,'Antigua et Barbuda'),(44,1,'Argentina'),(44,2,'Argentine'),(45,1,'Armenia'),(45,2,'Armenie'),(46,1,'Aruba'),(46,2,'Aruba'),(47,1,'Azerbaijan'),(47,2,'Azerbaidjan'),(48,1,'Bahamas'),(48,2,'Bahamas'),(49,1,'Bahrain'),(49,2,'Bahrein'),(50,1,'Bangladesh'),(50,2,'Bangladesh'),(51,1,'Barbados'),(51,2,'Barbade'),(52,1,'Belarus'),(52,2,'Belarus'),(53,1,'Belize'),(53,2,'Belize'),(54,1,'Benin'),(54,2,'Benin'),(55,1,'Bermuda'),(55,2,'Bermudes'),(56,1,'Bhutan'),(56,2,'Bhoutan'),(57,1,'Botswana'),(57,2,'Botswana'),(58,1,'Brazil'),(58,2,'Bresil'),(59,1,'Brunei'),(59,2,'Brunei Darussalam'),(60,1,'Burkina Faso'),(60,2,'Burkina Faso'),(61,1,'Burma (Myanmar)'),(61,2,'Burma (Myanmar)'),(62,1,'Burundi'),(62,2,'Burundi'),(63,1,'Cambodia'),(63,2,'Cambodge'),(64,1,'Cameroon'),(64,2,'Cameroun'),(65,1,'Cape Verde'),(65,2,'Cap-Vert'),(66,1,'Central African Republic'),(66,2,'Centrafricaine, Republique'),(67,1,'Chad'),(67,2,'Tchad'),(68,1,'Chile'),(68,2,'Chili'),(69,1,'Colombia'),(69,2,'Colombie'),(70,1,'Comoros'),(70,2,'Comores'),(71,1,'Congo, Dem. Republic'),(71,2,'Congo, Rep. Dem.'),(72,1,'Congo, Republic'),(72,2,'Congo, Rep.'),(73,1,'Costa Rica'),(73,2,'Costa Rica'),(74,1,'Croatia'),(74,2,'Croatie'),(75,1,'Cuba'),(75,2,'Cuba'),(76,1,'Cyprus'),(76,2,'Chypre'),(77,1,'Djibouti'),(77,2,'Djibouti'),(78,1,'Dominica'),(78,2,'Dominica'),(79,1,'Dominican Republic'),(79,2,'Republique Dominicaine'),(80,1,'East Timor'),(80,2,'Timor oriental'),(81,1,'Ecuador'),(81,2,'Equateur'),(82,1,'Egypt'),(82,2,'Egypte'),(83,1,'El Salvador'),(83,2,'El Salvador'),(84,1,'Equatorial Guinea'),(84,2,'Guinee Equatoriale'),(85,1,'Eritrea'),(85,2,'Erythree'),(86,1,'Estonia'),(86,2,'Estonie'),(87,1,'Ethiopia'),(87,2,'Ethiopie'),(88,1,'Falkland Islands'),(88,2,'Falkland, Iles'),(89,1,'Faroe Islands'),(89,2,'Feroe, Iles'),(90,1,'Fiji'),(90,2,'Fidji'),(91,1,'Gabon'),(91,2,'Gabon'),(92,1,'Gambia'),(92,2,'Gambie'),(93,1,'Georgia'),(93,2,'Georgie'),(94,1,'Ghana'),(94,2,'Ghana'),(95,1,'Grenada'),(95,2,'Grenade'),(96,1,'Greenland'),(96,2,'Groenland'),(97,1,'Gibraltar'),(97,2,'Gibraltar'),(98,1,'Guadeloupe'),(98,2,'Guadeloupe'),(99,1,'Guam'),(99,2,'Guam'),(100,1,'Guatemala'),(100,2,'Guatemala'),(101,1,'Guernsey'),(101,2,'Guernesey'),(102,1,'Guinea'),(102,2,'Guinee'),(103,1,'Guinea-Bissau'),(103,2,'Guinee-Bissau'),(104,1,'Guyana'),(104,2,'Guyana'),(105,1,'Haiti'),(105,2,'Haiti'),(106,1,'Heard Island and McDonald Islands'),(106,2,'Heard, Ile et Mcdonald, Iles'),(107,1,'Vatican City State'),(107,2,'Saint-Siege (Etat de la Cite du Vatican)'),(108,1,'Honduras'),(108,2,'Honduras'),(109,1,'Iceland'),(109,2,'Islande'),(110,1,'India'),(110,2,'Indie'),(111,1,'Indonesia'),(111,2,'Indonesie'),(112,1,'Iran'),(112,2,'Iran'),(113,1,'Iraq'),(113,2,'Iraq'),(114,1,'Isle of Man'),(114,2,'Ile de Man'),(115,1,'Jamaica'),(115,2,'Jamaique'),(116,1,'Jersey'),(116,2,'Jersey'),(117,1,'Jordan'),(117,2,'Jordanie'),(118,1,'Kazakhstan'),(118,2,'Kazakhstan'),(119,1,'Kenya'),(119,2,'Kenya'),(120,1,'Kiribati'),(120,2,'Kiribati'),(121,1,'Korea, Dem. Republic of'),(121,2,'Coree, Rep. Populaire Dem. de'),(122,1,'Kuwait'),(122,2,'Koweit'),(123,1,'Kyrgyzstan'),(123,2,'Kirghizistan'),(124,1,'Laos'),(124,2,'Laos'),(125,1,'Latvia'),(125,2,'Lettonie'),(126,1,'Lebanon'),(126,2,'Liban'),(127,1,'Lesotho'),(127,2,'Lesotho'),(128,1,'Liberia'),(128,2,'Liberia'),(129,1,'Libya'),(129,2,'Libyenne, Jamahiriya Arabe'),(130,1,'Liechtenstein'),(130,2,'Liechtenstein'),(131,1,'Lithuania'),(131,2,'Lituanie'),(132,1,'Macau'),(132,2,'Macao'),(133,1,'Macedonia'),(133,2,'Macedoine'),(134,1,'Madagascar'),(134,2,'Madagascar'),(135,1,'Malawi'),(135,2,'Malawi'),(136,1,'Malaysia'),(136,2,'Malaisie'),(137,1,'Maldives'),(137,2,'Maldives'),(138,1,'Mali'),(138,2,'Mali'),(139,1,'Malta'),(139,2,'Malte'),(140,1,'Marshall Islands'),(140,2,'Marshall, Iles'),(141,1,'Martinique'),(141,2,'Martinique'),(142,1,'Mauritania'),(142,2,'Mauritanie'),(144,1,'Mayotte'),(144,2,'Mayotte'),(145,1,'Mexico'),(145,2,'Mexique'),(146,1,'Micronesia'),(146,2,'Micronesie'),(147,1,'Moldova'),(147,2,'Moldova'),(148,1,'Monaco'),(148,2,'Monaco'),(149,1,'Mongolia'),(149,2,'Mongolie'),(150,1,'Montenegro'),(150,2,'Montenegro'),(151,1,'Montserrat'),(151,2,'Montserrat'),(152,1,'Morocco'),(152,2,'Maroc'),(153,1,'Mozambique'),(153,2,'Mozambique'),(154,1,'Namibia'),(154,2,'Namibie'),(155,1,'Nauru'),(155,2,'Nauru'),(156,1,'Nepal'),(156,2,'Nepal'),(157,1,'Netherlands Antilles'),(157,2,'Antilles Neerlandaises'),(158,1,'New Caledonia'),(158,2,'Nouvelle-Caledonie'),(159,1,'Nicaragua'),(159,2,'Nicaragua'),(160,1,'Niger'),(160,2,'Niger'),(161,1,'Niue'),(161,2,'Niue'),(162,1,'Norfolk Island'),(162,2,'Norfolk, Ile'),(163,1,'Northern Mariana Islands'),(163,2,'Mariannes du Nord, Iles'),(164,1,'Oman'),(164,2,'Oman'),(165,1,'Pakistan'),(165,2,'Pakistan'),(166,1,'Palau'),(166,2,'Palaos'),(167,1,'Palestinian Territories'),(167,2,'Palestinien Occupe, Territoire'),(168,1,'Panama'),(168,2,'Panama'),(169,1,'Papua New Guinea'),(169,2,'Papouasie-Nouvelle-Guinee'),(170,1,'Paraguay'),(170,2,'Paraguay'),(171,1,'Peru'),(171,2,'Perou'),(172,1,'Philippines'),(172,2,'Philippines'),(173,1,'Pitcairn'),(173,2,'Pitcairn'),(174,1,'Puerto Rico'),(174,2,'Porto Rico'),(175,1,'Qatar'),(175,2,'Qatar'),(176,1,'Reunion'),(176,2,'Reunion'),(177,1,'Russian Federation'),(177,2,'Russie, Federation de'),(178,1,'Rwanda'),(178,2,'Rwanda'),(179,1,'Saint Barthelemy'),(179,2,'Saint-Barthelemy'),(180,1,'Saint Kitts and Nevis'),(180,2,'Saint-Kitts-et-Nevis'),(181,1,'Saint Lucia'),(181,2,'Sainte-Lucie'),(182,1,'Saint Martin'),(182,2,'Saint-Martin'),(183,1,'Saint Pierre and Miquelon'),(183,2,'Saint-Pierre-et-Miquelon'),(184,1,'Saint Vincent and the Grenadines'),(184,2,'Saint-Vincent-et-Les Grenadines'),(185,1,'Samoa'),(185,2,'Samoa'),(186,1,'San Marino'),(186,2,'Saint-Marin'),(187,1,'São Tome and Príncipe'),(187,2,'Sao Tome-et-Principe'),(188,1,'Saudi Arabia'),(188,2,'Arabie Saoudite'),(189,1,'Senegal'),(189,2,'Senegal'),(190,1,'Serbia'),(190,2,'Serbie'),(191,1,'Seychelles'),(191,2,'Seychelles'),(192,1,'Sierra Leone'),(192,2,'Sierra Leone'),(193,1,'Slovenia'),(193,2,'Slovenie'),(194,1,'Solomon Islands'),(194,2,'Salomon, Iles'),(195,1,'Somalia'),(195,2,'Somalie'),(196,1,'South Georgia and the South Sandwich Islands'),(196,2,'Georgie du Sud et les Iles Sandwich du Sud'),(197,1,'Sri Lanka'),(197,2,'Sri Lanka'),(198,1,'Sudan'),(198,2,'Soudan'),(199,1,'Suriname'),(199,2,'Suriname'),(200,1,'Svalbard and Jan Mayen'),(200,2,'Svalbard et Ile Jan Mayen'),(201,1,'Swaziland'),(201,2,'Swaziland'),(202,1,'Syria'),(202,2,'Syrienne'),(203,1,'Taiwan'),(203,2,'Taiwan'),(204,1,'Tajikistan'),(204,2,'Tadjikistan'),(205,1,'Tanzania'),(205,2,'Tanzanie'),(206,1,'Thailand'),(206,2,'Thailande'),(207,1,'Tokelau'),(207,2,'Tokelau'),(208,1,'Tonga'),(208,2,'Tonga'),(209,1,'Trinidad and Tobago'),(209,2,'Trinite-et-Tobago'),(210,1,'Tunisia'),(210,2,'Tunisie'),(211,1,'Turkey'),(211,2,'Turquie'),(212,1,'Turkmenistan'),(212,2,'Turkmenistan'),(213,1,'Turks and Caicos Islands'),(213,2,'Turks et Caiques, Iles'),(214,1,'Tuvalu'),(214,2,'Tuvalu'),(215,1,'Uganda'),(215,2,'Ouganda'),(216,1,'Ukraine'),(216,2,'Ukraine'),(217,1,'United Arab Emirates'),(217,2,'Emirats Arabes Unis'),(218,1,'Uruguay'),(218,2,'Uruguay'),(219,1,'Uzbekistan'),(219,2,'Ouzbekistan'),(220,1,'Vanuatu'),(220,2,'Vanuatu'),(221,1,'Venezuela'),(221,2,'Venezuela'),(222,1,'Vietnam'),(222,2,'Vietnam'),(223,1,'Virgin Islands (British)'),(223,2,'Iles Vierges Britanniques'),(224,1,'Virgin Islands (U.S.)'),(224,2,'Iles Vierges des Etats-Unis'),(225,1,'Wallis and Futuna'),(225,2,'Wallis et Futuna'),(226,1,'Western Sahara'),(226,2,'Sahara Occidental'),(227,1,'Yemen'),(227,2,'Yemen'),(228,1,'Zambia'),(228,2,'Zambie'),(229,1,'Zimbabwe'),(229,2,'Zimbabwe'),(230,1,'Albania'),(230,2,'Albanie'),(231,1,'Afghanistan'),(231,2,'Afghanistan'),(232,1,'Antarctica'),(232,2,'Antarctique'),(233,1,'Bosnia and Herzegovina'),(233,2,'Bosnie-Herzegovine'),(234,1,'Bouvet Island'),(234,2,'Bouvet, Ile'),(235,1,'British Indian Ocean Territory'),(235,2,'Ocean Indien, Territoire Britannique de L\''),(236,1,'Bulgaria'),(236,2,'Bulgarie'),(237,1,'Cayman Islands'),(237,2,'Caimans, Iles'),(238,1,'Christmas Island'),(238,2,'Christmas, Ile'),(239,1,'Cocos (Keeling) Islands'),(239,2,'Cocos (Keeling), Iles'),(240,1,'Cook Islands'),(240,2,'Cook, Iles'),(241,1,'French Guiana'),(241,2,'Guyane Francaise'),(242,1,'French Polynesia'),(242,2,'Polynesie Francaise'),(243,1,'French Southern Territories'),(243,2,'Terres Australes Francaises'),(244,1,'Åland Islands'),(244,2,'Åland, Iles');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_currency`;
CREATE TABLE `ps_currency` (
`id_currency` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`iso_code` varchar(3) NOT NULL default '0',
`sign` varchar(8) NOT NULL,
`blank` tinyint(1) unsigned NOT NULL default '0',
`format` tinyint(1) unsigned NOT NULL default '0',
`decimals` tinyint(1) unsigned NOT NULL default '1',
`conversion_rate` decimal(13,6) NOT NULL,
`deleted` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_currency`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_currency` WRITE;
INSERT INTO `ps_currency` VALUES (1,'Euro','EUR','€',1,2,1,'1.000000',0),(2,'Dollar','USD','$',0,1,1,'1.470000',0),(3,'Pound','GBP','£',0,1,1,'0.800000',0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_customer`;
CREATE TABLE `ps_customer` (
`id_customer` int(10) unsigned NOT NULL auto_increment,
`id_gender` int(10) unsigned NOT NULL,
`secure_key` varchar(32) NOT NULL default '-1',
`email` varchar(128) NOT NULL,
`passwd` varchar(32) NOT NULL,
`last_passwd_gen` timestamp NOT NULL default CURRENT_TIMESTAMP,
`birthday` date default NULL,
`lastname` varchar(32) NOT NULL,
`newsletter` tinyint(1) unsigned NOT NULL default '0',
`ip_registration_newsletter` varchar(15) default NULL,
`newsletter_date_add` datetime default NULL,
`optin` tinyint(1) unsigned NOT NULL default '0',
`firstname` varchar(32) NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '0',
`deleted` tinyint(1) NOT NULL default '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_customer`),
UNIQUE KEY `customer_email` (`email`),
KEY `customer_login` (`email`,`passwd`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_customer` WRITE;
INSERT INTO `ps_customer` VALUES (1,1,'47ce86627c1f3c792a80773c5d2deaf8','john@doe.com','4717e0bdb6970abede946f45ae0c1c6d','2009-09-17 07:48:51','1970-01-15','DOE',1,NULL,'2009-09-17 09:54:53',1,'John',1,0,'2009-09-17 09:48:51','2009-09-17 09:54:53'),(2,9,'02d849254b0dd5a0ed20082ec54d9c4a','prestashop@prestashop.com','154c31ed01c2317e6fee607bb99b68a7','2009-09-17 01:55:26',NULL,'SITE',0,NULL,NULL,0,'Prestashop',1,0,'2009-09-17 09:55:26','2009-09-17 09:55:26'),(3,2,'898d9b1eca5f2115b4f256fd5a5bf272','jane@doe.com','9c29952d9a02ece31771cad1c97b3b2a','2009-09-17 01:56:30','1975-01-01','DOE',0,NULL,NULL,0,'Jane',1,0,'2009-09-17 09:56:30','2009-09-17 09:56:42');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_customer_group`;
CREATE TABLE `ps_customer_group` (
`id_customer` int(10) unsigned NOT NULL,
`id_group` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_customer`,`id_group`),
KEY `customer_login` (`id_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_customer_group` WRITE;
INSERT INTO `ps_customer_group` VALUES (1,1),(2,1),(3,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_group`;
CREATE TABLE `ps_group` (
`id_group` int(10) unsigned NOT NULL auto_increment,
`reduction` decimal(10,2) NOT NULL default '0.00',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_group`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_group` WRITE;
INSERT INTO `ps_group` VALUES (1,'0.00','2009-09-17 09:48:51','2009-09-17 09:48:51');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_group_lang`;
CREATE TABLE `ps_group_lang` (
`id_group` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL,
UNIQUE KEY `attribute_lang_index` (`id_group`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_group_lang` WRITE;
INSERT INTO `ps_group_lang` VALUES (1,1,'Default'),(1,2,'Defaut');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_image`;
CREATE TABLE `ps_image` (
`id_image` int(10) unsigned NOT NULL auto_increment,
`id_product` int(10) unsigned NOT NULL,
`position` tinyint(2) unsigned NOT NULL default '0',
`cover` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_image`),
KEY `image_product` (`id_product`)
) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_image` WRITE;
INSERT INTO `ps_image` VALUES (40,1,4,0),(39,1,3,0),(38,1,2,0),(37,1,1,1),(48,2,3,0),(47,2,2,0),(49,2,4,0),(46,2,1,1),(15,5,1,1),(16,5,2,0),(17,5,3,0),(18,6,4,0),(19,6,5,0),(20,6,1,1),(24,7,1,1),(33,8,1,1),(27,7,3,0),(26,7,2,0),(29,7,4,0),(30,7,5,0),(32,7,6,0),(36,9,1,1),(41,1,5,0),(42,1,6,0),(44,1,7,0),(45,1,8,0),(50,10,1,1),(51,11,1,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_image_lang`;
CREATE TABLE `ps_image_lang` (
`id_image` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`legend` varchar(128) default NULL,
UNIQUE KEY `image_lang_index` (`id_image`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_image_lang` WRITE;
INSERT INTO `ps_image_lang` VALUES (40,2,'iPod Nano'),(40,1,'iPod Nano'),(39,2,'iPod Nano'),(39,1,'iPod Nano'),(38,2,'iPod Nano'),(38,1,'iPod Nano'),(37,2,'iPod Nano'),(37,1,'iPod Nano'),(48,2,'iPod shuffle'),(48,1,'iPod shuffle'),(47,2,'iPod shuffle'),(47,1,'iPod shuffle'),(49,2,'iPod shuffle'),(49,1,'iPod shuffle'),(46,2,'iPod shuffle'),(46,1,'iPod shuffle'),(10,1,'luxury-cover-for-ipod-video'),(10,2,'housse-luxe-pour-ipod-video'),(11,1,'cover'),(11,2,'housse'),(12,1,'myglove-ipod-nano'),(12,2,'myglove-ipod-nano'),(13,1,'myglove-ipod-nano'),(13,2,'myglove-ipod-nano'),(14,1,'myglove-ipod-nano'),(14,2,'myglove-ipod-nano'),(15,1,'MacBook Air'),(15,2,'macbook-air-1'),(16,1,'MacBook Air'),(16,2,'macbook-air-2'),(17,1,'MacBook Air'),(17,2,'macbook-air-3'),(18,1,'MacBook Air'),(18,2,'macbook-air-4'),(19,1,'MacBook Air'),(19,2,'macbook-air-5'),(20,1,' MacBook Air SuperDrive'),(20,2,'superdrive-pour-macbook-air-1'),(24,2,'iPod touch'),(24,1,'iPod touch'),(33,1,'housse-portefeuille-en-cuir'),(26,1,'iPod touch'),(26,2,'iPod touch'),(27,1,'iPod touch'),(27,2,'iPod touch'),(29,1,'iPod touch'),(29,2,'iPod touch'),(30,1,'iPod touch'),(30,2,'iPod touch'),(32,1,'iPod touch'),(32,2,'iPod touch'),(33,2,'housse-portefeuille-en-cuir-ipod-nano'),(36,2,'Ecouteurs a isolation sonore Shure SE210'),(36,1,'Shure SE210 Sound-Isolating Earphones for iPod and iPhone'),(41,1,'iPod Nano'),(41,2,'iPod Nano'),(42,1,'iPod Nano'),(42,2,'iPod Nano'),(44,1,'iPod Nano'),(44,2,'iPod Nano'),(45,1,'iPod Nano'),(45,2,'iPod Nano'),(50,1,'Maillot de Bain'),(50,2,'Maillot de Bain'),(51,1,'Short'),(51,2,'Short');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_image_type`;
CREATE TABLE `ps_image_type` (
`id_image_type` int(10) unsigned NOT NULL auto_increment,
`name` varchar(16) NOT NULL,
`width` int(10) unsigned NOT NULL,
`height` int(10) unsigned NOT NULL,
`products` tinyint(1) NOT NULL default '1',
`categories` tinyint(1) NOT NULL default '1',
`manufacturers` tinyint(1) NOT NULL default '1',
`suppliers` tinyint(1) NOT NULL default '1',
`scenes` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id_image_type`),
KEY `image_type_name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_image_type` WRITE;
INSERT INTO `ps_image_type` VALUES (1,'small',45,45,1,1,1,1,0),(2,'medium',80,80,1,1,1,1,0),(3,'large',300,300,1,1,1,1,0),(4,'thickbox',600,600,1,0,0,0,0),(5,'category',500,150,0,1,0,0,0),(6,'home',129,129,1,0,0,0,0),(7,'large_scene',556,200,0,0,0,0,1),(8,'thumb_scene',161,58,0,0,0,0,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_lang`;
CREATE TABLE `ps_lang` (
`id_lang` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`active` tinyint(3) unsigned NOT NULL default '0',
`iso_code` char(2) NOT NULL,
PRIMARY KEY (`id_lang`),
KEY `lang_iso_code` (`iso_code`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_lang` WRITE;
INSERT INTO `ps_lang` VALUES (1,'English (English)',1,'en'),(2,'Francais (French)',1,'fr');
DROP TABLE IF EXISTS `ps_manufacturer`;
CREATE TABLE `ps_manufacturer` (
`id_manufacturer` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_manufacturer`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_manufacturer` WRITE;
INSERT INTO `ps_manufacturer` VALUES (1,'Apple Computer, Inc','2009-09-17 09:48:51','2009-09-17 09:48:51'),(2,'Shure Incorporated','2009-09-17 09:48:51','2009-09-17 09:48:51');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_manufacturer_lang`;
CREATE TABLE `ps_manufacturer_lang` (
`id_manufacturer` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
`short_description` varchar(254) default NULL,
`meta_title` varchar(254) default NULL,
`meta_keywords` varchar(254) default NULL,
`meta_description` varchar(254) default NULL,
PRIMARY KEY (`id_manufacturer`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_module`;
CREATE TABLE `ps_module` (
`id_module` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_module`),
KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_module` WRITE;
INSERT INTO `ps_module` VALUES (1,'homefeatured',1),(2,'gsitemap',1),(3,'cheque',1),(4,'paypal',1),(5,'editorial',1),(6,'bankwire',1),(7,'blockadvertising',1),(8,'blockbestsellers',1),(9,'blockcart',1),(10,'blockcategories',1),(11,'blockcurrencies',1),(12,'blockinfos',1),(13,'blocklanguages',1),(14,'blockmanufacturer',1),(15,'blockmyaccount',1),(16,'blocknewproducts',1),(17,'blockpaymentlogo',1),(18,'blockpermanentlinks',1),(19,'blocksearch',1),(20,'blockspecials',1),(21,'blocktags',1),(22,'blockuserinfo',1),(23,'blockvariouslinks',1),(24,'blockviewed',1),(25,'statsdata',1),(26,'statsvisits',1),(27,'statssales',1),(28,'statsregistrations',1),(30,'statspersonalinfos',1),(31,'statslive',1),(32,'statsequipment',1),(33,'statscatalog',1),(34,'graphvisifire',1),(35,'graphxmlswfcharts',1),(36,'graphgooglechart',1),(37,'graphartichow',1),(38,'statshome',1),(39,'gridextjs',1),(40,'statsbestcustomers',1),(41,'statsorigin',1),(42,'pagesnotfound',1),(43,'sekeywords',1),(44,'statsproduct',1),(45,'statsbestproducts',1),(46,'statsbestcategories',1),(47,'statsbestvouchers',1),(48,'statsbestsuppliers',1),(49,'statscarrier',1),(50,'statsnewsletter',1),(51,'statssearch',1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_module_country`;
CREATE TABLE `ps_module_country` (
`id_module` int(10) unsigned NOT NULL,
`id_country` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_module`,`id_country`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_module_country` WRITE;
INSERT INTO `ps_module_country` VALUES (3,1),(3,2),(3,3),(3,4),(3,5),(3,6),(3,7),(3,8),(3,9),(3,10),(3,11),(3,12),(3,13),(3,14),(3,15),(3,16),(3,17),(3,18),(3,19),(3,20),(3,21),(3,22),(3,23),(3,24),(3,25),(3,26),(3,27),(3,28),(3,29),(3,30),(3,31),(3,32),(3,33),(3,34),(4,1),(4,2),(4,3),(4,4),(4,5),(4,6),(4,7),(4,8),(4,9),(4,10),(4,11),(4,12),(4,13),(4,14),(4,15),(4,16),(4,17),(4,18),(4,19),(4,20),(4,21),(4,22),(4,23),(4,24),(4,25),(4,26),(4,27),(4,28),(4,29),(4,30),(4,31),(4,32),(4,33),(4,34),(6,1),(6,2),(6,3),(6,4),(6,5),(6,6),(6,7),(6,8),(6,9),(6,10),(6,11),(6,12),(6,13),(6,14),(6,15),(6,16),(6,17),(6,18),(6,19),(6,20),(6,21),(6,22),(6,23),(6,24),(6,25),(6,26),(6,27),(6,28),(6,29),(6,30),(6,31),(6,32),(6,33),(6,34);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_module_currency`;
CREATE TABLE `ps_module_currency` (
`id_module` int(10) unsigned NOT NULL,
`id_currency` int(11) NOT NULL,
PRIMARY KEY (`id_module`,`id_currency`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_module_currency` WRITE;
INSERT INTO `ps_module_currency` VALUES (3,1),(3,2),(3,3),(4,-2),(6,1),(6,2),(6,3);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_module_group`;
CREATE TABLE `ps_module_group` (
`id_module` int(10) unsigned NOT NULL,
`id_group` int(11) NOT NULL,
PRIMARY KEY (`id_module`,`id_group`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_module_group` WRITE;
INSERT INTO `ps_module_group` VALUES (3,1),(4,1),(6,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_detail`;
CREATE TABLE `ps_order_detail` (
`id_order_detail` int(10) unsigned NOT NULL auto_increment,
`id_order` int(10) unsigned NOT NULL,
`product_id` int(10) unsigned NOT NULL,
`product_attribute_id` int(10) unsigned default NULL,
`product_name` varchar(255) NOT NULL,
`product_quantity` int(10) unsigned NOT NULL default '0',
`product_quantity_in_stock` int(10) unsigned NOT NULL default '0',
`product_quantity_refunded` int(10) unsigned NOT NULL default '0',
`product_quantity_return` int(10) unsigned NOT NULL default '0',
`product_quantity_reinjected` int(10) unsigned NOT NULL default '0',
`product_price` decimal(13,6) NOT NULL default '0.000000',
`product_quantity_discount` decimal(13,6) NOT NULL default '0.000000',
`product_ean13` varchar(13) default NULL,
`product_reference` varchar(32) default NULL,
`product_supplier_reference` varchar(32) default NULL,
`product_weight` float NOT NULL,
`tax_name` varchar(16) NOT NULL,
`tax_rate` decimal(10,2) NOT NULL default '0.00',
`ecotax` decimal(10,2) NOT NULL default '0.00',
`download_hash` varchar(255) default NULL,
`download_nb` int(10) unsigned default '0',
`download_deadline` datetime default '0000-00-00 00:00:00',
PRIMARY KEY (`id_order_detail`),
KEY `order_detail_order` (`id_order`),
KEY `product_id` (`product_id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_detail` WRITE;
INSERT INTO `ps_order_detail` VALUES (1,1,7,23,'iPod touch - Capacite: 32Go',1,0,0,0,0,'392.140500','0.000000',NULL,NULL,NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(2,1,9,0,'Ecouteurs a isolation sonore Shure SE210',1,0,0,0,0,'124.581900','0.000000',NULL,NULL,NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(3,2,11,0,'Short',5,5,0,0,0,'12.123746','0.000000','9876543210982','9876short5432',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(4,3,10,49,'Maillot de Bain - Couleur : Rouge, Size : L',1,1,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(5,4,10,43,'Maillot de Bain - Couleur : Bleu, Size : L',1,1,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(6,4,10,44,'Maillot de Bain - Couleur : Bleu, Size : M',2,2,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(7,4,10,47,'Maillot de Bain - Couleur : Noir, Size : M',3,3,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(8,4,10,48,'Maillot de Bain - Couleur : Noir, Size : S',4,4,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(9,4,10,49,'Maillot de Bain - Couleur : Rouge, Size : L',5,5,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(10,4,10,50,'Maillot de Bain - Couleur : Rouge, Size : M',6,6,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(11,4,10,51,'Maillot de Bain - Couleur : Rouge, Size : S',7,7,0,0,0,'16.722408','0.000000','1234567890128','123mdb321',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00'),(12,4,11,0,'Short',8,8,0,0,0,'12.123746','0.000000','9876543210982','9876short5432',NULL,0,'TVA 19.6%','19.60','0.00','',0,'0000-00-00 00:00:00');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_discount`;
CREATE TABLE `ps_order_discount` (
`id_order_discount` int(10) unsigned NOT NULL auto_increment,
`id_order` int(10) unsigned NOT NULL,
`id_discount` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL,
`value` decimal(10,2) NOT NULL default '0.00',
PRIMARY KEY (`id_order_discount`),
KEY `order_discount_order` (`id_order`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_order_history`;
CREATE TABLE `ps_order_history` (
`id_order_history` int(10) unsigned NOT NULL auto_increment,
`id_employee` int(10) unsigned NOT NULL,
`id_order` int(10) unsigned NOT NULL,
`id_order_state` int(10) unsigned NOT NULL,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id_order_history`),
KEY `order_history_order` (`id_order`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_history` WRITE;
INSERT INTO `ps_order_history` VALUES (1,0,1,1,'2009-09-17 09:48:51'),(2,0,2,1,'2009-09-17 10:34:39'),(3,0,3,1,'2009-09-17 10:35:44'),(4,0,4,1,'2009-09-17 10:36:58'),(5,1,2,2,'2009-09-17 10:37:48'),(6,1,2,4,'2009-09-17 10:37:53'),(7,1,3,2,'2009-09-17 10:38:04'),(8,1,3,4,'2009-09-17 10:38:09'),(9,1,4,2,'2009-09-17 10:39:26'),(10,1,4,4,'2009-09-17 10:39:30');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_message`;
CREATE TABLE `ps_order_message` (
`id_order_message` int(10) unsigned NOT NULL auto_increment,
`date_add` datetime NOT NULL,
PRIMARY KEY (`id_order_message`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_message` WRITE;
INSERT INTO `ps_order_message` VALUES (1,'2009-09-17 09:48:51');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_message_lang`;
CREATE TABLE `ps_order_message_lang` (
`id_order_message` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(128) NOT NULL,
`message` text NOT NULL,
PRIMARY KEY (`id_order_message`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_message_lang` WRITE;
INSERT INTO `ps_order_message_lang` VALUES (1,1,'Delay','Hi,\n\nUnfortunately, an item on your order is currently out of stock. This may cause a slight delay in delivery.\nPlease accept our apologies and rest assured that we are working hard to rectify this.\n\nBest regards,\n'),(1,2,'Delai','Bonjour,\n\nUn des elements de votre commande est actuellement en reapprovisionnement, ce qui peut legerement retarder son envoi.\n\nMerci de votre comprehension.\n\nCordialement, \n');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_return`;
CREATE TABLE `ps_order_return` (
`id_order_return` int(10) unsigned NOT NULL auto_increment,
`id_customer` int(10) unsigned NOT NULL,
`id_order` int(10) unsigned NOT NULL,
`state` tinyint(1) unsigned NOT NULL default '1',
`question` text NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_order_return`),
KEY `order_return_customer` (`id_customer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_order_return_detail`;
CREATE TABLE `ps_order_return_detail` (
`id_order_return` int(10) unsigned NOT NULL,
`id_order_detail` int(10) unsigned NOT NULL,
`id_customization` int(10) NOT NULL default '0',
`product_quantity` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id_order_return`,`id_order_detail`,`id_customization`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_order_return_state`;
CREATE TABLE `ps_order_return_state` (
`id_order_return_state` int(10) unsigned NOT NULL auto_increment,
`color` varchar(32) default NULL,
PRIMARY KEY (`id_order_return_state`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_return_state` WRITE;
INSERT INTO `ps_order_return_state` VALUES (1,'#ADD8E6'),(2,'#EEDDFF'),(3,'#DDFFAA'),(4,'#FFD3D3'),(5,'#FFFFBB');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_return_state_lang`;
CREATE TABLE `ps_order_return_state_lang` (
`id_order_return_state` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL,
UNIQUE KEY `order_state_lang_index` (`id_order_return_state`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_return_state_lang` WRITE;
INSERT INTO `ps_order_return_state_lang` VALUES (1,1,'Waiting for confirmation'),(2,1,'Waiting for package'),(3,1,'Package received'),(4,1,'Return denied'),(5,1,'Return completed'),(1,2,'En attente de confirmation'),(2,2,'En attente du colis'),(3,2,'Colis recu'),(4,2,'Retour refuse'),(5,2,'Retour termine');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_slip`;
CREATE TABLE `ps_order_slip` (
`id_order_slip` int(10) unsigned NOT NULL auto_increment,
`id_customer` int(10) unsigned NOT NULL,
`id_order` int(10) unsigned NOT NULL,
`shipping_cost` tinyint(3) unsigned NOT NULL default '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_order_slip`),
KEY `order_slip_customer` (`id_customer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_order_slip_detail`;
CREATE TABLE `ps_order_slip_detail` (
`id_order_slip` int(10) unsigned NOT NULL,
`id_order_detail` int(10) unsigned NOT NULL,
`product_quantity` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id_order_slip`,`id_order_detail`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_order_state`;
CREATE TABLE `ps_order_state` (
`id_order_state` int(10) unsigned NOT NULL auto_increment,
`invoice` tinyint(1) unsigned default '0',
`send_email` tinyint(1) unsigned NOT NULL default '0',
`color` varchar(32) default NULL,
`unremovable` tinyint(1) unsigned NOT NULL,
`hidden` tinyint(1) unsigned NOT NULL default '0',
`logable` tinyint(1) NOT NULL default '0',
`delivery` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_order_state`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_state` WRITE;
INSERT INTO `ps_order_state` VALUES (1,0,1,'lightblue',1,0,0,0),(2,1,1,'#DDEEFF',1,0,1,0),(3,1,1,'#FFDD99',1,0,1,1),(4,1,1,'#EEDDFF',1,0,1,1),(5,1,0,'#DDFFAA',1,0,1,1),(6,1,1,'#DADADA',1,0,0,0),(7,1,1,'#FFFFBB',1,0,0,0),(8,0,1,'#FFDFDF',1,0,0,0),(9,1,1,'#FFD3D3',1,0,0,0),(10,0,1,'lightblue',1,0,0,0),(11,0,0,'lightblue',1,0,0,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_order_state_lang`;
CREATE TABLE `ps_order_state_lang` (
`id_order_state` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(64) NOT NULL,
`template` varchar(64) NOT NULL,
UNIQUE KEY `order_state_lang_index` (`id_order_state`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_order_state_lang` WRITE;
INSERT INTO `ps_order_state_lang` VALUES (1,1,'Awaiting cheque payment','cheque'),(2,1,'Payment accepted','payment'),(3,1,'Preparation in progress','preparation'),(4,1,'Shipped','shipped'),(5,1,'Delivered',''),(6,1,'Canceled','order_canceled'),(7,1,'Refund','refund'),(8,1,'Payment error','payment_error'),(9,1,'Out of stock','outofstock'),(10,1,'Awaiting bank wire payment','bankwire'),(11,1,'Awaiting PayPal payment',''),(1,2,'En attente du paiement par cheque','cheque'),(2,2,'Paiement accepte','payment'),(3,2,'Preparation en cours','preparation'),(4,2,'En cours de livraison','shipped'),(5,2,'Livre',''),(6,2,'Annule','order_canceled'),(7,2,'Rembourse','refund'),(8,2,'Erreur de paiement','payment_error'),(9,2,'Produit(s) indisponibles','outofstock'),(10,2,'En attente du paiement par virement bancaire','bankwire'),(11,2,'En attente du paiement par PayPal','');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_orders`;
CREATE TABLE `ps_orders` (
`id_order` int(10) unsigned NOT NULL auto_increment,
`id_carrier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`id_customer` int(10) unsigned NOT NULL,
`id_cart` int(10) unsigned NOT NULL,
`id_currency` int(10) unsigned NOT NULL,
`id_address_delivery` int(10) unsigned NOT NULL,
`id_address_invoice` int(10) unsigned NOT NULL,
`secure_key` varchar(32) NOT NULL default '-1',
`payment` varchar(255) NOT NULL,
`module` varchar(255) default NULL,
`recyclable` tinyint(1) unsigned NOT NULL default '0',
`gift` tinyint(1) unsigned NOT NULL default '0',
`gift_message` text,
`shipping_number` varchar(32) default NULL,
`total_discounts` decimal(10,2) NOT NULL default '0.00',
`total_paid` decimal(10,2) NOT NULL default '0.00',
`total_paid_real` decimal(10,2) NOT NULL default '0.00',
`total_products` decimal(10,2) NOT NULL default '0.00',
`total_shipping` decimal(10,2) NOT NULL default '0.00',
`total_wrapping` decimal(10,2) NOT NULL default '0.00',
`invoice_number` int(10) unsigned NOT NULL default '0',
`delivery_number` int(10) unsigned NOT NULL default '0',
`invoice_date` datetime NOT NULL,
`delivery_date` datetime NOT NULL,
`valid` int(1) unsigned NOT NULL default '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_order`),
KEY `id_customer` (`id_customer`),
KEY `id_cart` (`id_cart`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_orders` WRITE;
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,2,2,'47ce86627c1f3c792a80773c5d2deaf8','Cheque','cheque',1,0,'','','0.00','625.98','625.98','516.72','7.98','0.00',1,0,'2008-09-10 15:30:44','0000-00-00 00:00:00',0,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(2,2,2,1,2,1,2,2,'47ce86627c1f3c792a80773c5d2deaf8','Cheque','cheque',1,0,'','','0.00','80.48','80.48','60.62','7.98','0.00',2,1,'2009-09-17 10:37:48','2009-09-17 10:37:53',1,'2009-09-17 10:34:39','2009-09-17 10:37:53'),(3,2,2,1,3,1,2,2,'47ce86627c1f3c792a80773c5d2deaf8','Cheque','cheque',1,0,'','','0.00','27.98','27.98','16.72','7.98','0.00',3,2,'2009-09-17 10:38:04','2009-09-17 10:38:09',1,'2009-09-17 10:35:44','2009-09-17 10:38:09'),(4,2,2,1,4,1,2,2,'47ce86627c1f3c792a80773c5d2deaf8','Cheque','cheque',1,0,'','','0.00','676.00','676.00','565.22','0.00','0.00',4,3,'2009-09-17 10:39:26','2009-09-17 10:39:30',1,'2009-09-17 10:36:58','2009-09-17 10:39:30');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_pack`;
CREATE TABLE `ps_pack` (
`id_product_pack` int(10) unsigned NOT NULL,
`id_product_item` int(10) unsigned NOT NULL,
`quantity` int(10) unsigned NOT NULL default '1',
PRIMARY KEY (`id_product_pack`,`id_product_item`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_product`;
CREATE TABLE `ps_product` (
`id_product` int(10) unsigned NOT NULL auto_increment,
`id_supplier` int(10) unsigned default NULL,
`id_manufacturer` int(10) unsigned default NULL,
`id_tax` int(10) unsigned NOT NULL,
`id_category_default` int(10) unsigned default NULL,
`id_color_default` int(10) unsigned default NULL,
`on_sale` tinyint(1) unsigned NOT NULL default '0',
`ean13` varchar(13) default NULL,
`ecotax` decimal(10,2) NOT NULL default '0.00',
`quantity` int(10) unsigned NOT NULL default '0',
`price` decimal(13,6) NOT NULL default '0.000000',
`wholesale_price` decimal(13,6) NOT NULL default '0.000000',
`reduction_price` decimal(10,2) default NULL,
`reduction_percent` float default NULL,
`reduction_from` date default NULL,
`reduction_to` date default NULL,
`reference` varchar(32) default NULL,
`supplier_reference` varchar(32) default NULL,
`location` varchar(64) default NULL,
`weight` float NOT NULL default '0',
`out_of_stock` int(10) unsigned NOT NULL default '2',
`quantity_discount` tinyint(1) default '0',
`customizable` tinyint(2) NOT NULL default '0',
`uploadable_files` tinyint(4) NOT NULL default '0',
`text_fields` tinyint(4) NOT NULL default '0',
`active` tinyint(1) unsigned NOT NULL default '0',
`indexed` tinyint(1) NOT NULL default '0',
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_product`),
KEY `product_supplier` (`id_supplier`),
KEY `product_manufacturer` (`id_manufacturer`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product` WRITE;
INSERT INTO `ps_product` VALUES (1,1,1,1,2,2,0,'0','0.00',800,'124.581940','70.000000','0.00',5,'2009-09-17','2009-09-17','','',NULL,0.5,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(2,1,1,1,2,0,0,'0','0.00',100,'66.053500','33.000000','0.00',0,'2009-09-17','2009-09-17','','',NULL,0,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(5,1,1,1,4,0,0,'0','0.00',274,'1504.180602','1000.000000','0.00',0,'2009-09-17','2009-09-17','',NULL,NULL,1.36,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(6,1,1,1,4,0,0,'0','0.00',250,'1170.568561','0.000000','0.00',0,'2009-09-17','2009-09-17','',NULL,NULL,0.75,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(7,0,0,1,2,0,0,'','0.00',180,'241.638796','200.000000','0.00',0,'2009-09-17','2009-09-17','',NULL,NULL,0,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(8,0,0,1,3,0,0,'','0.00',1,'25.041806','0.000000','0.00',0,'2009-09-17','2009-09-17','',NULL,NULL,0,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(9,2,2,1,3,0,0,'','0.00',1,'124.581940','0.000000','0.00',0,'2009-09-17','2009-09-17','',NULL,NULL,0,2,0,0,0,0,1,1,'2009-09-17 09:48:51','2009-09-17 09:48:51'),(10,0,0,1,1,0,0,'1234567890128','0.00',60,'16.722408','10.000000','0.00',0,'2009-09-17','2009-09-17','123mdb321','','',0,2,0,0,0,0,1,1,'2009-09-17 10:04:08','2009-09-17 10:10:33'),(11,0,0,1,1,0,0,'9876543210982','0.00',87,'12.123746','5.000000','0.00',0,'2009-09-17','2009-09-17','9876short5432','','',0,2,0,0,0,0,1,1,'2009-09-17 10:27:15','2009-09-17 10:32:29');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_attachment`;
CREATE TABLE `ps_product_attachment` (
`id_product` int(10) NOT NULL,
`id_attachment` int(10) NOT NULL,
PRIMARY KEY (`id_product`,`id_attachment`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_product_attribute`;
CREATE TABLE `ps_product_attribute` (
`id_product_attribute` int(10) unsigned NOT NULL auto_increment,
`id_product` int(10) unsigned NOT NULL,
`reference` varchar(32) default NULL,
`supplier_reference` varchar(32) default NULL,
`location` varchar(64) default NULL,
`ean13` varchar(13) default NULL,
`wholesale_price` decimal(13,6) NOT NULL default '0.000000',
`price` decimal(10,2) NOT NULL default '0.00',
`ecotax` decimal(10,2) NOT NULL default '0.00',
`quantity` int(10) unsigned NOT NULL default '0',
`weight` float NOT NULL default '0',
`default_on` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_product_attribute`),
KEY `product_attribute_product` (`id_product`),
KEY `reference` (`reference`),
KEY `supplier_reference` (`supplier_reference`)
) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_attribute` WRITE;
INSERT INTO `ps_product_attribute` VALUES (30,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(29,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(28,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(27,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(26,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(25,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(7,2,'','',NULL,'','0.000000','0.00','0.00',10,0,0),(8,2,'','',NULL,'','0.000000','0.00','0.00',20,0,1),(9,2,'','',NULL,'','0.000000','0.00','0.00',30,0,0),(10,2,'','',NULL,'','0.000000','0.00','0.00',40,0,0),(12,5,'',NULL,NULL,'','0.000000','899.00','0.00',100,0,0),(13,5,'',NULL,NULL,'','0.000000','0.00','0.00',99,0,1),(14,5,'',NULL,NULL,'','0.000000','270.00','0.00',50,0,0),(15,5,'',NULL,NULL,'','0.000000','1169.00','0.00',25,0,0),(23,7,'',NULL,NULL,'','0.000000','180.00','0.00',70,0,0),(22,7,'',NULL,NULL,'','0.000000','90.00','0.00',60,0,0),(19,7,'',NULL,NULL,'','0.000000','0.00','0.00',50,0,1),(31,1,'','',NULL,'','0.000000','50.00','0.00',50,0,1),(32,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(33,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(34,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(35,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(36,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(39,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(40,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(41,1,'','',NULL,'','0.000000','50.00','0.00',50,0,0),(42,1,'','',NULL,'','0.000000','0.00','0.00',50,0,0),(43,10,'','','','','0.000000','0.00','0.00',9,0,1),(44,10,'','','','','0.000000','0.00','0.00',18,0,0),(45,10,'','','','','0.000000','0.00','0.00',30,0,0),(46,10,'','','','','0.000000','0.00','0.00',40,0,0),(47,10,'','','','','0.000000','0.00','0.00',47,0,0),(48,10,'','','','','0.000000','0.00','0.00',56,0,0),(49,10,'','','','','0.000000','0.00','0.00',64,0,0),(50,10,'','','','','0.000000','0.00','0.00',74,0,0),(51,10,'','','','','0.000000','0.00','0.00',83,0,0);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_attribute_combination`;
CREATE TABLE `ps_product_attribute_combination` (
`id_attribute` int(10) unsigned NOT NULL,
`id_product_attribute` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_attribute`,`id_product_attribute`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_attribute_combination` WRITE;
INSERT INTO `ps_product_attribute_combination` VALUES (3,9),(3,12),(3,13),(3,14),(3,15),(3,29),(3,30),(4,7),(4,25),(4,26),(4,43),(4,44),(4,45),(5,10),(5,35),(5,36),(6,8),(6,39),(6,40),(7,33),(7,34),(8,13),(8,15),(9,12),(9,14),(10,12),(10,13),(11,14),(11,15),(14,31),(14,32),(14,46),(14,47),(14,48),(15,19),(15,26),(15,28),(15,30),(15,32),(15,34),(15,36),(15,40),(15,42),(16,22),(16,25),(16,27),(16,29),(16,31),(16,33),(16,35),(16,39),(16,41),(17,23),(18,41),(18,42),(19,27),(19,28),(20,49),(20,50),(20,51),(21,45),(21,48),(21,51),(22,44),(22,47),(22,50),(23,43),(23,46),(23,49);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_attribute_image`;
CREATE TABLE `ps_product_attribute_image` (
`id_product_attribute` int(10) NOT NULL,
`id_image` int(10) NOT NULL,
PRIMARY KEY (`id_product_attribute`,`id_image`),
KEY `id_image` (`id_image`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_attribute_image` WRITE;
INSERT INTO `ps_product_attribute_image` VALUES (7,46),(8,47),(9,49),(10,48),(12,0),(13,0),(14,0),(15,0),(19,0),(22,0),(23,0),(25,38),(26,38),(27,45),(28,45),(29,44),(30,44),(31,37),(32,37),(33,40),(34,40),(35,41),(36,41),(39,39),(40,39),(41,42),(42,42);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_download`;
CREATE TABLE `ps_product_download` (
`id_product_download` int(10) unsigned NOT NULL auto_increment,
`id_product` int(10) unsigned NOT NULL,
`display_filename` varchar(255) default NULL,
`physically_filename` varchar(255) default NULL,
`date_deposit` datetime NOT NULL,
`date_expiration` datetime default NULL,
`nb_days_accessible` int(10) unsigned default NULL,
`nb_downloadable` int(10) unsigned default '1',
`active` tinyint(1) unsigned NOT NULL default '1',
PRIMARY KEY (`id_product_download`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_product_lang`;
CREATE TABLE `ps_product_lang` (
`id_product` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
`description_short` text,
`link_rewrite` varchar(128) NOT NULL,
`meta_description` varchar(255) default NULL,
`meta_keywords` varchar(255) default NULL,
`meta_title` varchar(128) default NULL,
`name` varchar(128) NOT NULL,
`available_now` varchar(255) default NULL,
`available_later` varchar(255) default NULL,
UNIQUE KEY `product_lang_index` (`id_product`,`id_lang`),
KEY `id_lang` (`id_lang`),
KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_lang` WRITE;
INSERT INTO `ps_product_lang` VALUES (1,1,'<p><strong><span style=\"font-size: small\">Curved ahead of the curve.</span></strong></p>\r\n<p>For those about to rock, we give you nine amazing colors. But that\'s only part of the story. Feel the curved, all-aluminum and glass design and you won\'t want to put iPod nano down.</p>\r\n<p><strong><span style=\"font-size: small\">Great looks. And brains, too.</span></strong></p>\r\n<p>The new Genius feature turns iPod nano into your own highly intelligent, personal DJ. It creates playlists by finding songs in your library that go great together.</p>\r\n<p><strong><span style=\"font-size: small\">Made to move with your moves.</span></strong></p>\r\n<p>The accelerometer comes to iPod nano. Give it a shake to shuffle your music. Turn it sideways to view Cover Flow. And play games designed with your moves in mind.</p>','<p>New design. New features. Now in 8GB and 16GB. iPod nano rocks like never before.</p>','ipod-nano','','','','iPod Nano','In stock',''),(1,2,'<p><span style=\"font-size: small\"><strong>Des courbes avantageuses.</strong></span></p>\r\n<p>Pour les amateurs de sensations, voici neuf nouveaux coloris. Et ce n\'est pas tout ! Faites l\'experience du design elliptique en aluminum et verre. Vous ne voudrez plus le lacher.</p>\r\n<p><strong><span style=\"font-size: small\">Beau et intelligent.</span></strong></p>\r\n<p>La nouvelle fonctionnalite Genius fait d\'iPod nano votre DJ personnel. Genius cree des listes de lecture en recherchant dans votre bibliotheque les chansons qui vont bien ensemble.</p>\r\n<p><strong><span style=\"font-size: small\">Fait pour bouger avec vous.</span></strong></p>\r\n<p>iPod nano est equipe de l\'accelerometre. Secouez-le pour melanger votre musique. Basculez-le pour afficher Cover Flow. Et decouvrez des jeux adaptes a vos mouvements.</p>','<p>Nouveau design. Nouvelles fonctionnalites. Desormais en 8 et 16 Go. iPod nano, plus rock que jamais.</p>','ipod-nano','','','','iPod Nano','En stock',''),(2,1,'<p><span style=\"font-size: small\"><strong>Instant attachment.</strong></span></p>\r\n<p>Wear up to 500 songs on your sleeve. Or your belt. Or your gym shorts. iPod shuffle is a badge of musical devotion. Now in new, more brilliant colors.</p>\r\n<p><span style=\"font-size: small\"><strong>Feed your iPod shuffle.</strong></span></p>\r\n<p>iTunes is your entertainment superstore. It’s your ultra-organized music collection and jukebox. And it’s how you load up your iPod shuffle in one click.</p>\r\n<p><span style=\"font-size: small\"><strong>Beauty and the beat.</strong></span></p>\r\n<p>Intensely colorful anodized aluminum complements the simple design of iPod shuffle. Now in blue, green, pink, red, and original silver.</p>','<p>iPod shuffle, the world’s most wearable music player, now clips on in more vibrant blue, green, pink, and red.</p>','ipod-shuffle','','','','iPod shuffle','In stock',''),(2,2,'<p><span style=\"font-size: small\"><strong>Un lien immediat.</strong></span></p>\r\n<p>Portez jusqu\'a 500 chansons accrochees a votre manche, a votre ceinture ou a votre short. Arborez votre iPod shuffle comme signe exterieur de votre passion pour la musique. Existe desormais en quatre nouveaux coloris encore plus eclatants.</p>\r\n<p><span style=\"font-size: small\"><strong>Emplissez votre iPod shuffle.</strong></span></p>\r\n<p>iTunes est un immense magasin dedie au divertissement, une collection musicale parfaitement organisee et un jukebox. Vous pouvez en un seul clic remplir votre iPod shuffle de chansons.</p>\r\n<p><strong><span style=\"font-size: small\">La musique en technicolor.</span></strong></p>\r\n<p>iPod shuffle s\'affiche desormais dans de nouveaux coloris intenses qui rehaussent le design epure du boitier en aluminium anodise. Choisissez parmi le bleu, le vert, le rose, le rouge et l\'argente d\'origine.</p>','<p>iPod shuffle, le baladeur le plus portable du monde, se clippe maintenant en bleu, vert, rose et rouge.</p>','ipod-shuffle','','','','iPod shuffle','En stock',''),(5,1,'<p>MacBook Air is nearly as thin as your index finger. Practically every detail that could be streamlined has been. Yet it still has a 13.3-inch widescreen LED display, full-size keyboard, and large multi-touch trackpad. It’s incomparably portable without the usual ultraportable screen and keyboard compromises.</p><p>The incredible thinness of MacBook Air is the result of numerous size- and weight-shaving innovations. From a slimmer hard drive to strategically hidden I/O ports to a lower-profile battery, everything has been considered and reconsidered with thinness in mind.</p><p>MacBook Air is designed and engineered to take full advantage of the wireless world. A world in which 802.11n Wi-Fi is now so fast and so available, people are truly living untethered — buying and renting movies online, downloading software, and sharing and storing files on the web. </p>','MacBook Air is ultrathin, ultraportable, and ultra unlike anything else. But you don’t lose inches and pounds overnight. It’s the result of rethinking conventions. Of multiple wireless innovations. And of breakthrough design. With MacBook Air, mobile computing suddenly has a new standard.','macbook-air','','','','MacBook Air','',NULL),(5,2,'<p>MacBook Air est presque aussi fin que votre index. Pratiquement tout ce qui pouvait etre simplifie l\'a ete. Il n\'en dispose pas moins d\'un ecran panoramique de 13,3 pouces, d\'un clavier complet et d\'un vaste trackpad multi-touch. Incomparablement portable il vous evite les compromis habituels en matiere d\'ecran et de clavier ultra-portables.</p><p>L\'incroyable finesse de MacBook Air est le resultat d\'un grand nombre d\'innovations en termes de reduction de la taille et du poids. D\'un disque dur plus fin a des ports d\'E/S habilement dissimules en passant par une batterie plus plate, chaque detail a ete considere et reconsidere avec la finesse a l\'esprit.</p><p>MacBook Air a ete concu et elabore pour profiter pleinement du monde sans fil. Un monde dans lequel la norme Wi-Fi 802.11n est desormais si rapide et si accessible qu\'elle permet veritablement de se liberer de toute attache pour acheter des videos en ligne, telecharger des logiceeeeiels, stocker et partager des fichiers sur le Web. </p>','MacBook Air est ultra fin, ultra portable et ultra different de tout le reste. Mais on ne perd pas des kilos et des centimetres en une nuit. C\'est le resultat d\'une reinvention des normes. D\'une multitude d\'innovations sans fil. Et d\'une revolution dans le design. Avec MacBook Air, l\'informatique mobile prend soudain une nouvelle dimension.','macbook-air','','','','MacBook Air','',NULL),(6,1,'Every MacBook has a larger hard drive, up to 250GB, to store growing media collections and valuable data.<br /><br />The 2.4GHz MacBook models now include 2GB of memory standard — perfect for running more of your favorite applications smoothly.','MacBook makes it easy to hit the road thanks to its tough polycarbonate case, built-in wireless technologies, and innovative MagSafe Power Adapter that releases automatically if someone accidentally trips on the cord.','macbook','','','','MacBook','',NULL),(6,2,'Chaque MacBook est equipe d\'un disque dur plus spacieux, d\'une capacite atteignant 250 Go, pour stocker vos collections multimedia en expansion et vos donnees precieuses.<br /><br />Le modele MacBook a 2,4 GHz integre desormais 2 Go de memoire en standard. L\'ideal pour executer en souplesse vos applications preferees.','MacBook vous offre la liberte de mouvement grace a son boitier resistant en polycarbonate, a ses technologies sans fil integrees et a son adaptateur secteur MagSafe novateur qui se deconnecte automatiquement si quelqu\'un se prend les pieds dans le fil.','macbook','','','','MacBook','',NULL),(7,1,'<h3>Five new hands-on applications</h3>\r\n<p>View rich HTML email with photos as well as PDF, Word, and Excel attachments. Get maps, directions, and real-time traffic information. Take notes and read stock and weather reports.</p>\r\n<h3>Touch your music, movies, and more</h3>\r\n<p>The revolutionary Multi-Touch technology built into the gorgeous 3.5-inch display lets you pinch, zoom, scroll, and flick with your fingers.</p>\r\n<h3>Internet in your pocket</h3>\r\n<p>With the Safari web browser, see websites the way they were designed to be seen and zoom in and out with a tap.<sup>2</sup> And add Web Clips to your Home screen for quick access to favorite sites.</p>\r\n<h3>What\'s in the box</h3>\r\n<ul>\r\n<li><span></span>iPod touch</li>\r\n<li><span></span>Earphones</li>\r\n<li><span></span>USB 2.0 cable</li>\r\n<li><span></span>Dock adapter</li>\r\n<li><span></span>Polishing cloth</li>\r\n<li><span></span>Stand</li>\r\n<li><span></span>Quick Start guide</li>\r\n</ul>','<ul>\r\n<li>Revolutionary Multi-Touch interface</li>\r\n<li>3.5-inch widescreen color display</li>\r\n<li>Wi-Fi (802.11b/g)</li>\r\n<li>8 mm thin</li>\r\n<li>Safari, YouTube, Mail, Stocks, Weather, Notes, iTunes Wi-Fi Music Store, Maps</li>\r\n</ul>','ipod-touch','','','','iPod touch','',NULL),(7,2,'<h1>Titre 1</h1>\r\n<h2>Titre 2</h2>\r\n<h3>Titre 3</h3>\r\n<h4>Titre 4</h4>\r\n<h5>Titre 5</h5>\r\n<h6>Titre 6</h6>\r\n<ul>\r\n<li>UL</li>\r\n<li>UL</li>\r\n<li>UL</li>\r\n<li>UL</li>\r\n</ul>\r\n<ol>\r\n<li>OL</li>\r\n<li>OL</li>\r\n<li>OL</li>\r\n<li>OL</li>\r\n</ol>\r\n<p>paragraphe...</p>\r\n<p>paragraphe...</p>\r\n<p>paragraphe...</p>\r\n<table border=\"0\">\r\n<thead> \r\n<tr>\r\n<th>th</th> <th>th</th> <th>th</th>\r\n</tr>\r\n</thead> \r\n<tbody>\r\n<tr>\r\n<td>td</td>\r\n<td>td</td>\r\n<td>td</td>\r\n</tr>\r\n<tr>\r\n<td>td</td>\r\n<td>td</td>\r\n<td>td</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<h3>Cinq nouvelles applications sous la main</h3>\r\n<p>Consultez vos e-mails au format HTML enrichi, avec photos et pieces jointes au format PDF, Word et Excel. Obtenez des cartes, des itineraires et des informations sur l\'etat de la circulation en temps reel. Redigez des notes et consultez les cours de la Bourse et les bulletins meteo.</p>\r\n<h3>Touchez du doigt votre musique et vos videos. Entre autres.</h3>\r\n<p>La technologie multi-touch revolutionnaire integree au superbe ecran de 3,5 pouces vous permet d\'effectuer des zooms avant et arriere, de faire defiler et de feuilleter des pages a l\'aide de vos seuls doigts.</p>\r\n<h3>Internet dans votre poche</h3>\r\n<p>Avec le navigateur Safari, vous pouvez consulter des sites web dans leur mise en page d\'origine et effectuer un zoom avant et arriere d\'une simple pression sur l\'ecran.</p>\r\n<h3>Contenu du coffret</h3>\r\n<ul>\r\n<li><span></span>iPod touch</li>\r\n<li><span></span>Ecouteurs</li>\r\n<li><span></span>Cable USB 2.0</li>\r\n<li><span></span>Adaptateur Dock</li>\r\n<li><span></span>Chiffon de nettoyage</li>\r\n<li><span></span>Support</li>\r\n<li><span></span>Guide de demarrage rapide</li>\r\n</ul>\r\n<p> </p>','<p>Interface multi-touch revolutionnaire<br />Ecran panoramique couleur de 3,5 pouces<br />Wi-Fi (802.11b/g)<br />8 mm d\'epaisseur<br />Safari, YouTube, iTunes Wi-Fi Music Store, Courrier, Cartes, Bourse, Meteo, Notes</p>','ipod-touch','','','','iPod touch','En stock',NULL),(8,1,'<p>Lorem ipsum</p>','<p>Lorem ipsum</p>','housse-portefeuille-en-cuir-belkin-pour-ipod-nano-noir-chocolat','','','','Housse portefeuille en cuir Belkin pour iPod nano - Noir/Chocolat','',NULL),(8,2,'<p><strong>Caracteristiques</strong></p>\r\n<li>Cuir doux resistant<br /> </li>\r\n<li>Acces au bouton Hold<br /> </li>\r\n<li>Fermeture magnetique<br /> </li>\r\n<li>Acces au Dock Connector<br /> </li>\r\n<li>Protege-ecran</li>','<p>Cet etui en cuir tendance assure une protection complete contre les eraflures et les petits aleas de la vie quotidienne. Sa conception elegante et compacte vous permet de glisser votre iPod directement dans votre poche ou votre sac a main.</p>','housse-portefeuille-en-cuir-ipod-nano-noir-chocolat','','','','Housse portefeuille en cuir (iPod nano) - Noir/Chocolat','',NULL),(9,1,'<div class=\"product-overview-full\">Using Hi-Definition MicroSpeakers to deliver full-range audio, the ergonomic and lightweight design of the SE210 earphones is ideal for premium on-the-go listening on your iPod or iPhone. They offer the most accurate audio reproduction from both portable and home stereo audio sources--for the ultimate in precision highs and rich low end. In addition, the flexible design allows you to choose the most comfortable fit from a variety of wearing positions. <br /> <br /> <strong>Features </strong> <br /> \r\n<ul>\r\n<li>Sound-isolating design </li>\r\n<li> Hi-Definition MicroSpeaker with a single balanced armature driver </li>\r\n<li> Detachable, modular cable so you can make the cable longer or shorter depending on your activity </li>\r\n<li> Connector compatible with earphone ports on both iPod and iPhone </li>\r\n</ul>\r\n<strong>Specifications </strong><br /> \r\n<ul>\r\n<li>Speaker type: Hi-Definition MicroSpeaker </li>\r\n<li> Frequency range: 25Hz-18.5kHz </li>\r\n<li> Impedance (1kHz): 26 Ohms </li>\r\n<li> Sensitivity (1mW): 114 dB SPL/mW </li>\r\n<li> Cable length (with extension): 18.0 in./45.0 cm (54.0 in./137.1 cm) </li>\r\n</ul>\r\n<strong>In the box</strong><br /> \r\n<ul>\r\n<li>Shure SE210 earphones </li>\r\n<li> Extension cable (36.0 in./91.4 cm) </li>\r\n<li> Three pairs foam earpiece sleeves (small, medium, large) </li>\r\n<li> Three pairs soft flex earpiece sleeves (small, medium, large) </li>\r\n<li> One pair triple-flange earpiece sleeves </li>\r\n<li> Carrying case </li>\r\n</ul>\r\nWarranty<br /> Two-year limited <br />(For details, please visit <br />www.shure.com/PersonalAudio/CustomerSupport/ProductReturnsAndWarranty/index.htm.) <br /><br /> Mfr. Part No.: SE210-A-EFS <br /><br />Note: Products sold through this website that do not bear the Apple Brand name are serviced and supported exclusively by their manufacturers in accordance with terms and conditions packaged with the products. Apple\'s Limited Warranty does not apply to products that are not Apple-branded, even if packaged or sold with Apple products. Please contact the manufacturer directly for technical support and customer service.</div>','<p>Evolved from personal monitor technology road-tested by pro musicians and perfected by Shure engineers, the lightweight and stylish SE210 delivers full-range audio that\'s free from outside noise.</p>','ecouteurs-a-isolation-sonore-shure-se210-blanc','','','','Shure SE210 Sound-Isolating Earphones for iPod and iPhone','',NULL),(9,2,'<p>Bases sur la technologie des moniteurs personnels testee sur la route par des musiciens professionnels et perfectionnee par les ingenieurs Shure, les ecouteurs SE210, legers et elegants, fournissent une sortie audio a gamme etendue exempte de tout bruit externe.</p>\r\n<p><img src=\"http://store.apple.com/Catalog/fr/Images/TM255_screen1.jpg\" border=\"0\" /></p>\r\n<p><strong>Conception a isolation sonore <br /></strong>Les embouts a isolation sonore fournis bloquent plus de 90 % du bruit ambiant. Combines a un design ergonomique seduisant et un cable modulaire, ils minimisent les intrusions du monde exterieur, vous permettant de vous concentrer sur votre musique. Concus pour les amoureux de la musique qui souhaitent faire evoluer leur appareil audio portable, les ecouteurs SE210 vous permettent d\'emmener la performance avec vous. <br /> <br /><strong>Micro-transducteur haute definition <br /></strong>Developpes pour une ecoute de qualite superieure en deplacement, les ecouteurs SE210 utilisent un seul transducteur a armature equilibree pour beneficier d\'une gamme audio etendue. Le resultat ? Un confort d\'ecoute epoustouflant qui restitue tous les details d\'un spectacle live.</p>\r\n<p><strong>Le kit universel Deluxe comprend les elements suivants : <br /></strong>- <strong><em>Embouts a isolation sonore</em></strong> <br />Les embouts a isolation sonore inclus ont un double role : bloquer les bruits ambiants et garantir un maintien et un confort personnalises. Comme chaque oreille est differente, le kit universel Deluxe comprend trois tailles (S, M, L) d\'embouts mousse et flexibles. Choisissez la taille et le style d\'embout qui vous conviennent le mieux : une bonne etancheite est un facteur cle pour optimiser l\'isolation sonore et la reponse des basses, ainsi que pour accroitre le confort en ecoute prolongee.<br /><br />- <em><strong>Cable modulaire</strong></em> <br />En se basant sur les commentaires de nombreux utilisateurs, les ingenieurs de Shure ont developpe une solution de cable detachable pour permettre un degre de personnalisation sans precedent. Le cable de 1 metre fourni vous permet d\'adapter votre confort en fonction de l\'activite et de l\'application.<br /> <br />- <em><strong>Etui de transport</strong></em> <br />Outre les embouts a isolation sonore et le cable modulaire, un etui de transport compact et resistant est fourni avec les ecouteurs SE210 pour vous permettre de ranger vos ecouteurs de maniere pratique et sans encombres.<br /> <br />- <strong><em>Garantie limitee de deux ans <br /></em></strong>Chaque solution SE210 achetee est couverte par une garantie pieces et main-d\'œuvre de deux ans.<br /><br /><strong>Caracteristiques techniques</strong></p>\r\n<ul>\r\n<li> Type de transducteur : micro-transducteur haute definition<br /></li>\r\n<li> Sensibilite (1 mW) : pression acoustique de 114 dB/mW<br /></li>\r\n<li> Impedance (a 1 kHz) : 26 W<br /></li>\r\n<li> Gamme de frequences : 25 Hz – 18,5 kHz<br /></li>\r\n<li> Longueur de cable / avec rallonge : 45 cm / 136 cm<br /></li>\r\n</ul>\r\n<p><strong>Contenu du coffret<br /></strong></p>\r\n<ul>\r\n<li> Ecouteurs Shure SE210<br /></li>\r\n<li> Kit universel Deluxe (embouts a isolation sonore, cable modulaire, etui de transport)</li>\r\n</ul>','<p>Les ecouteurs a isolation sonore ergonomiques et legers offrent la reproduction audio la plus fidele en provenance de sources audio stereo portables ou de salon.</p>','ecouteurs-a-isolation-sonore-shure-se210','','','','Ecouteurs a isolation sonore Shure SE210','',NULL),(10,1,'','','maillot-de-bain','','','','Maillot de Bain','',''),(10,2,'','','maillot-de-bain','','','','Maillot de Bain','',''),(11,1,'','','short','','','','Short','',''),(11,2,'','','short','','','','Short','','');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_sale`;
CREATE TABLE `ps_product_sale` (
`id_product` int(10) unsigned NOT NULL,
`quantity` int(10) unsigned NOT NULL default '0',
`sale_nbr` int(10) unsigned NOT NULL default '0',
`date_upd` date NOT NULL,
PRIMARY KEY (`id_product`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_sale` WRITE;
INSERT INTO `ps_product_sale` VALUES (11,13,2,'2009-09-17'),(10,29,8,'2009-09-17');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_product_tag`;
CREATE TABLE `ps_product_tag` (
`id_product` int(10) unsigned NOT NULL,
`id_tag` int(10) unsigned NOT NULL,
PRIMARY KEY (`id_product`,`id_tag`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_product_tag` WRITE;
INSERT INTO `ps_product_tag` VALUES (1,2),(1,6),(1,7),(1,8),(2,6),(2,18),(5,8),(5,19),(5,20),(5,21),(6,5),(6,22),(7,23),(7,24),(9,25),(9,26),(9,27);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_state`;
CREATE TABLE `ps_state` (
`id_state` int(10) unsigned NOT NULL auto_increment,
`id_country` int(11) NOT NULL,
`id_zone` int(11) NOT NULL,
`name` varchar(64) NOT NULL,
`iso_code` char(4) NOT NULL,
`tax_behavior` smallint(1) NOT NULL default '0',
`active` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_state`)
) ENGINE=MyISAM AUTO_INCREMENT=53 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_state` WRITE;
INSERT INTO `ps_state` VALUES (1,21,2,'Alabama','AL',0,1),(2,21,2,'Alaska','AK',0,1),(3,21,2,'Arizona','AZ',0,1),(4,21,2,'Arkansas','AR',0,1),(5,21,2,'California','CA',0,1),(6,21,2,'Colorado','CO',0,1),(7,21,2,'Connecticut','CT',0,1),(8,21,2,'Delaware','DE',0,1),(9,21,2,'Florida','FL',0,1),(10,21,2,'Georgia','GA',0,1),(11,21,2,'Hawaii','HI',0,1),(12,21,2,'Idaho','ID',0,1),(13,21,2,'Illinois','IL',0,1),(14,21,2,'Indiana','IN',0,1),(15,21,2,'Iowa','IA',0,1),(16,21,2,'Kansas','KS',0,1),(17,21,2,'Kentucky','KY',0,1),(18,21,2,'Louisiana','LA',0,1),(19,21,2,'Maine','ME',0,1),(20,21,2,'Maryland','MD',0,1),(21,21,2,'Massachusetts','MA',0,1),(22,21,2,'Michigan','MI',0,1),(23,21,2,'Minnesota','MN',0,1),(24,21,2,'Mississippi','MS',0,1),(25,21,2,'Missouri','MO',0,1),(26,21,2,'Montana','MT',0,1),(27,21,2,'Nebraska','NE',0,1),(28,21,2,'Nevada','NV',0,1),(29,21,2,'New Hampshire','NH',0,1),(30,21,2,'New Jersey','NJ',0,1),(31,21,2,'New Mexico','NM',0,1),(32,21,2,'New York','NY',0,1),(33,21,2,'North Carolina','NC',0,1),(34,21,2,'North Dakota','ND',0,1),(35,21,2,'Ohio','OH',0,1),(36,21,2,'Oklahoma','OK',0,1),(37,21,2,'Oregon','OR',0,1),(38,21,2,'Pennsylvania','PA',0,1),(39,21,2,'Rhode Island','RI',0,1),(40,21,2,'South Carolina','SC',0,1),(41,21,2,'South Dakota','SD',0,1),(42,21,2,'Tennessee','TN',0,1),(43,21,2,'Texas','TX',0,1),(44,21,2,'Utah','UT',0,1),(45,21,2,'Vermont','VT',0,1),(46,21,2,'Virginia','VA',0,1),(47,21,2,'Washington','WA',0,1),(48,21,2,'West Virginia','WV',0,1),(49,21,2,'Wisconsin','WI',0,1),(50,21,2,'Wyoming','WY',0,1),(51,21,2,'Puerto Rico','PR',0,1),(52,21,2,'US Virgin Islands','VI',0,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_supplier`;
CREATE TABLE `ps_supplier` (
`id_supplier` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
`date_add` datetime NOT NULL,
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_supplier`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_supplier` WRITE;
INSERT INTO `ps_supplier` VALUES (1,'AppleStore','2009-09-17 09:48:51','2009-09-17 09:48:51'),(2,'Shure Online Store','2009-09-17 09:48:51','2009-09-17 09:48:51');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_supplier_lang`;
CREATE TABLE `ps_supplier_lang` (
`id_supplier` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`description` text,
`meta_title` varchar(254) default NULL,
`meta_keywords` varchar(254) default NULL,
`meta_description` varchar(254) default NULL,
PRIMARY KEY (`id_supplier`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_tag`;
CREATE TABLE `ps_tag` (
`id_tag` int(10) unsigned NOT NULL auto_increment,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL,
PRIMARY KEY (`id_tag`),
KEY `tag_name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=28 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_tag` WRITE;
INSERT INTO `ps_tag` VALUES (5,1,'apple'),(6,2,'ipod'),(7,2,'nano'),(8,2,'apple'),(18,2,'shuffle'),(19,2,'macbook'),(20,2,'macbookair'),(21,2,'air'),(22,1,'superdrive'),(27,2,'marche'),(26,2,'casque'),(25,2,'ecouteurs'),(24,2,'ipod touch tacticle'),(23,1,'Ipod touch');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_tax`;
CREATE TABLE `ps_tax` (
`id_tax` int(10) unsigned NOT NULL auto_increment,
`rate` float NOT NULL,
PRIMARY KEY (`id_tax`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_tax` WRITE;
INSERT INTO `ps_tax` VALUES (1,19.6),(2,5.5),(3,17.5);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_tax_lang`;
CREATE TABLE `ps_tax_lang` (
`id_tax` int(10) unsigned NOT NULL,
`id_lang` int(10) unsigned NOT NULL,
`name` varchar(32) NOT NULL,
UNIQUE KEY `tax_lang_index` (`id_tax`,`id_lang`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_tax_lang` WRITE;
INSERT INTO `ps_tax_lang` VALUES (1,1,'VAT 19.6%'),(1,2,'TVA 19.6%'),(2,1,'VAT 5.5%'),(2,2,'TVA 5.5%'),(3,1,'VAT 17.5%'),(3,2,'TVA UK 17.5%');
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_tax_state`;
CREATE TABLE `ps_tax_state` (
`id_tax` int(10) unsigned NOT NULL,
`id_state` int(10) unsigned NOT NULL,
KEY `tax_state_index` (`id_tax`,`id_state`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `ps_tax_zone`;
CREATE TABLE `ps_tax_zone` (
`id_tax` int(10) unsigned NOT NULL,
`id_zone` int(10) unsigned NOT NULL,
KEY `tax_zone_index` (`id_tax`,`id_zone`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
LOCK TABLES `ps_tax_zone` WRITE;
INSERT INTO `ps_tax_zone` VALUES (1,1),(2,1);
UNLOCK TABLES;
DROP TABLE IF EXISTS `ps_zone`;
CREATE TABLE `ps_zone` (
`id_zone` int(10) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL,
`active` tinyint(1) unsigned NOT NULL default '0',
`enabled` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id_zone`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
LOCK TABLES `ps_zone` WRITE;
INSERT INTO `ps_zone` VALUES (1,'Europe',1,1),(2,'US',1,1),(3,'Asia',1,1),(4,'Africa',1,1),(5,'Oceania',1,1);
UNLOCK TABLES;
/* Drop table if exists */
DROP TABLE IF EXISTS `NOMACTX`;
/* Create the NOMACTX table */
CREATE TABLE `NOMACTX` (
`account_code` int(20) DEFAULT NULL,
`account_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`transaction_reference` int(20) DEFAULT NULL,
`journal_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`date` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`third_party` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`comment1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`comment2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`tax_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`debit` float DEFAULT NULL,
`credit` float DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `NOMACTX` VALUES (1100, 'Debtors Control Account', 1812, 'SR', '2009-01-06', 'OrgaNisma', '', 'Sales Receipt', 'Tax9', 0.0, 16892.2),(1100, 'Debtors Control Account', 2298, 'SI', '2009-01-05', 'NorgA', '25', 'Nov Outlay', 'Tax6', 741213.0, 0.0),(1100, 'Debtors Control Account', 2778, 'SA', '2009-03-11', 'NorgA', '', 'Payment on Account', 'Tax9', 0.0, 610204.0),(1100, 'Debtors Control Account', 4397, 'SC', '2009-06-17', 'NorgA', '47-1', 'Reverse Invoice 43', 'Tax6', 0.0, 477746.0),(1200, 'Bank Current Account', 1717, 'PP', '2009-01-02', 'MobileOrg', 'DD', 'Purchase Payment', 'Tax9', 0.0, 471.37),(1200, 'Bank Current Account', 1780, 'BP', '2009-01-05', 1200, 'DD', 'Lease # 01234', 'Tax6', 0.0,618.65),(1200, 'Bank Current Account', 1781, 'PA', '2009-01-06', 'Comporg', 'iBB', 'Payment on Account', 'Tax9', 0.0, 4070.25),(1200, 'Bank Current Account', 1812, 'SR', '2009-01-06', 'OrgaNisma', '', 'Sales Receipt', 'Tax9', 16892.2, 0.0),(1200, 'Bank Current Account', 2778, 'SA', '2009-03-11', 'NorgA', '', 'Payment on Account', 'Tax9', 610204.0, 0.0),(1200, 'Bank Current Account', 3049, 'BR', '2009-03-31', 1200, '518785', 'Return of goods to Elara', 'Tax6', 29.16, 0.0),(1230, 'Petty Cash', '2041', 'JC', '2009-01-02', 1230, 'Transporters', 'Error in posting payments', 'Tax9', 0.0, 58.38),(1231, 'Cash Advance - Quatre four', 2352, 'CP', '2009-02-16', 1231, 'Cash', 'Quatre four - Weekcomm 16/02/09', 'Tax0', 0.0, 896.0),(1240, 'Company Credit Card', 2036, 'JD', '2009-01-09', 1240, 'Transporters', 'Bank Transfer', 'Tax9', 463.87, 0.0),(1240, 'Company Credit Card', 2454, 'VP', '2009-01-19', 1240, 'COrg', 'Sat Nav and Motor Oil etc for Corg', 'Tax0', 0.0, 220.18),(2100, 'Creditors Control Account', 1690, 'PI', '2009-01-02', 'Telecom Supplier', '6', 'Calls to 31/12/08', 'Tax6', 0.0, 20.64),(2100, 'Creditors Control Account', 1717, 'PP', '2009-01-02', 'MobileOrg', 'DD', 'Purchase Payment', 'Tax9', 471.37, 0.0),(2100, 'Creditors Control Account', 1781, 'PA', '2009-01-06', 'Comporg', 'iBB', 'Payment on Account', 'Tax9', 4070.25, 0.0),(2100, 'Creditors Control Account', 2403, 'PC', '2009-02-27', 'MyCompTELEPE', '697', 'Against Oct Invoice 521069', 'Tax5', 20000.0, 0.0),(2200, 'Sales Tax Control Account', 2298, 'SI', '2009-01-05', 'NorgA', '25', 'Nov Outlay', 'Tax6', 0.0, 131161.0),(2200, 'Sales Tax Control Account', 3049, 'BR', '2009-03-31', 1200, '518785', 'Return of goods to Elara', 'Tax6', 0.0, 5.16),(2200, 'Sales Tax Control Account', 4397, 'SC', '2009-06-17', 'NorgA', '47-1', 'Reverse Invoice 43', 'Tax6', 84539.5, 0.0),(2201, 'Purchase Tax Control Account', 1690, 'PI', '2009-01-02', 'Telecom Supplier', '6', 'Calls to 31/12/08', 'Tax6', 3.65, 0.0),(2201, 'Purchase Tax Control Account', 1780, 'BP', '2009-01-05', 1200, 'DD', 'Lease # 01234', 'Tax6', 109.47, 0.0),(4004, 'Change request construction services', 4397, 'SC', '2009-06-17', 'NorgA', '47-1', 'Reverse Invoice 43', 'Tax6', 393207.0, 0.0),(5000, 'Purchases', 2298, 'SI', '2009-01-05', 'NorgA', '25', 'Nov Outlay', 'Tax6', 0.0, 610052.0),(5006, 'Contact Centre Services - MM Teleperformance', 2403, 'PC', '2009-02-27', 'MyCompTELEPE', '697', 'Against Oct Invoice 521069', 'Tax5', 0.0, 20000.0),(7301, 'Repairs and Servicing', 3049, 'BR', '2009-03-31', 1200, '518785', 'Return of goods to Elara', 'Tax6', 0.0, 24.0),(7304, 'Miscellaneous Motor Expenses', 1780, 'BP', '2009-01-05', 1200, 'DD', 'Lease # 01234', 'Tax6', 509.18, 0.0),(7304, 'Miscellaneous Motor Expenses', 2454, 'VP', '2009-01-19', 1240, 'Corg', 'Sat Nav and Motor Oil etc for Corg', 'Tax0', 220.18, 0.0),(7400, 'Travelling', 2352, 'CP', '2009-02-16', 1231, 'Cash', 'Quatre four - Weekcomm 16/02/09', 'Tax0', 896.0, 0.0),(7502, 'Telephone', 1690, 'PI', '2009-01-02', 'Telecom Supplier', '6', 'Calls to 31/12/08', 'Tax6', 16.99, 0.0);
DROP TABLE IF EXISTS `ps_access`;
DROP TABLE IF EXISTS `ps_accessory`;
DROP TABLE IF EXISTS `ps_address`;
DROP TABLE IF EXISTS `ps_alias`;
DROP TABLE IF EXISTS `ps_attachment`;
DROP TABLE IF EXISTS `ps_attachment_lang`;
DROP TABLE IF EXISTS `ps_attribute`;
DROP TABLE IF EXISTS `ps_attribute_group`;
DROP TABLE IF EXISTS `ps_attribute_group_lang`;
DROP TABLE IF EXISTS `ps_attribute_lang`;
DROP TABLE IF EXISTS `ps_block_cms`;
DROP TABLE IF EXISTS `ps_blocklink`;
DROP TABLE IF EXISTS `ps_blocklink_lang`;
DROP TABLE IF EXISTS `ps_carrier`;
DROP TABLE IF EXISTS `ps_carrier_lang`;
DROP TABLE IF EXISTS `ps_carrier_zone`;
DROP TABLE IF EXISTS `ps_cart`;
DROP TABLE IF EXISTS `ps_cart_discount`;
DROP TABLE IF EXISTS `ps_cart_product`;
DROP TABLE IF EXISTS `ps_category`;
DROP TABLE IF EXISTS `ps_category_group`;
DROP TABLE IF EXISTS `ps_category_lang`;
DROP TABLE IF EXISTS `ps_category_product`;
DROP TABLE IF EXISTS `ps_cms`;
DROP TABLE IF EXISTS `ps_cms_lang`;
DROP TABLE IF EXISTS `ps_configuration`;
DROP TABLE IF EXISTS `ps_configuration_lang`;
DROP TABLE IF EXISTS `ps_connections`;
DROP TABLE IF EXISTS `ps_connections_page`;
DROP TABLE IF EXISTS `ps_connections_source`;
DROP TABLE IF EXISTS `ps_contact`;
DROP TABLE IF EXISTS `ps_contact_lang`;
DROP TABLE IF EXISTS `ps_country`;
DROP TABLE IF EXISTS `ps_country_lang`;
DROP TABLE IF EXISTS `ps_currency`;
DROP TABLE IF EXISTS `ps_customer`;
DROP TABLE IF EXISTS `ps_customer_group`;
DROP TABLE IF EXISTS `ps_customization`;
DROP TABLE IF EXISTS `ps_customization_field`;
DROP TABLE IF EXISTS `ps_customization_field_lang`;
DROP TABLE IF EXISTS `ps_customized_data`;
DROP TABLE IF EXISTS `ps_date_range`;
DROP TABLE IF EXISTS `ps_delivery`;
DROP TABLE IF EXISTS `ps_discount`;
DROP TABLE IF EXISTS `ps_discount_category`;
DROP TABLE IF EXISTS `ps_discount_lang`;
DROP TABLE IF EXISTS `ps_discount_quantity`;
DROP TABLE IF EXISTS `ps_discount_type`;
DROP TABLE IF EXISTS `ps_discount_type_lang`;
DROP TABLE IF EXISTS `ps_employee`;
DROP TABLE IF EXISTS `ps_feature`;
DROP TABLE IF EXISTS `ps_feature_lang`;
DROP TABLE IF EXISTS `ps_feature_product`;
DROP TABLE IF EXISTS `ps_feature_value`;
DROP TABLE IF EXISTS `ps_feature_value_lang`;
DROP TABLE IF EXISTS `ps_group`;
DROP TABLE IF EXISTS `ps_group_lang`;
DROP TABLE IF EXISTS `ps_guest`;
DROP TABLE IF EXISTS `ps_hook`;
DROP TABLE IF EXISTS `ps_hook_module`;
DROP TABLE IF EXISTS `ps_hook_module_exceptions`;
DROP TABLE IF EXISTS `ps_image`;
DROP TABLE IF EXISTS `ps_image_lang`;
DROP TABLE IF EXISTS `ps_image_type`;
DROP TABLE IF EXISTS `ps_lang`;
DROP TABLE IF EXISTS `ps_manufacturer`;
DROP TABLE IF EXISTS `ps_manufacturer_lang`;
DROP TABLE IF EXISTS `ps_message`;
DROP TABLE IF EXISTS `ps_message_readed`;
DROP TABLE IF EXISTS `ps_meta`;
DROP TABLE IF EXISTS `ps_meta_lang`;
DROP TABLE IF EXISTS `ps_module`;
DROP TABLE IF EXISTS `ps_module_country`;
DROP TABLE IF EXISTS `ps_module_currency`;
DROP TABLE IF EXISTS `ps_module_group`;
DROP TABLE IF EXISTS `ps_operating_system`;
DROP TABLE IF EXISTS `ps_order_detail`;
DROP TABLE IF EXISTS `ps_order_discount`;
DROP TABLE IF EXISTS `ps_order_history`;
DROP TABLE IF EXISTS `ps_order_message`;
DROP TABLE IF EXISTS `ps_order_message_lang`;
DROP TABLE IF EXISTS `ps_order_return`;
DROP TABLE IF EXISTS `ps_order_return_detail`;
DROP TABLE IF EXISTS `ps_order_return_state`;
DROP TABLE IF EXISTS `ps_order_return_state_lang`;
DROP TABLE IF EXISTS `ps_order_slip`;
DROP TABLE IF EXISTS `ps_order_slip_detail`;
DROP TABLE IF EXISTS `ps_order_state`;
DROP TABLE IF EXISTS `ps_order_state_lang`;
DROP TABLE IF EXISTS `ps_orders`;
DROP TABLE IF EXISTS `ps_pack`;
DROP TABLE IF EXISTS `ps_page`;
DROP TABLE IF EXISTS `ps_page_type`;
DROP TABLE IF EXISTS `ps_page_viewed`;
DROP TABLE IF EXISTS `ps_pagenotfound`;
DROP TABLE IF EXISTS `ps_product`;
DROP TABLE IF EXISTS `ps_product_attachment`;
DROP TABLE IF EXISTS `ps_product_attribute`;
DROP TABLE IF EXISTS `ps_product_attribute_combination`;
DROP TABLE IF EXISTS `ps_product_attribute_image`;
DROP TABLE IF EXISTS `ps_attribute_impact`;
DROP TABLE IF EXISTS `ps_product_download`;
DROP TABLE IF EXISTS `ps_product_lang`;
DROP TABLE IF EXISTS `ps_product_sale`;
DROP TABLE IF EXISTS `ps_product_tag`;
DROP TABLE IF EXISTS `ps_profile`;
DROP TABLE IF EXISTS `ps_profile_lang`;
DROP TABLE IF EXISTS `ps_quick_access`;
DROP TABLE IF EXISTS `ps_quick_access_lang`;
DROP TABLE IF EXISTS `ps_range_price`;
DROP TABLE IF EXISTS `ps_range_weight`;
DROP TABLE IF EXISTS `ps_referrer`;
DROP TABLE IF EXISTS `ps_referrer_cache`;
DROP TABLE IF EXISTS `ps_scene`;
DROP TABLE IF EXISTS `ps_scene_category`;
DROP TABLE IF EXISTS `ps_scene_lang`;
DROP TABLE IF EXISTS `ps_scene_products`;
DROP TABLE IF EXISTS `ps_search_engine`;
DROP TABLE IF EXISTS `ps_search_index`;
DROP TABLE IF EXISTS `ps_search_word`;
DROP TABLE IF EXISTS `ps_sekeyword`;
DROP TABLE IF EXISTS `ps_state`;
DROP TABLE IF EXISTS `ps_statssearch`;
DROP TABLE IF EXISTS `ps_subdomain`;
DROP TABLE IF EXISTS `ps_supplier`;
DROP TABLE IF EXISTS `ps_supplier_lang`;
DROP TABLE IF EXISTS `ps_tab`;
DROP TABLE IF EXISTS `ps_tab_lang`;
DROP TABLE IF EXISTS `ps_tag`;
DROP TABLE IF EXISTS `ps_tax`;
DROP TABLE IF EXISTS `ps_tax_lang`;
DROP TABLE IF EXISTS `ps_tax_state`;
DROP TABLE IF EXISTS `ps_tax_zone`;
DROP TABLE IF EXISTS `ps_timezone`;
DROP TABLE IF EXISTS `ps_web_browser`;
DROP TABLE IF EXISTS `ps_zone`;
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, deleted) VALUES (1, 'John', 'DOE', 'john@doe.com', 0);
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jenifer-Dylan', 'COX', 'jenifer-dylan@cox.com', '2008-06-06', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '234 rue de la Paix', '75000', 'Paris', 0), (2, 1, 1, '123 boulevard des Capucines', '72160', 'Stuttgart', 0), (3, 1, 1, '345 avenue des Fleurs', '44001', 'Dortmund', 0);
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'John', 'DORIAN', 'john@dorian.com', '1980-01-27', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Champs', '75000', 'Paris', 0), (2, 8, 1, '17 rue des Plomb', '44001', 'Dortmund', 0);
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, deleted) VALUES (1, 'John', 'DOE', 'john@doe.com', 0), (2, 'Jane', 'DOE', 'jane@doe.com', 0), (3, 'Dan', 'DOE', 'dan@doe.com', 0);
/* ********** Delete the Persons ********** */
DELETE FROM ps_customer;
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Chris', 'TURK', 'chris@turk.com', '1980-06-22', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Update person ********** */
UPDATE `ps_customer` SET birthday = '1974-06-22' WHERE id_customer = 1;
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Perry', 'COX', 'perry@cox.com', '1959-08-03', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '456 rue de la Paix', '75000', 'Paris', 0), (2, 1, 1, '789 avenue des Fleurs', '44001', 'Dortmund', 0);
/* ********** Update person ********** */
UPDATE `ps_customer` SET birthday = NULL WHERE id_customer = 1;
DELETE FROM `ps_address`;
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 1, 1, '123 boulevard des Capucines', '72160', 'Stuttgart', 0);
/* ********** Update person ********** */
UPDATE `ps_customer` SET birthday = '1959-08-03' WHERE id_customer = 1;
DELETE FROM `ps_address`;
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 1, 1, '123 boulevard des Capucines', '72160', 'Stuttgart', 0), (2, 1, 1, '789 avenue des Fleurs', '44001', 'Dortmund', 0);
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, active) VALUES (1, 1, 'my_ref', 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Tee-Shirt');
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '0123456789', 2.123456, 1.123456, 1234567890128, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Ballon de Foot');
/* ********** Variation declaration ********** */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* ********** Mapping between product and attribute ********** */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 1, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 1, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 1, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 1, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (3, 1), (1, 2), (4, 2), (2, 3), (3, 3), (2, 4), (4, 4);
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* ********** Variation declaration ********** */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* ********** Mapping between product and attribute ********** */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, active) VALUES (1, 1, '12345', 1), (2, 1, '34567', 1), (3, 1, '56789', 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Tee-Shirt'), (2, 2, 'Short'), (3, 2, 'Pull-Over');
/* ********** Delete the Products ********** */
DELETE FROM ps_product;
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, 'b246b', 2000.4, 1000.4, 1234567890128, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Ballon de Basket');
/* ********** Variation declaration ********** */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* ********** Mapping between product and attribute ********** */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 1, '', '', '', '', '0.000000', '0.00', '0.00', 11, 0, 0), (2, 1, '', '', '', '', '0.000000', '0.00', '0.00', 21, 0, 0), (3, 1, '', '', '', '', '0.000000', '0.00', '0.00', 31, 0, 0), (4, 1, '', '', '', '', '0.000000', '0.00', '0.00', 41, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (3, 1), (1, 2), (4, 2), (2, 3), (3, 3), (2, 4), (4, 4);
/* ********** Product declaration ********** */
UPDATE ps_product SET price = 20.0, wholesale_price = 10.0, ean13 = '0987654321098' WHERE id_product = 1;
/* ********** Product declaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, active) VALUES (1, 1, 'a5962z', 200.25, 100.25, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Ballon de Plage');
/* ********** Variation declaration ********** */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 1, NULL), (4, 2, '#FFFFFF'), (5, 2, '#000000'), (6, 2, '#FF0000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 's6'), (4, 2, 'Blanc'), (5, 2, 'Noir'), (6, 2, 'Rouge');
/* ********** Mapping between product and attribute ********** */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 1, '', '', '', '', '0.000000', '0.00', '0.00', 12, 0, 0), (2, 1, '', '', '', '', '0.000000', '0.00', '0.00', 22, 0, 0), (3, 1, '', '', '', '', '0.000000', '0.00', '0.00', 32, 0, 0), (4, 1, '', '', '', '', '0.000000', '0.00', '0.00', 42, 0, 0), (5, 1, '', '', '', '', '0.000000', '0.00', '0.00', 52, 0, 0), (6, 1, '', '', '', '', '0.000000', '0.00', '0.00', 62, 0, 0), (7, 1, '', '', '', '', '0.000000', '0.00', '0.00', 72, 0, 0), (8, 1, '', '', '', '', '0.000000', '0.00', '0.00', 82, 0, 0), (9, 1, '', '', '', '', '0.000000', '0.00', '0.00', 92, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (4, 1), (1, 2), (5, 2), (2, 3), (4, 3), (2, 4), (5, 4);
/* ********** Product declaration ********** */
UPDATE ps_product SET price = 120.0, wholesale_price = 0.0, ean13 = '1357913579130' WHERE id_product = 1;
/* ********** Update the variations ********** */
DELETE FROM `ps_product_attribute_combination`;
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (4, 1), (1, 2), (6, 2), (3, 3), (4, 3), (3, 4), (6, 4);
/* ********** Update the variations ********** */
DELETE FROM `ps_product_attribute_combination`;
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (4, 1), (1, 3), (4, 3);
/* ********** Update the variations ********** */
DELETE FROM `ps_product_attribute_combination`;
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (4, 1), (1, 2), (5, 2), (1, 3), (6, 3), (2, 4), (4, 4), (2, 5), (6, 5), (2, 6), (4, 6), (3, 7), (4, 7), (3, 8), (6, 8), (3, 9), (4, 9);
/* ********** Variation declaration ********** */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 1, NULL), (4, 2, '#FFFFFF'), (5, 2, '#000000'), (6, 2, '#FF0000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 's6'), (4, 2, 'Blanc'), (5, 2, 'Noir'), (6, 2, 'Rouge');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order declaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','10.49','10.49','2.10','7.98','0.00',0,0,'2010-06-14 09:00:00','2010-06-16 09:00:00',0,'2010-06-14 09:00:00','2010-06-14 09:00:00');
INSERT INTO `ps_order_detail` VALUES (1,1,1,0,'Stylo',1,1,0,0,0,'2.100000','0.000000',NULL,'01111',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:00:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:00:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:00:00','2010-06-14 09:00:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,2,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','104.62','104.62','80.80','7.98','0.00',0,0,'2010-06-14 09:10:00','2010-06-16 09:10:00',0,'2010-06-14 09:10:00','2010-06-14 09:10:00');
INSERT INTO `ps_order_detail` VALUES (
1,1,2,1,'Ballon - Taille du Ballon : s4',2,2,0,0,0,'20.200000','0.000000','2222222222222','02222',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:10:00'), (2,1,2,2,'Ballon - Taille du Ballon : s5',2,2,0,0,0,'20.200000','0.000000','2222222222222','02222',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:10:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:10:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:10:00','2010-06-14 09:10:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','966.22','966.22','801.20','7.98','0.00',0,0,'2010-06-14 09:20:00','2010-06-16 09:20:00',0,'2010-06-14 09:20:00','2010-06-14 09:20:00');
INSERT INTO `ps_order_detail` VALUES (1,1,3,3,'Ballon de Foot - Couleur : Blanc',2,2,0,0,0,'200.300000','0.000000','3333333333338','03333',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:20:00'), (2,1,3,4,'Ballon de Foot - Couleur : Noir',2,2,0,0,0,'200.300000','0.000000','3333333333338','03333',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:20:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:20:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 16:25:00','2010-06-14 09:20:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','19147.81','19147.81','16003.20','7.98','0.00',0,0,'2010-06-14 09:30:00','2010-06-16 09:30:00',0,'2010-06-14 09:30:00','2010-06-14 09:30:00');
INSERT INTO `ps_order_detail` VALUES (1,1,4,5,'Ballon de Basket - Couleur : Blanc, Taille du Ballon : s4',4,4,0,0,0,'2000.400000','0.000000','4444444444444','044444',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:30:00'), (7,1,4,8,'Ballon de Basket - Couleur : Noir, Taille du Ballon : s5',4,4,0,0,0,'2000.400000','0.000000','4444444444444','044444',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 00:30:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:30:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 16:26:00','2010-06-14 09:30:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','5.00','10.49','5.49','2.10','7.98','0.00',0,0,'2010-06-14 09:00:00','2010-06-16 09:00:00',0,'2010-06-14 09:00:00','2010-06-14 09:00:00');
INSERT INTO `ps_order_detail` VALUES (1,1,1,0,'Stylo',1,1,0,0,0,'2.100000','0.000000',NULL,'01111',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:00:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:00:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:00:00','2010-06-14 09:00:00');
INSERT INTO `ps_discount` VALUES (1,2,1,'Dicount 5 Euro','5.00',0,1,0,0,'2010-06-14 00:00:00','2010-06-14 22:00:00','1.00',1);
INSERT INTO `ps_order_discount` VALUES (1,1,1,'Discount 5 Euro','5.00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,0,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','10.49','10.49','2.10','7.98','0.00',0,0,'2010-06-14 09:00:00','2010-06-16 09:00:00',0,'2010-06-14 09:00:00','2010-06-14 09:00:00');
INSERT INTO `ps_order_detail` VALUES (1,1,1,0,'Stylo',1,1,0,0,0,'2.100000','0.000000',NULL,'01111',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:00:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:00:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:00:00','2010-06-14 09:00:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0);
/* FIXME: Is variation are keep even if the product is removed ?? , (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0) */
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','19147.81','19147.81','16003.20','7.98','0.00',0,0,'2010-06-14 09:30:00','2010-06-16 09:30:00',0,'2010-06-14 09:30:00','2010-06-14 09:30:00');
INSERT INTO `ps_order_detail` VALUES (1,1,0,5,'Ballon de Basket - Couleur : Blanc, Taille du Ballon : s4',4,4,0,0,0,'2000.400000','0.000000','4444444444444','044444',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:30:00'), (7,1,0,8,'Ballon de Basket - Couleur : Noir, Taille du Ballon : s5',4,4,0,0,0,'2000.400000','0.000000','4444444444444','044444',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 00:30:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:00:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:00:00','2010-06-14 09:00:00');
/* ********** Person delcaration ********** */
INSERT INTO `ps_customer` (id_customer, firstname, lastname, email, birthday, deleted) VALUES (1, 'Jean', 'GRAY', 'jean@gray.com', '1985-04-05', 0);
INSERT INTO `ps_address` (id_address, id_country, id_customer, address1, postcode, city, deleted) VALUES (1, 8, 1, '22 rue des Peupliers', '75000', 'Paris', 0);
/* ********** Product delcaration ********** */
INSERT INTO `ps_product` (id_product, id_tax, reference, price, wholesale_price, ean13, active) VALUES (1, 1, '01111', 2.1, 1.1, NULL, 1), (2, 1, '02222', 20.2, 10.2, 2222222222222, 1), (3, 1, '03333', 200.3, 100.3, 3333333333338, 1), (4, 1, '04444', 2000.4, 1000.4, 4444444444444, 1);
INSERT INTO `ps_product_lang` (id_product, id_lang, name) VALUES (1, 2, 'Stylo'), (2, 2, 'Ballon'), (3, 2, 'Ballon de Foot'), (4, 2, 'Ballon de Basket');
/* Variation declaration */
INSERT INTO `ps_attribute_group_lang` (id_attribute_group, id_lang, name, public_name) VALUES (1, 2, 'Taille du Ballon', 'Taille du Ballon'), (2, 2, 'Couleur', 'Couleur');
INSERT INTO `ps_attribute` (id_attribute, id_attribute_group, color) VALUES (1, 1, NULL), (2, 1, NULL), (3, 2, '#FFFFFF'), (4, 2, '#000000');
INSERT INTO `ps_attribute_lang` (id_attribute, id_lang, name) VALUES (1, 2, 's4'), (2, 2, 's5'), (3, 2, 'Blanc'), (4, 2, 'Noir');
/* Mapping between product and attribute */
INSERT INTO `ps_product_attribute` (id_product_attribute, id_product, reference, supplier_reference, location, ean13, wholesale_price, price, ecotax, quantity, weight, default_on) VALUES (1, 2, '', '', '', '', '0.000000', '0.00', '0.00', 10, 0, 0), (2, 2, '', '', '', '', '0.000000', '0.00', '0.00', 20, 0, 0), (3, 3, '', '', '', '', '0.000000', '0.00', '0.00', 30, 0, 0), (4, 3, '', '', '', '', '0.000000', '0.00', '0.00', 40, 0, 0), (5, 4, '', '', '', '', '0.000000', '0.00', '0.00', 50, 0, 0), (6, 4, '', '', '', '', '0.000000', '0.00', '0.00', 60, 0, 0), (7, 4, '', '', '', '', '0.000000', '0.00', '0.00', 70, 0, 0), (8, 4, '', '', '', '', '0.000000', '0.00', '0.00', 80, 0, 0);
INSERT INTO `ps_product_attribute_combination` (id_attribute, id_product_attribute) VALUES (1, 1), (2, 2), (3, 3), (4, 4), (1, 5), (3, 5), (1, 6), (4, 6), (2, 7), (3, 7), (2, 8), (4, 8);
/* ********** Sale Order delcaration ********** */
INSERT INTO `ps_orders` VALUES (1,2,2,1,1,1,1,1,'40959ebe0a5332ea6864b557ee546915','CB','carte bancaire',1,0,'','','0.00','10.49','10.49','2.10','7.98','0.00',0,0,'2010-06-14 09:00:00','2010-06-16 09:00:00',0,'2010-06-14 09:00:00','2010-06-14 09:00:00');
INSERT INTO `ps_order_detail` VALUES (1,1,1,0,'Stylo',1,1,0,0,0,'2.100000','0.000000',NULL,'01111',NULL,0,'TVA 19.6%','19.60','0.00','',0,'2010-06-14 09:00:00');
INSERT INTO `ps_order_history` VALUES (1,0,1,4,'2010-06-14 09:00:00');
INSERT INTO `ps_cart` VALUES (1,2,2,1,1,1,1,1,1,0,'','2010-06-14 09:00:00','2010-06-14 09:00:00');
/* ********** Update the Sale Order ********** */
UPDATE ps_orders SET invoice_date = '2010-06-15 09:10:00' WHERE id_order = 1;
/* ********** Delete the Sale Order ********** */
DELETE FROM ps_orders;
##############################################################################
# -*- coding: utf8 -*-
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Jerome Perrin <jerome@nexedi.com>
# Guy Oswald Obama <guy@nexedi.com>
#
#
##############################################################################
"""Test suites for packaging of tiosafe
"""
from testTioSafeMixin import testTioSafeMixin
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
current_user_name = 'herve'
class TestPackaging(testTioSafeMixin):
"""Test business template packaging.
Ce teste s'assure que certains éléments du site sont bien installés. Il peut
également être utilisé pour initialiser un site.
"""
def getTitle(self):
return "TioSafe Business template packaging."
def _createUser(self, user_name, user_groups, user_roles=['Member'], **kw):
"""Create a user.
"""
kw['reference'] = user_name
#kw.setdefault('password', 'secret')
person = self.portal.person_module.newContent(**kw)
assignment = person.newContent(
portal_type='Assignment',
start_date=DateTime(),
stop_date=DateTime() + 10,)
assignment.open()
get_transaction().commit()
self.tic()
zodb_roles = self.portal.acl_users.zodb_roles
for role in user_roles:
if role != 'Member':
zodb_roles.assignRoleToPrincipal(role, user_name)
def loginAsUser(self, user_id):
"""Login with a given user_id """
uf = self.getPortal().acl_users
user = uf.getUserById(user_id).__of__(uf)
return newSecurityManager(None, user)
def afterSetUp(self):
"""set up """
self._createUser(current_user_name, [], ['Author', 'Auditor', 'Assignee',
'Assignor', 'Associate', 'Manager'])
self.loginAsUser(current_user_name)
portal = self.getPortal()
self.portal = portal
self.skin_tool = portal.portal_skins
self.workflow_tool = portal.portal_workflow
self.category_tool = portal.portal_categories
self.preferences_tool = portal.portal_preferences
def test_skins(self):
"""Test skins are present."""
for skin_name in ( 'erp5_base',
'erp5_pdm',
'erp5_trade',
'erp5_accounting',
'erp5_invoicing',
'erp5_simplified_invoicing',
'erp5_syncml',
'erp5_integration',
'erp5_oauth',
):
self.failUnless(skin_name in self.skin_tool.objectIds(), skin_name)
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPackaging))
return suite
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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 transaction
from DateTime import DateTime
from Products.ERP5TioSafe.tests.testPrestashopMixin import testPrestashopMixin
class testPersonERP5Synchronization(testPrestashopMixin):
""" This class allows to check different cases of Person's sync. """
def afterSetUp(self):
""" This method is called after the SetUp method. """
# Shortcut for modules and tools
self.person_module = self.portal.person_module
self.connection = self.portal.erp5_sql_connection
self.prestashop = self.portal.portal_integrations.prestashop
self.root_xml = '<directory>\n%s\n</directory>'
def test_PrestashopSimplestXMLSync(self):
""" This test checks the person sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_01.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
person = self.person_module.contentValues()[0]
self.assertEqual(person.getTitle(), 'John DOE')
self.assertEqual(person.getFirstName(), 'John')
self.assertEqual(person.getLastName(), 'DOE')
self.assertEqual(person.getDefaultEmailText(), 'john@doe.com')
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % person.Node_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopPersonWithSingleAddressSync(self):
""" This test checks the person sync with an address. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_02.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
person = self.person_module.contentValues()[0]
self.assertEqual(person.getTitle(), 'Jean GRAY')
self.assertEqual(person.getFirstName(), 'Jean')
self.assertEqual(person.getLastName(), 'GRAY')
self.assertEqual(person.getDefaultEmailText(), 'jean@gray.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('1985-04-05')))
self.assertEqual(len(person.searchFolder(portal_type='Address')), 1)
self.assertEqual(
person.getDefaultAddressStreetAddress(),
'22 rue des Peupliers',
)
self.assertEqual(person.getDefaultAddressZipCode(), '75000')
self.assertEqual(person.getDefaultAddressCity(), 'Paris')
self.assertEqual(person.getDefaultAddressRegionTitle(), 'France')
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % person.Node_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopPersonWithMultipleAddressSync(self):
""" This test checks the person sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_03.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
person = self.person_module.contentValues()[0]
self.assertEqual(person.getTitle(), 'Jenifer-Dylan COX')
self.assertEqual(person.getFirstName(), 'Jenifer-Dylan')
self.assertEqual(person.getLastName(), 'COX')
self.assertEqual(person.getDefaultEmailText(), 'jenifer-dylan@cox.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('2008-06-06')))
self.assertEqual(len(person.searchFolder(portal_type='Address')), 3)
for address in person.searchFolder(portal_type='Address'):
index = address.getId()
if index == 'default_address':
self.assertEqual(
address.getStreetAddress(),
'123 boulevard des Capucines',
)
self.assertEqual(address.getZipCode(), '72160')
self.assertEqual(address.getCity(), 'Stuttgart')
self.assertEqual(address.getRegionTitle(), 'Allemagne')
elif index == '2':
self.assertEqual(
address.getStreetAddress(),
'234 rue de la Paix',
)
self.assertEqual(address.getZipCode(), '75000')
self.assertEqual(address.getCity(), 'Paris')
self.assertEqual(address.getRegionTitle(), 'France')
elif index == '3':
self.assertEqual(address.getStreetAddress(), '345 avenue des Fleurs')
self.assertEqual(address.getZipCode(), '44001')
self.assertEqual(address.getCity(), 'Dortmund')
self.assertEqual(address.getRegionTitle(), 'Allemagne')
else:
raise ValueError, 'Can not check the address: %s of the person: %s' % \
(address.getId(), person.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % person.Node_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopPersonWithAddressNoMappingSync(self):
""" This test checks the person sync with an address and no mapping. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_04.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Check that an empty mapping is created in integration site
self.assertTrue(self.prestashop.get('Country', None) is None)
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 0)
def test_PrestashopDeletePerson(self):
""" Check that the delete during a person's sync invalidate the person. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_05.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 3)
# Move the persons as draft, validated and invalidated state
john_doe = self.person_module.searchFolder(
portal_type='Person',
title='John DOE',
)[0].getObject()
jane_doe = self.person_module.searchFolder(
portal_type='Person',
title='Jane DOE',
)[0].getObject()
if jane_doe.getValidationState() != "validated":
jane_doe.validate()
dan_doe = self.person_module.searchFolder(
portal_type='Person',
title='Dan DOE',
)[0].getObject()
if dan_doe.getValidationState() != "validated":
dan_doe.validate()
dan_doe.invalidate()
# Remove the persons in prestashop and check that after sync the state
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_06.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
self.assertEqual(john_doe.getValidationState(), 'validated')
self.assertEqual(jane_doe.getValidationState(), 'validated')
self.assertEqual(dan_doe.getValidationState(), 'invalidated')
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 3)
self.assertEqual(john_doe.getValidationState(), 'invalidated')
self.assertEqual(jane_doe.getValidationState(), 'invalidated')
self.assertEqual(dan_doe.getValidationState(), 'invalidated')
def test_PrestashopUpdateSimpleElement(self):
""" This test checks the simple update after sync of persons. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_07.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
person = self.person_module.contentValues()[0]
self.assertEqual(person.getTitle(), 'Chris TURK')
self.assertEqual(person.getFirstName(), 'Chris')
self.assertEqual(person.getLastName(), 'TURK')
self.assertEqual(person.getDefaultEmailText(), 'chris@turk.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('1980-06-22')))
self.assertEqual(len(person.searchFolder(portal_type='Address')), 1)
self.assertEqual(
person.getDefaultAddressStreetAddress(),
'22 rue des Peupliers',
)
self.assertEqual(person.getDefaultAddressZipCode(), '75000')
self.assertEqual(person.getDefaultAddressCity(), 'Paris')
self.assertEqual(person.getDefaultAddressRegionTitle(), 'France')
# Update the data, run the sync and check the data after the update
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_08.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
self.assertEqual(person.getTitle(), 'Chris TURK')
self.assertEqual(person.getFirstName(), 'Chris')
self.assertEqual(person.getLastName(), 'TURK')
self.assertEqual(person.getDefaultEmailText(), 'chris@turk.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('1974-06-22')))
self.assertEqual(len(person.searchFolder(portal_type='Address')), 1)
self.assertEqual(
person.getDefaultAddressStreetAddress(),
'22 rue des Peupliers',
)
self.assertEqual(person.getDefaultAddressZipCode(), '75000')
self.assertEqual(person.getDefaultAddressCity(), 'Paris')
self.assertEqual(person.getDefaultAddressRegionTitle(), 'France')
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % person.Node_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopComplexeUpdateElement(self):
"""
This test checks the complexe update after sync of persons.
It updates some element, adds others and removes the last.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_09.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.person_module.contentValues()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 1)
person = self.person_module.contentValues()[0]
self.assertEqual(person.getTitle(), 'Perry COX')
self.assertEqual(person.getFirstName(), 'Perry')
self.assertEqual(person.getLastName(), 'COX')
self.assertEqual(person.getDefaultEmailText(), 'perry@cox.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('1959-08-03')))
address_list = person.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(address_list), 2)
for index, address in enumerate(address_list):
if index == 0:
self.assertEqual(address.getStreetAddress(), '789 avenue des Fleurs')
self.assertEqual(address.getZipCode(), '44001')
self.assertEqual(address.getCity(), 'Dortmund')
self.assertEqual(address.getRegionTitle(), 'Allemagne')
elif index == 1:
self.assertEqual(address.getStreetAddress(), '456 rue de la Paix')
self.assertEqual(address.getZipCode(), '75000')
self.assertEqual(address.getCity(), 'Paris')
self.assertEqual(address.getRegionTitle(), 'France')
else:
raise ValueError, 'Can not check the address: %s of the person: %s' % \
(index, person.getTitle())
# The first update check remove of simple element, remove an address
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_10.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(person.getTitle(), 'Perry COX')
self.assertEqual(person.getFirstName(), 'Perry')
self.assertEqual(person.getLastName(), 'COX')
self.assertEqual(person.getDefaultEmailText(), 'perry@cox.com')
self.assertEqual(person.getStartDate(), None)
self.assertEqual(len(person.searchFolder(portal_type='Address')), 1)
self.assertEqual(
person.getDefaultAddressStreetAddress(),
'123 boulevard des Capucines',
)
self.assertEqual(person.getDefaultAddressZipCode(), '72160')
self.assertEqual(person.getDefaultAddressCity(), 'Stuttgart')
self.assertEqual(person.getDefaultAddressRegionTitle(), 'Allemagne')
# The second update check the add of a simple element and the add of
# address
self.loadSQLDump(
self.connection,
'%s/dump_person_sync_11.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(person.getTitle(), 'Perry COX')
self.assertEqual(person.getFirstName(), 'Perry')
self.assertEqual(person.getLastName(), 'COX')
self.assertEqual(person.getDefaultEmailText(), 'perry@cox.com')
self.assertEqual(str(person.getStartDate()), str(DateTime('1959-08-03')))
address_list = person.searchFolder(
portal_type='Address',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(address_list), 2)
for index, address in enumerate(address_list):
if index == 0:
self.assertEqual(address.getStreetAddress(), '789 avenue des Fleurs')
self.assertEqual(address.getZipCode(), '44001')
self.assertEqual(address.getCity(), 'Dortmund')
self.assertEqual(address.getRegionTitle(), 'Allemagne')
elif index == 1:
self.assertEqual(
address.getStreetAddress(),
'123 boulevard des Capucines',
)
self.assertEqual(address.getZipCode(), '72160')
self.assertEqual(address.getCity(), 'Stuttgart')
self.assertEqual(address.getRegionTitle(), 'Allemagne')
else:
raise ValueError, 'Can not check the address: %s of the person: %s' % \
(index, person.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % person.Node_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
xsd_path='../XSD/nodes.xsd',
)
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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 transaction
from Products.ERP5TioSafe.tests.testPrestashopMixin import testPrestashopMixin
class testPersonPrestashopSynchronization(testPrestashopMixin):
""" This class allows to check different cases of Person's sync. """
def afterSetUp(self):
""" This method is called after the SetUp method. """
# Shortcut for modules and tools
self.person_module = self.portal.person_module
self.portal_sync= self.portal.portal_synchronizations
self.prestashop = self.portal.portal_integrations.prestashop
self.root_xml = '<directory>\n%s\n</directory>'
def test_PrestashopSimplestXMLSync(self):
""" This test checks the person sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
person = self.person_module.newContent(
portal_type='Person',
title='John DOE',
first_name='John',
last_name='DOE',
default_email_text='john@doe.com',
career_role_list = ['client'],
)
person.validate()
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopPersonWithSingleAddressSync(self):
""" This test checks the person sync with an address. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
person = self.person_module.newContent(
portal_type='Person',
title='Jean GRAY',
first_name='Jean',
last_name='GRAY',
start_date='1985-04-05',
default_email_text='jean@gray.com',
career_role_list = ['client'],
)
person.setDefaultAddressStreetAddress('22 rue des Peupliers')
person.setDefaultAddressZipCode('75000')
person.setDefaultAddressCity('Paris')
person.setDefaultAddressRegion('france')
person.validate()
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopPersonWithMultipleAddressSync(self):
""" This test checks the person sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
person = self.person_module.newContent(
portal_type='Person',
title='Jenifer-Dylan COX',
first_name='Jenifer-Dylan',
last_name='COX',
start_date='2008-06-06',
default_email_text='jenifer-dylan@cox.com',
career_role_list = ['client'],
)
# default address
person.setDefaultAddressStreetAddress('123 boulevard des Capucines')
person.setDefaultAddressZipCode('72160')
person.setDefaultAddressCity('Stuttgart')
person.setDefaultAddressRegion('europe/western_europe/allemagne')
person.validate()
# second address
person.newContent(
portal_type='Address',
id='2',
street_address='234 rue de la Paix',
zip_code='75000',
city='Paris',
region='france',
)
# third address
person.newContent(
portal_type='Address',
id='3',
street_address='345 avenue des Fleurs',
zip_code='44001',
city='Dortmund',
region='europe/western_europe/allemagne',
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopDeletePerson(self):
""" Check that the delete during a person's sync invalidate the person. """
# Initialize the instance and prestashop
self.initPrestashopTest()
person = self.person_module.newContent(
portal_type='Person',
title='John DOE',
first_name='John',
last_name='DOE',
default_email_text='john@doe.com',
career_role_list = ['client'],
)
person.validate()
transaction.commit()
self.tic()
# Run the sync of persons
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Remove the persons in ERP5 and check that after sync in prestashop
self.person_module.manage_delObjects([person.getId(), ])
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.person_module.contentValues()), 0)
def test_PrestashopUpdateSimpleElement(self):
""" This test checks the simple update after sync of persons. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
person = self.person_module.newContent(
portal_type='Person',
title='Chris TURK',
first_name='Chris',
last_name='TURK',
default_email_text='chris@turk.com',
default_address_street_address='22 rue des Peupliers',
default_address_zip_code='75000',
default_address_city='Paris',
default_address_region='france',
career_role_list = ['client'],
)
person.validate()
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
# Update the data, run the sync and check the data after the update
person.setStartDate('1974-06-22')
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
def test_PrestashopComplexeUpdateElement(self):
"""
This test checks the complexe update after sync of persons.
It updates some element, adds others and removes the last.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
person = self.person_module.newContent(
portal_type='Person',
title='Perry COX',
first_name='Perry',
last_name='COX',
default_email_text='perry@cox.com',
start_date='1959-08-03',
default_address_street_address='456 rue de la Paix',
default_address_zip_code='75000',
default_address_city='Paris',
default_address_region='france',
career_role_list = ['client'],
)
person.validate()
address2 = person.newContent(
portal_type='Address',
street_address='789 avenue des Fleurs',
zip_code='44001',
city='Dortmund',
region='europe/western_europe/allemagne',
)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.prestashop.person_module()), 0)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
# The first update check remove of simple element, remove an address
person.setStartDate(None)
person.manage_delObjects([address2.getId(), ])
person.setDefaultAddressStreetAddress('123 boulevard des Capucines')
person.setDefaultAddressZipCode('72160')
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
# The second update check the add of a simple element and the add of
# address
person.setStartDate('1959-08-03') # TODO: Why it doesn't work ???
person.setDefaultAddressCity('Stuttgart')
address2 = person.newContent(
portal_type='Address',
street_address='789 avenue des Fleurs',
zip_code='44001',
city='Dortmund',
region='europe/western_europe/allemagne',
)
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
# The third update check the remove of element in addresses
person.setDefaultAddressZipCode('73000')
address2.setCity('Munich')
self.loadSync([self.prestashop.person_module, ])
self.assertEqual(len(self.prestashop.person_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.person_module()[0].asXML(),
tiosafe_xml=self.root_xml % person.Node_asTioSafeXML(),
xsd_path='../XSD/nodes.xsd',
)
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@nexedi.com>
# Hervé Poulain <herve@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 os
import transaction
from Products.ERP5TioSafe.tests.testTioSafeMixin import testTioSafeMixin
class testPrestashopMixin(testTioSafeMixin):
""" This class provides the Prestashop generics elements. """
def getBusinessTemplateList(self):
""" Return the list of BT required by unit tests. """
return (
'erp5_base',
'erp5_pdm',
'erp5_trade',
'erp5_simulation',
'erp5_simulation_legacy',
'erp5_trade_simulation_legacy',
'erp5_syncml',
'erp5_tiosafe_core',
'erp5_tiosafe_prestashop',
'erp5_tiosafe_test',
)
def initPrestashopTest(self):
""" This method is called after the SetUp method. """
# Declare some shortcuts
self.prestashop = self.portal.portal_integrations.prestashop
# Path for integration site dump
self.ps_dump_path = 'dump/prestashop'
# Init the prestashop database
self.loadSQLDump(
self.portal.erp5_sql_connection,
'dump/prestashop/dump_00_init_tables.sql',
)
# set the language used by prestashop
self.prestashop.setLanguage(2)
# Update the connection to use the PHPUnitTestConnection
url = os.path.dirname(__file__)
url = url.split('/ERP5TioSafe/')[0] + '/ERP5TioSafe'
url += '/plugins/prestashop/modules/oneclickconnect'
connection_plugin = self.getConnectionPlugin(self.prestashop)
connection_plugin.setUrlString(url)
connection_plugin.setTransport('php_unit_test')
self.updateSynchronizationObjects()
self.organisation = self.portal.organisation_module.tiosafe_default_organisation
self.prestashop.recursiveReindexObject()
transaction.commit()
self.tic()
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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 transaction
from Products.ERP5TioSafe.tests.testPrestashopMixin import testPrestashopMixin
class testProductERP5Synchronization(testPrestashopMixin):
""" This class allows to check different cases of Product's sync. """
def afterSetUp(self):
""" This method is called after the SetUp method. """
# Shortcut for modules and tools
self.product_module = self.portal.product_module
self.portal_categories = self.portal.portal_categories
self.portal_sync = self.portal.portal_synchronizations
self.connection = self.portal.erp5_sql_connection
self.prestashop = self.portal.portal_integrations.prestashop
self.root_xml = '<catalog>\n%s\n</catalog>'
def test_PrestashopSimplestXMLSync(self):
""" This test checks the product sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_01.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Tee-Shirt')
self.assertEqual(product.getReference(), 'my_ref')
self.assertEqual(product.getUse(), 'sale')
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopIndividualVariationSync(self):
""" This test check the product sync with individual variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_02.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Ballon de Foot')
self.assertEqual(product.getReference(), '0123456789')
self.assertEqual(product.getEan13Code(), '1234567890128')
self.assertEqual(product.getUse(), 'sale')
# Check the individual variations
# FIXME: When no mapping is created between ERP5 and Prestashop, the full
# variation is created as individual variation, ie:
# Ball Size/s4 and Ball Size/s5 will be an individual variations,
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 4)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size', ])
elif index == '2':
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size', ])
elif index == '3':
self.assertEqual(title, 'Blanc')
self.assertEqual(base_category_list, ['colour', ])
elif index == '4':
self.assertEqual(title, 'Noir')
self.assertEqual(base_category_list, ['colour', ])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(index, product.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopSharedVariationSync(self):
""" This test check the product sync with shared variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_02.sql' % self.ps_dump_path,
)
self.initMapping(self.prestashop)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Ballon de Foot')
self.assertEqual(product.getReference(), '0123456789')
self.assertEqual(product.getEan13Code(), '1234567890128')
self.assertEqual(product.getUse(), 'sale')
# Check the shared variations
self.assertEqual(
product.contentValues(portal_type='Product Individual Variation'),
[],
)
sorted_shared_category_list = product.getVariationCategoryList()
sorted_shared_category_list.sort()
self.assertEqual(len(sorted_shared_category_list), 4)
for i, variation in enumerate(sorted_shared_category_list):
if i == 0:
self.assertEqual(variation, 'ball_size/x4')
elif i == 1:
self.assertEqual(variation, 'ball_size/x5')
elif i == 2:
self.assertEqual(variation, 'colour/black')
elif i == 3:
self.assertEqual(variation, 'colour/white')
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(variation, product.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopDifferentKindVariationsSync(self):
""" This test check the product sync with the two kind of variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_02.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Ballon de Foot')
self.assertEqual(product.getReference(), '0123456789')
self.assertEqual(product.getEan13Code(), '1234567890128')
self.assertEqual(product.getUse(), 'sale')
# Check the shared variations
sorted_shared_category_list = product.getVariationCategoryList()
sorted_shared_category_list.sort()
self.assertEqual(len(sorted_shared_category_list), 2)
for i, variation in enumerate(sorted_shared_category_list):
if i == 0:
self.assertEqual(variation, 'colour/black')
elif i == 1:
self.assertEqual(variation, 'colour/white')
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(variation, product.getTitle())
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 2)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == '2':
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(index, product.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopMultipleSync(self):
""" This test check the multiple product sync. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_03.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 4)
# Check the product 'Stylo'
product_1 = self.product_module.searchFolder(
portal_type='Product',
title='Stylo',
)[0].getObject()
self.assertEqual(product_1.getTitle(), 'Stylo')
self.assertEqual(product_1.getReference(), '01111')
self.assertEqual(product_1.getUse(), 'sale')
# Check the product 'Ballon'
product_2 = self.product_module.searchFolder(
portal_type='Product',
title='Ballon',
)[0].getObject()
self.assertEqual(product_2.getTitle(), 'Ballon')
self.assertEqual(product_2.getReference(), '02222')
self.assertEqual(product_2.getEan13Code(), '2222222222222')
self.assertEqual(product_2.getUse(), 'sale')
self.assertEqual(product_2.getVariationCategoryList(), [])
individual_variation_list = product_2.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == '2':
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(index, product_2.getTitle())
# Check the product 'Ballon de foot'
product_3 = self.product_module.searchFolder(
portal_type='Product',
title='Ballon de Foot',
)[0].getObject()
self.assertEqual(product_3.getTitle(), 'Ballon de Foot')
self.assertEqual(product_3.getReference(), '03333')
self.assertEqual(product_3.getEan13Code(), '3333333333338')
self.assertEqual(product_3.getUse(), 'sale')
self.assertEqual(
product_3.contentValues(portal_type='Product Individual Variation'),
[],
)
sorted_shared_category_list = product_3.getVariationCategoryList()
sorted_shared_category_list.sort()
self.assertEqual(len(sorted_shared_category_list), 2)
for i, variation in enumerate(sorted_shared_category_list):
if i == 0:
self.assertEqual(variation, 'colour/black')
elif i == 1:
self.assertEqual(variation, 'colour/white')
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(variation, product_3.getTitle())
# Check the product 'Ballon de Basket'
product_4 = self.product_module.searchFolder(
portal_type='Product',
title='Ballon de Basket',
)[0].getObject()
self.assertEqual(product_4.getTitle(), 'Ballon de Basket')
self.assertEqual(product_4.getReference(), '04444')
self.assertEqual(product_4.getEan13Code(), '4444444444444')
self.assertEqual(product_4.getUse(), 'sale')
shared_variation_list = product_4.getVariationCategoryList()
shared_variation_list.sort()
self.assertEqual(len(shared_variation_list), 2)
for i, variation in enumerate(shared_variation_list):
if i == 0:
self.assertEqual(variation, 'colour/black')
elif i == 1:
self.assertEqual(variation, 'colour/white')
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(variation, product_4.getTitle())
individual_variation_list = product_4.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 2)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == '2':
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(index, product_4.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product_1.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module[1].asXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml= self.root_xml % product_2.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module[2].asXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml= self.root_xml % product_3.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module[3].asXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml= self.root_xml % product_4.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module[4].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopDeleteProduct(self):
""" Check that delete during a product's sync invalidate the product. """
# Initialize the instance and prestashop
product_module = self.portal.product_module
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_04.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run the sync of products
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 3)
# Move the products as validated and invalidated state
tee_shirt = product_module.searchFolder(
portal_type='Product',
title='Tee-Shirt',
)[0].getObject()
short = product_module.searchFolder(
portal_type='Product',
title='Short',
)[0].getObject()
pull_over = product_module.searchFolder(
portal_type='Product',
title='Pull-Over',
)[0].getObject()
pull_over.invalidate()
# Remove the products in prestashop and check that after sync the states
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_05.sql' % self.ps_dump_path,
)
self.assertEqual(tee_shirt.getValidationState(), 'validated')
self.assertEqual(short.getValidationState(), 'validated')
self.assertEqual(pull_over.getValidationState(), 'invalidated')
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 3)
self.assertEqual(tee_shirt.getValidationState(), 'invalidated')
self.assertEqual(short.getValidationState(), 'invalidated')
self.assertEqual(pull_over.getValidationState(), 'invalidated')
def test_PrestashopUpdateSimpleElement(self):
""" This test checks the simple update after sync of products. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_06.sql' % self.ps_dump_path,
)
self.initMapping(self.prestashop)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Ballon de Basket')
self.assertEqual(product.getReference(), 'b246b')
self.assertEqual(product.getEan13Code(), '1234567890128')
self.assertEqual(product.getUse(), 'sale')
base_category_list = product.getVariationBaseCategoryList()
base_category_list.sort()
self.assertEqual(len(base_category_list), 2)
self.assertEqual(base_category_list, ['ball_size', 'colour'])
variation_category_list = product.getVariationCategoryList()
variation_category_list.sort()
self.assertEqual(len(variation_category_list), 4)
self.assertEqual(
variation_category_list,
['ball_size/x4', 'ball_size/x5', 'colour/black', 'colour/white'],
)
# Update the data, run the sync and check the data after the update
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_07.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(product.getTitle(), 'Ballon de Basket')
self.assertEqual(product.getReference(), 'b246b')
self.assertEqual(product.getEan13Code(), '0987654321098')
self.assertEqual(product.getUse(), 'sale')
base_category_list = product.getVariationBaseCategoryList()
base_category_list.sort()
self.assertEqual(len(base_category_list), 2)
self.assertEqual(base_category_list, ['ball_size', 'colour'])
variation_category_list = product.getVariationCategoryList()
variation_category_list.sort()
self.assertEqual(len(variation_category_list), 4)
self.assertEqual(
variation_category_list,
['ball_size/x4', 'ball_size/x5', 'colour/black', 'colour/white'],
)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopComplexeUpdateElement(self):
"""
This test checks the complexe update after sync of products.
It updates some element, adds others and removes the last.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_08.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
{ 'title': 'Rouge',
'path': 'Couleur/Rouge',
'source_reference': 'Rouge',
'destination_reference': 'red', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
transaction.commit()
self.tic()
# Run the sync of persons and check person's data after sync
self.assertEqual(len(self.product_module.contentValues()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
product = self.product_module.contentValues()[0]
self.assertEqual(product.getTitle(), 'Ballon de Plage')
self.assertEqual(product.getReference(), 'a5962z')
self.assertEqual(product.getEan13Code(), None)
self.assertEqual(product.getUse(), 'sale')
base_category_list = product.getVariationBaseCategoryList(omit_individual_variation=True)
self.assertEqual(len(base_category_list), 1)
self.assertEqual(base_category_list, ['colour'])
shared_variation_list = product.getVariationCategoryList()
shared_variation_list.sort()
self.assertEqual(len(shared_variation_list), 2)
self.assertEqual(
shared_variation_list,
['colour/black', 'colour/white'],
)
individual_base_category_list = product.getIndividualVariationBaseCategoryList()
self.assertEqual(len(individual_base_category_list), 1)
self.assertEqual(individual_base_category_list, ['ball_size'])
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 2)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == '2':
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(individual_variation.getId(), product.getTitle())
# The first update remove, add and update some elements but not realise an
# hard work on variations
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_09.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(product.getTitle(), 'Ballon de Plage')
self.assertEqual(product.getReference(), 'a5962z')
self.assertEqual(product.getEan13Code(), '1357913579130')
self.assertEqual(product.getUse(), 'sale')
base_category_list = product.getVariationBaseCategoryList()
base_category_list.sort()
self.assertEqual(len(base_category_list), 2)
self.assertEqual(base_category_list, ['ball_size', 'colour'])
shared_variation_list = product.getVariationCategoryList()
shared_variation_list.sort()
self.assertEqual(len(shared_variation_list), 2)
self.assertEqual(
shared_variation_list,
['colour/red', 'colour/white'],
)
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 2)
for individual_variation in individual_variation_list:
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
index = individual_variation.getId()
# check through the order
if index == '1':
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == '2':
self.assertEqual(title, 's6')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(index, product.getTitle())
# The second update remove variations (individuals and shareds)
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_10.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
base_category_list = product.getVariationBaseCategoryList()
base_category_list.sort()
self.assertEqual(len(base_category_list), 2)
self.assertEqual(base_category_list, ['ball_size', 'colour'])
shared_variation_list = product.getVariationCategoryList()
shared_variation_list.sort()
self.assertEqual(len(shared_variation_list), 1)
self.assertEqual(shared_variation_list, ['colour/white', ])
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 1)
individual_variation = individual_variation_list[0].getObject()
self.assertEqual(individual_variation.getTitle(), 's4')
self.assertEqual(
individual_variation.getVariationBaseCategoryList(), ['ball_size'],
)
# The third update allows to add variations (individuals and shareds)
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_11.sql' % self.ps_dump_path,
)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.product_module.contentValues()), 1)
base_category_list = product.getVariationBaseCategoryList()
base_category_list.sort()
self.assertEqual(len(base_category_list), 2)
self.assertEqual(base_category_list, ['ball_size', 'colour'])
shared_variation_list = product.getVariationCategoryList()
shared_variation_list.sort()
self.assertEqual(len(shared_variation_list), 3)
self.assertEqual(
shared_variation_list,
['colour/black', 'colour/red', 'colour/white', ])
individual_variation_list = product.searchFolder(
portal_type='Product Individual Variation',
sort_on=(['id', 'ASC'], ),
)
self.assertEqual(len(individual_variation_list), 3)
for index, individual_variation in enumerate(individual_variation_list):
# Use shortcut for the checking
individual_variation = individual_variation.getObject()
title = individual_variation.getTitle()
base_category_list = individual_variation.getVariationBaseCategoryList()
# check through the order
if index == 0:
self.assertEqual(title, 's4')
self.assertEqual(base_category_list, ['ball_size'])
elif index == 1:
self.assertEqual(title, 's5')
self.assertEqual(base_category_list, ['ball_size'])
elif index == 2:
self.assertEqual(title, 's6')
self.assertEqual(base_category_list, ['ball_size'])
else:
raise ValueError, 'Can not check variation: %s of the product: %s' % \
(individual_variation.getId(), product.getTitle())
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml= self.root_xml % product.Resource_asTioSafeXML(),
tiosafe_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
xsd_path='../XSD/resources.xsd',
)
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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 transaction
from Products.ERP5TioSafe.tests.testPrestashopMixin import testPrestashopMixin
class testProductPrestashopSynchronization(testPrestashopMixin):
""" This class allows to check different cases of Product's sync. """
def afterSetUp(self):
""" This method is called after the SetUp method. """
# Shortcut for modules and tools
self.product_module = self.portal.product_module
self.portal_categories = self.portal.portal_categories
self.portal_sync = self.portal.portal_synchronizations
self.connection = self.portal.erp5_sql_connection
self.prestashop = self.portal.portal_integrations.prestashop
self.root_xml = '<catalog>\n%s\n</catalog>'
def test_PrestashopSimplestXMLSync(self):
""" This test checks the product sync with the simplest XML. """
# Initialize the instance and prestashop
self.initPrestashopTest()
product = self.product_module.newContent(
portal_type='Product',
title='Tee-Shirt',
reference='my_ref',
use='sale',
)
product.validate()
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopIndividualVariationSync(self):
""" This test check the product sync with individual variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
# create and init the product
product = self.product_module.newContent(
portal_type='Product',
title='Ballon de Foot',
reference='0123456789',
ean13_code='1234567890128',
use='sale',
sale_supply_line_base_price=2.123456,
purchase_supply_line_base_price=1.123456,
)
product.validate()
individual_variation_dict_list = [
{'variation_base_category': 'ball_size', 'title': 's4', },
{'variation_base_category': 'ball_size', 'title': 's5', },
{'variation_base_category': 'colour', 'title': 'Blanc', },
{'variation_base_category': 'colour', 'title': 'Noir', },
]
for individual_variation in individual_variation_dict_list:
product.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopSharedVariationSync(self):
""" This test check the product sync with shared variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
self.initMapping(self.prestashop)
# create and init the product
product = self.product_module.newContent(
portal_type='Product',
title='Ballon de Foot',
reference='0123456789',
ean13_code='1234567890128',
use='sale',
sale_supply_line_base_price=2.123456,
purchase_supply_line_base_price=1.123456,
)
product.validate()
product.setVariationBaseCategoryList(['ball_size', 'colour'])
product.setVariationCategoryList(
['ball_size/x4', 'ball_size/x5', 'colour/black', 'colour/white'],
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopDifferentKindVariationsSync(self):
""" This test check the product sync with the two kind of variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
# create and init the product
product = self.product_module.newContent(
portal_type='Product',
title='Ballon de Foot',
reference='0123456789',
ean13_code='1234567890128',
use='sale',
sale_supply_line_base_price=2.123456,
purchase_supply_line_base_price=1.123456,
)
product.validate()
product.setVariationBaseCategoryList(['colour'])
product.setVariationCategoryList(['colour/black', 'colour/white'])
individual_variation_dict_list = [
{'variation_base_category': 'ball_size', 'title': 's4', },
{'variation_base_category': 'ball_size', 'title': 's5', },
]
for individual_variation in individual_variation_dict_list:
product.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopMultipleSync(self):
""" This test check the multiple product sync. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
# create and init the product one
product_1 = self.product_module.newContent(
portal_type='Product',
title='Stylo',
reference='01111',
use='sale',
sale_supply_line_base_price=2.1,
purchase_supply_line_base_price=1.1,
)
product_1.validate()
# create and init the product two
product_2 = self.product_module.newContent(
portal_type='Product',
title='Ballon',
reference='02222',
ean13_code='2222222222222',
use='sale',
sale_supply_line_base_price=20.2,
purchase_supply_line_base_price=10.2,
)
product_2.validate()
individual_variation_dict_list = [
{'variation_base_category': 'ball_size', 'title': 's4', },
{'variation_base_category': 'ball_size', 'title': 's5', },
]
for individual_variation in individual_variation_dict_list:
product_2.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
# create and init the product three
product_3 = self.product_module.newContent(
portal_type='Product',
title='Ballon de Foot',
reference='03333',
ean13_code='3333333333338',
use='sale',
sale_supply_line_base_price=200.3,
purchase_supply_line_base_price=100.3,
)
product_3.validate()
product_3.setVariationBaseCategoryList(['colour', ])
product_3.setVariationCategoryList(['colour/black', 'colour/white'])
# create and init the product four
product_4 = self.product_module.newContent(
portal_type='Product',
title='Ballon de Basket',
reference='04444',
ean13_code='4444444444444',
use='sale',
sale_supply_line_base_price=2000.4,
purchase_supply_line_base_price=1000.4,
)
product_4.validate()
product_4.setVariationBaseCategoryList(['colour'])
product_4.setVariationCategoryList(['colour/black', 'colour/white'])
individual_variation_dict_list = [
{'variation_base_category': 'ball_size', 'title': 's4', },
{'variation_base_category': 'ball_size', 'title': 's5', },
]
for individual_variation in individual_variation_dict_list:
product_4.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 4)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module[13].asXML(),
tiosafe_xml= self.root_xml % product_1.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module[12].asXML(),
tiosafe_xml= self.root_xml % product_2.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module[11].asXML(),
tiosafe_xml= self.root_xml % product_3.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module[10].asXML(),
tiosafe_xml= self.root_xml % product_4.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopDeleteProduct(self):
""" Check that delete during a product's sync invalidate the product. """
# Initialize the instance and prestashop
product_module = self.portal.product_module
self.initPrestashopTest()
product = self.product_module.newContent(
portal_type='Product',
title='Tee-Shirt',
reference='0123456789',
use='sale',
)
product.validate()
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Remove the product in ERP5 and check that after sync in prestashop
self.product_module.manage_delObjects([product.getId(), ])
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 0)
def test_PrestashopUpdateSimpleElement(self):
""" This test checks the simple update after sync of products. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
self.initMapping(self.prestashop)
# create and init the product
product = self.product_module.newContent(
portal_type='Product',
title='Ballon de Foot',
reference='0123456789',
ean13_code='1234567890128',
use='sale',
sale_supply_line_base_price=2000.4,
purchase_supply_line_base_price=1000.4,
)
product.validate()
product.setVariationBaseCategoryList(['ball_size', 'colour'])
product.setVariationCategoryList(
['ball_size/x4', 'ball_size/x5', 'colour/black', 'colour/white'],
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
# Update the data, run the sync and check the data after the update
product.setSaleSupplyLineBasePrice(20.0)
product.setPurchaseSupplyLineBasePrice(20.0)
product.setEan13Code('0987654321098')
self.assertEqual(len(self.prestashop.product_module()), 1)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
def test_PrestashopComplexeUpdateElement(self):
"""
This test checks the complexe update after sync of products.
It updates some element, adds others and removes the last.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.loadSQLDump(
self.connection,
'%s/dump_product_sync_12.sql' % self.ps_dump_path,
)
# Define the specific mapping, initMapping declare the categories in ERP5
self.initMapping()
mapping_dict_list = [
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference':'ball', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
{ 'title': 'Rouge',
'path': 'Couleur/Rouge',
'source_reference': 'Rouge',
'destination_reference': 'red', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
# create and init the product
product = self.product_module.newContent(
portal_type='Product',
title='Ballon de Plage',
reference='a5962z',
use='sale',
sale_supply_line_base_price=200.25,
purchase_supply_line_base_price=100.25,
)
product.validate()
product.setVariationBaseCategoryList(['colour'])
product.setVariationCategoryList(['colour/black', 'colour/white'])
individual_variation_dict_list = [
{'variation_base_category': 'ball', 'title': 's4', },
{'variation_base_category': 'ball', 'title': 's5', },
]
for individual_variation in individual_variation_dict_list:
product.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
transaction.commit()
self.tic()
# Run the sync of products and check product's data after sync
self.assertEqual(len(self.prestashop.product_module()), 0)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
# Check the XML schema and the fixed point
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
# The first update remove, add and update some elements but not realise an
# hard work on variations
product.setEan13Code('1357913579130')
product.setVariationCategoryList(['colour/white', 'colour/red'])
individual_variation = product.portal_catalog(
portal_type='Product Individual Variation',
parent_uid=product.getUid(),
title='s5',
)[0].getObject()
individual_variation.setTitle('s6')
self.assertEqual(len(self.prestashop.product_module()), 1)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
# The second update remove variations (individuals and shareds)
product.setVariationCategoryList(['colour/white', ])
product.manage_delObjects([individual_variation.getId(), ])
self.assertEqual(len(self.prestashop.product_module()), 1)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
# The third update allows to add variations (individuals and shareds)
product.setVariationCategoryList(
['colour/white', 'colour/red', 'colour/white'],
)
individual_variation_dict_list = [
{'variation_base_category': 'ball', 'title': 's5', },
{'variation_base_category': 'ball', 'title': 's6', },
]
for individual_variation in individual_variation_dict_list:
product.newContent(
portal_type='Product Individual Variation',
**individual_variation
)
self.assertEqual(len(self.prestashop.product_module()), 1)
self.loadSync([self.prestashop.product_module, ])
self.assertEqual(len(self.prestashop.product_module()), 1)
self.checkTioSafeXML(
plugin_xml=self.root_xml % self.prestashop.product_module()[0].asXML(),
tiosafe_xml=self.root_xml % product.Resource_asTioSafeXML(),
xsd_path='../XSD/resources.xsd',
)
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Hervé Poulain <herve@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 transaction
from DateTime import DateTime
from Products.ERP5TioSafe.tests.testPrestashopMixin import testPrestashopMixin
class testSaleOrderERP5Synchronization(testPrestashopMixin):
""" This class allows to check different cases of Slae Order's sync. """
def getBusinessTemplateList(self):
return testPrestashopMixin.getBusinessTemplateList(self) + ('erp5_accounting',
'erp5_invoicing',
'erp5_simplified_invoicing',
)
def afterSetUp(self):
""" This method is called after the SetUp method. """
# Shortcut for modules and tools
self.person_module = self.portal.person_module
self.organisation_module = self.portal.organisation_module
self.product_module = self.portal.product_module
self.service_module = self.portal.service_module
self.sale_order_module = self.portal.sale_order_module
self.currency_module = self.portal.currency_module
self.sale_trade_condition_module = self.portal.sale_trade_condition_module
self.portal_categories = self.portal.portal_categories
self.connection = self.portal.erp5_sql_connection
self.prestashop = self.portal.portal_integrations.prestashop
self.root_xml = '<journal>\n%s\n</journal>'
self.delivery = self.service_module.tiosafe_delivery_service
self.discount = self.service_module.tiosafe_discount_service
def test_PrestashopSimplestXMLSync(self):
""" Check the sync of the simplest XML for a sale order. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_01.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Stylo',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 8.772241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 2)
for line in sale_order_line_list:
if line.getTitle() == 'Delivery':
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
elif line.getTitle() == 'Stylo':
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 2.1)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
self.failUnless(line.getTitle() in ['Delivery', 'Stylo'])
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopSyncWithIndividualVariation(self):
"""
Check the sync of sale order with individual variation on the product.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping()
self.createUnknownObject()
self.validateRules()
# Integration site country
mapping_dict_list = [
{ 'title': 'Country',
'path': 'Country',
'source_reference': 'Country',
'destination_reference': 'region', },
{ 'title': 'France',
'path': 'Country/France',
'source_reference': 'France',
'destination_reference': 'france', },
{ 'title': 'Allemagne',
'path': 'Country/Allemagne',
'source_reference': 'Allemagne',
'destination_reference': 'europe/western_europe/allemagne', },
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference': 'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Payment Mode',
'path': 'PaymentMode',
'source_reference': 'Payment Mode',
'destination_reference': 'payment_mode', },
{ 'title': 'CB',
'path': 'PaymentMode/CB',
'source_reference': 'CB',
'destination_reference': 'cb', },
{ 'title': 'Cheque',
'path': 'PaymentMode/Cheque',
'source_reference': 'Cheque',
'destination_reference': 'cb', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_02.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Ballon',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 87.472241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 3)
product_relative_url = product.getRelativeUrl()
for line in sale_order_line_list:
if line.getId() == '1': # Ballon / (Taille du Ballon/s4)
self.assertEqual(line.getTitle(), 'Ballon - Taille du Ballon : s4')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0.getQuantity(), 2.0)
self.assertEqual(round(line.movement_0.getPrice(), 6), 20.2)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertEqual(
line.getVariationCategoryList(),
['ball_size/%s/1' % product_relative_url, ],
)
elif line.getId() == '2': # Ballon / (Taille du Ballon/s5)
self.assertEqual(line.getTitle(), 'Ballon - Taille du Ballon : s5')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0.getQuantity(), 2.0)
self.assertEqual(round(line.movement_0.getPrice(), 6), 20.2)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertEqual(
line.getVariationCategoryList(),
['ball_size/%s/2' % product_relative_url, ],
)
elif line.getId() == '3':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
raise 'A line has not been checked'
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopSyncWithSharedVariation(self):
""" Check the sync of sale order with shared variation. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_03.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Ballon de Foot',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 807.872241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 3)
for line in sale_order_line_list:
if line.getId() == '1': # Ballon de Foot / (Couleur/Blanc)
self.assertEqual(line.getTitle(), 'Ballon de Foot - Couleur : Blanc')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0.getQuantity(), 2.0)
self.assertEqual(round(line.movement_0.getPrice(), 6), 200.3)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertEqual(
line.getVariationCategoryList(),
['colour/white', ],
)
elif line.getId() == '2': # Ballon de Foot / (Couleur/Noir)
self.assertEqual(line.getTitle(), 'Ballon de Foot - Couleur : Noir')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0.getQuantity(), 2.0)
self.assertEqual(round(line.movement_0.getPrice(), 6), 200.3)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertEqual(
line.getVariationCategoryList(),
['colour/black', ],
)
elif line.getId() == '3':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
raise 'A line has not been checked'
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopSyncDifferentKindVariation(self):
""" Check the sync of sale order with the two kind of variations. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping()
self.createUnknownObject()
self.validateRules()
# Integration site country
mapping_dict_list = [
{ 'title': 'Country',
'path': 'Country',
'source_reference': 'Country',
'destination_reference': 'region', },
{ 'title': 'France',
'path': 'Country/France',
'source_reference': 'France',
'destination_reference': 'france', },
{ 'title': 'Allemagne',
'path': 'Country/Allemagne',
'source_reference': 'Allemagne',
'destination_reference': 'europe/western_europe/allemagne', },
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference': 'ball_size', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
{ 'title': 'Payment Mode',
'path': 'PaymentMode',
'source_reference': 'Payment Mode',
'destination_reference': 'payment_mode', },
{ 'title': 'CB',
'path': 'PaymentMode/CB',
'source_reference': 'CB',
'destination_reference': 'cb', },
{ 'title': 'Cheque',
'path': 'PaymentMode/Cheque',
'source_reference': 'Cheque',
'destination_reference': 'cb', },
]
for mapping in mapping_dict_list:
self.createMapping(integration_site=self.prestashop, **mapping)
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_04.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Ballon de Basket',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 16009.872241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 3)
product_relative_url = product.getRelativeUrl()
# See movement rather than line
for line in sale_order_line_list:
if line.getId() == '1': # Ballon de Foot / (Couleur/Blanc) / (Taille du Ballon/s5)
self.assertEqual(
line.getTitle(),
'Ballon de Basket - Couleur : Blanc, Taille du Ballon : s4',
)
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0_0.getQuantity(), 4.0)
self.assertEqual(round(line.movement_0_0.getPrice(), 6), 2000.4)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertSameSet(
line.getVariationCategoryList(),
['ball_size/%s/1' % product_relative_url, 'colour/white', ],
)
elif line.getId() == '2': # Ballon de Foot / (Couleur/Noir) / (Taille du Ballon/s4)
self.assertEqual(
line.getTitle(),
'Ballon de Basket - Couleur : Noir, Taille du Ballon : s5',
)
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.movement_0_0.getQuantity(), 4.0)
self.assertEqual(round(line.movement_0_0.getPrice(), 6), 2000.4)
self.assertEqual(line.getPriceCurrencyValue(), currency)
self.assertSameSet(
line.getVariationCategoryList(),
['ball_size/%s/2' % product_relative_url, 'colour/black', ],
)
elif line.getId() == '3':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
raise 'A line has not been checked'
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopDiscountSync(self):
""" Check the sync of sale order with discount. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_05.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Stylo',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 3.772241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 3)
for line in sale_order_line_list:
if line.getTitle() == 'Delivery':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
elif line.getTitle() == 'Discount':
self.assertEqual(line.getTitle(), 'Discount')
self.assertEqual(line.getResourceValue(), self.discount)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_exempted',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), -5.0)
self.assertEqual(line.getPriceCurrencyValue(), currency)
elif line.getTitle() == 'Stylo':
self.assertEqual(line.getTitle(), 'Stylo')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 2.1)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
self.failUnless(line.getTitle() in ['Delivery', 'Stylo', 'Discount'])
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopSyncWithoutDestination(self):
""" Check the sync of sale order without destination. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
person_unknown = self.person_module['404']
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_06.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
product = self.product_module.searchFolder(
portal_type='Product',
title='Stylo',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person_unknown)
self.assertEqual(sale_order.getDestinationSectionValue(), person_unknown)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 8.772241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 2)
for line in sale_order_line_list:
if line.getTitle() == 'Delivery':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
elif line.getTitle() == 'Stylo':
self.assertEqual(line.getTitle(), 'Stylo')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 2.1)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
self.failUnless(line.getTitle() in ['Delivery', 'Stylo'])
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopSyncWithoutProduct(self):
""" Check the sync of sale order with a non-existant product. """
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
product_unknown = self.product_module['404']
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_07.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 16009.872241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 3)
for line in sale_order_line_list:
if line.getTitle() == 'Ballon de Basket - Couleur : Blanc, Taille du Ballon : s4':
self.assertEqual(
line.getTitle(),
'Ballon de Basket - Couleur : Blanc, Taille du Ballon : s4',
)
self.assertEqual(line.getResourceValue(), product_unknown)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 4.0)
self.assertEqual(round(line.getPrice(), 6), 2000.4)
self.assertEqual(line.getPriceCurrencyValue(), currency)
# FIXME: Is variation are keep even if the product is removed ?? (cf. dump)
# self.assertEqual(line.movement_0_0.getQuantity(), 4.0)
# self.assertEqual(round(line.movement_0_0.getPrice(), 6), 2000.4)
# self.assertEqual(
# line.getVariationCategoryList(),
# ['ball_size/product_module/2/1', 'colour/white', ],
# )
elif line.getTitle() == 'Ballon de Basket - Couleur : Noir, Taille du Ballon : s5':
self.assertEqual(
line.getTitle(),
'Ballon de Basket - Couleur : Noir, Taille du Ballon : s5',
)
self.assertEqual(line.getResourceValue(), product_unknown)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 4.0)
self.assertEqual(round(line.getPrice(), 6), 2000.4)
self.assertEqual(line.getPriceCurrencyValue(), currency)
# FIXME: Is variation are keep even if the product is removed ?? (cf. dump)
# self.assertEqual(line.movement_0_0.getQuantity(), 4.0)
# self.assertEqual(round(line.movement_0_0.getPrice(), 6), 2000.4)
# self.assertEqual(
# line.getVariationCategoryList(),
# ['ball_size/product_module/2/2', 'colour/black', ],
# )
elif line.getTitle() == 'Delivery': # Ballon de Basket / (Couleur/Noir) / (Taille du Ballon/s5)
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
raise 'A line has not been checked'
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopGenerateAccounting(self):
"""
This test realises a sync of sale order and generate the accounting to
check that it works.
"""
# Initialize the instance and prestashop
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_08.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
sale_order = self.sale_order_module.contentValues()[0]
person = self.person_module.searchFolder(
portal_type='Person',
title='Jean GRAY',
)[0].getObject()
product = self.product_module.searchFolder(
portal_type='Product',
title='Stylo',
)[0].getObject()
# TODO: What about the vat ?????
vat_normal = self.service_module.searchFolder(
portal_type='Service',
title='VAT Normal',
)[0].getObject()
currency = self.currency_module.contentValues()[0]
trade_condition = self.sale_trade_condition_module['tiosafe_sale_trade_condition']
self.assertEqual(sale_order.getSourceValue(), self.organisation)
self.assertEqual(sale_order.getSourceSectionValue(), self.organisation)
self.assertEqual(sale_order.getDestinationValue(), person)
self.assertEqual(sale_order.getDestinationSectionValue(), person)
self.assertEqual(sale_order.getPriceCurrencyValue(), currency)
self.assertEqual(sale_order.getSpecialiseValueList(), [trade_condition, ])
self.assertEqual(sale_order.getReference(), '1')
self.assertEqual(
str(sale_order.getStartDate()), str(DateTime('2010-06-14')),
)
self.assertEqual(
str(sale_order.getStopDate()), str(DateTime('2010-06-16')),
)
self.assertEqual(round(sale_order.getTotalPrice(), 6), 8.772241)
self.assertEqual(sale_order.getSimulationState(), 'confirmed')
sale_order_line_list = sale_order.contentValues(
portal_type='Sale Order Line',
)
self.assertEqual(len(sale_order_line_list), 2)
for line in sale_order_line_list:
if line.getTitle() == 'Delivery':
self.assertEqual(line.getTitle(), 'Delivery')
self.assertEqual(line.getResourceValue(), self.delivery)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 6.672241)
self.assertEqual(line.getPriceCurrencyValue(), currency)
elif line.getTitle() == 'Stylo':
self.assertEqual(line.getTitle(), 'Stylo')
self.assertEqual(line.getResourceValue(), product)
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(round(line.getPrice(), 6), 2.1)
self.assertEqual(line.getPriceCurrencyValue(), currency)
else:
self.failUnless(line.getTitle() in ['Delivery', 'Stylo'])
raise 'A line has not been checked'
# Check the accounting
sale_packing_list = sale_order.getCausalityRelatedValue(
portal_type='Sale Packing List',
)
self.assertNotEqual(sale_packing_list, None)
# Ship the sale packing list
sale_packing_list.start()
self.assertEqual(sale_packing_list.getSimulationState(), 'started')
transaction.commit()
self.tic()
self.assertEqual(
len(sale_packing_list.contentValues()),
len(sale_packing_list.contentValues(
portal_type='Sale Packing List Line'),
),
2,
)
# Check the sale invoice and the lines
invoice = sale_packing_list.getCausalityRelatedValue(
portal_type='Sale Invoice Transaction',
)
self.assertNotEqual(invoice, None)
invoice_line_list = invoice.getMovementList(portal_type='Invoice Line')
self.assertEqual(len(invoice_line_list), 3)
for line in invoice_line_list:
if line.getResourceValue() == self.delivery:
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(line.getPrice(), line.getTotalPrice(), 6.672241)
elif line.getResourceValue() == product:
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/base/taxable/vat/vat_normal_rate',
)
self.assertEqual(line.getQuantity(), 1.0)
self.assertEqual(line.getPrice(), line.getTotalPrice(), 2.1)
elif line.getResourceValue() == vat_normal:
self.assertEqual(
line.getBaseContribution(),
'base_amount/trade/l10n/fr/vat/purchase_sale/national',
)
self.assertEqual(line.getQuantity(), 6.672241 + 2.1)
self.assertEqual(line.getPrice(), 0.196)
self.assertEqual(line.getTotalPrice(), 6.672241 * 0.196 + 2.1 * 0.196)
else:
raise 'The lines must contain VAT, Product or Delivery, nothing else.'
# Check the XML schema and the fixed point
self.checkTioSafeXML(
tiosafe_xml=self.root_xml % sale_order.Transaction_asTioSafeXML(),
plugin_xml=self.root_xml % self.prestashop.sale_order_module()[0].asXML(),
xsd_path='../XSD/transactions.xsd',
)
def test_PrestashopUpdateDoNothing(self):
"""
Check that the update of a sale order after the sync do nothing
"""
# Initialize the instance and prestashop
portal_sync = self.portal.portal_synchronizations
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_01.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
self.assertEqual(str(self.sale_order_module.objectValues()[0].getStartDate()), '2010/06/14')
# Update the sale order
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_09.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
self.loadSync([
getattr(self.prestashop, module)
for module in ['sale_order_module',]
])
self.assertEqual(str(self.sale_order_module.objectValues()[0].getStartDate()), '2010/06/14')
def test_PrestashopDeleteDoNothing(self):
"""
Check that the delete of a sale order after the sync did nothing
"""
# Initialize the instance and prestashop
portal_sync = self.portal.portal_synchronizations
self.initPrestashopTest()
self.initMapping(self.prestashop)
self.createUnknownObject()
self.validateRules()
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_01.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
# Run sync process and check result
self.assertEqual(len(self.sale_order_module.contentValues()), 0)
self.assertEqual(len(self.product_module.contentValues()), 1)
self.assertEqual(len(self.person_module.contentValues()), 1)
self.loadSync([
getattr(self.prestashop, module)
for module in ['person_module', 'product_module', 'sale_order_module']
])
self.assertEqual(len(self.sale_order_module.contentValues()), 1)
self.assertEqual(len(self.product_module.contentValues()), 5)
self.assertEqual(len(self.person_module.contentValues()), 2)
self.assertEqual(self.sale_order_module.objectValues()[0].getSimulationState(), "confirmed")
# load a dump in which the sale order no longer exists
self.loadSQLDump(
self.connection,
'%s/dump_sale_order_sync_10.sql' % self.ps_dump_path,
)
transaction.commit()
self.tic()
self.loadSync([
getattr(self.prestashop, module)
for module in ['sale_order_module',]
])
self.assertEqual(self.sale_order_module.objectValues()[0].getSimulationState(), "confirmed")
##############################################################################
#
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
# Aurelien Calonne <aurel@nexedi.com>
# Hervé Poulain <herve@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 os
import subprocess
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from zLOG import LOG, ERROR
from lxml import etree
from StringIO import StringIO
from Products.ERP5Type.tests.runUnitTest import tests_home
from difflib import unified_diff
class testTioSafeMixin(ERP5TypeTestCase):
""" This class provides the main generics elements of test. """
def getSynchronizationTool(self):
""" return the tool """
return self.portal.portal_synchronizations
def getBusinessTemplateList(self):
""" Return the list of BT required by unit tests. """
return (
'erp5_base',
'erp5_pdm',
'erp5_trade',
'erp5_accounting',
'erp5_invoicing',
'erp5_simplified_invoicing',
'erp5_syncml',
'erp5_tiosafe_core',
'erp5_tiosafe_test',
'erp5_tiosafe_accounting',
'erp5_tiosafe_prestashop',
'erp5_oauth',
)
def beforeTearDown(self):
""" Call the methods which remove all created elements. """
# remove the main elements, person, account
for module_id in ["person_module", "product_module", "sale_order_module"]:
module = getattr(self.portal, module_id)
module.manage_delObjects([x for x in module.objectIds()])
# delete the category integration mapping of the full integration site
for integration_site in self.portal.portal_integrations.contentValues():
self.deleteMapping(integration_site)
# reset the pub/sub
for sync in self.portal.portal_synchronizations.contentValues():
if sync.getPortalType() == 'Publication':
sync.resetSubscriberList()
else:
sync.resetSignatureList()
sync.resetAnchorList()
# drop the prestashop tables
self.loadSQLDump(
self.portal.erp5_sql_connection,
'dump/prestashop/dump_99_drop_tables.sql',
)
transaction.commit()
self.tic()
def makeFilePath(self, file_path):
""" This method allows to build a file path to work with the file. """
return '%s/%s' % (os.path.dirname(__file__), file_path)
def loadSQLDump(self, connection, file_path):
""" This methods allows to generate a database dump. """
file = open(self.makeFilePath(file_path), 'r')
sql = file.read().replace(';', ';\0')
connection.manage_test(sql)
def executeQuery(self, connection, query):
"""
This method execute an SQL query in the database. These two elements are
give as parameters.
"""
connection.manage_test(query)
def executePHP(self, integration_site, file_path, **kw):
""" Execute a php script with the parameter given through kw. """
# Build the args of the php command
php_args = '$_GET["site_path"] = "%s";' % integration_site.getRelativeUrl()
for key, value in kw.items():
php_args += '$_GET["%s"] = "%s";' % (key, value)
php_args += 'include("%s");' % self.makeFilePath(file_path)
# Execute the php command and return the result
process = subprocess.Popen(
['php', '-r', php_args, ],
stdout=subprocess.PIPE,
)
return process.stdout.read()
def login(self):
acl_users = self.portal.acl_users
acl_users._doAddUser('TioSafeUser', 'TioSafeUserPassword', ['Manager'], [])
user = acl_users.getUserById('TioSafeUser').__of__(acl_users)
newSecurityManager(None, user)
def updateSynchronizationObjects(self):
""" Change the url string of publication & subscription for tests """
sync_server_path = "file://%s/sync_server" % tests_home
sync_client_path = "file://%s/sync_client" % tests_home
portal_sync = self.getSynchronizationTool()
for pub in portal_sync.objectValues(portal_type="SyncML Publication"):
pub.edit(
url_string=sync_server_path,
subscription_url_string=sync_server_path,
)
for sub in portal_sync.objectValues(portal_type="SyncML Subscription"):
sub.edit(
url_string=sync_server_path,
subscription_url_string=sync_client_path,
user_id='TioSafeUser',
password='TioSafeUserPassword',
)
def synchronize(self, publication, subscription):
""" This method allows to run the synchronization. """
portal_sync = self.getSynchronizationTool()
# To simulate sync which works by networks, the unittest will use file.
# The XML frames will be exchange by file.
# Reset files because we work on synchronization by this way.
# Reset Publication URL
file = open(subscription.getUrlString()[len('file:/'):], 'w')
file.write('')
file.close()
# Reset Subscription URL
file = open(subscription.getSubscriptionUrlString()[len('file:/'):], 'w')
file.write('')
file.close()
transaction.commit()
self.tic()
# Number of message exchange during synchronization
nb_message = 1
# Run synchronization
result = portal_sync.SubSync(subscription.getPath())
while result['has_response'] == 1:
portal_sync.PubSync(publication.getPath())
transaction.commit()
LOG("COMMIT", 300, "COMMIT")
self.tic()
result = portal_sync.SubSync(subscription.getPath())
transaction.commit()
LOG("COMMIT", 300, "COMMIT")
self.tic()
nb_message += 1 + result['has_response']
return nb_message
def loadSync(self, sync_list=None, **kw):
""" This method allows to call sync on each element of a list. """
# ZopeTestCase._print('\nSynchronize Persons and Products\n')
for module in sync_list:
LOG('Synchronization... ', 0, str(module.getId()))
self.synchronize(
publication=module.getSourceSectionValue(),
subscription=module.getDestinationSectionValue(),
)
def getConnectionPlugin(self, site, plugin_type=None):
"""
Return a specific conneciton plugin
"""
# XXX-AUREL implement type when needed
if plugin_type is not None:
raise NotImplementedError
return site.objectValues(portal_type=['Web Service Connector',])[0]
def createMapping(self, integration_site=None, title=None, path=None,
source_reference=None, destination_reference=None):
"""
This method allows to declare a mapping through the elements give as
parameters in the integration site a mapping with the corresponding ERP5
category.
"""
# XXX-Aurel why don't we use the dict pass as parameter ?
base = integration_site
path_list = path.split('/')
keyword = {}
for link in path_list:
if getattr(base, link, None) is not None:
base = getattr(base, link, None)
else:
keyword['portal_type'] = 'Integration Category Mapping'
keyword['title'] = title
keyword['id'] = link
keyword['source_reference'] = source_reference
if base == integration_site:
keyword['portal_type'] = 'Integration Base Category Mapping'
keyword['destination_reference'] = destination_reference
if len(path_list) != 1:
continue
else:
keyword['destination_reference'] = base.getDestinationReference() + "/" + destination_reference
# create the mapping
base.newContent(**keyword)
def initMapping(self, integration_site=None):
""" This method create the mapping in the integration site. """
# integration site mapping
if integration_site is not None and \
integration_site.getPortalType() == 'Integration Site':
# think to order the list of creation of mappings
mapping_dict_list = [
{ 'title': 'Country',
'path': 'Country',
'source_reference': 'Country',
'destination_reference': 'region', },
{ 'title': 'France',
'path': 'Country/France',
'source_reference': 'France',
'destination_reference': 'france', },
{ 'title': 'Allemagne',
'path': 'Country/Allemagne',
'source_reference': 'Allemagne',
'destination_reference': 'europe/western_europe/allemagne', },
{ 'title': 'Taille du Ballon',
'path': 'TailleduBallon',
'source_reference': 'Taille du Ballon',
'destination_reference': 'ball_size', },
{ 'title': 's4',
'path': 'TailleduBallon/s4',
'source_reference': 's4',
'destination_reference': 'x4', },
{ 'title': 's5',
'path': 'TailleduBallon/s5',
'source_reference': 's5',
'destination_reference': 'x5', },
{ 'title': 's6',
'path': 'TailleduBallon/s6',
'source_reference': 's6',
'destination_reference': 'x6', },
{ 'title': 'Couleur',
'path': 'Couleur',
'source_reference': 'Couleur',
'destination_reference': 'colour', },
{ 'title': 'Blanc',
'path': 'Couleur/Blanc',
'source_reference': 'Blanc',
'destination_reference': 'white', },
{ 'title': 'Noir',
'path': 'Couleur/Noir',
'source_reference': 'Noir',
'destination_reference': 'black', },
{ 'title': 'Rouge',
'path': 'Couleur/Rouge',
'source_reference': 'Rouge',
'destination_reference': 'red', },
{ 'title': 'Payment Mode',
'path': 'PaymentMode',
'source_reference': 'Payment Mode',
'destination_reference': 'payment_mode', },
{ 'title': 'CB',
'path': 'PaymentMode/CB',
'source_reference': 'CB',
'destination_reference': 'cb', },
{ 'title': 'Cheque',
'path': 'PaymentMode/Cheque',
'source_reference': 'Cheque',
'destination_reference': 'cb', },
]
# browses the list of categories dict
for mapping in mapping_dict_list:
self.createMapping(integration_site=integration_site, **mapping)
transaction.commit()
self.tic()
def deleteMapping(self, integration_site):
""" Remove the category integration mapping of integration site. """
for category in integration_site.contentValues(
portal_type='Integration Base Category Mapping'):
integration_site.manage_delObjects(category.getId())
def createUnknownObject(self):
""" This method declare the unknown element like Persons and Product. """
person_module = self.portal.person_module
product_module = self.portal.product_module
# Person unknown
if getattr(person_module, '404', None) is None:
person_module.newContent(
portal_type='Person',
id='404',
title='Unknown',
default_email_text='unknown@person.com',
# FIXME: Require to build source/destination because email is required
)
# Product unknown
if getattr(product_module, '404', None) is None:
product_module.newContent(
portal_type='Product',
id='404',
title='Unknown',
reference="Unknown",
)
def checkTioSafeXML(self, plugin_xml=None, tiosafe_xml=None, xsd_path=None):
"""
This methods allows to check the xmls with the xsd and to check that
the two xml are the same.
"""
self.assertTrue(self.validateXMLSchema(plugin_xml, xsd_path))
self.assertTrue(self.validateXMLSchema(tiosafe_xml, xsd_path))
try:
self.assertEqual(plugin_xml, tiosafe_xml)
except AssertionError:
diff = "\n"
for x in unified_diff(plugin_xml.split('\n'), tiosafe_xml.split('\n'), "plugin", "tiosafe", lineterm=''):
diff += "%s\n" %(x)
raise AssertionError, diff
def validateXMLSchema(self, xml, file_path):
""" This method allows to check and validate the schema of an xml. """
file = open(self.makeFilePath(file_path) ,'r')
xml_schema = ''.join(file.readlines())
xml_schema = StringIO(xml_schema)
xml_schema = etree.parse(xml_schema)
xml_schema = etree.XMLSchema(xml_schema)
xml = etree.XML(xml)
validated = xml_schema.validate(xml)
if validated is False:
LOG("validateXMLSchema failed with", ERROR, "%s" %(xml_schema.error_log.filter_from_errors()[0]))
return validated
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