Merge 2 exclusive options into 1

This commit is contained in:
Laurent Destailleur 2021-01-07 12:39:51 +01:00
parent 26fa8b45ac
commit 6da3ed1a51
8 changed files with 47 additions and 33 deletions

View File

@ -1003,8 +1003,9 @@ if (empty($reshook))
} else {
$desc = $prod->description;
}
//If text set in desc is the same as product descpription (as now it's preloaded) whe add it only one time
var_dump($desc);
var_dump($product_desc);exit;
//If text set in desc is the same as product description (as now it's preloaded) whe add it only one time
if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
$product_desc='';
}

View File

@ -697,6 +697,12 @@ class Conf
if (!empty($this->global->MAIN_TZUSERINPUTKEY)) $this->tzuserinputkey = $this->global->MAIN_TZUSERINPUTKEY; // 'tzserver' or 'tzuserrel'
if (!empty($this->global->PRODUIT_AUTOFILL_DESC)) {
$this->global->MAIN_NO_CONCAT_DESCRIPTION = 1;
} else {
unset($this->global->MAIN_NO_CONCAT_DESCRIPTION);
}
// For backward compatibility
if (isset($this->product)) $this->produit = $this->product;
if (isset($this->facture)) $this->invoice = $this->facture;

View File

@ -677,7 +677,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
console.log("Load unit price end, we got value "+data.price_ht);
jQuery("#price_ht").val(data.price_ht);
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { ?>
var proddesc = data.desc_trans;
<?php
@ -875,7 +875,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
}
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
?>
var description = $('option:selected', this).attr('data-description');
if (typeof description == 'undefined') { description = jQuery('#idprodfournprice').attr('data-description'); }
@ -898,7 +898,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
}?>
} else if (jQuery('#idprodfournprice').length > 0) {
<?php
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC)) {
if (!empty($conf->global->PRODUIT_AUTOFILL_DESC) && $conf->global->PRODUIT_AUTOFILL_DESC == 1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) { ?>
if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined")
{

View File

@ -119,8 +119,7 @@ if (($line->info_bits & 2) == 2) {
} else {
$format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day';
if ($line->fk_product > 0)
{
if ($line->fk_product > 0) {
print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
$type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type);

View File

@ -1599,9 +1599,12 @@ ProductServiceSetup=Products and Services modules setup
NumberOfProductShowInSelect=Maximum number of products to show in combo select lists (0=no limit)
ViewProductDescInFormAbility=Display product descriptions in forms (otherwise shown in a tooltip popup)
DoNotAddProductDescAtAddLines=Do not add product description (from product card) on submit add lines on forms
OnProductSelectAddProductDesc=On product selection in forms get the production description into description line
OnProductSelectAddProductDesc=How to use the description of the products when adding a product as a line of a document
AutoFillFormFieldBeforeSubmit=Auto fill the description input field with the description of product
DoNotAutofillButAutoConcat=Do not autofill the input field with description of product. Description of the product will be concatenated to the entered description automatically.
DoNotUseDescriptionOfProdut=Description of the product will never be included into the description of lines of 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
ViewProductDescInThirdpartyLanguageAbility=Display products descriptions in forms in the language of the third party (otherwise in the language of the user)
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.
UseSearchToSelectProduct=Wait until you press a key before loading content of product combo list (This may increase performance if you have a large number of products, but it is less convenient)
SetDefaultBarcodeTypeProducts=Default barcode type to use for products

View File

@ -108,7 +108,7 @@ FillWithLastServiceDates=Fill with last service line dates
MultiPricesAbility=Multiple price segments per product/service (each customer is in one price segment)
MultiPricesNumPrices=Number of prices
DefaultPriceType=Base of prices per default (with versus without tax) when adding new sale prices
AssociatedProductsAbility=Enable Kits (set of other products)
AssociatedProductsAbility=Enable Kits (set of several products)
VariantsAbility=Enable Variants (variations of products, for example color, size)
AssociatedProducts=Kits
AssociatedProductsNumber=Number of products composing this kit

View File

@ -148,9 +148,6 @@ if ($action == 'other')
$value = GETPOST('activate_FillProductDescAuto', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_AUTOFILL_DESC", $value, 'chaine', 0, '', $conf->entity);
$value = GETPOST('activate_DoNotAddStdProductDescOnAddLine', 'alpha');
$res = dolibarr_set_const($db, "MAIN_NO_CONCAT_DESCRIPTION", $value, 'chaine', 0, '', $conf->entity);
if ($value) {
$sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
$resql = $db->query($sql_test);
@ -583,7 +580,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES)) $current_rule = 'PRODUIT_MULTIPR
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES';
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
print $form->selectarray("princingrule", $select_pricing_rules, $current_rule);
print $form->selectarray("princingrule", $select_pricing_rules, $current_rule, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1);
print '</td>';
print '</tr>';
@ -635,6 +632,28 @@ if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT))
print '</tr>';
}
// Do Not Add Product description on add lines
print '<tr class="oddeven">';
print '<td>'.$langs->trans("OnProductSelectAddProductDesc").'</td>';
print '<td class="right">';
print $form->selectarray(
"activate_FillProductDescAuto",
array(1=>'AutoFillFormFieldBeforeSubmit', 0=>'DoNotAutofillButAutoConcat', -1=>'DoNotUseDescriptionOfProdut'),
empty($conf->global->PRODUIT_AUTOFILL_DESC) ? 0 : $conf->global->PRODUIT_AUTOFILL_DESC,
0,
0,
0,
'',
1,
0,
0,
'',
'maxwidth400',
1
);
print '</td>';
print '</tr>';
// Visualiser description produit dans les formulaires activation/desactivation
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ViewProductDescInFormAbility").'</td>';
@ -643,23 +662,6 @@ print $form->selectyesno("activate_viewProdDescInForm", $conf->global->PRODUIT_D
print '</td>';
print '</tr>';
// Do Not Add Product description on add lines
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DoNotAddProductDescAtAddLines").'</td>';
print '<td class="right">';
print $form->selectyesno("activate_DoNotAddStdProductDescOnAddLine", $conf->global->MAIN_NO_CONCAT_DESCRIPTION, 1);
print '</td>';
print '</tr>';
// Do Not Add Product description on add lines
print '<tr class="oddeven">';
print '<td>'.$langs->trans("OnProductSelectAddProductDesc").'</td>';
print '<td class="right">';
print $form->selectyesno("activate_FillProductDescAuto", $conf->global->PRODUIT_AUTOFILL_DESC, 1);
print '</td>';
print '</tr>';
// Activate propal merge produt card
/* Kept as hidden feature only. PRODUIT_PDF_MERGE_PROPAL can be added manually. Still did not understand how this feature works.

View File

@ -413,7 +413,10 @@ if (empty($reshook))
$object->ref = $ref;
$object->label = GETPOST('label', $label_security_check);
$object->description = dol_htmlcleanlastbr(GETPOST('desc', 'restricthtml'));
$desc = dol_htmlcleanlastbr(preg_replace('/&nbsp;$/', '', GETPOST('desc', 'restricthtml')));
$object->description = $desc;
$object->url = GETPOST('url');
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{
@ -426,8 +429,8 @@ if (empty($reshook))
$object->status = GETPOST('statut', 'int');
$object->status_buy = GETPOST('statut_buy', 'int');
$object->status_batch = GETPOST('status_batch', 'aZ09');
// removed from update view so GETPOST always empty
$object->fk_default_warehouse = GETPOST('fk_default_warehouse');
// removed from update view so GETPOST always empty
/*
$object->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$object->desiredstock = GETPOST('desiredstock');