Ver Fonte

MMIPrestaSync : ReSync buttons & Clean unused module files

Mathieu Moulin há 1 ano atrás
pai
commit
dabebced43

+ 63 - 7
class/actions_mmiprestasync.class.php

@@ -1,23 +1,79 @@
 <?php
 
 dol_include_once('custom/mmicommon/class/mmi_actions.class.php');
+dol_include_once('custom/mmiprestasync/class/mmi_prestasync.class.php');
 
 class ActionsMMIPrestaSync extends MMI_Actions_1_0
 {
 	const MOD_NAME = 'mmiprestasync';
 
-	function doActions($parameters, &$object, &$action, $hookmanager)
+	function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
 	{
+		global $user, $langs, $conf;
+
 		$error = 0; // Error counter
 		$myvalue = 'test'; // A result value
 
-		//print_r($parameters);
-		//echo "action: " . $action;
-		//print_r($object);
-
-		if (in_array('somecontext', explode(':', $parameters['context'])))
+		if (!empty($user->rights->mmiprestasync->resync_button->all) && $this->in_context($parameters, ['ordercard', 'productcard', 'productlotcard', 'stockproductcard', 'pricesuppliercard', 'thirdpartysupplier', 'thirdpartycomm', 'contactcard'])) //'thirdpartycard'
 		{
-		  // do something only for the context 'somecontext'
+			if ($this->in_context($parameters, 'ordercard')) {
+				$type = 'order';
+				$otype = 'commande';
+				$oid = $object->id;
+			}
+			elseif ($this->in_context($parameters, 'productcard')) {
+				$type = 'product';
+				$otype = 'product';
+				$oid = $object->id;
+			}
+			elseif ($this->in_context($parameters, 'productlotcard')) {
+				$type = 'product_lot';
+				$otype = 'product_lot';
+				$oid = $object->id;
+			}
+			elseif ($this->in_context($parameters, 'pricesuppliercard')) {
+				$type = 'supplier_price';
+				$otype = 'product_fournisseur_price';
+				// @todo choper le bon
+				$oid = '';
+			}
+			elseif ($this->in_context($parameters, 'stockproductcard')) {
+				$type = 'stock';
+				$otype = 'product_stock';
+				// @todo choper le bon
+				$oid = '';
+			}
+			elseif ($this->in_context($parameters, 'thirdpartysupplier')) {
+				$type = 'supplier';
+				$otype = 'societe';
+				$oid = $object->id;
+			}
+			elseif ($this->in_context($parameters, 'thirdpartycomm')) {
+				$type = 'customer';
+				$otype = 'societe';
+				$oid = $object->id;
+			}
+			elseif ($this->in_context($parameters, 'contactcard')) {
+				$type = 'address';
+				$otype = 'socpeople';
+				$oid = $object->id;
+			}
+
+			if (!empty($oid)) {
+				echo '<a class="butAction" href="/custom/mmiprestasync/ws2.php?type='.$type.'&otype='.$otype.'&oid='.$oid.'" onclick="MMI_PS_ajaxnotify(this.href); return false;">'.$langs->trans("MMIPrestaSynchronize").'</a>';
+				echo '<script>
+					function MMI_PS_ajaxnotify(url)
+					{
+						//console.log("URL : "+url);
+						$.get(url, function(r){
+							if (r.r==undefined || !r.r)
+								$.jnotify(\'Erreur de synchronisation...\');
+							else
+								$.jnotify(\'Synchronisation effectuée...\');
+						});
+					}
+				</script>';
+			}
 		}
 
 		if (! $error)

+ 14 - 155
core/modules/modMMIPrestaSync.class.php

@@ -103,6 +103,15 @@ class modMMIPrestaSync extends DolibarrModules
 			// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
 			'hooks' => array(
 				'pdfgeneration',
+				'ordercard',
+				'productcard',
+				'productlotcard',
+				'stockproductcard',
+				'pricesuppliercard',
+				'thirdpartysupplier',
+				'thirdpartycomm',
+				//'thirdpartycard',
+				'contactcard',
 				//   'data' => array(
 				//       'hookcontext1',
 				//       'hookcontext2',
@@ -263,6 +272,11 @@ class modMMIPrestaSync extends DolibarrModules
 		// Permissions provided by this module
 		$this->rights = array();
 		$r = 0;
+		$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Resynchroniser manuellement'; // Permission label
+		$this->rights[$r][4] = 'resync_button'; // In php code, permission will be checked by test if ($user->rights->mmiprestasync->level1->level2)
+		$this->rights[$r][5] = 'all'; // In php code, permission will be checked by test if ($user->rights->mmiprestasync->level1->level2)
+		$r++;
 		// Add here entries to declare new permissions
 		/* BEGIN MODULEBUILDER PERMISSIONS */
 		/*
@@ -289,162 +303,7 @@ class modMMIPrestaSync extends DolibarrModules
 		$r = 0;
 		// Add here entries to declare new menus
 		/* BEGIN MODULEBUILDER TOPMENU */
-		$this->menu[$r++] = array(
-			'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'top', // This is a Top menu entry
-			'titre'=>'ModulemmiprestasyncName',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'',
-			'url'=>'/mmiprestasync/index.php',
-			'langs'=>'mmiprestasync@mmiprestasync', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000 + $r,
-			'enabled'=>'$conf->mmiprestasync->enabled', // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'1', // Use 'perms'=>'$user->rights->mmiprestasync->myobject->read' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0, // 0=Menu for internal users, 1=external users, 2=both
-		);
-		/* END MODULEBUILDER TOPMENU */
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Sync Prestashop',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'index',
-			'url'=>'/mmiprestasync/index.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Fournisseurs',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'supplier',
-			'url'=>'/mmiprestasync/supplier.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Produit',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'product',
-			'url'=>'/mmiprestasync/product.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Lots produit',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'product_lot',
-			'url'=>'/mmiprestasync/product_lot.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Stock',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'stock',
-			'url'=>'/mmiprestasync/stock.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Tiers',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'tiers',
-			'url'=>'/mmiprestasync/tiers.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=index',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'Commandes',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'order',
-			'url'=>'/mmiprestasync/order.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>0,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
 		/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',                          // This is a Top menu entry
-			'titre'=>'MyObject',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'myobject',
-			'url'=>'/mmiprestasync/mmiprestasyncindex.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=myobject',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',			                // This is a Left menu entry
-			'titre'=>'List MyObject',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'mmiprestasync_myobject_list',
-			'url'=>'/mmiprestasync/myobject_list.php',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
-			'perms'=>'$user->rights->mmiprestasync->myobject->read',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
-		$this->menu[$r++]=array(
-			'fk_menu'=>'fk_mainmenu=mmiprestasync,fk_leftmenu=myobject',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
-			'type'=>'left',			                // This is a Left menu entry
-			'titre'=>'New MyObject',
-			'mainmenu'=>'mmiprestasync',
-			'leftmenu'=>'mmiprestasync_myobject_new',
-			'url'=>'/mmiprestasync/myobject_card.php?action=create',
-			'langs'=>'mmiprestasync@mmiprestasync',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
-			'position'=>1000+$r,
-			'enabled'=>'$conf->mmiprestasync->enabled',  // Define condition to show or hide menu entry. Use '$conf->mmiprestasync->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
-			'perms'=>'$user->rights->mmiprestasync->myobject->write',			                // Use 'perms'=>'$user->rights->mmiprestasync->level1->level2' if you want your menu with a permission rules
-			'target'=>'',
-			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
-		);
 		END MODULEBUILDER LEFTMENU MYOBJECT */
 		
 		// Disable menu

+ 1 - 2
core/triggers/interface_99_modMMIPrestaSync_PrestaSync.class.php

@@ -22,6 +22,7 @@
  */
 
 require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
+dol_include_once('custom/mmiprestasync/class/mmi_prestasync.class.php');
 
 /**
  *  Class of triggers for MyModule module
@@ -48,8 +49,6 @@ class InterfacePrestaSync extends DolibarrTriggers
 		// 'development', 'experimental', 'dolibarr' or version
 		$this->version = 'development';
 		$this->picto = 'logo@mmiprestasync';
-		
-		require_once DOL_DOCUMENT_ROOT.'/custom/mmiprestasync/class/mmi_prestasync.class.php';
 	}
 
 	/**

+ 0 - 30
img.php

@@ -1,30 +0,0 @@
-<?php
-/**
-* 2021 Mathieu Moulin iProspective
-*
-* NOTICE OF LICENSE
-*
-* This source file is subject to the Academic Free License (AFL 3.0)
-* that is bundled with this package in the file LICENSE.txt.
-* It is also available through the world-wide-web at this URL:
-* http://opensource.org/licenses/afl-3.0.php
-* If you did not receive a copy of the license and are unable to
-* obtain it through the world-wide-web, please send an email
-* to license@prestashop.com so we can send you a copy immediately.
-*
-* DISCLAIMER
-*
-* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
-* versions in the future. If you wish to customize PrestaShop for your
-* needs please refer to http://www.prestashop.com for more information.
-*
-*  @author    Mathieu Moulin <contact@iprospective.fr>
-*  @copyright 2021 Mathieu Moulin iProspective
-*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
-*  International Registered Trademark & Property of iProspective & Mathieu Moulin
-*/
-
-require_once '../../conf/conf.php';
-
-$db = new mysqli($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
-var_dump($db);

+ 1 - 20
index.php

@@ -25,6 +25,7 @@
  */
 
 // Load Dolibarr environment
+require_once 'env.inc.php';
 require_once 'main_load.inc.php';
 
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@@ -44,10 +45,6 @@ if (isset($user->socid) && $user->socid > 0)
 	$socid = $user->socid;
 }
 
-$max = 5;
-$now = dol_now();
-
-
 /*
  * Actions
  */
@@ -68,24 +65,8 @@ print load_fiche_titre($langs->trans("mmiprestasyncArea"), '', 'mmiprestasync.pn
 
 print '<div class="fichecenter"><div class="fichethirdleft">';
 
-echo "<h3>Données à Synchroniser :</h3>";
-
-echo "<p>Produits</p>";
-echo "<p>Fournisseurs</p>";
-echo "<p>Stocks</p>";
-echo "<p>Tiers (Clients/Prospects)</p>";
-echo "<p>Commandes</p>";
-echo "<p>Expéditions</p>";
-echo "<p>Factures/Avoirs</p>";
-echo "<p>Lots Produits (avec DLC/DLUO)</p>";
-
-
 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
 
-
-$NBMAX = 3;
-$max = 3;
-
 print '</div></div></div>';
 
 // End of page

+ 1 - 0
langs/fr_FR/mmiprestasync.lang

@@ -123,3 +123,4 @@ ExtrafieldToolTip_kit_unsync = Particulièrement utile si on est sur une déclin
 # Global
 #
 ASSIGN_COMMERCIAL = Assigner Commercial
+MMIPrestaSynchronize = ReSynchroniser Presta

+ 0 - 149
orders.php

@@ -1,149 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/product.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-
-echo "<h3>Synchronisation des Commandes</h3>";
-
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
-// Last modified myobject
-if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
-{
-	$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
-	$sql.= ", s.code_client";
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	$sql.= " WHERE s.client IN (1, 2, 3)";
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-	if ($socid)	$sql.= " AND s.rowid = $socid";
-	$sql .= " ORDER BY s.tms DESC";
-	$sql .= $db->plimit($max, 0);
-
-	$resql = $db->query($sql);
-	if ($resql)
-	{
-		$num = $db->num_rows($resql);
-		$i = 0;
-
-		print '<table class="noborder centpercent">';
-		print '<tr class="liste_titre">';
-		print '<th colspan="2">';
-		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
-		else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
-		else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
-		print '</th>';
-		print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
-		print '</tr>';
-		if ($num)
-		{
-			while ($i < $num)
-			{
-				$objp = $db->fetch_object($resql);
-				$companystatic->id=$objp->rowid;
-				$companystatic->name=$objp->name;
-				$companystatic->client=$objp->client;
-				$companystatic->code_client = $objp->code_client;
-				$companystatic->code_fournisseur = $objp->code_fournisseur;
-				$companystatic->canvas=$objp->canvas;
-				print '<tr class="oddeven">';
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
-				print '<td class="right nowrap">';
-				print $companystatic->getLibCustProspStatut();
-				print "</td>";
-				print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
-				print '</tr>';
-				$i++;
-
-
-			}
-
-			$db->free($resql);
-		}
-		else
-		{
-			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
-		}
-		print "</table><br>";
-	}
-}
-*/
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 0 - 149
product.php

@@ -1,149 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/product.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-
-echo "<h3>Synchronisation des Produit</h3>";
-
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
-// Last modified myobject
-if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
-{
-	$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
-	$sql.= ", s.code_client";
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	$sql.= " WHERE s.client IN (1, 2, 3)";
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-	if ($socid)	$sql.= " AND s.rowid = $socid";
-	$sql .= " ORDER BY s.tms DESC";
-	$sql .= $db->plimit($max, 0);
-
-	$resql = $db->query($sql);
-	if ($resql)
-	{
-		$num = $db->num_rows($resql);
-		$i = 0;
-
-		print '<table class="noborder centpercent">';
-		print '<tr class="liste_titre">';
-		print '<th colspan="2">';
-		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
-		else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
-		else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
-		print '</th>';
-		print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
-		print '</tr>';
-		if ($num)
-		{
-			while ($i < $num)
-			{
-				$objp = $db->fetch_object($resql);
-				$companystatic->id=$objp->rowid;
-				$companystatic->name=$objp->name;
-				$companystatic->client=$objp->client;
-				$companystatic->code_client = $objp->code_client;
-				$companystatic->code_fournisseur = $objp->code_fournisseur;
-				$companystatic->canvas=$objp->canvas;
-				print '<tr class="oddeven">';
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
-				print '<td class="right nowrap">';
-				print $companystatic->getLibCustProspStatut();
-				print "</td>";
-				print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
-				print '</tr>';
-				$i++;
-
-
-			}
-
-			$db->free($resql);
-		}
-		else
-		{
-			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
-		}
-		print "</table><br>";
-	}
-}
-*/
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 0 - 93
product_lot.php

@@ -1,93 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/product_lot.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-require_once './lib/product_lot.lib.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-echo "<h3>Synchronisation des Lots produit</h3>";
-
-// BDD Prestashop
-$db2 = lmiprestasyncPrestaDBConnect();
-//var_dump($db2);
-
-//echo '<div style="height: 200px;overflow: auto;">';
-lmiprestasyncProductLot();
-//echo '</div>';
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 0 - 94
stock.php

@@ -1,94 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/stock.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-require_once './lib/stock.lib.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-
-echo "<h3>Synchronisation des stock produit</h3>";
-
-// BDD Prestashop
-$db2 = lmiprestasyncPrestaDBConnect();
-//var_dump($db2);
-
-//echo '<div style="height: 200px;overflow: auto;">';
-lmiprestasyncProductBatch();
-//echo '</div>';
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 0 - 151
supplier.php

@@ -1,151 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/supplier.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-require_once './lib/tiers.lib.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-
-echo "<h3>Synchronisation des Fournisseurs</h3>";
-
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
-// Last modified myobject
-if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
-{
-	$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
-	$sql.= ", s.code_client";
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	$sql.= " WHERE s.client IN (1, 2, 3)";
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-	if ($socid)	$sql.= " AND s.rowid = $socid";
-	$sql .= " ORDER BY s.tms DESC";
-	$sql .= $db->plimit($max, 0);
-
-	$resql = $db->query($sql);
-	if ($resql)
-	{
-		$num = $db->num_rows($resql);
-		$i = 0;
-
-		print '<table class="noborder centpercent">';
-		print '<tr class="liste_titre">';
-		print '<th colspan="2">';
-		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
-		else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
-		else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
-		print '</th>';
-		print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
-		print '</tr>';
-		if ($num)
-		{
-			while ($i < $num)
-			{
-				$objp = $db->fetch_object($resql);
-				$companystatic->id=$objp->rowid;
-				$companystatic->name=$objp->name;
-				$companystatic->client=$objp->client;
-				$companystatic->code_client = $objp->code_client;
-				$companystatic->code_fournisseur = $objp->code_fournisseur;
-				$companystatic->canvas=$objp->canvas;
-				print '<tr class="oddeven">';
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
-				print '<td class="right nowrap">';
-				print $companystatic->getLibCustProspStatut();
-				print "</td>";
-				print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
-				print '</tr>';
-				$i++;
-
-
-			}
-
-			$db->free($resql);
-		}
-		else
-		{
-			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
-		}
-		print "</table><br>";
-	}
-}
-*/
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 0 - 151
tiers.php

@@ -1,151 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
- * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
- *
- * 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 3 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, see <https://www.gnu.org/licenses/>.
- */
-
-/**
- *	\file       lmiprestasync/tiers.php
- *	\ingroup    lmiprestasync
- *	\brief      Home page of lmiprestasync top menu
- */
-
-// Load Dolibarr environment
-require_once 'main_load.inc.php';
-
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-
-require_once './lib/tiers.lib.php';
-
-// Load translation files required by the page
-$langs->loadLangs(array("lmiprestasync@lmiprestasync"));
-
-$action = GETPOST('action', 'alpha');
-
-
-// Security check
-//if (! $user->rights->lmiprestasync->myobject->read) accessforbidden();
-$socid = GETPOST('socid', 'int');
-if (isset($user->socid) && $user->socid > 0)
-{
-	$action = '';
-	$socid = $user->socid;
-}
-
-$max = 5;
-$now = dol_now();
-
-
-/*
- * Actions
- */
-
-// None
-
-
-/*
- * View
- */
-
-$form = new Form($db);
-$formfile = new FormFile($db);
-
-llxHeader("", $langs->trans("LMIPrestaSyncArea"));
-
-print load_fiche_titre($langs->trans("LMIPrestaSyncArea"), '', 'lmiprestasync.png@lmiprestasync');
-
-print '<div class="fichecenter"><div class="fichethirdleft">';
-
-
-echo "<h3>Synchronisation des Clients/Prospects</h3>";
-
-
-print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
-
-
-$NBMAX = 3;
-$max = 3;
-
-/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
-// Last modified myobject
-if (! empty($conf->lmiprestasync->enabled) && $user->rights->lmiprestasync->read)
-{
-	$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
-	$sql.= ", s.code_client";
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-	$sql.= " WHERE s.client IN (1, 2, 3)";
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-	if ($socid)	$sql.= " AND s.rowid = $socid";
-	$sql .= " ORDER BY s.tms DESC";
-	$sql .= $db->plimit($max, 0);
-
-	$resql = $db->query($sql);
-	if ($resql)
-	{
-		$num = $db->num_rows($resql);
-		$i = 0;
-
-		print '<table class="noborder centpercent">';
-		print '<tr class="liste_titre">';
-		print '<th colspan="2">';
-		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
-		else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
-		else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
-		print '</th>';
-		print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
-		print '</tr>';
-		if ($num)
-		{
-			while ($i < $num)
-			{
-				$objp = $db->fetch_object($resql);
-				$companystatic->id=$objp->rowid;
-				$companystatic->name=$objp->name;
-				$companystatic->client=$objp->client;
-				$companystatic->code_client = $objp->code_client;
-				$companystatic->code_fournisseur = $objp->code_fournisseur;
-				$companystatic->canvas=$objp->canvas;
-				print '<tr class="oddeven">';
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
-				print '<td class="right nowrap">';
-				print $companystatic->getLibCustProspStatut();
-				print "</td>";
-				print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
-				print '</tr>';
-				$i++;
-
-
-			}
-
-			$db->free($resql);
-		}
-		else
-		{
-			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
-		}
-		print "</table><br>";
-	}
-}
-*/
-
-print '</div></div></div>';
-
-// End of page
-llxFooter();
-$db->close();

+ 44 - 0
ws2.php

@@ -0,0 +1,44 @@
+<?php
+/* Copyright (C) 2023      Mathieu Moulin	<contact@iprospective.fr>
+ *
+ * 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 3 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, see <https://www.gnu.org/licenses/>.
+ */
+
+// Load Dolibarr environment
+require_once 'env.inc.php';
+require_once 'main_load.inc.php';
+
+dol_include_once('custom/mmiprestasync/class/mmi_prestasync.class.php');
+
+header('content-type:application/json; charset=utf-8');
+
+if (empty($user) || empty($user->id)) {
+	echo json_encode(['r'=>false, 'reason'=>'Not connected']);
+	die();
+}
+$permission = $user->rights->mmiprestasync->resync_button->all;
+
+$type = GETPOST('type');
+$otype = GETPOST('otype');
+$oid = GETPOST('oid');
+
+if (empty($type) || empty($otype) || empty($oid)) {
+	echo json_encode(['r'=>false, 'reason'=>'Missing parameter']);
+	die();
+}
+$ret = mmi_prestasync::ws_trigger($type, $otype, 'osync', $oid);
+
+
+echo json_encode(['r'=>true, 'result'=>$ret]);
+die();