Clean code

This commit is contained in:
ldestailleur 2025-09-11 12:25:22 +02:00
parent af74f2c057
commit 702d91c65d
16 changed files with 24 additions and 24 deletions

View file

@ -399,7 +399,6 @@ class AccountancyCategory // extends CommonObject
*/
public function delete($user, $notrigger = 0)
{
global $conf, $langs;
$error = 0;
$sql = "DELETE FROM ".$this->db->prefix().$this->table_element;
@ -438,6 +437,7 @@ class AccountancyCategory // extends CommonObject
public function display($id)
{
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM ".$this->db->prefix()."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".((int) $id);

View file

@ -305,7 +305,7 @@ class Proposals extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -309,7 +309,7 @@ class Orders extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('commande', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -347,7 +347,7 @@ class Invoices extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
if (!is_array($request_data)) {

View file

@ -200,7 +200,7 @@ class Donations extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('don', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields

View file

@ -208,7 +208,7 @@ class Shipments extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('expedition', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -215,7 +215,7 @@ class ExpenseReports extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
@ -568,7 +568,7 @@ class ExpenseReports extends DolibarrApi
public function validate($id, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('expensereport', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->expensereport->fetch($id);
if (!$result) {
@ -613,7 +613,7 @@ class ExpenseReports extends DolibarrApi
public function approve($id, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('expensereport', 'approve')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->expensereport->fetch($id);
if (!$result) {
@ -659,7 +659,7 @@ class ExpenseReports extends DolibarrApi
public function deny($id, $details, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('expensereport', 'approve')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->expensereport->fetch($id);
if (!$result) {

View file

@ -250,7 +250,7 @@ class Interventions extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);
@ -376,7 +376,7 @@ class Interventions extends DolibarrApi
public function postLine($id, $request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validateLine($request_data);
@ -468,7 +468,7 @@ class Interventions extends DolibarrApi
public function reopen($id)
{
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->fichinter->fetch($id);
if (!$result) {
@ -511,7 +511,7 @@ class Interventions extends DolibarrApi
public function validate($id, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->fichinter->fetch($id);
if (!$result) {
@ -551,7 +551,7 @@ class Interventions extends DolibarrApi
public function closeFichinter($id)
{
if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->fichinter->fetch($id);
if (!$result) {

View file

@ -231,7 +231,7 @@ class SupplierInvoices extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight("fournisseur", "facture", "creer")) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
if (!is_array($request_data)) {

View file

@ -247,7 +247,7 @@ class SupplierOrders extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight("fournisseur", "commande", "creer") && !DolibarrApiAccess::$user->hasRight("supplier_order", "creer")) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
if (!is_array($request_data)) {

View file

@ -457,7 +457,7 @@ class KnowledgeManagement extends DolibarrApi
public function validate($id, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->knowledgerecord->fetch($id);
if (!$result) {
@ -494,7 +494,7 @@ class KnowledgeManagement extends DolibarrApi
public function cancel($id, $notrigger = 0)
{
if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
$result = $this->knowledgerecord->fetch($id);
if (!$result) {

View file

@ -313,7 +313,7 @@ class Projects extends DolibarrApi
{
global $conf;
if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -196,7 +196,7 @@ class Tasks extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('projet', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -207,7 +207,7 @@ class Receptions extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('reception', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -126,7 +126,7 @@ class SupplierProposals extends DolibarrApi
public function post($request_data = null)
{
if (!DolibarrApiAccess::$user->hasRight('supplier_proposal', 'creer')) {
throw new RestException(403, "Insuffisant rights");
throw new RestException(403, "Insufficiant rights");
}
// Check mandatory fields
$result = $this->_validate($request_data);

View file

@ -3362,7 +3362,7 @@ if (!GETPOST('hide_websitemenu')) {
} elseif (empty($virtualurl)) {
//$htmltext .= '<br><span class="error">'.$langs->trans("VirtualHostUrlNotDefined").'</span><br><br>';
} else {
$htmltext .= '<br><center>'.$langs->trans("GoTo").' <a href="'.$virtualurl.'" target="_website">'.$virtualurl.'</a></center><br>';
$htmltext .= '<br><center>'.$langs->trans("GoTo").' <a href="'.$virtualurl.'" target="_website">'.$virtualurl.' '.img_picto('', 'url').'</a></center><br>';
}
if (getDolGlobalString('WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER')) {
$htmltext .= '<!-- Message defined translate key set into WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER -->';