USe fk_product is better than ref
This commit is contained in:
parent
f3ffc7ce8a
commit
78697c1735
@ -104,8 +104,11 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if ($ret > 0)
|
||||
$ret = $object->fetch_thirdparty();
|
||||
if ($ret < 0)
|
||||
dol_print_error('', $object->error);
|
||||
if ($ret <= 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -1711,7 +1714,7 @@ if ($action == 'create')
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
} else {
|
||||
} elseif ($object->id > 0) {
|
||||
/*
|
||||
* Show object in view mode
|
||||
*/
|
||||
@ -1818,7 +1821,6 @@ if ($action == 'create')
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
||||
|
||||
@ -425,7 +425,7 @@ abstract class CommonDocGenerator
|
||||
{
|
||||
$object->fetch_projet();
|
||||
}
|
||||
|
||||
|
||||
$resarray[$array_key.'_project_ref'] = $object->project->ref;
|
||||
$resarray[$array_key.'_project_title'] = $object->project->title;
|
||||
$resarray[$array_key.'_project_description'] = $object->project->description;
|
||||
@ -510,7 +510,7 @@ abstract class CommonDocGenerator
|
||||
'line_multicurrency_total_tva_locale' => price($line->multicurrency_total_tva, 0, $outputlangs),
|
||||
'line_multicurrency_total_ttc_locale' => price($line->multicurrency_total_ttc, 0, $outputlangs),
|
||||
);
|
||||
|
||||
|
||||
// Units
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
@ -527,16 +527,16 @@ abstract class CommonDocGenerator
|
||||
$line->fetch_optionals($line->rowid,$extralabels);
|
||||
|
||||
$resarray = $this->fill_substitutionarray_with_extrafields($line,$resarray,$extrafields,$array_key=$array_key,$outputlangs);
|
||||
|
||||
|
||||
// Load product data optional fields to the line -> enables to use "line_options_{extrafield}"
|
||||
if (isset($line->product_ref))
|
||||
if (isset($line->fk_product) && $line->fk_product > 0)
|
||||
{
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch(null, $line->product_ref);
|
||||
foreach($product->array_options as $key=>$label)
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($line->fk_product);
|
||||
foreach($tmpproduct->array_options as $key=>$label)
|
||||
$resarray["line_".$key] = $label;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $resarray;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user