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
if ($object->statut == 1 && $user->rights->propale->envoyer)
if ($object->statut == 1)
{
$propref = dol_sanitizeFileName($object->ref);
$file = $conf->propale->dir_output . '/'.$propref.'/'.$propref.'.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>';
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

@ -1173,7 +1173,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
// Object source contacts list
$srccontactslist = $objectsrc->liste_contact(-1,'external',1);
}
@ -1447,7 +1447,7 @@ else
$head = commande_prepare_head($object);
dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order');
$formconfirm='';
/*
@ -1522,7 +1522,7 @@ else
// Paiement incomplet. On demande si motif = escompte ou autre
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1);
}
// Hook of thirdparty module
if (empty($formconfirm) && ! empty($object->hooks))
{
@ -1531,7 +1531,7 @@ else
if (empty($formconfirm)) $formconfirm = $module->formconfirm($action,$object,$lineid);
}
}
// Print form confirm
print $formconfirm;
@ -1741,7 +1741,7 @@ else
$html->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
}
print '</td></tr>';
// Availability
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1845,7 +1845,7 @@ else
* Lines
*/
$result = $object->getLinesArray();
$numlines = count($object->lines);
if ($conf->use_javascript_ajax && $object->statut == 0)
@ -1915,14 +1915,15 @@ else
// Send
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);
$file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file))
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_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>';
}
}
@ -1931,7 +1932,7 @@ else
if ($conf->expedition->enabled)
{
$numshipping = $object->nb_expedition();
if ($object->statut > 0 && $object->statut < 3 && $object->getNbOfProductsLines() > 0)
{
if ($user->rights->expedition->creer)

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
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][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'envoyer';
$this->rights[$r][4] = 'order_advance';
$this->rights[$r][5] = 'send';
$r++;
$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][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'envoyer';
$this->rights[$r][4] = 'invoice_advance';
$this->rights[$r][5] = 'send';
$r++;
$this->rights[$r][0] = 16;

View File

@ -129,7 +129,7 @@ class modFicheinter extends DolibarrModules
$r++;
$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][3] = 0;
$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][2] = 'a';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'facture';
$this->rights[$r][5] = 'envoyer';
$this->rights[$r][4] = 'supplier_invoice_advance';
$this->rights[$r][5] = 'send';
$r++;
$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][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][4] = 'envoyer';
$this->rights[$r][4] = 'propal_advance';
$this->rights[$r][5] = 'send';
$r++;
$this->rights[$r][0] = 26; // id de la permission