Merge pull request #11337 from atm-john/10.0_fix_dolGetButtonAction

FIX empty test
This commit is contained in:
Laurent Destailleur 2019-06-14 13:51:34 +02:00 committed by GitHub
commit 122c4eb8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8123,14 +8123,22 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
$attr['href'] = ''; $attr['href'] = '';
} }
if(empty($id)){ if(!empty($id)){
$attr['id'] = $id; $attr['id'] = $id;
} }
// Override attr // Override attr
if(!empty($params['attr']) && is_array($params['attr'])){ if(!empty($params['attr']) && is_array($params['attr'])){
foreach($params['attr'] as $key => $value){ foreach($params['attr'] as $key => $value){
$attr[$key] = $value; if($key == 'class'){
$attr['class'].= ' '.$value;
}
elseif($key == 'classOverride'){
$attr['class'] = $value;
}
else{
$attr[$key] = $value;
}
} }
} }
@ -8202,10 +8210,10 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
$attr['href'] = ''; $attr['href'] = '';
if($status == -1){ // Not enough permissions if($status == -1){ // disable
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled")); $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("FeatureDisabled"));
} }
elseif($status == 0){ // disable elseif($status == 0){ // Not enough permissions
$attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions")); $attr['title'] = dol_escape_htmltag($langs->transnoentitiesnoconv("NotEnoughPermissions"));
} }
} }