Skip to content

Commit

Permalink
Fix: Type of line (product/service) could not be edited on supplier
Browse files Browse the repository at this point in the history
order/invoice.
  • Loading branch information
eldy committed Jul 20, 2014
1 parent a9779ca commit 8137fd7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -544,16 +544,16 @@ function select_country($selected='',$htmlname='country_id',$htmloption='',$maxl
* @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)
{
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.'">';
Expand Down
12 changes: 7 additions & 5 deletions htdocs/fourn/commande/fiche.php
Expand Up @@ -1698,7 +1698,7 @@
print "</tr>";
}

// Ligne en mode update
// Edit line
if ($action == 'edit_line' && $user->rights->fournisseur->commande->creer && ($_GET["rowid"] == $line->id))
{
print "\n";
Expand All @@ -1723,8 +1723,10 @@
}
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))
Expand Down Expand Up @@ -1758,15 +1760,15 @@
// Add free products/services form
global $forceall, $senderissupplier, $dateSelector;
$forceall=1; $senderissupplier=1; $dateSelector=0;

$var = true;

// Add free products/services
$object->formAddObjectLine(1, $societe, $mysoc);

$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

}
print '</table>';

Expand Down
8 changes: 4 additions & 4 deletions htdocs/fourn/facture/fiche.php
Expand Up @@ -306,7 +306,7 @@
$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();

Expand Down Expand Up @@ -1953,7 +1953,7 @@

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);
Expand All @@ -1964,9 +1964,9 @@
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>';
}
Expand Down

0 comments on commit 8137fd7

Please sign in to comment.