Enhancement for textbrowser

This commit is contained in:
Laurent Destailleur 2024-10-08 20:58:09 +02:00
commit 8ba82ecfa0
3 changed files with 110 additions and 12 deletions

View File

@ -2,6 +2,56 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 20.0.1 compared to 20.0.0 *****
FIX: #30960 show and search extrafields (#31026)
FIX: #31076 Bad position of hooks
FIX: #31152
FIX: #31237 (#31239)
FIX: #31241 (#31245)
FIX: accounting transfer when nb of lines is not zero but amount is zero
FIX: Add same security test when nuploading files from API than from GUI (#31114)
FIX: allow "class" into search string in website module
FIX: autoselect the fiscal period by default
FIX: avoid odt errors (#31126)
FIX: Backport fix fatal error on price with some truncating setup
FIX: better compatibility with some old extrafield syntax filter
FIX: box_actions.php still uses fk_user_done which no longer exists (#31190)
FIX: Browser Notification ko with firefox
FIX: custom CSS for WebPortal (#31022)
FIX: Debug calculation of the delay of purchase order
FIX: Debug option WORKFLOW_TICKET_LINK_CONTRACT. Bad id stored. Bad
FIX: dolFICalculatePaymentReference for Finland in functions_fi.lib.php (#31281)
FIX: Duplicate trigger printFieldPreListTitle
FIX: edit contract of intervention broken by CSRF protection
FIX: error return missing in mo creation when qty to consume is <= 0 (#31134)
FIX: Extrafields does not appear on form
FIX: FATAL ERROR abusively triggered due to incomplete regex (#31052)
FIX: if you call fetchLines several times, your $object->lines contains duplicates (#31167)
FIX: late order search option (v18+) (#30692)
FIX: late propal search option (v18+) (#30687)
FIX: Maxi debug edit/delete accounting transaction
FIX: member must be found to search the linked partnership (WebPortal) (#30977)
FIX: Missing picto on user link
FIX: mysql error during dump for enable sandbox M999999 (#31116)
FIX: OAuth generation of token for Microsoft, Stripe and Generic
FIX: param id in website account list from third-party card (#30975)
FIX: Position of box for shipping address in PDF
FIX: Protection to avoid an extrafield to be mandatory if computed
FIX: removed unreachable code (#31141)
FIX: Remove wrong button
FIX: retrieving user specific constant
FIX: Revert storing of ticket files into event dir, too many troubles.
FIX: Selection of country - state in resource
FIX: State dropdown is not working on User card #31198 (#31205)
FIX: Tool to convert into utf8 or utf8mb4
FIX: use price() to display qty on a product's stats tab to avoid showing too many decimals when rounding errors are possible (#31165)
FIX: Warning visible when it should not
FIX: webhook must send POST in body. Add WEBHOOK_POST_SEND_DATA_IN_BODY
FIX: when qty is not an integer, apply price() (#31138)
FIX: Wrong price for BOM with workstation (#31142)
FIX: determine multi-currency price on object line create tpl (#28021)
***** ChangeLog for 21.0.0 compared to 20.0 *****

View File

@ -617,8 +617,12 @@ function getBrowserInfo($user_agent)
$version = end($reg);
} elseif (preg_match('/l[iy]n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) {
// MS products at end
$name = 'lynxlinks';
$name = 'textbrowser';
$version = empty($reg[3]) ? '' : $reg[3];
} elseif (preg_match('/w3m\/([\d\.]+)/i', $user_agent, $reg)) {
// MS products at end
$name = 'textbrowser';
$version = empty($reg[1]) ? '' : $reg[1];
}
if ($tablet) {
@ -12415,6 +12419,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* $arrayforbutaction = array(
* 10 => array('attr' => array('class'=>''), 'lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&amp;projectid='.$object->id.'&amp;socid='.$object->socid),
* 20 => array('attr' => array('class'=>''), 'lang'=>'mymodule', 'enabled'=>isModEnabled("mymodule"), 'perm'=>$user->hasRight('mymodule', 'write'), 'label' => 'MyModuleAction', 'urlroot'=>dol_build_patch('/mymodule/mypage.php?action=create')),
* 30 => array('attr' => array('class'=>''), 'lang'=>'mymodule', 'enabled'=>isModEnabled("mymodule"), 'perm'=>$user->hasRight('mymodule', 'write'), 'label' => 'MyModuleOtherAction', 'urlraw' => '# || external Url || javascript: || tel: || mailto:' ),
* ); );
* @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method.
* @param int|boolean $userRight User action right
@ -12480,17 +12485,18 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
$langs->load($subbutton['lang']);
}
if (!empty($subbutton['urlroot'])) {
$tmpurl = $subbutton['urlroot'].(empty($params['backtopage']) ? '' : '&amp;backtopage='.urlencode($params['backtopage']));
if (!empty($subbutton['urlraw'])) {
$tmpurl = $subbutton['urlraw']; // Use raw url, no url completion, use only what developer send
} else {
$tmpurl = DOL_URL_ROOT.$subbutton['url'].(empty($params['backtopage']) ? '' : '&amp;backtopage='.urlencode($params['backtopage']));
$tmpurl = !empty($subbutton['urlroot']) ? $subbutton['urlroot'] : $subbutton['url'];
$tmpurl = dolCompletUrlForDropdownButton($tmpurl, $params, empty($subbutton['urlroot']));
}
$subbuttonparam = array();
if (!empty($subbutton['attr'])) {
$subbuttonparam['attr'] = $subbutton['attr'];
}
$subbuttonparam['isDropDown'] = (empty($params['isDropDown']) ? $subbutton['isDropDown'] : $params['isDropDown']);
$subbuttonparam['isDropDown'] = (empty($params['isDropDown']) ? ($subbutton['isDropDown']??false) : $params['isDropDown']);
$out .= dolGetButtonAction('', $langs->trans($subbutton['label']), 'default', $tmpurl, $subbutton['id'] ?? '', $subbutton['perm'], $subbuttonparam);
}
@ -12502,10 +12508,11 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
$langs->load($subbutton['lang']);
}
if (!empty($subbutton['urlroot'])) {
$tmpurl = $subbutton['urlroot'].(empty($params['backtopage']) ? '' : '&amp;backtopage='.urlencode($params['backtopage']));
if (!empty($subbutton['urlraw'])) {
$tmpurl = $subbutton['urlraw']; // Use raw url, no url completion, use only what developer send
} else {
$tmpurl = DOL_URL_ROOT.$subbutton['url'].(empty($params['backtopage']) ? '' : '&amp;backtopage='.urlencode($params['backtopage']));
$tmpurl = !empty($subbutton['urlroot']) ? $subbutton['urlroot'] : $subbutton['url'];
$tmpurl = dolCompletUrlForDropdownButton($tmpurl, $params, empty($subbutton['urlroot']));
}
$out .= dolGetButtonAction('', $langs->trans($subbutton['label']), 'default', $tmpurl, '', $subbutton['perm'], $params);
@ -12640,6 +12647,42 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
}
}
/**
* An function to complete dropdown url in dolGetButtonAction
*
* @param string $url the Url to complete
* @param array|array<string> $params params of dolGetButtonAction function
* @param bool $addDolUrlRoot to add root url
* @return string
*/
function dolCompletUrlForDropdownButton(string $url, array $params, bool $addDolUrlRoot = true)
{
if (empty($url)) {
return '';
}
$parsedUrl = parse_url($url);
if ((isset($parsedUrl['scheme']) && in_array($parsedUrl['scheme'], ['javascript', 'mailto', 'tel'])) || strpos($url, '#') === 0) {
return $url;
}
if (!empty($parsedUrl['query'])) {
// Use parse_str() function to parse the string passed via URL
parse_str($parsedUrl['query'], $urlQuery);
if (!isset($urlQuery['backtopage']) && isset($params['backtopage'])) {
$url.= '&amp;backtopage='.urlencode($params['backtopage']);
}
}
if (!isset($parsedUrl['scheme']) && $addDolUrlRoot) {
$url = DOL_URL_ROOT.$url;
}
return $url;
}
/**
* Add space between dolGetButtonTitle
*

View File

@ -511,7 +511,7 @@ if (GETPOST('theme', 'aZ09')) {
}
// Set global MAIN_OPTIMIZEFORTEXTBROWSER (must be before login part)
if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks')) { // If we must enable text browser
if (GETPOSTINT('textbrowser') || (!empty($conf->browser->name) && $conf->browser->name == 'textbrowser')) { // If we must enable text browser
$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 2;
}
@ -2514,6 +2514,11 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager;
// Return empty in some case
if ($conf->browser->name == 'textbrowser') {
return '';
}
$langs->load('companies');
$userImage = $userDropDownImage = '';
@ -3051,9 +3056,9 @@ function top_menu_bookmark()
$html = '';
// Define $bookmarks
if (!isModEnabled('bookmark') || !$user->hasRight('bookmark', 'lire')) {
return $html;
// Return empty in some case
if (!isModEnabled('bookmark') || !$user->hasRight('bookmark', 'lire') || $conf->browser->name == 'textbrowser') {
return '';
}
// accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox