Fix: Type of line (product/service) could not be edited on supplier
order/invoice.
This commit is contained in:
parent
a9779ca1ff
commit
8137fd7fe4
@ -544,7 +544,7 @@ class Form
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $hidetext Do not show label before combo box
|
||||
* @param string $forceall Force to show products and services in combo list, whatever are activated modules
|
||||
* @param string $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service')
|
||||
* @return void
|
||||
*/
|
||||
function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0)
|
||||
@ -552,8 +552,8 @@ class Form
|
||||
global $db,$langs,$user,$conf;
|
||||
|
||||
// If product & services are enabled or both disabled.
|
||||
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled)))
|
||||
if ($forceall > 0 || (empty($forceall) && ! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($forceall) && empty($conf->product->enabled) && empty($conf->service->enabled)) )
|
||||
{
|
||||
if (empty($hidetext)) print $langs->trans("Type").': ';
|
||||
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
@ -1698,7 +1698,7 @@ elseif (! empty($object->id))
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
// Ligne en mode update
|
||||
// Edit line
|
||||
if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
|
||||
{
|
||||
print "\n";
|
||||
@ -1723,8 +1723,10 @@ elseif (! empty($object->id))
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_type_of_lines($line->product_type,'type',1);
|
||||
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) print '<br>';
|
||||
$forceall=1; // For suppliers, we always show all types
|
||||
print $form->select_type_of_lines($line->product_type,'type',1,0,$forceall);
|
||||
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
||||
}
|
||||
|
||||
if (is_object($hookmanager))
|
||||
@ -1758,7 +1760,7 @@ elseif (! empty($object->id))
|
||||
// Add free products/services form
|
||||
global $forceall, $senderissupplier, $dateSelector;
|
||||
$forceall=1; $senderissupplier=1; $dateSelector=0;
|
||||
|
||||
|
||||
$var = true;
|
||||
|
||||
// Add free products/services
|
||||
@ -1766,7 +1768,7 @@ elseif (! empty($object->id))
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_project = ($tmpproject > 0) ? $tmpproject : null;
|
||||
|
||||
|
||||
// Auto calculation of date due if not filled by user
|
||||
if(empty($object->date_echeance)) $object->date_echeance = $object->calculate_date_lim_reglement();
|
||||
|
||||
@ -1953,7 +1953,7 @@ else
|
||||
|
||||
print '<input type="hidden" name="lineid" value="'.$object->lines[$i]->rowid.'">';
|
||||
|
||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product)
|
||||
if ((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $object->lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<input type="hidden" name="idprod" value="'.$object->lines[$i]->fk_product.'">';
|
||||
$product_static=new ProductFournisseur($db);
|
||||
@ -1964,9 +1964,9 @@ else
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$forceall=1; // For suppliers, we always show all types
|
||||
print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1);
|
||||
print $form->select_type_of_lines($object->lines[$i]->product_type,'type',1,0,$forceall);
|
||||
if ($forceall || (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
|
||||
|| (empty($conf->product->enabled) && empty($conf->service->enabled))) print '<br>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user