Skip to content

Commit

Permalink
Merge pull request #4699 from bafbes/abb-11
Browse files Browse the repository at this point in the history
new:advanced permissions to validate and unvalidate interventions
  • Loading branch information
eldy committed Mar 2, 2016
2 parents ac60b42 + f9162aa commit f96511e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
16 changes: 16 additions & 0 deletions htdocs/core/modules/modFicheinter.class.php
Expand Up @@ -131,6 +131,22 @@ function __construct($db)
$this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'send';

$r++;
$this->rights[$r][0] = 69;
$this->rights[$r][1] = 'Valider les fiches d\'intervention ';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'validate';

$r++;
$this->rights[$r][0] = 70;
$this->rights[$r][1] = 'Dévalider les fiches d\'intervention';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'unvalidate';

//Exports
//--------
$r=1;
Expand Down
20 changes: 10 additions & 10 deletions htdocs/fichinter/card.php
Expand Up @@ -1660,17 +1660,17 @@
{
if ($user->societe_id == 0)
{
if ($action != 'editdescription' && ($action != 'presend'))
{
// Validate
if ($object->statut == 0 && $user->rights->ficheinter->creer && (count($object->lines) > 0 || ! empty($conf->global->FICHINTER_DISABLE_DETAILS)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate"';
print '>'.$langs->trans("Validate").'</a></div>';
}
if ($action != 'editdescription' && ($action != 'presend')) {
// Validate
if ($object->statut == 0 && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&action=validate"';
print '>' . $langs->trans("Validate") . '</a></div>';
}
}

// Modify
if ($object->statut == 1 && $user->rights->ficheinter->creer)
// Modify
if ($object->statut == 1 && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate)))
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=modify">';
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) print $langs->trans("Modify");
Expand Down

0 comments on commit f96511e

Please sign in to comment.