name = 'opensi'; $this->tab = "billing_invoicing"; $this->version = '1.1.0'; $this->author = 'PrestaShop'; $this->displayName = $this->l('OpenSi connector'); $this->description = $this->l('Self-made Management Accounting Software for PrestaShop'); $this->confirmUninstall = $this->l('Are you sure you want to delete OpenSi connector ?'); parent::__construct(); /* Check minimum version required of Prestashop */ if(substr(_PS_VERSION_, 0, 5) < '1.3.2') { $this->warning = $this->l('Error : the module is not compatible with your version of Prestashop (minimum required is 1.3.2).'); } else { /* If no configuration => display alert message */ $urlws = Configuration::get('OSI_WS_URL'); $portws = Configuration::get('OSI_WS_PORT'); $loginws = Configuration::get('OSI_WS_LOGIN'); $passwdws = Configuration::get('OSI_WS_PASSWD'); $servicecode = Configuration::get('OSI_SERVICE_CODE'); $websitecode = Configuration::get('OSI_WEBSITE_CODE'); $depotcode = Configuration::get('OSI_DEPOSIT_CODE'); if($urlws == '' || $portws == '' || $loginws == '' || $passwdws == '' || $servicecode == '' || $websitecode == '' || $depotcode == '') $this->warning = $this->l('The webservice access OpenSi and the cron must be configured.'); } /* * If the page is saved * Frequencies are updated */ $actualConfigurationMode = Configuration::get('OSI_CONFIGURATION_MODE'); /* * Update min time info */ $CONF_WsReqListDefaultDelay = array("WSO-G002" => "1", "WSO-G003" => "1", "WSO-G008" => "1", "WSO-G009" => "1", "WSO-P005" => "1", "WSO-P006" => "1", "WSO-P010" => "1", "WSO-P011" => "1", "WSO-P015" => "1", "WSO-P025" => "1" ); // in minutes /* * Page saved */ if(Tools::isSubmit('submitSettings')) { /* Check if the conf mode has changed */ if(Tools::getValue('osi_configuration_mode') != $actualConfigurationMode) { /* * Reset last dates request webservices to 0 * Not apply to P011 => create_commande_web & P015 => create_transaction_web */ Configuration::updateValue('OSI_LASTREQUEST_WSO-G002', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-G003', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-G008', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-G009', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-P005', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-P006', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-P010', 0); Configuration::updateValue('OSI_LASTREQUEST_WSO-P011', time()); Configuration::updateValue('OSI_LASTREQUEST_WSO-P015', time()); Configuration::updateValue('OSI_LASTREQUEST_WSO-P025', 0); } } else { $configuration_mode = Configuration::get('OSI_CONFIGURATION_MODE'); } /* Loading config for this module */ /*if(__PS_BASE_URI__ == "/") { include_once($_SERVER['DOCUMENT_ROOT']."/modules/".$this->name."/config.inc.php"); } else { include_once($_SERVER['DOCUMENT_ROOT'].__PS_BASE_URI__."/modules/".$this->name."/config.inc.php"); }*/ include_once(_PS_MODULE_DIR_.$this->name."/config.inc.php"); /* Definition */ if(isset($CONF_CachetimeLbl)) { $this->cachetimeLbl = $CONF_CachetimeLbl; $this->lastrequestLbl = $CONF_LastrequestLbl; $this->wsGetList = $CONF_WsGetReqList; $this->wsPostList = $CONF_WsPostReqList; $this->WsReqListDefaultDelay = $CONF_WsReqListDefaultDelay; } } /* Install Method */ public function install() { /* Install databases */ include(dirname(__FILE__).'/sql/install.php'); foreach ($sql as $s) if (!Db::getInstance()->Execute($s)) return false; /* Install module */ if(!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('AdminOrder') || !Configuration::updateValue('OSI_ACTIVE_WSO-G002',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-G003',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P005',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P006',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-G008',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-G009',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P010',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P011',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P015',1) || !Configuration::updateValue('OSI_ACTIVE_WSO-P025',1) || !Configuration::updateValue($this->cachetimeLbl.'WSO-G002','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-G003','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P005','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P006','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-G008','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-G009','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P010','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P011','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P015','10') || !Configuration::updateValue($this->cachetimeLbl.'WSO-P025','10') || !Configuration::updateValue('OSI_CONFIGURATION_MODE',1) || !Configuration::updateValue('OSI_DEFAULT_PRICE',1) || !Configuration::updateValue('OSI_DEPOSIT_CODE','') || !Configuration::updateValue('OSI_HOOK_ADMIN_ORDER',1) || !Configuration::updateValue('OSI_INVOICE',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-G002',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-G003',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P005',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P006',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-G008',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-G009',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P010',0) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P011',time()) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P015',time()) || !Configuration::updateValue($this->lastrequestLbl.'WSO-P025',0) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE1','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE2','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE3','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE4','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE5','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE6','') || !Configuration::updateValue('OSI_LINK_ATTRIBUTE1_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE2_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE3_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE4_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE5_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_ATTRIBUTE6_ISFEATURE',1) || !Configuration::updateValue('OSI_LINK_FEATURE_VOLUME','') || !Configuration::updateValue('OSI_STATE_ID_CANCELED',6) || !Configuration::updateValue('OSI_STATE_ID_ON_DELIVERY',4) | !Configuration::updateValue('OSI_STATE_ID_ON_PREPARATION',3) || !Configuration::updateValue('OSI_SERVICE_CODE','') || !Configuration::updateValue('OSI_VERSION', $this->version) || !Configuration::updateValue('OSI_WEBSITE_CODE','') || !Configuration::updateValue('OSI_WS_LOGIN','') || !Configuration::updateValue('OSI_WS_PASSWD','') || !Configuration::updateValue('OSI_WS_PORT',443) || !Configuration::updateValue('OSI_WS_URL','https://webservices.opensi.eu/cows/Gateway')) return false; if(substr(_PS_VERSION_, 0, 3) > 1.3) $this->registerHook('OrderDetailDisplayed'); return true; } /* Uninstall Method */ public function uninstall() { /* Uninstall databases */ include(dirname(__FILE__).'/sql/uninstall.php'); foreach ($sql as $s) if (!Db::getInstance()->Execute($s)) return false; /* Uninstall module */ if(!parent::uninstall() || !$this->unregisterHook('leftColumn') || !$this->unregisterHook('AdminOrder') || !Configuration::deleteByName('OSI_ACTIVE_WSO-G002') || !Configuration::deleteByName('OSI_ACTIVE_WSO-G003') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P005') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P006') || !Configuration::deleteByName('OSI_ACTIVE_WSO-G008') || !Configuration::deleteByName('OSI_ACTIVE_WSO-G009') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P010') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P011') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P015') || !Configuration::deleteByName('OSI_ACTIVE_WSO-P025') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-G002') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-G003') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P005') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P006') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-G008') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-G009') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P010') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P011') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P015') || !Configuration::deleteByName($this->cachetimeLbl.'WSO-P025') || !Configuration::deleteByName('OSI_CONFIGURATION_MODE') || !Configuration::deleteByName('OSI_DEFAULT_PRICE') || !Configuration::deleteByName('OSI_DEPOSIT_CODE') || !Configuration::deleteByName('OSI_HOOK_ADMIN_ORDER') || !Configuration::deleteByName('OSI_INVOICE') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-G002') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-G003') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P005') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P006') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-G008') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-G009') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P010') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P011') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P015') || !Configuration::deleteByName($this->lastrequestLbl.'WSO-P025') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE1') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE2') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE3') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE4') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE5') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE6') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE1_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE2_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE3_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE4_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE5_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_ATTRIBUTE6_ISFEATURE') || !Configuration::deleteByName('OSI_LINK_FEATURE_VOLUME') || !Configuration::deleteByName('OSI_STATE_ID_CANCELED') || !Configuration::deleteByName('OSI_STATE_ID_ON_DELIVERY') || !Configuration::deleteByName('OSI_STATE_ID_ON_PREPARATION') || !Configuration::deleteByName('OSI_SERVICE_CODE') || !Configuration::deleteByName('OSI_VERSION', $this->version) || !Configuration::deleteByName('OSI_WEBSITE_CODE') || !Configuration::deleteByName('OSI_WS_LOGIN') || !Configuration::deleteByName('OSI_WS_PASSWD') || !Configuration::deleteByName('OSI_WS_PORT') || !Configuration::deleteByName('OSI_WS_URL')) return false; if(substr(_PS_VERSION_, 0, 3) > 1.3) $this->unregisterHook('OrderDetailDisplayed'); return true; } /* Get content method */ public function getContent() { /* * Check if upgrade is available * Define global $upgrade to skip loop display on the installation (class loaded 2x on install) */ if (@ini_get('allow_url_fopen') AND $update = GlobalConfig::checkOpenSiVersion($this->version)) $this->_html .= '

'.$this->l('New OpenSi version available').'
'.$this->l('Download').' '.$update['name'].' !

'; /* html */ $this->_html .= '

'.$this->l('Config OpenSI connector module').'

'.$this->l('Version of the module').' '.$this->version.'

'; /* Save configuration */ if(Tools::isSubmit('submitSettings')) { /* Check for webservice duration big enough */ if(!$this->utilCheckWsTimeValidity()){ $this->_html .= $this->displayError($this->l('One of duration is not big enough')); } else { /* Get and parse links attributes */ for($i=1; $i<=6; $i++){ if(Tools::getValue('osi_link_attribute'.$i.'_isfeature') == 1) { $_POST['osi_link_attribute'.$i] = Tools::getValue('osi_link_attribute'.$i.'_features'); } else { $_POST['osi_link_attribute'.$i] = Tools::getValue('osi_link_attribute'.$i.'_attributesgp'); } } /* Update configuration */ Configuration::updateValue('OSI_ACTIVE_WSO-G002', Tools::getValue('active_wso_g002')); Configuration::updateValue('OSI_ACTIVE_WSO-G003', Tools::getValue('active_wso_g003')); Configuration::updateValue('OSI_ACTIVE_WSO-G008', Tools::getValue('active_wso_g008')); Configuration::updateValue('OSI_ACTIVE_WSO-G009', Tools::getValue('active_wso_g009')); Configuration::updateValue('OSI_ACTIVE_WSO-P005', Tools::getValue('active_wso_p005')); Configuration::updateValue('OSI_ACTIVE_WSO-P006', Tools::getValue('active_wso_p006')); Configuration::updateValue('OSI_ACTIVE_WSO-P010', Tools::getValue('active_wso_p010')); Configuration::updateValue('OSI_ACTIVE_WSO-P011', Tools::getValue('active_wso_p011')); Configuration::updateValue('OSI_ACTIVE_WSO-P015', Tools::getValue('active_wso_p015')); Configuration::updateValue('OSI_ACTIVE_WSO-P025', Tools::getValue('active_wso_p025')); Configuration::updateValue('OSI_CONFIGURATION_MODE', Tools::getValue('osi_configuration_mode')); Configuration::updateValue('OSI_DEFAULT_PRICE', Tools::getValue('osi_default_price')); Configuration::updateValue('OSI_DEPOSIT_CODE', Tools::getValue('osi_deposit_code')); Configuration::updateValue('OSI_HOOK_ADMIN_ORDER', Tools::getValue('osi_hook_admin_order')); Configuration::updateValue('OSI_INVOICE', Tools::getValue('osi_invoice')); Configuration::updateValue('OSI_LINK_ATTRIBUTE1', Tools::getValue('osi_link_attribute1')); Configuration::updateValue('OSI_LINK_ATTRIBUTE2', Tools::getValue('osi_link_attribute2')); Configuration::updateValue('OSI_LINK_ATTRIBUTE3', Tools::getValue('osi_link_attribute3')); Configuration::updateValue('OSI_LINK_ATTRIBUTE4', Tools::getValue('osi_link_attribute4')); Configuration::updateValue('OSI_LINK_ATTRIBUTE5', Tools::getValue('osi_link_attribute5')); Configuration::updateValue('OSI_LINK_ATTRIBUTE6', Tools::getValue('osi_link_attribute6')); Configuration::updateValue('OSI_LINK_ATTRIBUTE1_ISFEATURE', Tools::getValue('osi_link_attribute1_isfeature')); Configuration::updateValue('OSI_LINK_ATTRIBUTE2_ISFEATURE', Tools::getValue('osi_link_attribute2_isfeature')); Configuration::updateValue('OSI_LINK_ATTRIBUTE3_ISFEATURE', Tools::getValue('osi_link_attribute3_isfeature')); Configuration::updateValue('OSI_LINK_ATTRIBUTE4_ISFEATURE', Tools::getValue('osi_link_attribute4_isfeature')); Configuration::updateValue('OSI_LINK_ATTRIBUTE5_ISFEATURE', Tools::getValue('osi_link_attribute5_isfeature')); Configuration::updateValue('OSI_LINK_ATTRIBUTE6_ISFEATURE', Tools::getValue('osi_link_attribute6_isfeature')); Configuration::updateValue('OSI_LINK_FEATURE_VOLUME', Tools::getValue('osi_link_feature_volume')); Configuration::updateValue('OSI_STATE_ID_CANCELED', Tools::getValue('osi_state_id_canceled')); Configuration::updateValue('OSI_STATE_ID_ON_DELIVERY', Tools::getValue('osi_state_id_on_delivery')); Configuration::updateValue('OSI_STATE_ID_ON_PREPARATION', Tools::getValue('osi_state_id_on_preparation')); Configuration::updateValue('OSI_SERVICE_CODE', Tools::getValue('osi_service_code')); Configuration::updateValue('OSI_WEBSITE_CODE', Tools::getValue('osi_website_code')); Configuration::updateValue('OSI_WS_LOGIN', Tools::getValue('osi_ws_login')); Configuration::updateValue('OSI_WS_PASSWD', Tools::getValue('osi_ws_passwd')); Configuration::updateValue('OSI_WS_PORT', Tools::getValue('osi_ws_port')); Configuration::updateValue('OSI_WS_URL', Tools::getValue('osi_ws_url')); foreach($this->wsGetList as $wsName){ Configuration::updateValue($this->cachetimeLbl.$wsName, Tools::getValue(strtolower($this->cachetimeLbl.$wsName))); } foreach($this->wsPostList as $wsName){ Configuration::updateValue($this->cachetimeLbl.$wsName, Tools::getValue(strtolower($this->cachetimeLbl.$wsName))); } $this->_html .= $this->displayConfirmation($this->l('Settings updated.')); } } /* If not compatible with at least Prestashop 1.3.2 */ if(substr(_PS_VERSION_, 0, 5) < '1.3.2') { $this->_html .= '
'.$this->l('Compatibility error').'' .$this->l('Error : the module is not compatible with your version of Prestashop.').'

' .$this->l('Minimum version is 1.3.2').'
' .$this->l('Actual version :').' '._PS_VERSION_.'
'; } else { $this->_displayForm(); } return $this->_html; } /* Form configuration method */ private function _displayForm() { $this->_html .= '
'; return $this->_html; } /* Presentation tab */ private function _displayPresentation() { $html = '
'.$this->l('Introduction').' OpenSi E-Commerce : la solution de gestion commerciale et de comptabilité pour votre site Prestashop

Édité par la société Speedinfo, le logiciel de gestion OpenSi E-Commerce apporte un nouveau degré de performance dans la gestion des commandes Prestashop.
Connectable en standard avec la solution Prestashop, OpenSi E-Commerce permet de contrôler toute l’activité du site e-commerce.

Grâce à une technologie innovante, les ventes e-commerce sont intégrées automatiquement dans le logiciel sans intervention de votre part. Vous maîtrisez ainsi toute votre activité : commande client, comptabilité, suivi des stocks, gestion des achats, expéditions, réapprovisionnements fournisseur... Sans aucune ressaisie !






Des fonctionnalités inédites dans la gestion d’une boutique Prestashop

Avec OpenSi E-Commerce, il est possible de traiter et de suivre tous les flux d’un site Prestashop, d’une commande client jusqu’à la comptabilité en passant par la gestion des achats. Disponible en ligne, le logiciel OpenSi E-Commerce est riche en fonctions innovantes pour gérer votre boutique Prestashop :




Des bénéfices utilisateurs mesurables au quotidien

Utiliser le logiciel de gestion OpenSi E-Commerce au quotidien est l’assurance d’une maîtrise parfaite de l’ensemble de votre gestion commerciale & comptabilité : gain de temps, optimisation financière...


Productivité
Gain de temps dans la préparation des commandes,
Automatisation du processus de réapprovisionnement,
Transfert en comptabilité...
Visibilité financière
Consultation des marges,
Suivi de la valorisation des stocks,
Contrôle de la trésorerie...
Qualité
Fiabilité des informations stocks,
Réduction des délais de livraison,
Fiabilité des produits expédiés...
* Tarif abonnement OpenSi E-Commerce pour traiter 600 commandes/mois.


Un fonctionnement simple et performant

OpenSi E-Commerce bénéficie de toute l’expertise des équipes Speedinfo en matière de e-commerce et de gestion de flux. Découvrez OpenSi E-Commerce en images



Speedinfo, un éditeur de logiciels au croisement de la gestion et de l’e-commerce

Partenaire privilégié des e-commerçants depuis bientôt 10 ans, la vision de Speedinfo est de proposer des logiciels et des services innovants pour rendre la gestion d’entreprise accessible à tous :

Ils nous font confiance...

La volonté de Speedinfo est d’offrir des solutions de gestion d’entreprise aux PME/PMI qui soient performantes, fiables et pérennes.
De nombreuses sociétés ont déjà opté pour une nouvelle façon de gérer leur boutique Prestashop avec OpenSi E-Commerce :



Visitez le site officiel de la solution de gestion OpenSi
'; return $html; } /* Informations tab */ private function _displayInformations() { $html = ''; /* Get configuration */ $urlws = Configuration::get('OSI_WS_URL'); $portws = Configuration::get('OSI_WS_PORT'); $loginws = Configuration::get('OSI_WS_LOGIN'); $passwdws = Configuration::get('OSI_WS_PASSWD'); $servicecode = Configuration::get('OSI_SERVICE_CODE'); $websitecode = Configuration::get('OSI_WEBSITE_CODE'); $depotcode = Configuration::get('OSI_DEPOSIT_CODE'); if($urlws == '' || $portws == '' || $loginws == '' || $passwdws == '' || $servicecode == '' || $websitecode == '' || $depotcode == '') { $html .= '
'.$this->l('The webservice access OpenSi and the cron must be configured.'); $html .= '
'; $html .= $this->l('Absolute path to specify in your crontab').' : sh '.dirname(__FILE__).'/cron.sh
'; } $html .= '
'.$this->l('Access configuration').'


'.$this->l('Cron configuration').' Définition : Le cron est un séquenceur de tâches système UNIX.
Son activation est nécessaire pour automatiser les flux (commandes, clients, stocks, prix, ...) entre OpenSi et votre boutique.
Pour installer le cron, vous devez procéder de la manière suivante :

1. Connection à votre serveur en SSH
Pour se connecter, ouvrir un terminal et taper la ligne de commande suivante :
ssh user@host
Ex : ssh martin@120.01.02.03
Appuyer sur la touche "entrée".
Rentrer le mot de passe et appuyer à nouveau sur la touche "entrée".
Vous devez maintenant être connecté à votre serveur.

→ L\'éditeur OpenSi reste à votre disposition pour vous assister dans la mise en place de ce cron.
2. Édition de la crontab
Pour éditer la crontab, taper la ligne de commande suivante :
crontab -e
et appuyer sur la touche "entrée".
3. Configuration de la crontab
Ajouter la ligne suivante dans votre crontab, enregistrer et fermer le fichier.
*/10 * * * * sh '.dirname(__FILE__).'/cron.sh
Votre crontab est maintenant configurée.


'.$this->l('OpenSi adminnistration').' '.$this->l('Do not change the value of the fields below.').'

'; return $html; } /* Synchronisations tab */ private function _displaySync() { /* * Number of products * Parent without child = 1 * Parent with 2 child = 2 (don't add the parent if there are children) */ $nbProd = Db::getInstance()->getRow("SELECT count(*) FROM "._DB_PREFIX_."product p LEFT JOIN "._DB_PREFIX_."product_attribute pa ON p.id_product = pa.id_product"); /* Number of parent products */ $nbParentProd = Db::getInstance()->getRow("SELECT count(*) FROM "._DB_PREFIX_."product"); /* Number of child products */ $nbChildProd = $nbProd['count(*)'] - $nbParentProd['count(*)']; /* Number of products without reference */ $nbProdNoRef = Db::getInstance()->getRow("SELECT count(*) FROM "._DB_PREFIX_."product p LEFT JOIN "._DB_PREFIX_."product_attribute pa ON p.id_product = pa.id_product where (pa.id_product_attribute is null and p.reference = '') or (p.reference='' and pa.reference='')"); /* Number of orders */ $nbOrder = Db::getInstance()->getRow("SELECT count(*) FROM `"._DB_PREFIX_."orders`"); /* Number of clients */ $nbClient = Db::getInstance()->getRow("SELECT count(*) FROM `"._DB_PREFIX_."customer`"); /* * Get configuration mode * 1 => Production * 2 => Test */ $confMod = Db::getInstance()->getRow("SELECT * FROM `"._DB_PREFIX_."configuration` WHERE name = 'OSI_CONFIGURATION_MODE'"); $confMode = $confMod["value"]; /* html */ $html = '
'.$this->l('Configuration parameters').''; if($confMode == '1') { /* Production configuration mode */ $html .= '
'; } else { /* Test configuration mode */ $html .= '
'; } $html .= '


'.$this->l('Synchronizations configuration').' '.$this->l('Note : Frequencies are expressed in minutes').'.
'.$this->l('We advise you to get closer to the editor module before changing synchronization settings.').'



'; if($nbProdNoRef['count(*)'] > 0) $html .= '
'.$this->l('Warning, your catalog has').' '.$nbProdNoRef['count(*)'].' '.$this->l('products without references').' !
'.$this->l('Please note that any product without reference will not be synchronized with OpenSi.').'
'; $html .= '
'.$this->l('Create products').' * (Min : 1)
'.$this->l('Update products').' * (Min : 1)
'.$this->l('Update stocks').' * (Min : 1)
'.$this->l('Update prices').' * (Min : 1)





'.$this->l('Create orders').' * (Min : 1)
'.$this->l('Create transactions').' * (Min : 1)
'.$this->l('Update states orders').' * (Min : 1)
'.$this->l('Update orders tracking codes').' * (Min : 1)





'.$this->l('Create customers').' * (Min : 1)
'.$this->l('Update customers').' * (Min : 1)


'.$this->l('Synchronization from OpenSi to Prestashop').'
'.$this->l('Synchronization from Prestashop to OpenSi').'
'; return $html; } /* Mapping tab */ private function _displayMapping() { global $cookie; /* GET LISTS */ $db = Db::getInstance(); /* Get list features */ $query = 'SELECT fl.id_feature, fl.name FROM `'._DB_PREFIX_.'feature` as f, `'._DB_PREFIX_.'feature_lang` as fl WHERE f.id_feature=fl.id_feature AND fl.id_lang = "'.(int)GlobalConfig::getDefaultLangId().'"'; $result = $db->ExecuteS($query); $this->listFeatures = $result; /* Get list Groups attributes */ $query = 'SELECT agl.id_attribute_group, agl.public_name FROM `'._DB_PREFIX_.'attribute_group` as ag, `'._DB_PREFIX_.'attribute_group_lang` as agl WHERE ag.id_attribute_group=agl.id_attribute_group AND agl.id_lang = "'.(int)GlobalConfig::getDefaultLangId().'"'; $result = $db->ExecuteS($query); $this->listAttributesGp = $result; /* Get list Order states */ $query = 'SELECT osl.id_order_state, osl.name FROM `'._DB_PREFIX_.'order_state` as os, `'._DB_PREFIX_.'order_state_lang` as osl WHERE os.id_order_state=osl.id_order_state AND osl.id_lang = "'.(int)GlobalConfig::getDefaultLangId().'"'; $result = $db->ExecuteS($query); $this->listOrderStates = $result; /* html */ $html = '
'.$this->l('Attributes links').'

'.$this->l('Add a new feature').'    '.$this->l('Add a new attribut').'

'.$this->utilHtmlLinkAttribute(1).'
'.$this->utilHtmlLinkAttribute(2).'
'.$this->utilHtmlLinkAttribute(3).'
'.$this->utilHtmlLinkAttribute(4).'
'.$this->utilHtmlLinkAttribute(5).'
'.$this->utilHtmlLinkAttribute(6).'
'.$this->utilHtmlLinkFeature('volume').'


'.$this->l('Orders status').'

'.$this->l('Add a new status').'

'.$this->utilHtmlOrderState('on_preparation').'
'.$this->utilHtmlOrderState('on_delivery').'
'.$this->utilHtmlOrderState('canceled').'


'.$this->l('Price to use').' '.$this->l('You can manage up to 5 different prices for the same item in OpenSi. Select the price you want to use below...').'
'.$this->l('We advise you to get closer to the editor module before changing this parameter.').'

'.$this->utilHtmlDefaultPrice().'
'; return $html; } /* Journal tab */ private function _displayJournal() { $now = date("d/m/Y"); $html = '
'.$this->l('Last updates').' '.$this->l('You can find below the dates of the last synchronization at the level of items, orders and customers...').'

'.$this->l('PRODUCTS LAST UPDATES').'

'; /* Last creation products */ $LastReqWSOP005 = Configuration::get('OSI_LASTREQUEST_WSO-P005'); if($LastReqWSOP005 == 0) { $html .= ''; } else { $LastReqWSOP005 = date("d/m/Y H:i:s", $LastReqWSOP005); if (substr($LastReqWSOP005, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update products */ $LastReqWSOP006 = Configuration::get('OSI_LASTREQUEST_WSO-P006'); if($LastReqWSOP006 == 0) { $html .= ''; } else { $LastReqWSOP006 = date("d/m/Y H:i:s", $LastReqWSOP006); if (substr($LastReqWSOP006, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update stock */ $LastReqWSOG002 = Configuration::get('OSI_LASTREQUEST_WSO-G002'); if($LastReqWSOG002 == 0) { $html .= ''; } else { $LastReqWSOG002 = date("d/m/Y H:i:s", $LastReqWSOG002); if (substr($LastReqWSOG002, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update prices */ $LastReqWSOG009 = Configuration::get('OSI_LASTREQUEST_WSO-G009'); if($LastReqWSOG009 == 0) { $html .= ''; } else { $LastReqWSOG009 = date("d/m/Y H:i:s", $LastReqWSOG009); if (substr($LastReqWSOG009, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } $html .= '
'.$this->l('New products').' '.$this->l('Existing products').' '.$this->l('Stocks').' '.$this->l('Prices').'
'.$this->l('Not synchronized').''.$LastReqWSOP005.''.$LastReqWSOP005.''.$this->l('Not synchronized').''.$LastReqWSOP006.''.$LastReqWSOP006.''.$this->l('Not synchronized').''.$LastReqWSOG002.''.$LastReqWSOG002.''.$this->l('Not synchronized').''.$LastReqWSOG009.''.$LastReqWSOG009.'



'.$this->l('ORDERS LAST UPDATES').'

'; /* Last update orders */ $LastReqWSOP011 = Configuration::get('OSI_LASTREQUEST_WSO-P011'); if($LastReqWSOP011 == 0) { $html .= ''; } else { $LastReqWSOP011 = date("d/m/Y H:i:s", $LastReqWSOP011); if (substr($LastReqWSOP011, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update transaction */ $LastReqWSOP015 = Configuration::get('OSI_LASTREQUEST_WSO-P015'); if($LastReqWSOP015 == 0) { $html .= ''; } else { $LastReqWSOP015 = date("d/m/Y H:i:s", $LastReqWSOP015); if (substr($LastReqWSOP015, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update order statement */ $LastReqWSOG008 = Configuration::get('OSI_LASTREQUEST_WSO-G008'); if($LastReqWSOG008 == 0) { $html .= ''; } else { $LastReqWSOG008 = date("d/m/Y H:i:s", $LastReqWSOG008); if (substr($LastReqWSOG008, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update tracking colis */ $LastReqWSOG003 = Configuration::get('OSI_LASTREQUEST_WSO-G003'); if($LastReqWSOG003 == 0) { $html .= ''; } else { $LastReqWSOG003 = date("d/m/Y H:i:s", $LastReqWSOG003); if (substr($LastReqWSOG003, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } $html .= '
'.$this->l('New orders').' '.$this->l('Transactions').' '.$this->l('Order statment').' '.$this->l('Tracking colis').'
'.$this->l('Not synchronized').''.$LastReqWSOP011.''.$LastReqWSOP011.''.$this->l('Not synchronized').''.$LastReqWSOP015.''.$LastReqWSOP015.''.$this->l('Not synchronized').''.$LastReqWSOG008.''.$LastReqWSOG008.''.$this->l('Not synchronized').''.$LastReqWSOG003.''.$LastReqWSOG003.'



'.$this->l('CUSTOMERS LAST UPDATES').'

'; /* Last creation clients */ $LastReqWSOP010 = Configuration::get('OSI_LASTREQUEST_WSO-P010'); if($LastReqWSOP010 == 0) { $html .= ''; } else { $LastReqWSOP010 = date("d/m/Y H:i:s", $LastReqWSOP010); if (substr($LastReqWSOP010, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } /* Last update clients */ $LastReqWSOP025 = Configuration::get('OSI_LASTREQUEST_WSO-P025'); if($LastReqWSOP025 == 0) { $html .= ''; } else { $LastReqWSOP025 = date("d/m/Y H:i:s", $LastReqWSOP025); if (substr($LastReqWSOP025, 0, 10) != $now) { $html .= ''; } else { $html .= ''; } } $html .= '
'.$this->l('New customers').' '.$this->l('Existing customers').'
'.$this->l('Not synchronized').''.$LastReqWSOP010.''.$LastReqWSOP010.''.$this->l('Not synchronized').''.$LastReqWSOP025.''.$LastReqWSOP025.'
'; return $html; } /* Documentation tab */ private function _displayDoc() { $html = '


'.$this->l('Documentation').' '.$this->l('The module OpenSi Connect allows you to sync PrestaShop to OpenSi E-Commerce software business management and accounting.').'
'.$this->l('SpeedInfo has developed a connector for OpenSi E-Commerce & PrestaShop as module OpenSi Connect.').'
'.$this->l('OpenSi E-Commerce is a business management software and accounting dedicated to e-commerce.').'

'.$this->l('User guide - OpenSi for Prestashop').'

'.$this->l('You should find in this guide the complete documentation to install, configure and use the OpenSi module for Prestashop.').'

'.$this->l('More informations availble on').' www.opensi.fr.
'; return $html; } /* Preferences tab */ private function _displayPrefs() { $html = ''; /* Display only if Prestashop 1.4 minimum */ if(substr(_PS_VERSION_, 0, 3) > 1.3) { $html .= '
'.$this->l('Manage invoices').'
'.$this->l('This option allow your customers to download the OpenSi invoices instead of the Prestashop invoices.').'
'.$this->l('In the order details on the customer account, the user can download the OpenSi invoice instead of the Prestashop invoice.').'

l('No').'    l('Yes').'


'; } $html .= '
'.$this->l('Display synchronization with OpenSi').'
'.$this->l('This option allows you to see in the order details (admin panel) if it is synchronized with OpenSi or not, and the OpenSi invoices.').'

l('No').'    l('Yes').'
'; return $html; } /* * Generate html listbox for order states * @param $stateName */ public function utilHtmlOrderState($stateName){ if ($stateName == 'on_preparation'){ $stateValue = GlobalConfig::getStateIdOnPreparation(); } else if ($stateName == 'on_delivery'){ $stateValue = GlobalConfig::getStateIdOnDelivery(); } else if ($stateName == 'canceled'){ $stateValue = GlobalConfig::getStateIdCanceled(); } $selectOptions = ''; foreach($this->listOrderStates as $state){ $isSelected = ($state['id_order_state'] != "" && $state['id_order_state'] == $stateValue)?("selected"):(""); $selectOptions .= ""; } $html = ''; return $html; } /* * Generate html two listbox for link attribute * @param $numAttribute */ public function utilHtmlLinkAttribute($numAttribute){ if($numAttribute == 1){ $linkAttributeValue = GlobalConfig::getLinkAttribute1(); $isFeature = (GlobalConfig::getLinkAttribute1_isfeature() == 1)?(true):(false); } else if ($numAttribute == 2){ $linkAttributeValue = GlobalConfig::getLinkAttribute2(); $isFeature = (GlobalConfig::getLinkAttribute2_isfeature() == 1)?(true):(false); } else if ($numAttribute == 3){ $linkAttributeValue = GlobalConfig::getLinkAttribute3(); $isFeature = (GlobalConfig::getLinkAttribute3_isfeature() == 1)?(true):(false); } else if ($numAttribute == 4){ $linkAttributeValue = GlobalConfig::getLinkAttribute4(); $isFeature = (GlobalConfig::getLinkAttribute4_isfeature() == 1)?(true):(false); } else if ($numAttribute == 5){ $linkAttributeValue = GlobalConfig::getLinkAttribute5(); $isFeature = (GlobalConfig::getLinkAttribute5_isfeature() == 1)?(true):(false); } else if ($numAttribute == 6){ $linkAttributeValue = GlobalConfig::getLinkAttribute6(); $isFeature = (GlobalConfig::getLinkAttribute6_isfeature() == 1)?(true):(false); } $selectOptionsFeatures = ""; foreach($this->listFeatures as $feature){ $isSelected = ($isFeature && $feature['id_feature'] != "" && $feature['id_feature'] == $linkAttributeValue)?("selected"):(""); $selectOptionsFeatures .= ""; } $selectOptionsAtt = ""; foreach($this->listAttributesGp as $attribGp){ $isSelected = (!$isFeature && $attribGp['id_attribute_group'] != "" && $attribGp['id_attribute_group'] == $linkAttributeValue)?("selected"):(""); $selectOptionsAtt .= ""; } $checkedFeature = ($isFeature)?("checked"):(""); $checkedAttributesGp = ($isFeature)?(""):("checked"); $disableFeature = (!$isFeature == true)?('disabled="disabled" style="background:#fffff7; width:200px"'):('style="width:200px"'); $disableAttribut = ($isFeature == true)?('disabled="disabled" style="background:#fffff7; width:200px"'):('style="width:200px"'); $html = '    '.$this->l('Feat.').'   OU   '.$this->l('Attrib.').'    '; return $html; } /* * Generate html listbox for link feature * @param $featureName */ public function utilHtmlLinkFeature($featureName){ if($featureName == 'volume'){ $linkFeatureValue = GlobalConfig::getLinkFeatureVolume(); } $selectOptions = ""; foreach($this->listFeatures as $feature){ $isSelected = ($feature['id_feature'] != "" && $feature['id_feature'] == $linkFeatureValue)?("selected"):(""); $selectOptions .= ""; } $html = ''; return $html; } /* * Check if the submit time for each webservice is big enough * return boolean : true (is valid); false (error, is not valid) * @param $wsName is the name of webservice */ public function utilCheckWsTimeValidity() { $fullListWs = array_merge($this->wsGetList, $this->wsPostList); $isOk = true; foreach($fullListWs as $wsName){ $time = Tools::getValue(strtolower($this->cachetimeLbl.$wsName)); if($time < $this->WsReqListDefaultDelay[$wsName]) { $isOk = false; } } return $isOk; } /* * Generate html listbox for price * @param $priceName */ public function utilHtmlDefaultPrice(){ $defaultPriceValue = GlobalConfig::getDefaultPrice(); $selectOptions = ""; for ($i = 1; $i <= 5; $i++) { $isSelected = ($i == $defaultPriceValue)?("selected"):(""); $selectOptions .= ""; } $html = ''; return $html; } /* Display synchronisation state of the order with OpenSi */ public function hookAdminOrder($params) { if(Configuration::get('OSI_HOOK_ADMIN_ORDER') == 1) { global $cookie; $order = new Order($params['id_order']); $return = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'opensi_order WHERE id_order = \''.(int)($order->id).'\' LIMIT 1'); $html = '

'.$this->l('Sync with OpenSi').' '; /* * Check if upgrade is available */ if (@ini_get('allow_url_fopen') AND $update = GlobalConfig::checkOpenSiVersion($this->version)) $html .= '
'.$this->l('New OpenSi version available').'
'.$this->l('Download').' '.$update['name'].' !
'; /* * Is the order synchronized with OpenSi ? */ if(isset($return[0]['id_order'])) { $html .= $this->l('Order synchronized with OpenSi the :').' '.Tools::displayDate($return[0]['date_order_synchro'], (int)($cookie->id_lang), true); } else { $html .= $this->l('Order not synchronized with OpenSi.'); } /* Display links of OpenSi invoices if available */ $query = 'SELECT * FROM '._DB_PREFIX_.'opensi_invoice WHERE id_order = \''.(int)($order->id).'\''; if ($links = Db::getInstance()->ExecuteS($query)) { $html .= '
'; $i = 0; foreach ($links as $link) { $html .= '
'; if($link['type'] == 'F') { $html .= $this->l('Invoice').' '.$link['number_invoice'].'.pdf'; } else if($link['type'] == 'A') { $html .= $this->l('Credit').' '.$link['number_invoice'].'.pdf'; } $html .= ''; $i++; } } $html .= '
'; return $html; } } /* Display OpenSi invoice in the customer account */ public function hookOrderDetailDisplayed($params) { if(Configuration::get('OSI_INVOICE') == 1) { /* Is the OpenSi invoice is active */ $query = 'SELECT * FROM '._DB_PREFIX_.'opensi_invoice WHERE id_order = \''.(int)(Tools::getValue('id_order')).'\''; if ($links = Db::getInstance()->ExecuteS($query)) { $html = '
'; $i = 0; foreach ($links as $link) { $html .= ($i%2 == 0)?'':''; $html .= ''; $i++; } $html .= '
'.$this->l('Your invoices / credits').'
'; if($link['type'] == 'F') { $html .= $this->l('Invoice').' '.$link['number_invoice'].'.pdf'; } else if($link['type'] == 'A') { $html .= $this->l('Credit').' '.$link['number_invoice'].'.pdf'; } $html .= '
'; return $html; } } } }