Can show some tab entries as disabled (greyed link)

This commit is contained in:
Laurent Destailleur 2022-11-08 22:28:59 +01:00
parent 06c092acc0
commit 3fd4403bc7
6 changed files with 37 additions and 12 deletions

View File

@ -1810,7 +1810,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
/**
* Show tab header of a card
*
* @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head
* @param array $links Array of tabs (0=>url, 1=>label, 2=>code, 3=>not used, 4=>text after link, 5=>morecssonlink). Currently initialized by calling a function xxx_admin_prepare_head. Note that label into $links[$i][1] must be already HTML escaped.
* @param string $active Active tab name (document', 'info', 'ldap', ....)
* @param string $title Title
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after)
@ -1831,7 +1831,7 @@ function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0
/**
* Show tabs of a record
*
* @param array $links Array of tabs. Note that label into $links[$i][1] must be already HTML escaped.
* @param array $links Array of tabs (0=>url, 1=>label, 2=>code, 3=>not used, 4=>text after link, 5=>morecssonlink). Currently initialized by calling a function xxx_admin_prepare_head. Note that label into $links[$i][1] must be already HTML escaped.
* @param string $active Active tab name
* @param string $title Title
* @param int $notab -1 or 0=Add tab header, 1=no tab header (if you set this to 1, using print dol_get_fiche_end() to close tab is not required), -2=Add tab header with no seaparation under tab (to start a tab just after), -3=-2+'noborderbottom'
@ -1934,7 +1934,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
$out .= '<div class="tab tab'.($isactive?'active':'unactive').'" style="margin: 0 !important">';
if (!empty($links[$i][0])) {
$titletoshow = preg_replace('/<.*$/', '', $links[$i][1]);
$out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tab inline-block valignmiddle'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'" title="'.dol_escape_htmltag($titletoshow).'">';
$out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tab inline-block valignmiddle'.($morecss ? ' '.$morecss : '').($links[$i][5] ? ' '.$links[$i][5] : '').'" href="'.$links[$i][0].'" title="'.dol_escape_htmltag($titletoshow).'">';
}
$out .= $links[$i][1];
if (!empty($links[$i][0])) {

View File

@ -53,11 +53,19 @@ function product_prepare_head($object)
$head[$h][2] = 'card';
$h++;
if (!empty($object->status) && $usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$h++;
if (!empty($object->status)) {
if ($usercancreadprice) {
$head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$object->id;
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$h++;
} else {
$head[$h][0] = '#';
$head[$h][1] = $langs->trans("SellingPrices");
$head[$h][2] = 'price';
$head[$h][5] = 'disabled';
$h++;
}
}
if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
@ -69,6 +77,12 @@ function product_prepare_head($object)
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$h++;
} else {
$head[$h][0] = '#';
$head[$h][1] = $langs->trans("BuyingPrices");
$head[$h][2] = 'suppliers';
$head[$h][5] = 'disabled';
$h++;
}
}
}

View File

@ -2316,7 +2316,7 @@ UsePassword=Use a password
UseOauth=Use a OAUTH token
Images=Images
MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form
MaxNumberOfPostOnPublicPagesByIP=Max number of posts on public pages with an IP Address
MaxNumberOfPostOnPublicPagesByIP=Max number of posts on public pages with the same IP address
CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is:
ScriptIsEmpty=The script is empty
ShowHideTheNRequests=Show/hide the %s SQL request(s)

View File

@ -422,7 +422,7 @@ $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_u
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' p.fk_unit, cu.label as cu_label,';
}
$sql .= ' MIN(pfp.unitprice) as minsellprice';
$sql .= ' MIN(pfp.unitprice) as bestpurchaseprice';
if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= ', pac.rowid as prod_comb_id';
}
@ -1727,8 +1727,7 @@ while ($i < min($num, $limit)) {
// Better buy price
if (!empty($arrayfields['p.minbuyprice']['checked'])) {
print '<td class="right nowraponall">';
if ($obj->tobuy && $obj->minsellprice != '' && $usercancreadprice) {
//print price($obj->minsellprice).' '.$langs->trans("HT");
if ($obj->tobuy && $obj->bestpurchaseprice != '' && $usercancreadprice) {
if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {

View File

@ -2536,6 +2536,12 @@ span.mainmenuaspan.tmenudisabled {
cursor: not-allowed;
}
a.disabled {
color: #aaa;
text-decoration: none !important;
cursor: default;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
padding: 0px 2px 0px 2px;
margin: 0px 0px 0px 0px;

View File

@ -2586,6 +2586,12 @@ span.mainmenuaspan.tmenudisabled {
cursor: not-allowed;
}
a.disabled {
color: #aaa;
text-decoration: none !important;
cursor: default;
}
a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active {
font-weight: normal;
padding: 0px 5px 0px 5px;