Skip to content

Commit

Permalink
ADD check user's rights
Browse files Browse the repository at this point in the history
  • Loading branch information
inoveaconseil committed Jul 5, 2018
1 parent d8dd658 commit 30cff2b
Show file tree
Hide file tree
Showing 5 changed files with 4,405 additions and 4,736 deletions.
12 changes: 10 additions & 2 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -4,7 +4,8 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
Expand Down Expand Up @@ -1220,7 +1221,10 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw

if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips

$label = $this->label;
if ((!$user->rights->agenda->allactions->read && $this->author->id != $user->id) || (!$user->rights->agenda->myactions->read && $this->author->id == $user->id))
$option = 'nolink';

$label = $this->label;
if (empty($label)) $label=$this->libelle; // For backward compatibility

$result='';
Expand Down Expand Up @@ -1286,6 +1290,10 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw
$linkstart.=$linkclose.'>';
$linkend='</a>';

if ($option == 'nolink') {
$linkstart = '';
$linkend = '';
}
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;

if ($withpicto == 2)
Expand Down
8 changes: 8 additions & 0 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -3422,6 +3422,9 @@ function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $sa
if (! empty($conf->expedition->enabled) && ($option == '1' || $option == '2')) $url = DOL_URL_ROOT.'/expedition/shipment.php?id='.$this->id;
else $url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;

if (!$user->rights->commande->lire)
$option = 'nolink';

if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
Expand Down Expand Up @@ -3465,6 +3468,11 @@ function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $sa
$linkstart.=$linkclose.'>';
$linkend='</a>';

if ($option == 'nolink') {
$linkstart = '';
$linkend = '';
}

$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
Expand Down
11 changes: 10 additions & 1 deletion htdocs/compta/bank/class/account.class.php
Expand Up @@ -1301,13 +1301,17 @@ public static function countAccountToReconcile()
*/
function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1, $notooltip=0)
{
global $conf, $langs;
global $conf, $langs, $user;

$result='';
$label = '<u>' . $langs->trans("ShowAccount") . '</u>';
$label .= '<br><b>' . $langs->trans('BankAccount') . ':</b> ' . $this->label;
$label .= '<br><b>' . $langs->trans('AccountNumber') . ':</b> ' . $this->number;
$label .= '<br><b>' . $langs->trans("AccountCurrency") . ':</b> ' . $this->currency_code;

if (!$user->rights->accounting->read || !empty($user->socid))
$option = 'nolink';

if (! empty($conf->accounting->enabled))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
Expand Down Expand Up @@ -1338,6 +1342,11 @@ function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1
$linkstart = '<a href="'.$url.$linkclose;
$linkend = '</a>';

if ($option == 'nolink') {
$linkstart = '';
$linkend = '';
}

$result .= $linkstart;
if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '');
Expand Down

0 comments on commit 30cff2b

Please sign in to comment.