diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 7df8e437272..9358eb9c60d 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -4896,14 +4896,14 @@ class Product extends CommonObject
}
if (!empty($conf->accounting->enabled)) {
- if ($this->status) {
+ if ($this->status && isset($this->accountancy_code_sell)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= '
';
$label .= '
'.$langs->trans('ProductAccountancySellCode').': '.length_accountg($this->accountancy_code_sell);
$label .= '
'.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_intra);
$label .= '
'.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_export);
}
- if ($this->status_buy) {
+ if ($this->status_buy && isset($this->accountancy_code_buy)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (empty($this->status)) {
$label .= '
';
diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php
index cfa2f8fc2f6..b921f16d02e 100644
--- a/htdocs/product/popuprop.php
+++ b/htdocs/product/popuprop.php
@@ -68,6 +68,7 @@ restrictedArea($user, 'produit|service', 0, 'product&product', '', '');
*/
$form = new Form($db);
+$tmpproduct = new Product($db);
$helpurl = '';
if ($type == '0') {
@@ -124,7 +125,7 @@ $infoprod = array();
// Add lines for object
-$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, SUM(pd.qty) as c";
+$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, p.tobuy, p.tosell, p.tobatch, p.barcode, SUM(pd.qty) as c";
$textforqty = 'Qty';
if ($mode == 'facture') {
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as pd";
@@ -141,7 +142,7 @@ $sql .= " AND p.rowid = pd.fk_product";
if ($type !== '') {
$sql .= " AND fk_product_type = ".((int) $type);
}
-$sql .= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type";
+$sql .= " GROUP BY p.rowid, p.label, p.ref, p.fk_product_type, p.tobuy, p.tosell, p.tobatch, p.barcode";
$num = 0;
$totalnboflines = 0;
@@ -163,7 +164,7 @@ if (!empty($mode) && $mode != '-1') {
while ($i < $num) {
$objp = $db->fetch_object($resql);
- $infoprod[$objp->rowid] = array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label);
+ $infoprod[$objp->rowid] = array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label, 'tobuy'=>$objp->tobuy, 'tosell'=>$objp->tobuy, 'tobatch'=>$objp->tobatch, 'barcode'=>$objp->barcode);
$infoprod[$objp->rowid]['nbline'] = $objp->c;
$i++;
@@ -228,23 +229,28 @@ if ($mode && $mode != '-1') {
}
}
+ $tmpproduct->ref = $vals['ref'];
+ $tmpproduct->label = $vals['label'];
+ $tmpproduct->type = $vals['type'];
+ $tmpproduct->status = $vals['tosell'];
+ $tmpproduct->status_buy = $vals['tobuy'];
+ $tmpproduct->status_batch = $vals['tobatch'];
+ $tmpproduct->barcode = $vals['barcode'];
+
print "