diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php
index f6c178f2e4d..5b2c3e912dd 100644
--- a/htdocs/adherents/agenda.php
+++ b/htdocs/adherents/agenda.php
@@ -151,9 +151,7 @@ if ($object->id > 0)
$newcardbutton = '';
if (! empty($conf->agenda->enabled))
{
- $newcardbutton.=''.$langs->trans("AddAction").'';
- $newcardbutton.= '';
- $newcardbutton.= '';
+ $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 61afe204f02..515a5980050 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -321,9 +321,7 @@ print '';
$newcardbutton='';
//if ($user->rights->emailcollector->creer)
//{
-$newcardbutton=''.$langs->trans('New').'';
-$newcardbutton.= '';
-$newcardbutton.= '';
+$newcardbutton.= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', 'emailcollector_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']));
//}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit);
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index 17e23f0cadb..844443244cd 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -82,12 +82,8 @@ $userstatic=new User($db);
llxHeader('', $langs->trans("ListOfBookmarks"));
$newcardbutton='';
-if ($user->rights->bookmark->creer)
-{
- $newcardbutton=''.$langs->trans('NewBookmark').'';
- $newcardbutton.= '';
- $newcardbutton.= '';
-}
+$newcardbutton.= dolGetButtonTitle($langs->trans('NewBookmark'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create', '', !empty($user->rights->bookmark->creer));
+
print_barre_liste($langs->trans("ListOfBookmarks"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', -1, '', 'title_generic.png', 0, $newcardbutton);
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index 971fcd30f0c..d804cced41c 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -65,9 +65,7 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
-$newcardbutton = ''.$langs->trans("NewCategory").'';
-$newcardbutton.= '';
-$newcardbutton.= '';
+$newcardbutton.= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
print load_fiche_titre($title, $newcardbutton);
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 130e187eeaf..ad150bccac3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -8146,16 +8146,26 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
* @param string $iconClass class for icon element
* @param string $url the url for link
* @param string $id attribute id of button
- * @param int $status 0 no user rights, 1 active, -1 Feature Disabled
+ * @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip
* @param array $params various params for future : recommended rather than adding more function arguments
* @return string html button
*/
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())
{
- global $langs;
+ global $langs, $conf, $user;
+
+ // Actually this conf is used in css too for external module compatibility and smooth transition to this function
+ if (! empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin) && $status <= 0) {
+ return '';
+ }
$class = 'title-button' ;
+ // hidden conf keep during button transition TODO: remove this block
+ if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
+ $class = 'butActionNew';
+ }
+
$attr=array(
'class' => $class
,'href' => empty($url)?'':$url
@@ -8165,15 +8175,22 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
$attr['title'] = dol_escape_htmltag($helpText);
}
- if(empty($status)){
+ if($status <= 0){
$attr['class'] .= ' title-button-refused';
- $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
- $attr['href'] = '';
- }
- elseif($status < 0){
- $attr['class'] .= ' title-button-refused';
- $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
+
+ // hidden conf keep during button transition TODO: remove this block
+ if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
+ $attr['class'] = 'butActionRefused';
+ }
+
$attr['href'] = '';
+
+ if($status == -1){ // Not enough permissions
+ $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
+ }
+ elseif($status == 0){ // disable
+ $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
+ }
}
if(!empty($attr['title'])){
@@ -8223,5 +8240,12 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
$button.= ''.$label.'';
$button.= ''.$tag.'>';
+ // hidden conf keep during button transition TODO: remove this block
+ if(empty($conf->global->MAIN_USE_NEW_TITLE_BUTTON)){
+ $button='<'.$tag.' '.$compiledAttributes.' >'.$label.'';
+ $button.= '';
+ $button.= ''.$tag.'>';
+ }
+
return $button;
}
diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php
index 6ccb0adcf44..8175dd1ca83 100644
--- a/htdocs/imports/index.php
+++ b/htdocs/imports/index.php
@@ -92,7 +92,7 @@ if (count($import->array_import_code))
{
//if ($user->rights->import->run)
//{
- print ''.$langs->trans("NewImport").'';
+ print dolGetButtonTitle($langs->trans('NewImport'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/imports/import.php?leftmenu=import');
//}
//else
//{
diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php
index 0d6a0f05174..28b3c06ffa1 100644
--- a/htdocs/product/agenda.php
+++ b/htdocs/product/agenda.php
@@ -174,14 +174,8 @@ if ($id > 0 || $ref)
$morehtmlcenter='';
if (! empty($conf->agenda->enabled))
{
- if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
- {
- $morehtmlcenter.=''.$langs->trans("AddAction").'';
- }
- else
- {
- $morehtmlcenter.=''.$langs->trans("AddAction").'';
- }
+ $linktocreatetimeBtnStatus = ! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create);
+ $morehtmlcenter = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus);
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 9ce431d889b..f86873e675a 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -578,31 +578,35 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
}
// Link to create time
+ $linktocreatetimeBtnStatus = 0;
+ $linktocreatetimeUrl = '';
+ $linktocreatetimeHelpText = '';
if ($user->rights->projet->all->creer || $user->rights->projet->creer)
{
if ($projectstatic->public || $userWrite > 0)
{
+ $linktocreatetimeBtnStatus = 1;
+
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
{
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
- $linktocreatetime = ''.$langs->trans('AddTimeSpent').'';
+ $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl);
}
else // We are on tab 'Time Spent' of task
{
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
- $linktocreatetime = ''.$langs->trans('AddTimeSpent').'';
+ $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject?'withproject=1':'').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl);
}
}
else
{
- $linktocreatetime = ''.$langs->trans('AddTime').'';
+ $linktocreatetimeBtnStatus = -2;
+ $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject");
}
}
- else
- {
- $linktocreatetime = ''.$langs->trans('AddTime').'';
- }
- }
+
+ $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus);
+ }
$massactionbutton = '';
if ($projectstatic->bill_time)
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index 608530d0d63..d119e73dc76 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -1090,7 +1090,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
// List of bank accounts
print '
';
- $morehtmlright='id.'&action=create">'.$langs->trans("Add").'';
+ $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create');
print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, '');
diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php
index 8655136512b..3b15d3101c2 100644
--- a/htdocs/theme/eldy/btn.inc.php
+++ b/htdocs/theme/eldy/btn.inc.php
@@ -134,13 +134,10 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci
background-color: transparent ! important;
}
-global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
-.butActionRefused, .butActionNewRefused {
- display: none;
-}
-
-
+/*
+TITLE BUTTON
+ */
.title-button, a.title-button {
display: inline-block;
@@ -195,27 +192,28 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci
color: #8a8a8a;
cursor: not-allowed;
background-color: #fbfbfb;
- background: repeating-linear-gradient(
- 45deg,
- #ffffff,
- #f1f1f1 4px,
- #f1f1f1 4px,
- #f1f1f1 4px
- );
+ background: repeating-linear-gradient( 45deg, #ffffff, #f1f1f1 4px, #f1f1f1 4px, #f1f1f1 4px );
}
-
-
.title-button:hover .title-button-label{
color: #ffffff;
}
- .title-button.title-button-refused .title-button-label, .title-button.title-button-refused:hover .title-button-label{
+.title-button.title-button-refused .title-button-label, .title-button.title-button-refused:hover .title-button-label{
color: #8a8a8a;
}
-
.title-button>.fa {
font-size: 20px;
display: block;
-}
\ No newline at end of file
+}
+
+
+
+
+
+global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?>
+.butActionRefused, .butActionNewRefused, .title-button.title-button-refused {
+ display: none !important;
+}
+
\ No newline at end of file
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 989bbda8072..9b92a888f8a 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -449,12 +449,8 @@ if ($socid) print '';
$newcardbutton='';
-if ($user->rights->ticket->write)
-{
- $newcardbutton = '' . $langs->trans('NewTicket').'';
- $newcardbutton.= '';
- $newcardbutton.= '';
-}
+$newcardbutton.= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/ticket/card.php?action=create' . ($socid ? '&socid=' . $socid : '') . ($projectid ? '&origin=projet_project&originid=' . $projectid : ''), '', !empty($user->rights->ticket->write));
+
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_ticket', 0, $newcardbutton, '', $limit);