Skip to content
Permalink
Browse files

Add childproduct photo to childproduct list

  • Loading branch information
fappels committed Sep 27, 2019
1 parent e264f12 commit c2e9adbc4a735038616e53f34df9607cc870ab38
@@ -874,7 +874,7 @@ public function readOrderLine(stdClass $params)
} else {
$row->warehouse_id = $warehouse_id;
array_push($results, $row);
$myprod->fetchSubProducts($results, clone $row);
$myprod->fetchSubProducts($results, clone $row, $photoSize);
}
} else {
// get orderline with stock of warehouse
@@ -938,9 +938,9 @@ public function readOrderLine(stdClass $params)
$row->is_sub_product = false;
if (empty($conf->productbatch->enabled) || empty($line_warehouse_id)) {
array_push($results, $row);
$myprod->fetchSubProducts($results, clone $row);
$myprod->fetchSubProducts($results, clone $row, $photoSize);
} else {
if (($res = $myprod->fetchBatches($results, $row, $line->rowid, $line_warehouse_id, $myprod->stock_warehouse[$line_warehouse_id]->id)) < 0) return $res;
if (($res = $myprod->fetchBatches($results, $row, $line->rowid, $line_warehouse_id, $myprod->stock_warehouse[$line_warehouse_id]->id, false, null, '', $photoSize)) < 0) return $res;
}
}
} else {
@@ -1001,9 +1001,10 @@ public function readOrderLine(stdClass $params)
$row->is_sub_product = false;
if (empty($conf->productbatch->enabled)) {
array_push($results, $row);
$myprod->fetchSubProducts($results, clone $row);
$myprod->fetchSubProducts($results, clone $row, $photoSize);
$myprod->fetch($line->fk_product);
} else {
if (($res = $myprod->fetchBatches($results, $row, $line->rowid, $warehouse, $stock_warehouse->id)) < 0) return $res;
if (($res = $myprod->fetchBatches($results, $row, $line->rowid, $warehouse, $stock_warehouse->id, false, null, '', $photoSize)) < 0) return $res;
}
}
}
@@ -1480,7 +1480,7 @@ private function fetchIdFromBarcode($barcode)
*
* @return int < 0 if error > 0 if OK
*/
public function fetchBatches(&$results,$row,$id,$warehouseId,$productStockId,$includeNoBatch = false, $batchId = null, $batchValue = '') {
public function fetchBatches(&$results,$row,$id,$warehouseId,$productStockId,$includeNoBatch = false, $batchId = null, $batchValue = '', $photoFormat = '') {
require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
$batches = array();
$batchesQty = 0;
@@ -1526,7 +1526,8 @@ public function fetchBatches(&$results,$row,$id,$warehouseId,$productStockId,$in
$num++;
$row->is_sub_product = false;
array_push($results, clone $row);
$this->fetchSubProducts($results, $row);
$this->fetchSubProducts($results, $row, $photoFormat);
$this->fetch($product_id);
}
if ($includeNoBatch && (!empty($stockQty) || !empty($productStockId)) && isset($row->id) && isset($row->batch_id)) {
@@ -1736,7 +1737,7 @@ public function fetchBarcodeWithChecksum()
*
* @return void
*/
public function fetchSubProducts(&$results, $row) {
public function fetchSubProducts(&$results, $row, $photoFormat = '') {
global $conf;
if (! empty($conf->global->PRODUIT_SOUSPRODUITS)) {
@@ -1755,6 +1756,10 @@ public function fetchSubProducts(&$results, $row) {
$row->label = $rowLabel.' -> '.$value['fullpath'];
$row->qty_asked = $value['nb_total'];
$row->stock = $value['stock'];
$row->has_photo = 0;
$subProduct = new Product($this->db);
$subProduct->fetch($value['id']);
$this->fetchPhoto($row, $photoFormat, 0, $subProduct);
array_push($results, clone $row);
}
}
@@ -61,7 +61,7 @@ function __construct($db)
// not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Connect to external applications which use Sencha Ext.direct";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = '1.0.51';
$this->version = '1.0.52.beta';
// Key used in llx_const table to save module status enabled/disabled
// (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);

0 comments on commit c2e9adb

Please sign in to comment.
You can’t perform that action at this time.