Fix: Removed a duplicate permission

This commit is contained in:
Laurent Destailleur 2010-05-12 12:41:38 +00:00
parent 2a29f90d14
commit 83aebbb2ce
22 changed files with 79 additions and 116 deletions

View File

@ -223,7 +223,7 @@ class CommandeFournisseur extends Commande
}
/**
* \brief Valide la commande
* \brief Validate an order
* \param user Utilisateur qui valide
*/
function valid($user)
@ -331,65 +331,6 @@ class CommandeFournisseur extends Commande
}
}
/**
* \brief Annule la commande
* \param user Utilisateur qui demande annulation
* \remarks L'annulation se fait apres la validation
*/
function Cancel($user)
{
global $langs,$conf;
//dol_syslog("CommandeFournisseur::Cancel");
$result = 0;
if ($user->rights->fournisseur->commande->annuler)
{
$statut = 6;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("CommandeFournisseur::Cancel sql=".$sql);
if ($this->db->query($sql))
{
$result = 0;
$this->log($user, $statut, time());
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error == 0)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
dol_syslog("CommandeFournisseur::Cancel ".$this->error);
return -1;
}
}
else
{
dol_syslog("CommandeFournisseur::Cancel Not Authorized");
return -1;
}
}
/**
* \brief Return label of the status of object
@ -620,9 +561,8 @@ class CommandeFournisseur extends Commande
}
/**
* Refuse une commande
*
*
* \brief Refuse an order
* \param user User making action
*/
function refuse($user)
{
@ -663,6 +603,65 @@ class CommandeFournisseur extends Commande
return $result ;
}
/**
* \brief Cancel an approved order
* \param user User making action
* \remarks L'annulation se fait apres l'approbation
*/
function Cancel($user)
{
global $langs,$conf;
//dol_syslog("CommandeFournisseur::Cancel");
$result = 0;
if ($user->rights->fournisseur->commande->commander)
{
$statut = 6;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("CommandeFournisseur::Cancel sql=".$sql);
if ($this->db->query($sql))
{
$result = 0;
$this->log($user, $statut, time());
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('ORDER_SUPPLIER_CANCEL',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error == 0)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
dol_syslog("CommandeFournisseur::Cancel ".$this->error);
return -1;
}
}
else
{
dol_syslog("CommandeFournisseur::Cancel Not Authorized");
return -1;
}
}
/**
* Send a supplier order to supplier

View File

@ -344,17 +344,11 @@ if ($id > 0 || ! empty($ref))
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
if ($user->rights->fournisseur->commande->annuler)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
if ($commande->statut == 2)
{
if ($user->rights->fournisseur->commande->annuler)
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}

View File

@ -372,7 +372,7 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
}
}
if ($_REQUEST["action"] == 'confirm_cancel' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->annuler)
if ($_REQUEST["action"] == 'confirm_cancel' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->commander)
{
$commande = new CommandeFournisseur($db);
$commande->fetch($id);
@ -468,7 +468,7 @@ if ($action=='remove_file')
if ($commande->fetch($id))
{
$upload_dir = $conf->commande->dir_output . "/";
$upload_dir = $conf->fournisseur->commande->dir_output . "/";
$file = $upload_dir . '/' . $_GET['file'];
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
@ -1242,19 +1242,15 @@ if ($id > 0 || ! empty($ref))
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=refuse">'.$langs->trans("RefuseOrder").'</a>';
}
if ($user->rights->fournisseur->commande->annuler)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
// Send
if ($commande->statut > 1)
if ($commande->statut == 2)
{
if ($user->rights->fournisseur->commande->approuver)
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
$comref = dol_sanitizeFileName($commande->ref);
$file = $conf->fournisseur->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file))
@ -1267,13 +1263,13 @@ if ($id > 0 || ! empty($ref))
// Cancel
if ($commande->statut == 2)
{
if ($user->rights->fournisseur->commande->annuler)
if ($user->rights->fournisseur->commande->commander)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=cancel">'.$langs->trans("CancelOrder").'</a>';
}
}
if ($user->rights->fournisseur->commande->annuler)
if ($user->rights->fournisseur->commande->supprimer)
{
print '<a class="butActionDelete" href="fiche.php?id='.$commande->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
@ -1376,7 +1372,7 @@ if ($id > 0 || ! empty($ref))
if ($_GET['action'] == 'presend')
{
$ref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
$file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
print '<br>';
print_titre($langs->trans('SendOrderByMail'));

View File

@ -114,7 +114,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->rights[$r][0] = 1182;
$this->rights[$r][1] = 'Lire les commandes fournisseur';
$this->rights[$r][1] = 'Consulter les commandes fournisseur';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'commande';
@ -146,7 +146,7 @@ class modFournisseur extends DolibarrModules
$r++;
$this->rights[$r][0] = 1186;
$this->rights[$r][1] = 'Commander une commande fournisseur';
$this->rights[$r][1] = 'Commander/Annuler une commande fournisseur';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'commande';
@ -168,17 +168,9 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][4] = 'commande';
$this->rights[$r][5] = 'cloturer';
$r++;
$this->rights[$r][0] = 1189;
$this->rights[$r][1] = 'Annuler les commandes fournisseur';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'commande';
$this->rights[$r][5] = 'annuler';
$r++;
$this->rights[$r][0] = 1231;
$this->rights[$r][1] = 'Lire les factures fournisseur';
$this->rights[$r][1] = 'Consulter les factures fournisseur';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'facture';

View File

@ -514,7 +514,6 @@ Permission1185=الموافقة على أوامر المورد
Permission1186=من أجل المورد أوامر
Permission1187=باستلام المورد أوامر
Permission1188=وثيقة أوامر المورد
Permission1189=المورد إلغاء أوامر
Permission1201=ونتيجة للحصول على التصدير
Permission1202=إنشاء / تعديل للتصدير
Permission1231=قراءة فواتير الموردين

View File

@ -552,7 +552,6 @@ Permission1185= Aprovar comandes a proveïdors
Permission1186= Enviar comandes a proveïdors
Permission1187= Rebre comandes a proveïdors
Permission1188= Tancar comandes a proveïdors
Permission1189= Cancel·lar comandes a proveïdors
Permission1201= Obtenir resultat d'una exportació
Permission1202= Crear/modificar exportacions
Permission1231= Consultar factures de proveïdors

View File

@ -448,7 +448,6 @@ Permission1185=Godkend leverandør ordrer
Permission1186=Bestil leverandør ordrer
Permission1187=Anerkende modtagelsen af leverandør ordrer
Permission1188=Luk leverandør ordrer
Permission1189=Annuller leverandør ordrer
Permission1201=Få resultatet af en eksport
Permission1202=Opret / Modify en eksport
Permission1231=Læs leverandør fakturaer

View File

@ -445,7 +445,6 @@ Permission1185=Genehmigen Lieferanten Bestellungen
Permission1186=Bestell-Lieferanten Bestellungen
Permission1187=Bestätigt den Eingang des Lieferanten Bestellungen
Permission1188=Schließen Lieferanten Bestellungen
Permission1189=Abbrechen Lieferanten Bestellungen
Permission1201=Holen Sie sich zu einer Export -
Permission1202=Anlegen / Ändern einer Ausfuhrlizenz
Permission1231=Lesen Lieferanten Rechnungen

View File

@ -548,10 +548,9 @@ Permission1182=Read supplier orders
Permission1183=Create supplier orders
Permission1184=Validate supplier orders
Permission1185=Approve supplier orders
Permission1186=Order supplier orders
Permission1186=Order/Cancel supplier orders
Permission1187=Acknowledge receipt of supplier orders
Permission1188=Close supplier orders
Permission1189=Cancel supplier orders
Permission1201=Get result of an export
Permission1202=Create/Modify an export
Permission1231=Read supplier invoices

View File

@ -552,7 +552,6 @@ Permission1185= Aprobar pedidos a proveedores
Permission1186= Enviar pedidos a proveedores
Permission1187= Recibir pedidos de proveedores
Permission1188= Cerrar pedidos a proveedores
Permission1189= Cancelar pedidos a proveedores
Permission1201= Obtener resultado de una exportación
Permission1202= Crear/odificar exportaciones
Permission1231= Consultar facturas de proveedores

View File

@ -446,7 +446,6 @@ Permission1185=
Permission1186=Tilaa toimittaja tilaukset
Permission1187=Vastaanottaneeni toimittaja tilaukset
Permission1188=Sulje toimittaja tilaukset
Permission1189=Peruuta toimittaja tilaukset
Permission1201=Hanki seurauksena vienti
Permission1202=Luo / Muuta vienti
Permission1231=Lue toimittajan laskut

View File

@ -545,17 +545,16 @@ Permission1102= Créer/modifier les bons de livraison
Permission1104= Valider les bons de livraison
Permission1109= Supprimer les bons de livraison
Permission1181= Consulter les fournisseurs
Permission1182= Lire les commandes fournisseur
Permission1182= Consulter les commandes fournisseur
Permission1183= Créer une commande fournisseur
Permission1184= Valider une commande fournisseur
Permission1185= Approuver les commandes fournisseur
Permission1186= Commander une commande fournisseur
Permission1186= Commander/Annuler une commande fournisseur
Permission1187= Réceptionner les commandes fournisseur
Permission1188= Clôturer les commandes fournisseur
Permission1189= Annuler les commandes fournisseur
Permission1201= Récupérer le résultat d'un export
Permission1202= Créer/Modifier un export
Permission1231= Lire les factures fournisseur
Permission1231= Consulter les factures fournisseur
Permission1232= Créer une facture fournisseur
Permission1233= Valider une facture fournisseur
Permission1234= Supprimer une facture fournisseur

View File

@ -431,7 +431,6 @@ Permission1185=Approvare ordini fornitore
Permission1186=Ordinere ordini fornitore
Permission1187=Di aver ricevuto gli ordini del fornitore
Permission1188=Chiudere ordini fornitore
Permission1189=Annullare ordini fornitore
Permission1201=Risultato di ottenere un'autorizzazione di esportazione
Permission1202=Creare / Modificare esportazioni
Permission1231=Leggere le fatture fornitore

View File

@ -444,7 +444,6 @@ Permission1185=Godkjenne leverandørordre
Permission1186=Bestille leverandørordre
Permission1187=Bekrefte mottak av leverandørordre
Permission1188=Lukke leverandørordre
Permission1189=AbCancel supplier orders
Permission1201=Get result of an export
Permission1202=Create/Modify an export
Permission1231=Read supplier invoices

View File

@ -448,7 +448,6 @@ Permission1185=Goedkeuren van leverancier bestellingen
Permission1186=Bestel leverancier bestellingen
Permission1187=Ontvangstbewijs van de leverancier bestellingen
Permission1188=Sluiten leverancier bestellingen
Permission1189=Annuleren leverancier bestellingen
Permission1201=Krijg het resultaat van een export
Permission1202=Maken / wijzigen van een export
Permission1231=Lees leverancier facturen

View File

@ -552,7 +552,6 @@ Permission1185=Goedkeuren leverancier bestellingen
Permission1186=Bestel leverancier bestellingen
Permission1187=Bevestigt de ontvangst van de leverancier bestellingen
Permission1188=Sluiten leverancier bestellingen
Permission1189=Annuleren leverancier bestellingen
Permission1201=Geef het resultaat van een uitvoervergunning
Permission1202=Maken/wijzigen een uitvoervergunning
Permission1231=Bekijk leverancier facturen

View File

@ -448,7 +448,6 @@ Permission1185=Zatwierdź dostawcy zamówienia
Permission1186=Postanowienie dostawcy zamówienia
Permission1187=Potwierdzam otrzymanie zamówienia dostawcy
Permission1188=Zamknij dostawcy zamówienia
Permission1189=Zrezygnuj dostawcy zamówienia
Permission1201=Pobierz skutek wywozu
Permission1202=Utwórz / Modyfikuj wywóz
Permission1231=Czytaj dostawcy faktur

View File

@ -490,7 +490,6 @@ Permission1185=Aprovar pedidos a Fornecedores
Permission1186=Enviar pedidos a Fornecedores
Permission1187=Receber pedidos de Fornecedores
Permission1188=Fechar pedidos a Fornecedores
Permission1189=Cancelar pedidos a Fornecedores
Permission1201=Obter resultado de uma exportação
Permission1202=Criar/Modificar Exportações
Permission1231=Consultar faturas de Fornecedores

View File

@ -486,7 +486,6 @@ Permission1185=Aprovar pedidos a Fornecedores
Permission1186=Enviar pedidos a Fornecedores
Permission1187=Recever pedidos de Fornecedores
Permission1188=Fechar pedidos a Fornecedores
Permission1189=Cancelar pedidos a Fornecedores
Permission1201=Obter resultado de uma exportação
Permission1202=Criar/Modificar Exportações
Permission1231=Consultar facturas de Fornecedores

View File

@ -447,7 +447,6 @@ Permission1185=Aprobaţi furnizor ordinelor
Permission1186=Comanda furnizor ordinelor
Permission1187=Confirmarea de primire de furnizor de comenzi
Permission1188=Inchide furnizor ordinelor
Permission1189=Anulare furnizor ordinelor
Permission1201=Obţineţi rezultatul unui export
Permission1202=Creare / Modificare de export
Permission1231=Citeşte facturile furnizor

View File

@ -446,7 +446,6 @@ Permission1185=Одобрить поставщик заказов
Permission1186=Заказ поставщику заказов
Permission1187=Подтвердить получение поставщиками заказов
Permission1188=Закрыть поставщик заказов
Permission1189=Отмена заказов поставщику
Permission1201=Получите результат экспорта
Permission1202=Создать / Изменить экспорт
Permission1231=Читать поставщиком счета-фактуры

View File

@ -542,7 +542,6 @@ Permission1185=Onayla ticaret sipariş
Permission1186=Sipariş ticaret sipariş
Permission1187=Tedarikçi sipariş tanıyalım makbuz
Permission1188=Yakın tedarikçi sipariş
Permission1189=Iptal ticaret sipariş
Permission1201=Bir ihracat sonucu alın
Permission1202=Oluştur / ihracat değiştirin
Permission1231=Read tedarikçi faturalar