Skip to content

Commit

Permalink
Fix: For supplier order/invoice, deselect product when free line is
Browse files Browse the repository at this point in the history
selected.
  • Loading branch information
eldy committed Jun 9, 2014
1 parent 48cdd3c commit 8d8ca15
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 103 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/tpl/objectline_create.tpl.php
Expand Up @@ -487,7 +487,7 @@ function price2numjs(num)
function setforfree() {
jQuery("#search_idprod").val('');
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").attr('checked',true);
jQuery("#prod_entry_mode_predef").attr('checked',false);
Expand Down
102 changes: 0 additions & 102 deletions htdocs/fourn/commande/fiche.php
Expand Up @@ -1734,17 +1734,6 @@
// Form to add new line
if ($object->statut == 0 && $user->rights->fournisseur->commande->creer && $action <> 'edit_line')
{
/*print '<tr class="liste_titre">';
print '<td>';
print '<a name="add"></a>'; // ancre
print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';*/

// Add free products/services form
global $forceall, $senderissupplier, $dateSelector;
$forceall=1; $senderissupplier=1; $dateSelector=0;
Expand All @@ -1761,97 +1750,6 @@
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}

/*
$var=true;
print '<tr '.$bc[$var].'>';
print '<td>';
$forceall=1;
print $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'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))
{
$parameters=array();
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
}
$nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('dp_desc', GETPOST('dp_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->load_tva('tva_tx',(GETPOST('tva_tx')?GETPOST('tva_tx'):-1),$object->thirdparty,$mysoc);
print '</td>';
print '<td align="right"><input type="text" name="pu" size="5" value="'.GETPOST('pu').'"></td>';
print '<td align="right"><input type="text" name="qty" value="'.(GETPOST('qty')?GETPOST('qty'):'1').'" size="2"></td>';
print '<td align="right" class="nowrap"><input type="text" name="remise_percent" size="1" value="'.(GETPOST('remise_percent')?GETPOST('remise_percent'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline_libre"></td>';
print '</tr>';
// Ajout de produits/services predefinis
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(\'#idprodfournprice\').change(function() {
if (jQuery(\'#idprodfournprice\').val() > 0) jQuery(\'#np_desc\').focus();
});
});
</script>';
print '<tr class="liste_titre">';
print '<td colspan="3">';
print $langs->trans("AddNewLine").' - ';
if (! empty($conf->service->enabled))
{
print $langs->trans('RecordedProductsAndServices');
}
else
{
print $langs->trans('RecordedProducts');
}
print '</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td>';
print '<td colspan="4">&nbsp;</td>';
print '</tr>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td colspan="3">';
$ajaxoptions=array(
'update' => array('qty_predef'=>'qty','remise_percent_predef' => 'discount'), // html id tag will be edited with which ajax json response key
'option_disabled' => 'addPredefinedProductButton', // html id to disable once select is done
'error' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'error'
);
$form->select_produits_fournisseurs($object->fourn_id, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions);
if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) print '<br>';
if (is_object($hookmanager))
{
$parameters=array('htmlname'=>'idprodfournprice');
$reshook=$hookmanager->executeHooks('formCreateProductSupplierOptions',$parameters,$object,$action);
}
$nbrows=ROWS_2;
if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
$doleditor = new DolEditor('np_desc', GETPOST('np_desc'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, $nbrows, 70);
$doleditor->Create();
print '</td>';
print '<td align="right"><input type="text" size="2" id="qty_predef" name="qty_predef" value="'.(GETPOST('qty_predef')?GETPOST('qty_predef'):'1').'"></td>';
print '<td align="right" class="nowrap"><input type="text" size="1" id="remise_percent_predef" name="remise_percent_predef" value="'.(GETPOST('remise_percent_predef')?GETPOST('remise_percent_predef'):$object->thirdparty->remise_percent).'"><span class="hideonsmartphone">%</span></td>';
print '<td align="center" colspan="4"><input type="submit" id="addPredefinedProductButton" class="button" value="'.$langs->trans('Add').'" name="addline_predefined"></td>';
print '</tr>';
}*/
}
print '</table>';

Expand Down

0 comments on commit 8d8ca15

Please sign in to comment.