2
0
forked from Wavyzz/dolibarr

Requested changes implemented

This commit is contained in:
Tim Otte
2019-10-22 11:36:28 +02:00
parent a8e73533b9
commit ceb3482204
3 changed files with 20 additions and 12 deletions

View File

@@ -590,19 +590,24 @@ abstract class CommonDocGenerator
$resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs);
// Check if the current line belongs to a supplier order
if (get_class($line) == 'CommandeFournisseurLigne') {
if (get_class($line) == 'CommandeFournisseurLigne')
{
// Add the product supplier extrafields to the substitutions
$extralabels=$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
$columns = "";
foreach ($extralabels as $key => $value) {
foreach ($extralabels as $key => $value)
$columns .= "$key, ";
}
$columns = substr($columns, 0, strlen($columns) - 2);
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_fourn . "'");
if ($this->db->num_rows($resql) > 0) {
$resql = $this->db->fetch_object($resql);
foreach ($extralabels as $key => $value) {
$resarray['line_product_supplier_'.$key] = $resql->{$key};
if ($columns != "")
{
$columns = substr($columns, 0, strlen($columns) - 2);
$resql = $this->db->query("SELECT $columns FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields AS ex INNER JOIN " . MAIN_DB_PREFIX . "product_fournisseur_price AS f ON ex.fk_object = f.rowid WHERE f.ref_fourn = '" . $line->ref_fourn . "'");
if ($this->db->num_rows($resql) > 0) {
$resql = $this->db->fetch_object($resql);
foreach ($extralabels as $key => $value)
$resarray['line_product_supplier_'.$key] = $resql->{$key};
}
}
}

View File

@@ -341,3 +341,4 @@ ErrorDestinationProductNotFound=Destination product not found
ErrorProductCombinationNotFound=Product variant not found
ActionAvailableOnVariantProductOnly=Action only available on the variant of product
ProductsPricePerCustomer=Product prices per customers
ProductSupplierExtraFields=Additional Attributes (Supplier Prices)

View File

@@ -758,7 +758,8 @@ SCRIPT;
print '</tr>';
}
$extralabels=$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
// Extrafields
$resql = $db->query("SELECT * FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields WHERE fk_object = " . $rowid);
if ($db->num_rows($resql) != 1) {
@@ -865,7 +866,8 @@ SCRIPT;
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels=$extrafields->attributes["product_fournisseur_price"]['label'];
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (! empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {