add ability to edit price ht before adding a line

This commit is contained in:
atm-greg 2018-10-29 15:37:17 +01:00
parent 0500f54237
commit 9f890c28dd
3 changed files with 28 additions and 2 deletions

View File

@ -646,8 +646,19 @@ jQuery(document).ready(function() {
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
jQuery('#trlinefordates').show();
<?php
if (!empty($conf->global->EDIT_PREDEF_PRICEHT))
{
?>
// get the HT price for the product and display it
$.post('<?php echo DOL_URL_ROOT; ?>/product/ajax/products.php?action=fetch', { 'id': $(this).val(), 'socid' : <?php print $object->socid; ?> }, function(data) {
jQuery("#price_ht").val(data.price_ht);
},
'json');
<?php
}
if (! empty($usemargins) && $user->rights->margins->creer)
{
$langs->load('stocks');
@ -831,7 +842,10 @@ function setforpredef() {
jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change();
jQuery("#price_ht").val('').hide();
<?php if (empty($conf->global->EDIT_PREDEF_PRICEHT))
{?>
jQuery("#price_ht").val('').hide();
<?php }?>
jQuery("#multicurrency_price_ht").hide();
jQuery("#price_ttc").hide(); // May no exists
jQuery("#fourn_ref").hide();

View File

@ -1447,6 +1447,7 @@ ServiceSetup=Services module setup
ProductServiceSetup=Products and Services modules setup
NumberOfProductShowInSelect=Max number of products in combos select lists (0=no limit)
ViewProductDescInFormAbility=Display product descriptions in forms (otherwise as popup tooltip)
EditPredifinedPriceHTAbility=Add the ability to edit price ht before adding a line on documents
MergePropalProductCard=Activate in product/service Attached Files tab an option to merge product PDF document to proposal PDF azur if product/service is in the proposal
ViewProductDescInThirdpartyLanguageAbility=Display products descriptions in the language of the third party
UseSearchToSelectProductTooltip=Also if you have a large number of products (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.

View File

@ -155,6 +155,9 @@ if ($action == 'other')
$resql_new = $db->query($sql_new);
}
}
$value = GETPOST('activate_EditPredifinedPriceHT','alpha');
$res = dolibarr_set_const($db, "EDIT_PREDEF_PRICEHT", $value,'chaine',0,'',$conf->entity);
}
if ($action == 'specimen') // For products
@ -675,6 +678,14 @@ if (! empty($conf->fournisseur->enabled))
print '</tr>';
}
// Activate price ht edition for predefined product on line add
print '<tr class="oddeven">';
print '<td>'.$langs->trans("EditPredifinedPriceHTAbility").'</td>';
print '<td width="60" align="right">';
print $form->selectyesno("activate_EditPredifinedPriceHT",$conf->global->EDIT_PREDEF_PRICEHT,1);
print '</td>';
print '</tr>';
if (! empty($conf->global->PRODUCT_CANVAS_ABILITY))
{
// Add canvas feature