Fix: A lot of fix in permissions
This commit is contained in:
parent
cea172ce0e
commit
321840ee67
@ -55,6 +55,7 @@ class Commande extends CommonObject
|
|||||||
var $contactid;
|
var $contactid;
|
||||||
var $fk_project;
|
var $fk_project;
|
||||||
var $statut; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted, 3=Closed (Envoyee/Recue facturee ou non)
|
var $statut; // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted, 3=Closed (Envoyee/Recue facturee ou non)
|
||||||
|
|
||||||
var $facturee; // Facturee ou non
|
var $facturee; // Facturee ou non
|
||||||
var $brouillon;
|
var $brouillon;
|
||||||
var $cond_reglement_id;
|
var $cond_reglement_id;
|
||||||
|
|||||||
@ -632,7 +632,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_close' && $_REQUEST['confirm'] == 'yes' && $user->rights->commande->creer)
|
if ($_REQUEST['action'] == 'confirm_close' && $_REQUEST['confirm'] == 'yes' && $user->rights->commande->cloturer)
|
||||||
{
|
{
|
||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$commande->fetch($_GET['id']); // Load order and lines
|
$commande->fetch($_GET['id']); // Load order and lines
|
||||||
@ -2167,7 +2167,7 @@ else
|
|||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$commande->id.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$commande->id.'&action=clone&object=order">'.$langs->trans("ToClone").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Annuler commande
|
// Cancel order
|
||||||
if ($commande->statut == 1)
|
if ($commande->statut == 1)
|
||||||
{
|
{
|
||||||
$nb_expedition = $commande->nb_expedition();
|
$nb_expedition = $commande->nb_expedition();
|
||||||
|
|||||||
@ -329,8 +329,8 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repasse la facture en mode brouillon
|
// Repasse la facture en mode brouillon (unvalidate)
|
||||||
if ($_GET['action'] == 'modif' && $user->rights->facture->modifier)
|
if ($_GET['action'] == 'modif' && $user->rights->facture->unvalidate)
|
||||||
{
|
{
|
||||||
$fac = new Facture($db);
|
$fac = new Facture($db);
|
||||||
$fac->fetch($_GET['facid']);
|
$fac->fetch($_GET['facid']);
|
||||||
@ -3150,14 +3150,20 @@ else
|
|||||||
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
|
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
|
||||||
$ventilExportCompta = $fac->getVentilExportCompta();
|
$ventilExportCompta = $fac->getVentilExportCompta();
|
||||||
|
|
||||||
if ($user->rights->facture->modifier
|
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
|
||||||
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
|
||||||
{
|
{
|
||||||
if (! $facidnext)
|
if (! $facidnext)
|
||||||
|
{
|
||||||
|
if ($user->rights->facture->unvalidate)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
print '<span class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Modify').'</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span>';
|
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,10 +49,10 @@ class CommandeFournisseur extends Commande
|
|||||||
|
|
||||||
var $ref;
|
var $ref;
|
||||||
var $brouillon;
|
var $brouillon;
|
||||||
var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally
|
var $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
|
||||||
// -> 7=Canceled/Never received -> 3=Process
|
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
||||||
// -> 6=Canceled -> 2=Approved
|
// -> 6=Canceled -> (reopen) 2=Approved
|
||||||
// -> 9=Refused -> 1=Validated
|
// -> 9=Refused -> (reopen) 1=Validated
|
||||||
|
|
||||||
|
|
||||||
/** \brief Constructeur
|
/** \brief Constructeur
|
||||||
|
|||||||
@ -355,11 +355,11 @@ if ($_REQUEST['action'] == 'confirm_commande' && $_REQUEST['confirm'] == 'yes' &
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->creer)
|
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->supprimer)
|
||||||
{
|
{
|
||||||
$commande = new CommandeFournisseur($db);
|
$commande = new CommandeFournisseur($db);
|
||||||
$commande->id = $id;
|
$commande->fetch($id);
|
||||||
$result=$commande->delete();
|
$result=$commande->delete($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".DOL_URL_ROOT.'/fourn/commande/liste.php');
|
Header("Location: ".DOL_URL_ROOT.'/fourn/commande/liste.php');
|
||||||
@ -1308,6 +1308,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete
|
||||||
if ($user->rights->fournisseur->commande->supprimer)
|
if ($user->rights->fournisseur->commande->supprimer)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
|
|||||||
@ -788,8 +788,8 @@ class DolibarrModules
|
|||||||
$name = $this->const[$key][0];
|
$name = $this->const[$key][0];
|
||||||
$type = $this->const[$key][1];
|
$type = $this->const[$key][1];
|
||||||
$val = $this->const[$key][2];
|
$val = $this->const[$key][2];
|
||||||
$note = $this->const[$key][3];
|
$note = isset($this->const[$key][3])?$this->const[$key][3]:'';
|
||||||
$visible = $this->const[$key][4];
|
$visible = isset($this->const[$key][4])?$this->const[$key][4]:0;
|
||||||
$entity = ! empty($this->const[$key][5])?0:$conf->entity;
|
$entity = ! empty($this->const[$key][5])?0:$conf->entity;
|
||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
@ -905,6 +905,7 @@ class DolibarrModules
|
|||||||
|
|
||||||
dol_syslog("DolibarrModules::insert_permissions sql=".$sql, LOG_DEBUG);
|
dol_syslog("DolibarrModules::insert_permissions sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql,1);
|
$resql=$this->db->query($sql,1);
|
||||||
|
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
|
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
|
||||||
|
|||||||
@ -119,17 +119,18 @@ class modFacture extends DolibarrModules
|
|||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 12;
|
$this->rights[$r][0] = 12;
|
||||||
$this->rights[$r][1] = 'Creer les factures';
|
$this->rights[$r][1] = 'Creer/modifier les factures';
|
||||||
$this->rights[$r][2] = 'a';
|
$this->rights[$r][2] = 'a';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'creer';
|
$this->rights[$r][4] = 'creer';
|
||||||
|
|
||||||
|
// There is a particular permission for unvalidate because this may be not forbidden by some laws
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 13;
|
$this->rights[$r][0] = 13;
|
||||||
$this->rights[$r][1] = 'Modifier les factures';
|
$this->rights[$r][1] = 'Dévalider les factures';
|
||||||
$this->rights[$r][2] = 'a';
|
$this->rights[$r][2] = 'a';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'modifier';
|
$this->rights[$r][4] = 'unvalidate';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 14;
|
$this->rights[$r][0] = 14;
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class modFournisseur extends DolibarrModules
|
|||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 1185;
|
$this->rights[$r][0] = 1185;
|
||||||
$this->rights[$r][1] = 'Approuver les commandes fournisseur';
|
$this->rights[$r][1] = 'Approuver une commande fournisseur';
|
||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'commande';
|
$this->rights[$r][4] = 'commande';
|
||||||
@ -149,7 +149,7 @@ class modFournisseur extends DolibarrModules
|
|||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 1186;
|
$this->rights[$r][0] = 1186;
|
||||||
$this->rights[$r][1] = 'Commander/Annuler une commande fournisseur';
|
$this->rights[$r][1] = 'Commander une commande fournisseur';
|
||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'commande';
|
$this->rights[$r][4] = 'commande';
|
||||||
@ -157,7 +157,7 @@ class modFournisseur extends DolibarrModules
|
|||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 1187;
|
$this->rights[$r][0] = 1187;
|
||||||
$this->rights[$r][1] = 'Receptionner les commandes fournisseur';
|
$this->rights[$r][1] = 'Receptionner une commande fournisseur';
|
||||||
$this->rights[$r][2] = 'd';
|
$this->rights[$r][2] = 'd';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'commande';
|
$this->rights[$r][4] = 'commande';
|
||||||
@ -165,11 +165,11 @@ class modFournisseur extends DolibarrModules
|
|||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 1188;
|
$this->rights[$r][0] = 1188;
|
||||||
$this->rights[$r][1] = 'Cloturer les commandes fournisseur';
|
$this->rights[$r][1] = 'Supprimer une commande fournisseur';
|
||||||
$this->rights[$r][2] = 'd';
|
$this->rights[$r][2] = 'd';
|
||||||
$this->rights[$r][3] = 0;
|
$this->rights[$r][3] = 0;
|
||||||
$this->rights[$r][4] = 'commande';
|
$this->rights[$r][4] = 'commande';
|
||||||
$this->rights[$r][5] = 'cloturer';
|
$this->rights[$r][5] = 'supprimer';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 1231;
|
$this->rights[$r][0] = 1231;
|
||||||
|
|||||||
@ -278,11 +278,11 @@ if (isset($_POST['action']) && preg_match('/upgrade/i',$_POST["action"]))
|
|||||||
migrate_shipping_delivery($db,$langs,$conf);
|
migrate_shipping_delivery($db,$langs,$conf);
|
||||||
|
|
||||||
migrate_shipping_delivery2($db,$langs,$conf);
|
migrate_shipping_delivery2($db,$langs,$conf);
|
||||||
|
}
|
||||||
|
|
||||||
migrate_reload_modules($db,$langs,$conf);
|
migrate_reload_modules($db,$langs,$conf);
|
||||||
|
|
||||||
migrate_reload_menu($db,$langs,$conf);
|
migrate_reload_menu($db,$langs,$conf);
|
||||||
}
|
|
||||||
|
|
||||||
// On commit dans tous les cas.
|
// On commit dans tous les cas.
|
||||||
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
|
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
|
||||||
@ -1843,6 +1843,27 @@ function migrate_reload_modules($db,$langs,$conf)
|
|||||||
$mod=new modService($db);
|
$mod=new modService($db);
|
||||||
$mod->init();
|
$mod->init();
|
||||||
}
|
}
|
||||||
|
if (! empty($conf->global->MAIN_MODULE_COMMANDE)) // Permission has changed into 2.9
|
||||||
|
{
|
||||||
|
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modCommande.class.php');
|
||||||
|
$mod=new modCommande($db);
|
||||||
|
$mod->init();
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->MAIN_MODULE_FACTURE)) // Permission has changed into 2.9
|
||||||
|
{
|
||||||
|
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modFacture.class.php');
|
||||||
|
$mod=new modFacture($db);
|
||||||
|
$mod->init();
|
||||||
|
}
|
||||||
|
if (! empty($conf->global->MAIN_MODULE_FOURNISSEUR)) // Permission has changed into 2.9
|
||||||
|
{
|
||||||
|
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/modFournisseur.class.php');
|
||||||
|
$mod=new modFournisseur($db);
|
||||||
|
$mod->init();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2847,6 +2868,26 @@ function migrate_project_task_time($db,$langs,$conf)
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans('AlreadyDone')."<br>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans('AlreadyDone')."<br>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
@ -2856,27 +2897,6 @@ function migrate_project_task_time($db,$langs,$conf)
|
|||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans('AlreadyDone')."<br>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
$db->rollback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans('AlreadyDone')."<br>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user