Fix warning

This commit is contained in:
Laurent Destailleur 2023-08-06 12:26:27 +02:00
parent 9e3db267bc
commit 921a6f3135
10 changed files with 80 additions and 36 deletions

View File

@ -67,7 +67,7 @@ class Documents extends DolibarrApi
*/
public function index($modulepart, $original_file = '')
{
global $conf, $langs;
global $conf;
if (empty($modulepart)) {
throw new RestException(400, 'bad value for parameter modulepart');
@ -188,66 +188,66 @@ class Documents extends DolibarrApi
if ($modulepart == 'facture' || $modulepart == 'invoice') {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$this->invoice = new Facture($this->db);
$result = $this->invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Facture($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Invoice not found');
}
$templateused = $doctemplate ? $doctemplate : $this->invoice->model_pdf;
$result = $this->invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') {
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
$this->supplier_invoice = new FactureFournisseur($this->db);
$result = $this->supplier_invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new FactureFournisseur($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Supplier invoice not found');
}
$templateused = $doctemplate ? $doctemplate : $this->supplier_invoice->model_pdf;
$result = $this->supplier_invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$this->order = new Commande($this->db);
$result = $this->order->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Commande($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Order not found');
}
$templateused = $doctemplate ? $doctemplate : $this->order->model_pdf;
$result = $this->order->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'propal' || $modulepart == 'proposal') {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$this->propal = new Propal($this->db);
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Propal($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Proposal not found');
}
$templateused = $doctemplate ? $doctemplate : $this->propal->model_pdf;
$result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document');
}
} elseif ($modulepart == 'contrat' || $modulepart == 'contract') {
require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
$this->contract = new Contrat($this->db);
$result = $this->contract->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
$tmpobject = new Contrat($this->db);
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
if (!$result) {
throw new RestException(404, 'Contract not found');
}
$templateused = $doctemplate ? $doctemplate : $this->contract->model_pdf;
$result = $this->contract->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) {
throw new RestException(500, 'Error generating document missing doctemplate parameter');
@ -631,7 +631,7 @@ class Documents extends DolibarrApi
*/
public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0, $createdirifnotexists = 1)
{
global $db, $conf;
global $conf;
//var_dump($modulepart);
//var_dump($filename);

View File

@ -27,11 +27,16 @@ class BlockedLogAuthority
public $db;
/**
* Id of the log
* Id of the authority
* @var int
*/
public $id;
/**
* @var string Ref of the authority
*/
public $ref;
/**
* Unique fingerprint of the blockchain to store
* @var string
@ -158,7 +163,6 @@ class BlockedLogAuthority
*/
public function fetch($id, $signature = '')
{
global $langs;
dol_syslog(get_class($this)."::fetch id=".((int) $id), LOG_DEBUG);

View File

@ -756,15 +756,14 @@ class BlockedLog
if ($resql) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->rowid;
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->tms = $this->db->jdate($obj->tms);
$this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->tms);
$this->amounts = (double) $obj->amounts;
$this->action = $obj->action;
$this->action = $obj->action;
$this->element = $obj->element;
$this->fk_object = $obj->fk_object;
@ -778,7 +777,7 @@ class BlockedLog
$this->object_version = $obj->object_version;
$this->signature = $obj->signature;
$this->signature_line = $obj->signature_line;
$this->signature_line = $obj->signature_line;
$this->certified = ($obj->certified == 1);
return 1;

View File

@ -81,7 +81,7 @@ class AgendaEvents extends DolibarrApi
}
if (!DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) {
throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
throw new RestException(401, 'Insufficient rights to read event of this owner id. Your id is '.DolibarrApiAccess::$user->id);
}
if (!DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {

View File

@ -33,6 +33,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
*/
class ICal
{
/**
* @var string Name of remote HTTP file to read
*/
public $file;
// Text in file
public $file_text;
public $cal; // Array to save iCalendar parse data

View File

@ -170,6 +170,11 @@ class Mailing extends CommonObject
*/
public $date_validation;
/**
* @var int date sending
*/
public $date_envoi;
/**
* @var array extraparams
*/

View File

@ -62,8 +62,6 @@ class PropaleStats extends Stats
*/
public function __construct($db, $socid = 0, $userid = 0, $mode = 'customer', $typentid = 0, $categid = 0)
{
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;

View File

@ -263,7 +263,7 @@ class FactureRec extends CommonInvoice
$this->db->begin();
// Charge facture modele
// Load invoice template
$facsrc = new Facture($this->db);
$result = $facsrc->fetch($facid);
if ($result > 0) {

View File

@ -431,11 +431,22 @@ abstract class CommonObject
* @var string multicurrency code
*/
public $multicurrency_code;
/**
* @var string multicurrency tx
*/
public $multicurrency_tx;
/**
* @var string multicurrency total_ht
*/
public $multicurrency_total_ht;
/**
* @var string multicurrency total_tva
*/
public $multicurrency_total_tva;
/**
* @var string multicurrency total_ttc
*/
public $multicurrency_total_ttc;
/**
* @var string

View File

@ -33,6 +33,28 @@ abstract class Stats
protected $lastfetchdate = array(); // Dates of cache file read by methods
public $cachefilesuffix = ''; // Suffix to add to name of cache file (to avoid file name conflicts)
/**
* @var string To store the FROM part of the main table of the SQL request
*/
public $from;
/**
* @var string To store the FROM part of the line table of the SQL request
*/
public $from_line;
/**
* @var string To store the field of the date
*/
public $field_date;
/**
* @var string To store the field for total HT
*/
public $field;
/**
* @var string To store the FROM part of the line table of the SQL request
*/
public $field_line;
/**
* @param int $year number
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month