FIXME: with ajax autocompleter, does not see the products that have no
supplier prices because they can be selected and it creates an error message. Fix: Do not make a "print" on "hook methods", just get the result
This commit is contained in:
parent
4825448ced
commit
3438305169
@ -1425,7 +1425,7 @@ class Form
|
|||||||
|
|
||||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||||
if ($objp->fprice == '') $opt.=' disabled="disabled"';
|
if (empty($objp->idprodfournprice)) $opt.=' disabled="disabled"';
|
||||||
$opt.= '>';
|
$opt.= '>';
|
||||||
|
|
||||||
$objRef = $objp->ref;
|
$objRef = $objp->ref;
|
||||||
@ -1440,7 +1440,7 @@ class Form
|
|||||||
$opt.=dol_trunc($objp->label,18).' - ';
|
$opt.=dol_trunc($objp->label,18).' - ';
|
||||||
$outval.=dol_trunc($label,18).' - ';
|
$outval.=dol_trunc($label,18).' - ';
|
||||||
|
|
||||||
if ($objp->fprice != '') // Keep != ''
|
if (! empty($objp->idprodfournprice))
|
||||||
{
|
{
|
||||||
$currencytext=$langs->trans("Currency".$conf->currency);
|
$currencytext=$langs->trans("Currency".$conf->currency);
|
||||||
$currencytextnoent=$langs->transnoentities("Currency".$conf->currency);
|
$currencytextnoent=$langs->transnoentities("Currency".$conf->currency);
|
||||||
@ -1486,7 +1486,10 @@ class Form
|
|||||||
// "key" value of json key array is used by jQuery automatically as selected value
|
// "key" value of json key array is used by jQuery automatically as selected value
|
||||||
// "label" value of json key array is used by jQuery automatically as text for combo box
|
// "label" value of json key array is used by jQuery automatically as text for combo box
|
||||||
$outselect.=$opt;
|
$outselect.=$opt;
|
||||||
array_push($outjson,array('key'=>$outkey,'value'=>$outref,'label'=>$outval));
|
// FIXME don't select with autocomplete
|
||||||
|
if (! empty($objp->idprodfournprice)) {
|
||||||
|
array_push($outjson,array('key'=>$outkey,'value'=>$outref,'label'=>$outval));
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ if (! empty($conf->margin->enabled)) {
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('line'=>$line,'fk_parent_line'=>$line->fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
$parameters=array('line'=>$line,'fk_parent_line'=>$line->fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
||||||
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// editeur wysiwyg
|
// editeur wysiwyg
|
||||||
|
|||||||
@ -77,7 +77,7 @@ jQuery(document).ready(function() {
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('fk_parent_line'=>$_POST["fk_parent_line"]);
|
$parameters=array('fk_parent_line'=>$_POST["fk_parent_line"]);
|
||||||
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
{
|
{
|
||||||
$fk_parent_line = ($_POST["fk_parent_line"] ? $_POST["fk_parent_line"] : $line->fk_parent_line);
|
$fk_parent_line = ($_POST["fk_parent_line"] ? $_POST["fk_parent_line"] : $line->fk_parent_line);
|
||||||
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
$parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer);
|
||||||
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$this,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// editeur wysiwyg
|
// editeur wysiwyg
|
||||||
|
|||||||
@ -193,13 +193,14 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
if ((! isset($_POST['qty']) || $_POST['qty'] == ''))
|
if (empty($_POST['idprodfournprice']) && (! isset($_POST['qty']) || $_POST['qty'] == '')
|
||||||
|
|| ! empty($_POST['idprodfournprice']) && (! isset($_POST['pqty']) || $_POST['pqty'] == ''))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice'])))
|
if (! $error && (($_POST['qty'] || $_POST['pqty']) && (($_POST['pu'] && ($_POST['np_desc'] || $_POST['dp_desc'])) || $_POST['idprodfournprice'])))
|
||||||
{
|
{
|
||||||
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
if ($object->fetch($id) < 0) dol_print_error($db,$object->error);
|
||||||
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
if ($object->fetch_thirdparty() < 0) dol_print_error($db,$object->error);
|
||||||
@ -1192,7 +1193,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if ($conf->projet->enabled)
|
if (! empty($conf->projet->enabled))
|
||||||
{
|
{
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr><td height="10">';
|
print '<tr><td height="10">';
|
||||||
@ -1215,9 +1216,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
|
||||||
// Ligne de 3 colonnes
|
// Ligne de 3 colonnes
|
||||||
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
print '<tr><td>'.$langs->trans("AmountHT").'</td>';
|
||||||
@ -1418,7 +1419,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i);
|
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i);
|
||||||
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description - Editor wysiwyg
|
// Description - Editor wysiwyg
|
||||||
@ -1474,13 +1475,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
$forceall=1;
|
$forceall=1;
|
||||||
print $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,0,$forceall);
|
print $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,0,$forceall);
|
||||||
if ($forceall || ($conf->product->enabled && $conf->service->enabled)
|
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
||||||
|
|
||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
@ -1536,7 +1537,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('htmlname'=>'idprodfournprice');
|
$parameters=array('htmlname'=>'idprodfournprice');
|
||||||
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
|
|||||||
@ -1614,7 +1614,7 @@ else
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
|
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
|
||||||
echo $hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formEditProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Description - Editor wysiwyg
|
// Description - Editor wysiwyg
|
||||||
@ -1750,7 +1750,7 @@ else
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
@ -1812,7 +1812,7 @@ else
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('htmlname'=>'idprodfournprice');
|
$parameters=array('htmlname'=>'idprodfournprice');
|
||||||
echo $hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nbrows=ROWS_2;
|
$nbrows=ROWS_2;
|
||||||
|
|||||||
@ -291,7 +291,7 @@ if ($id || $ref)
|
|||||||
if (is_object($hookmanager))
|
if (is_object($hookmanager))
|
||||||
{
|
{
|
||||||
$parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id);
|
$parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id);
|
||||||
echo $hookmanager->executeHooks('formCreateThirdpartyOptions',$parameters,$object,$action);
|
$reshook=$hookmanager->executeHooks('formCreateThirdpartyOptions',$parameters,$object,$action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user