Browse Source

Merge branch 'master' into dev

Mathieu Moulin 11 months ago
parent
commit
acb754156e

+ 1 - 1
src/install/product.inc.php

@@ -15,7 +15,7 @@ if (isset($_GET['pd'])) {
 	}
 
 	$sql = 'SELECT pa.id_product_attribute
-		FROM ps_product p
+		FROM '.DB_P_PREFIX.'product p
 		INNER JOIN '.DB_P_PREFIX.'product_attribute pa ON pa.id_product=p.id_product';
 
 	$q = DB::p_select($sql);

+ 25 - 8
src/install/supplier.inc.php

@@ -1,12 +1,29 @@
 <?php
 
 // Fournisseur
-$sql = 'SELECT s.*
-	FROM ps_supplier s';
-$q = DB::p_select($sql);
-while ($row=$q->fetch_assoc()) {
-	var_dump($row);
-	if (isset($_GET['go']))
-		sync::_action('supplier', 'pd', 'osync', 'supplier', $row['id_supplier']);
-	break;
+
+if (isset($_GET['pd'])) {
+        $sql = 'SELECT s.*
+                FROM '.DB_P_PREFIX.'supplier s';
+	$q = DB::p_select($sql);
+	while ($row=$q->fetch_assoc()) {
+		var_dump($row);
+		if (isset($_GET['go']))
+			sync::_action('supplier', 'pd', 'osync', 'supplier', $row['id_supplier']);
+		break;
+	}
+}
+
+if (isset($_GET['dp'])) {
+        $sql = 'SELECT s.*
+                FROM '.DB_D_PREFIX.'societe s
+		WHERE s.fournisseur=1';
+        $q = DB::d_select($sql);
+        while ($row=$q->fetch_assoc()) {
+                var_dump($row);
+                if (isset($_GET['go']))
+                        sync::_action('supplier', 'dp', 'osync', 'supplier', $row['rowid']);
+//                break;
+        }
 }
+

+ 2 - 2
src/notify.inc.php

@@ -22,7 +22,7 @@ class notify
 	{
 		if (empty($this->list))
 			return;
-		$sep = '<hr style="border-top: 1px solid rgb(0,0,0);" />';
+		$sep = '<hr style="border-top: 1px solid rgb(0,0,0);" />'."\r\n";
 
 		$message = '<h3>CONTEXT INFORMATION</h3>';
 		$message .= '<p>REMOTE_ADDR : '.$_SERVER['REMOTE_ADDR'].'</p>'
@@ -39,7 +39,7 @@ class notify
 			foreach($db_error_log as &$error)
 				$error = json_encode($error);
 			$message .= $sep.'<h3>DB DEBUG LOG</h3>'.
-				implode('<br /><br />', $db_error_log);
+				implode('<br /><br />'."\r\n", $db_error_log);
 		}
 
 		mail(DEBUG_EMAIL_TO.(!empty($this->emails) ?','.implode(',', $this->emails) :''),

+ 22 - 0
src/resync/product.inc.php

@@ -14,6 +14,28 @@ if (isset($_GET['pd'])) {
        }
 }
 
+if (isset($_GET['dp_error'])) {
+        if (empty($_GET['start']) || !is_numeric($start=$_GET['start']) || $start != (int)$start)
+                $start = 0;
+        if (empty($_GET['nb']) || !is_numeric($nb=$_GET['nb']) || $nb != (int)$nb)
+                $nb = 100;
+	$sql = 'SELECT od.oid
+		FROM '.DB_P_BASE.'.`'.DB_P_PREFIX.'product` p
+		LEFT JOIN '.DB_P_BASE.'.`'.DB_P_PREFIX.'product_lang` pl ON pl.id_product=p.id_product
+		INNER JOIN '.DB_BASE.'.`_objects_p` op ON op.oid=p.id_product AND op.tid=1
+		INNER JOIN '.DB_BASE.'.`_objects_d` od ON od.id=op.id
+		WHERE pl.id_product IS NULL AND (p.reference != "" AND p.reference IS NOT NULL)
+		ORDER BY od.oid ASC
+		LIMIT '.$start.', '.$nb;
+	//echo $sql;
+	$q = DB::o_select($sql);
+	while(list($id)=$q->fetch_row()) {
+		if (isset($_GET['go']))
+			sync::_action('product', 'dp', 'osync', 'product', $id);
+		else
+			echo '<p>'.$id.'</p>';
+	}
+}
 
 if (isset($_GET['dp'])) {
 	if (empty($_GET['start']) || !is_numeric($start=$_GET['start']) || $start != (int)$start)

+ 1 - 1
src/sync/product/pd.inc.php

@@ -212,7 +212,7 @@ public function pd_update_more(&$o, &$d_data_map, &$d_data_map_create, &$d_data,
 
 	// product_supplier
 	// Only add/update if exists, not a complete sync with deletion in Doli
-	if (!empty($p_data['product_supplier'])) foreach($p_data['product_supplier'] as $row)
+	if (defined('PD_SYNC_SUPPLIER_PRICE') && PD_SYNC_SUPPLIER_PRICE && !empty($p_data['product_supplier'])) foreach($p_data['product_supplier'] as $row)
 		static::_action('supplier_price', 'pd', 'osync', 'product_supplier', $row['id_product_supplier']);
 	
 	// Déclinaisons

+ 2 - 1
web/.user.ini

@@ -1,3 +1,4 @@
-display_errors = 1
+display_errors=On
 zend_extension=xdebug.so
+error_log = "log_php/erp-sync.error.log"