Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2024-02-19 15:02:37 +01:00
commit 978dd06c67
8 changed files with 103 additions and 62 deletions

View file

@ -731,7 +731,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate&amp;token='.newToken().'">'.$langs->trans("Validate").'</a>'."\n";
} else {
$langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'."\n";
print '<a class="butActionRefused classfortooltip" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'."\n";
}
}
}

View file

@ -1698,15 +1698,22 @@ class Categorie extends CommonObject
* Return name and link of category (with picto)
* Use ->id, ->ref, ->label, ->color
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param int $maxlength Max length of text
* @param string $moreparam More param on URL link
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option On what the link point to ('nolink', ...)
* @param int $maxlength Max length of text
* @param string $moreparam More param on URL link
* @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '')
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = '')
{
global $hookmanager;
global $conf, $hookmanager;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
}
$result = '';
$params = [
@ -1724,6 +1731,19 @@ class Categorie extends CommonObject
$label = implode($this->getTooltipContentArray($params));
}
$url = DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
if ($option !== 'nolink') {
// Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && isset($_SERVER["PHP_SELF"]) && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
$add_save_lastsearch_values = 1;
}
if ($url && $add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
}
// Check contrast with background and correct text color
$forced_color = 'categtextwhite';
if ($this->color) {
@ -1731,24 +1751,43 @@ class Categorie extends CommonObject
$forced_color = 'categtextblack';
}
}
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
$link .= '"'.$dataparams;
$link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$link .= ' class="'.$classfortooltip.' '.$forced_color.'">';
$linkend = '</a>';
$picto = 'category';
$linkclose = '';
if (empty($notooltip)) {
if (getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$label = $langs->trans("ShowMyObject");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="'.$classfortooltip.' '.$forced_color.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$forced_color.($morecss ? ' '.$morecss : '').'"' : '');
}
if ($option == 'nolink' || empty($url)) {
$linkstart = '<span';
} else {
$linkstart = '<a href="'.$url.'"';
}
$linkstart .= $linkclose.'>';
if ($option == 'nolink' || empty($url)) {
$linkend = '</span>';
} else {
$linkend = '</a>';
}
$result .= $linkstart;
if ($withpicto) {
$result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $link.dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength).$linkend;
$result .= dol_trunc(($this->ref ? $this->ref : $this->label), $maxlength);
}
$result .= $linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);

View file

@ -204,6 +204,7 @@ foreach ($fulltree as $key => $val) {
$entry .= '<span class="noborderoncategories" '.$color.'>'.$li.'</span>';
$entry .= '</td>';
// Add column counter
$entry .= $counter;
$entry .= '<td class="right" width="20px;">';

View file

@ -46,14 +46,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (isModEnabled('commande')) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
}
@ -5656,7 +5655,7 @@ if ($action == 'create') {
if (getDolGlobalString('INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE') || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
if (!$objectidnext && $object->is_last_in_cycle()) {
if ($usercanunvalidate) {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans('NotEnoughPermissions');
@ -5687,7 +5686,7 @@ if ($action == 'create') {
&& ($object->statut == Facture::STATUS_CLOSED || $object->status == Facture::STATUS_ABANDONED || ($object->status == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
&& ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice");
@ -5709,7 +5708,7 @@ if ($action == 'create') {
// Validate
if ($object->status == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (getDolGlobalString('FACTURE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
if ($usercanvalidate) {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
}
}
@ -5721,10 +5720,10 @@ if ($action == 'create') {
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
} else {
if ($usercansend) {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
} else {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
}
}
@ -5767,7 +5766,7 @@ if ($action == 'create') {
} else {
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&amp;action=create&amp;accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&amp;action=create'.($object->fk_account > 0 ? '&amp;accountid='.$object->fk_account : ''), '', true, $params);
}
}
@ -5795,7 +5794,7 @@ if ($action == 'create') {
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->status == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
&& (getDolGlobalString('INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED') || $sumofpayment == 0) && $object->total_ht < 0
) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
print '<a class="butAction classfortooltip'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
}
// For down payment invoice (deposit)
@ -5804,7 +5803,7 @@ if ($action == 'create') {
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || getDolGlobalInt('DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) {
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
} else {
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ConvertToReduc').'</span>';
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ConvertToReduc').'</span>';
}
}
}
@ -5821,7 +5820,7 @@ if ($action == 'create') {
$params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment');
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params);
} else {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid', '', true, $params);
}
}
@ -5867,14 +5866,14 @@ if ($action == 'create') {
// Clone
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=clone&amp;object=invoice', '', true, $params);
}
// Clone as predefined / Create template
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->status == 0 && $usercancreate) {
if (!$objectidnext && count($object->lines) > 0) {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&amp;action=create', '', true, $params);
}
}
@ -5928,10 +5927,10 @@ if ($action == 'create') {
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
$enableDelete = true;
}
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', $deleteHref, '', $enableDelete, $params);
} else {
$params['attr']['title'] = '';
unset($params['attr']['title']);
print dolGetButtonAction($htmltooltip, $langs->trans('Delete'), 'delete', '#', '', false);
}
}

View file

@ -2157,6 +2157,7 @@ if ($action == 'create') {
if ($object->status == $object::STATUS_DRAFT && $nbofservices) {
if ($user->hasRight('contrat', 'creer')) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
@ -2165,6 +2166,7 @@ if ($action == 'create') {
}
if ($object->status == $object::STATUS_VALIDATED) {
if ($user->hasRight('contrat', 'creer')) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
@ -2199,20 +2201,25 @@ if ($action == 'create') {
);
}
if (count($arrayofcreatebutton)) {
unset($params['attr']['title']);
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params);
}
if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) {
if ($user->hasRight('contrat', 'activer')) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params);
} else {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params);
}
}
if ($object->nbofservicesclosed < $nbofservices) {
if ($user->hasRight('contrat', 'desactiver')) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params);
} else {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params);
}
@ -2235,10 +2242,12 @@ if ($action == 'create') {
// Clone
if ($user->hasRight('contrat', 'creer')) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
}
// Delete
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete, $params);
}

View file

@ -6046,9 +6046,9 @@ class Form
print '</form>';
} else {
if (!empty($rate)) {
print price($rate, 1, $langs, 1, 0);
print price($rate, 1, $langs, 0, 0);
if ($currency && $rate != 1) {
print ' &nbsp; (' . price($rate, 1, $langs, 1, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
print ' &nbsp; (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')';
}
} else {
print 1;

View file

@ -170,6 +170,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
print $tab[$x]['buttons'];
print '</td></tr></table>';
} else {
// Show the badge with color for the category
print $tab[$x]['entry'];
}
//print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
@ -193,9 +194,11 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
if ($showfk) {
print '<table class="nobordernopadding centpercent"><tr>';
print '<td class="tdoverflowmax200">';
print '<strong class="paddingleft paddingright"><a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&token='.newToken().'&menuId='.$tab[$x]['rowid'].$moreparam.'">';
print '<strong class="paddingleft paddingright">';
print '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&token='.newToken().'&menuId='.$tab[$x]['rowid'].$moreparam.'">';
print $tab[$x]['title'];
print '</a></strong>';
print '</a>';
print '</strong>';
print '<span class="small opacitymedium">(mainmenu='.$tab[$x]['mainmenu'].' - leftmenu='.$tab[$x]['leftmenu'].', fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')</small>';
print '</td>';
print '<td class="right nowraponall">';

View file

@ -1971,17 +1971,19 @@ if ($action == 'create' || $action == 'adduserldap') {
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$params = array(
'attr' => array(
'title' => '',
'class' => 'classfortooltip'
)
);
if (empty($user->socid)) {
$canSendMail = false;
$params = array(
'attr' => array(
'title' => '',
'class' => 'classfortooltip'
)
);
if (!empty($object->email)) {
$langs->load("mails");
$canSendMail = true;
unset($params['attr']['title']);
} else {
$langs->load("mails");
$params['attr']['title'] = $langs->trans('NoEMail');
@ -1990,26 +1992,16 @@ if ($action == 'create' || $action == 'adduserldap') {
}
if ($caneditfield && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
$params = array(
'attr' => array(
'title' => '',
'class' => 'classfortooltip'
)
);
if (getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')) {
$params['attr']['title'] = $langs->trans('DisabledInMonoUserMode');
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
} else {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&token='.newToken(), '', true, $params);
}
} elseif ($caneditpasswordandsee && !$object->ldap_sid &&
(!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
$params = array(
'attr' => array(
'title' => '',
'class' => 'classfortooltip'
)
);
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit', '', true, $params);
}
@ -2026,6 +2018,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
} elseif (($user->id != $id && $caneditpasswordandsee) && $object->login && !$object->ldap_sid &&
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params);
}
@ -2035,6 +2028,7 @@ if ($action == 'create' || $action == 'adduserldap') {
} elseif (($user->id != $id && $caneditpasswordandsend) && $object->login && !$object->ldap_sid &&
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
if ($object->email) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params);
} else {
$params['attr']['title'] = $langs->trans('NoEMail');
@ -2043,20 +2037,15 @@ if ($action == 'create' || $action == 'adduserldap') {
}
}
// Enable user
$params = array(
'attr' => array(
'title' => '',
'class' => 'classfortooltip'
)
);
if ($user->id != $id && $candisableuser && $object->statut == 0 &&
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params);
}
// Disable user
if ($user->id != $id && $candisableuser && $object->statut == 1 &&
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params);
} else {
if ($user->id == $id) {
@ -2068,6 +2057,7 @@ if ($action == 'create' || $action == 'adduserldap') {
if ($user->id != $id && $candisableuser &&
((!isModEnabled('multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin
unset($params['attr']['title']);
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params);
} else {
$params['attr']['title'] = $langs->trans('MustBeAdminToDeleteOtherAdmin');