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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
##############################################################################
#
# 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
product/ERP5TioSafe/plugins/prestashop/modules/oneclickconnect/agt_reload.png

765 Bytes

<?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);
?>
product/ERP5TioSafe/plugins/prestashop/modules/oneclickconnect/logo.gif

1003 Bytes

product/ERP5TioSafe/plugins/prestashop/modules/oneclickconnect/old-logo.gif

1007 Bytes

<?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);
?>
This diff is collapsed.
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);
This diff is collapsed.
/* 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');
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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