Simplify code

This commit is contained in:
Laurent Destailleur 2021-08-24 15:28:59 +02:00
parent 22339a3ed3
commit e0fd8b5eb8
2 changed files with 3 additions and 18 deletions

View File

@ -9258,8 +9258,7 @@ class Form
* @param string $cancel_label Alternative label for cancel button
* @param array $morefields Add additional buttons between save and cancel
* @param bool $withoutdiv Option to remove enclosing centered div
*
* @return string
* @return string Html code with the buttons
*/
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morefields = array(), $withoutdiv = 0)
{
@ -9293,24 +9292,10 @@ class Form
$retstring = $withoutdiv ? '': '<div class="center">';
foreach ($buttons as $button) {
$retstring .= $this->button($button['name'], $langs->trans($button['label_key']), $button['addclass']);
$retstring .= '<input type="submit" class="button button-'.$button['name'].' '.$button['addclass'].'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
}
$retstring .= $withoutdiv ? '': '</div>';
return $retstring;
}
/**
* Return a button (input submit)
*
* @param string $name Name
* @param string $label Label of the button
* @param string $addclass Additional css classes
*
* @return string
*/
public function button($name, $label, $addclass = '')
{
return '<input type="submit" class="button button-'.$name.' '.$addclass.'" name="'.$name.'" value="'.$label.'">';
}
}

View File

@ -660,7 +660,7 @@ class User extends CommonObject
* @param int $module Id of permission to add or 0 to add several permissions
* @param string $permlevel1 Permission level1
* @param string $permlevel2 Permission level2
* @return int 1 if user has permission, 0 if not.
* @return int 1 if user has permission, 0 if not.
* @see clearrights(), delrights(), getrights(), hasRight()
*/
public function hasRight($module, $permlevel1, $permlevel2 = '')