Fix: Lost permission

This commit is contained in:
Laurent Destailleur 2010-08-17 08:18:46 +00:00
parent 30cdb4b455
commit 3b83692946
3 changed files with 16 additions and 15 deletions

View File

@ -96,40 +96,40 @@ class modProduct extends DolibarrModules
$this->rights_class = 'produit';
$r=0;
$r++;
$this->rights[$r][0] = 31; // id de la permission
$this->rights[$r][1] = 'Lire les produits'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire';
$r++;
$this->rights[$r][0] = 32; // id de la permission
$this->rights[$r][1] = 'Creer/modifier les produits'; // libelle de la permission
$this->rights[$r][2] = 'w'; // 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] = 'creer';
$r++;
$this->rights[$r][0] = 34; // id de la permission
$this->rights[$r][1] = 'Supprimer les produits'; // 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] = 'supprimer';
$r++;
$this->rights[$r][0] = 36; // id de la permission
$this->rights[$r][0] = 36; // id de la permission
$this->rights[$r][1] = 'Voir/gérer les produits cachés'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'hidden';
$r++;
$r++;
$r++;
$this->rights[$r][0] = 38; // Must be same permission than in service module
$this->rights[$r][1] = 'Exporter les produits';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export';
$r++;
// Exports

View File

@ -88,40 +88,40 @@ class modService extends DolibarrModules
$this->rights_class = 'service';
$r=0;
$r++;
$this->rights[$r][0] = 531; // id de la permission
$this->rights[$r][1] = 'Lire les services'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire';
$r++;
$r++;
$this->rights[$r][0] = 532; // id de la permission
$this->rights[$r][1] = 'Creer/modifier les services'; // libelle de la permission
$this->rights[$r][2] = 'w'; // 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] = 'creer';
$r++;
$r++;
$this->rights[$r][0] = 534; // id de la permission
$this->rights[$r][1] = 'Supprimer les services'; // 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] = 'supprimer';
$r++;
$this->rights[$r][0] = 536; // id de la permission
$this->rights[$r][1] = 'Voir/gérer les services cachés'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'hidden';
$r++;
$r++;
$r++;
$this->rights[$r][0] = 538; // Must be same permission than in product module
$this->rights[$r][1] = 'Exporter les services';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export';
$r++;
// Exports

View File

@ -672,7 +672,7 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$html->select_array('statut',$statutarray,$_POST["statut"]);
print '</td></tr>';
// To buy
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
@ -904,7 +904,7 @@ if ($_GET["id"] || $_GET["ref"])
}
print '</select>';
print '</td></tr>';
// To Buy
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td colspan="2">';
print '<select class="flat" name="statut_buy">';
@ -1102,7 +1102,7 @@ if ($_GET["id"] || $_GET["ref"])
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
print $product->getLibStatut(2,0);
print '</td></tr>';
// To buy
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
print $product->getLibStatut(2,1);
@ -1256,7 +1256,8 @@ if ($_GET["action"] == '')
}
$product_is_used = $product->verif_prod_use($product->id);
if ($user->rights->produit->supprimer)
if (($product->type == 0 && $user->rights->produit->supprimer)
|| ($product->type == 1 && $user->rights->service->supprimer))
{
if (! $product_is_used && $product->no_button_delete <> 1)
{