forked from Wavyzz/dolibarr
clean code (#35343)
* clean code * clean code * clean code * clean code * clean code * clean code * clean code * clean code
This commit is contained in:
@@ -324,138 +324,12 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../htdocs/accountancy/class/accountingjournal.class.php
|
path: ../../../htdocs/accountancy/class/accountingjournal.class.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Negated boolean expression is always true\.$#'
|
|
||||||
identifier: booleanNot.alwaysTrue
|
|
||||||
count: 2
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#'
|
message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#'
|
||||||
identifier: argument.type
|
identifier: argument.type
|
||||||
count: 3
|
count: 3
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$amount \(float\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$code_journal \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$credit \(float\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 3
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$debit \(float\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 3
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$doc_ref \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$doc_type \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$fk_doc \(int\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$fk_docdet \(int\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$fk_user_author \(int\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$import_key \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$journal_label \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$label_compte \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$label_operation \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$montant \(float\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 3
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$numero_compte \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$piece_num \(int\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 4
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$sens \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Property BookKeeping\:\:\$thirdparty_code \(string\) in isset\(\) is not nullable\.$#'
|
|
||||||
identifier: isset.property
|
|
||||||
count: 5
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Ternary operator condition is always true\.$#'
|
|
||||||
identifier: ternary.alwaysTrue
|
|
||||||
count: 2
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: '#^Variable \$sortfield in empty\(\) always exists and is not falsy\.$#'
|
|
||||||
identifier: empty.variable
|
|
||||||
count: 1
|
|
||||||
path: ../../../htdocs/accountancy/class/bookkeeping.class.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: '#^If condition is always false\.$#'
|
message: '#^If condition is always false\.$#'
|
||||||
identifier: if.alwaysFalse
|
identifier: if.alwaysFalse
|
||||||
|
|||||||
@@ -70,27 +70,27 @@ class BookKeeping extends CommonObject
|
|||||||
public $date_lim_reglement;
|
public $date_lim_reglement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Doc type
|
* @var ?string Doc type
|
||||||
*/
|
*/
|
||||||
public $doc_type;
|
public $doc_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Doc ref
|
* @var ?string Doc ref
|
||||||
*/
|
*/
|
||||||
public $doc_ref;
|
public $doc_ref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var ?int ID
|
||||||
*/
|
*/
|
||||||
public $fk_doc;
|
public $fk_doc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var ?int ID
|
||||||
*/
|
*/
|
||||||
public $fk_docdet;
|
public $fk_docdet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Thirdparty code
|
* @var ?string Thirdparty code
|
||||||
*/
|
*/
|
||||||
public $thirdparty_code;
|
public $thirdparty_code;
|
||||||
|
|
||||||
@@ -105,69 +105,69 @@ class BookKeeping extends CommonObject
|
|||||||
public $subledger_label;
|
public $subledger_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string doc_type
|
* @var ?string doc_type
|
||||||
*/
|
*/
|
||||||
public $numero_compte;
|
public $numero_compte;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string label compte
|
* @var ?string label compte
|
||||||
*/
|
*/
|
||||||
public $label_compte;
|
public $label_compte;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string label operation
|
* @var ?string label operation
|
||||||
*/
|
*/
|
||||||
public $label_operation;
|
public $label_operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float FEC:Debit
|
* @var ?float FEC:Debit
|
||||||
*/
|
*/
|
||||||
public $debit;
|
public $debit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float FEC:Credit
|
* @var ?float FEC:Credit
|
||||||
*/
|
*/
|
||||||
public $credit;
|
public $credit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float FEC:Amount (Not necessary)
|
* @var ?float FEC:Amount (Not necessary)
|
||||||
* @deprecated No more used (we have info into debit/credit and sens)
|
* @deprecated No more used (we have info into debit/credit and sens)
|
||||||
*/
|
*/
|
||||||
public $montant;
|
public $montant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float FEC:Amount (Not necessary)
|
* @var ?float FEC:Amount (Not necessary)
|
||||||
* @deprecated No more used (we have info into debit/credit and sens)
|
* @deprecated No more used (we have info into debit/credit and sens)
|
||||||
*/
|
*/
|
||||||
public $amount;
|
public $amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string FEC:Sens (Not necessary)
|
* @var ?string FEC:Sens (Not necessary)
|
||||||
*/
|
*/
|
||||||
public $sens;
|
public $sens;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var ?int ID
|
||||||
*/
|
*/
|
||||||
public $fk_user_author;
|
public $fk_user_author;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string key for import
|
* @var ?string key for import
|
||||||
*/
|
*/
|
||||||
public $import_key;
|
public $import_key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string code journal
|
* @var ?string code journal
|
||||||
*/
|
*/
|
||||||
public $code_journal;
|
public $code_journal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string label journal
|
* @var ?string label journal
|
||||||
*/
|
*/
|
||||||
public $journal_label;
|
public $journal_label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int accounting transaction id
|
* @var ?int accounting transaction id
|
||||||
*/
|
*/
|
||||||
public $piece_num;
|
public $piece_num;
|
||||||
|
|
||||||
@@ -1055,7 +1055,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND t.subledger_account IS NOT NULL";
|
$sql .= " AND t.subledger_account IS NOT NULL";
|
||||||
$sql .= " AND t.subledger_account <> ''";
|
$sql .= " AND t.subledger_account <> ''";
|
||||||
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
||||||
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
|
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||||
} else {
|
} else {
|
||||||
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
|
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
|
||||||
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||||
@@ -1416,16 +1416,15 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= " AND t.subledger_account <> ''";
|
$sql .= " AND t.subledger_account <> ''";
|
||||||
$sql .= " GROUP BY t.numero_compte, t.subledger_account, t.subledger_label";
|
$sql .= " GROUP BY t.numero_compte, t.subledger_account, t.subledger_label";
|
||||||
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
||||||
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
|
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||||
} else {
|
} else {
|
||||||
$sql .= ' GROUP BY t.numero_compte';
|
$sql .= ' GROUP BY t.numero_compte';
|
||||||
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
|
$sortfield = 't.numero_compte'.($sortfield ? ','.$sortfield : '');
|
||||||
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
$sortorder = 'ASC'.($sortorder ? ','.$sortorder : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($sortfield)) {
|
$sql .= $this->db->order($sortfield, $sortorder);
|
||||||
$sql .= $this->db->order($sortfield, $sortorder);
|
|
||||||
}
|
|
||||||
if (!empty($limit)) {
|
if (!empty($limit)) {
|
||||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||||
}
|
}
|
||||||
@@ -1823,7 +1822,7 @@ class BookKeeping extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Call triggers
|
// Call triggers
|
||||||
if (! $error && ! $notrigger) {
|
if (!$notrigger) {
|
||||||
$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
|
$result = $this->call_trigger('BOOKKEEPING_DELETE', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
@@ -2296,14 +2295,12 @@ class BookKeeping extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($direction == 1) {
|
} elseif ($direction == 1) {
|
||||||
if (!$error) {
|
$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
||||||
$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity);
|
$resql = $this->db->query($sql);
|
||||||
$resql = $this->db->query($sql);
|
if (!$resql) {
|
||||||
if (!$resql) {
|
$error++;
|
||||||
$error++;
|
$this->errors[] = 'Error '.$this->db->lasterror();
|
||||||
$this->errors[] = 'Error '.$this->db->lasterror();
|
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
||||||
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -935,7 +935,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
|
|||||||
if (preg_match('/\{(jj+)\}/i', $mask, $regJournal)) {
|
if (preg_match('/\{(jj+)\}/i', $mask, $regJournal)) {
|
||||||
$journalcode = 'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ';
|
$journalcode = 'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ';
|
||||||
if (is_object($objbookkeeping)) {
|
if (is_object($objbookkeeping)) {
|
||||||
$journalcode = $objbookkeeping->code_journal;
|
$journalcode = (string) $objbookkeeping->code_journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
$maskjournal = $regJournal[1];
|
$maskjournal = $regJournal[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user