fix unknown $user (#28687)

* fix unknown $user

* fix @param

* fix @param

* fix @param

* fix @param
This commit is contained in:
Frédéric FRANCE 2024-03-07 18:48:50 +01:00 committed by GitHub
parent 61e69b352b
commit 9b59445e39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View file

@ -2316,6 +2316,8 @@ class CommandeFournisseur extends CommonOrder
*/
public function deleteLine($idline, $notrigger = 0)
{
global $user;
if ($this->statut == 0) {
$line = new CommandeFournisseurLigne($this->db);
@ -2333,12 +2335,11 @@ class CommandeFournisseur extends CommonOrder
}
}
if ($line->delete($notrigger) > 0) {
if ($line->delete($user, $notrigger) > 0) {
$this->update_price(1);
return 1;
} else {
$this->error = $line->error;
$this->errors = $line->errors;
$this->setErrorsFromObject($line);
return -1;
}
} else {
@ -4162,10 +4163,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
* @param int $notrigger 1=Disable call to triggers
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($notrigger = 0)
public function delete($user, $notrigger = 0)
{
global $user;
$error = 0;
$this->db->begin();

View file

@ -327,7 +327,6 @@ class Establishment extends CommonObject
* Delete record
*
* @param User $user User making the change
* @param int $id Id of record to delete
* @return int Return integer <0 if KO, >0 if OK
*/
public function delete($user)

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2016 Jean-François Ferry <hello@librethic.io>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -410,7 +411,7 @@ class Tickets extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$this->ticket->delete($user)) {
if (!$this->ticket->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when deleting ticket');
}