NEW Option PRODUIT_DESC_IN_FORM accept (desktop only or +smartphone)

This commit is contained in:
Laurent Destailleur 2022-10-21 11:14:28 +02:00
parent dde7f6f655
commit 3e5273d83b
18 changed files with 43 additions and 36 deletions

View File

@ -93,7 +93,7 @@ foreach ($modules as $const => $desc) {
if ($action == 'enable_'.strtolower($const)) {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1", 'chaine', 0, '', $conf->entity);
// If fckeditor is active in the product/service description, it is activated in the forms
if ($const == 'PRODUCTDESC' && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if ($const == 'PRODUCTDESC' && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1", 'chaine', 0, '', $conf->entity);
}
header("Location: ".$_SERVER["PHP_SELF"]);

View File

@ -520,7 +520,7 @@ if ($sql_select) {
}
$text .= ' - '.(!empty($objp->label) ? $objp->label : $label);
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
}
if (($objp->info_bits & 2) == 2) {
@ -571,7 +571,7 @@ if ($sql_select) {
echo get_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($objp->description) && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
}
} else {
@ -608,7 +608,7 @@ if ($sql_select) {
// Show range
$prodreftxt .= get_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE'))
{
$prodreftxt .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}

View File

@ -1589,7 +1589,7 @@ if ($action == 'create') {
$description = $objp->description;
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
$text .= (!empty($objp->description) && $objp->description != $objp->plabel) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
$description = ''; // Already added into main visible desc
}

View File

@ -169,12 +169,6 @@ class box_services_contracts extends ModeleBoxes
}
$description = $objp->description;
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
//$text .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
$s = $form->textwithtooltip($text, $description, 3, '', '', '', 0, (!empty($objp->fk_parent_line) ?img_picto('', 'rightarrow') : ''));
} else {
$s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description);

View File

@ -5015,7 +5015,7 @@ abstract class CommonObject
}
$text .= ' - '.(!empty($line->label) ? $line->label : $label);
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : (!empty($line->description) ? dol_htmlentitiesbr($line->description) : '')); // Description is what to show on popup. We shown nothing if already into desc.
$description .= (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : (!empty($line->description) ? dol_htmlentitiesbr($line->description) : '')); // Description is what to show on popup. We shown nothing if already into desc.
}
$line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');

View File

@ -347,7 +347,7 @@ class Conf
$db->free($resql);
}
// Include other local consts.php files and fetch their values to the corresponding database constants.
// Include other local file xxx/zzz_consts.php to overwrite some variables
if (!empty($this->global->LOCAL_CONSTS_FILES)) {
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
foreach ($filesList as $file) {
@ -675,6 +675,9 @@ class Conf
}
$this->product->limit_size = $this->global->PRODUIT_LIMIT_SIZE;
// Set PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE, may be modified later according to browser
$this->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = (isset($this->global->PRODUIT_DESC_IN_FORM) ? $this->global->PRODUIT_DESC_IN_FORM : 0);
// conf->theme et $this->css
if (empty($this->global->MAIN_THEME)) {
$this->global->MAIN_THEME = "eldy";

View File

@ -341,14 +341,14 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
$product_static->status_batch = $objp->product_tobatch;
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
// Show range
print_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($objp->description) && $objp->description != $objp->product) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
}

View File

@ -213,7 +213,7 @@ if (($line->info_bits & 2) == 2) {
}
// Add description in form
if ($line->fk_product > 0 && !empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if ($line->fk_product > 0 && getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
if ($line->element == 'facturedetrec') {
print (!empty($line->description) && $line->description != $line->product_label) ? (($line->date_start_fill || $line->date_end_fill) ? '' : '<br>').'<br>'.dol_htmlentitiesbr($line->description) : '';
} elseif ($line->element == 'invoice_supplier_det_rec') {

View File

@ -577,11 +577,11 @@ if ($action == 'create') {
}
$text .= ' '.$object->lines[$i]->product_ref.'</a>';
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($object->lines[$i]->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($object->lines[$i]->description));
//print $description;
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '<br>'.dol_htmlentitiesbr($object->lines[$i]->description) : '';
}
} else {

View File

@ -1143,7 +1143,7 @@ if ($action == 'create') {
$product_static->status_buy = $line->product_tobuy;
$product_static->status_batch = $line->product_tobatch;
$showdescinproductdesc = (getDolGlobalString('PRODUIT_DESC_IN_FORM') == 2 ? 1 : 0);
$showdescinproductdesc = getDolGlobalString('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE');
$text = $product_static->getNomUrl(1);
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
@ -2202,10 +2202,10 @@ if ($action == 'create') {
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : '');
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
}
print "</td>\n";

View File

@ -733,7 +733,7 @@ if ($id > 0 || !empty($ref)) {
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
print $form->textwithtooltip($text, $description, 3, '', '', $i);
@ -741,7 +741,7 @@ if ($id > 0 || !empty($ref)) {
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print ($objp->description && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
}

View File

@ -114,7 +114,7 @@ class KnowledgeRecord extends CommonObject
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
//'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'),
'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'),
'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'isModEnabled("ticket")', 'position'=>520, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'),
'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),),
);

View File

@ -2331,4 +2331,5 @@ RECEPTION_PDF_HIDE_ORDERED=Hide the quantity ordered on the generated documents
MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents for receptions
WarningDisabled=Warning disabled
LimitsAndMitigation=Access limits and mitigation
DesktopsOnly=Desktops only
DesktopsAndSmartphones=Desktops et smartphones

View File

@ -47,7 +47,7 @@ KnowledgeRecord = Article
KnowledgeRecordExtraFields = Extrafields for Article
GroupOfTicket=Group of tickets
YouCanLinkArticleToATicketCategory=You can link the article to a ticket group (so the article will be highlighted on any tickets in this group)
SuggestedForTicketsInGroup=Suggested for tickets when group is
SuggestedForTicketsInGroup=Suggested on ticket creation
SetObsolete=Set as obsolete
ConfirmCloseKM=Do you confirm the closing of this article as obsolete ?

View File

@ -1207,14 +1207,22 @@ if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover
if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) {
$conf->dol_use_jmobile = 1;
}
// If not on Desktop
if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') {
$conf->dol_no_mouse_hover = 1;
}
// If on smartphone or optmized for small screen
if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone')
|| (!empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400)
|| (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400)
|| (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400
|| !empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
) {
$conf->dol_optimize_smallscreen = 1;
if (isset($conf->global->PRODUIT_DESC_IN_FORM) && $conf->global->PRODUIT_DESC_IN_FORM == 1) {
$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;
}
}
// Replace themes bugged with jmobile with eldy
if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {

View File

@ -133,7 +133,7 @@ if ($action == 'other') {
/*$value = GETPOST('PRODUIT_SOUSPRODUITS', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $value, 'chaine', 0, '', $conf->entity);*/
$value = GETPOST('activate_viewProdDescInForm', 'alpha');
$value = GETPOST('PRODUIT_DESC_IN_FORM', 'alpha');
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $value, 'chaine', 0, '', $conf->entity);
$value = GETPOST('activate_viewProdTextsInThirdpartyLanguage', 'alpha');
@ -689,7 +689,8 @@ print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ViewProductDescInFormAbility").'</td>';
print '<td class="right">';
print $form->selectyesno("activate_viewProdDescInForm", $conf->global->PRODUIT_DESC_IN_FORM, 1);
$arrayofchoices = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes").' ('.$langs->trans("DesktopsOnly").')', '2' => $langs->trans("Yes").' ('.$langs->trans("DesktopsAndSmartphones").')');
print $form->selectarray("PRODUIT_DESC_IN_FORM", $arrayofchoices, getDolGlobalInt('PRODUIT_DESC_IN_FORM'), 0);
print '</td>';
print '</tr>';

View File

@ -1102,14 +1102,14 @@ if ($action == 'create') {
$text = $product_static->getNomUrl(1);
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($line->desc));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
// Show range
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
}
}
@ -1825,10 +1825,10 @@ if ($action == 'create') {
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
$text = $lines[$i]->product->getNomUrl(1);
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
}
}

View File

@ -564,7 +564,7 @@ if ($sql_select) {
}
$text .= ' - '.(!empty($objp->label) ? $objp->label : $label);
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description));
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
}
if (($objp->info_bits & 2) == 2) { ?>
@ -619,7 +619,7 @@ if ($sql_select) {
echo get_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($objp->description) && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
}
} else {
@ -656,7 +656,7 @@ if ($sql_select) {
// Show range
$prodreftxt .= get_date_range($objp->date_start, $objp->date_end);
// Add description in form
if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE'))
{
$prodreftxt .= (!empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
}