New: Send by mail permissions are not really protected permission because user can still view file and send it manually by email or from pdf reader menu. So i moved it as an ADVANCE permission.

This commit is contained in:
Laurent Destailleur 2011-05-05 07:25:31 +00:00
parent a694166fc2
commit 04babd9297
10 changed files with 3461 additions and 3218 deletions

View File

@ -1559,13 +1559,17 @@ if ($id > 0 || ! empty($ref))
} }
// Send // Send
if ($object->statut == 1 && $user->rights->propale->envoyer) if ($object->statut == 1)
{ {
$propref = dol_sanitizeFileName($object->ref); $propref = dol_sanitizeFileName($object->ref);
$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf'; $file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.pdf';
if (file_exists($file)) if (file_exists($file))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propale->propal_advance->send)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
}
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }
} }

View File

@ -1915,14 +1915,15 @@ else
// Send // Send
if ($object->statut > 0) if ($object->statut > 0)
{ {
if ($user->rights->commande->envoyer) $comref = dol_sanitizeFileName($object->ref);
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file))
{ {
$comref = dol_sanitizeFileName($object->ref); if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send))
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
} }
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1767,9 +1767,13 @@ else
} }
// Send by mail // Send by mail
if (($fac->statut == 1 || $fac->statut == 2) && $user->rights->facture->envoyer) if (($fac->statut == 1 || $fac->statut == 2))
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>'; if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->fournisseur->supplier_invoice_advance->send)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=presend&amp;mode=init">'.$langs->trans('SendByMail').'</a>';
}
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
} }

View File

@ -130,7 +130,8 @@ class modCommande extends DolibarrModules
$this->rights[$r][1] = 'Envoyer les commandes clients'; $this->rights[$r][1] = 'Envoyer les commandes clients';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'envoyer'; $this->rights[$r][4] = 'order_advance';
$this->rights[$r][5] = 'send';
$r++; $r++;
$this->rights[$r][0] = 87; $this->rights[$r][0] = 87;

View File

@ -145,7 +145,8 @@ class modFacture extends DolibarrModules
$this->rights[$r][1] = 'Envoyer les factures par mail'; $this->rights[$r][1] = 'Envoyer les factures par mail';
$this->rights[$r][2] = 'a'; $this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'envoyer'; $this->rights[$r][4] = 'invoice_advance';
$this->rights[$r][5] = 'send';
$r++; $r++;
$this->rights[$r][0] = 16; $this->rights[$r][0] = 16;

View File

@ -129,7 +129,7 @@ class modFicheinter extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 68; $this->rights[$r][0] = 68;
$this->rights[$r][1] = 'Envoyer les fiches d\'intervention'; $this->rights[$r][1] = 'Envoyer les fiches d\'intervention par courriel';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on

View File

@ -215,8 +215,8 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][1] = 'Envoyer les factures par mail'; $this->rights[$r][1] = 'Envoyer les factures par mail';
$this->rights[$r][2] = 'a'; $this->rights[$r][2] = 'a';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'facture'; $this->rights[$r][4] = 'supplier_invoice_advance';
$this->rights[$r][5] = 'envoyer'; $this->rights[$r][5] = 'send';
$r++; $r++;
$this->rights[$r][0] = 1236; $this->rights[$r][0] = 1236;

View File

@ -134,7 +134,8 @@ class modPropale extends DolibarrModules
$this->rights[$r][1] = 'Envoyer les propositions commerciales aux clients'; // libelle de la permission $this->rights[$r][1] = 'Envoyer les propositions commerciales aux clients'; // libelle de la permission
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'envoyer'; $this->rights[$r][4] = 'propal_advance';
$this->rights[$r][5] = 'send';
$r++; $r++;
$this->rights[$r][0] = 26; // id de la permission $this->rights[$r][0] = 26; // id de la permission