Skip to content

Commit

Permalink
fix sql ticket list (Dolibarr#32080)
Browse files Browse the repository at this point in the history
* fix sql ticket list

* fix sql ticket list

* fix phpstan

* fix

* fix
  • Loading branch information
frederic34 authored Nov 28, 2024
1 parent 76d4a87 commit 286c3d1
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 216 deletions.
102 changes: 0 additions & 102 deletions build/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ parameters:
count: 4
path: ../../htdocs/accountancy/bookkeeping/export.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../htdocs/accountancy/bookkeeping/list.php

-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
Expand All @@ -252,12 +246,6 @@ parameters:
count: 3
path: ../../htdocs/accountancy/bookkeeping/list.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../htdocs/accountancy/bookkeeping/listbyaccount.php

-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
Expand Down Expand Up @@ -4572,12 +4560,6 @@ parameters:
count: 1
path: ../../htdocs/comm/propal/class/propal.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/comm/propal/class/propal.class.php

-
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -4974,12 +4956,6 @@ parameters:
count: 1
path: ../../htdocs/commande/class/commande.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/commande/class/commande.class.php

-
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -6174,12 +6150,6 @@ parameters:
count: 1
path: ../../htdocs/compta/facture/class/facture.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 3
path: ../../htdocs/compta/facture/class/facture.class.php

-
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -19368,12 +19338,6 @@ parameters:
count: 2
path: ../../htdocs/expedition/class/expedition.class.php

-
message: '#^Property Expedition\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/expedition/class/expedition.class.php

-
message: '#^Property Expedition\:\:\$ref_customer \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -20742,12 +20706,6 @@ parameters:
count: 1
path: ../../htdocs/fourn/class/fournisseur.commande.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/fourn/class/fournisseur.commande.class.php

-
message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -20982,12 +20940,6 @@ parameters:
count: 1
path: ../../htdocs/fourn/class/fournisseur.facture.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/fourn/class/fournisseur.facture.class.php

-
message: '#^Property CommonObject\:\:\$ref_ext \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -28758,12 +28710,6 @@ parameters:
count: 1
path: ../../htdocs/projet/list.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../htdocs/projet/list.php

-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
Expand Down Expand Up @@ -30654,12 +30600,6 @@ parameters:
count: 2
path: ../../htdocs/reception/class/reception.class.php

-
message: '#^Property Reception\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/reception/class/reception.class.php

-
message: '#^Property Reception\:\:\$ref_supplier \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -31914,12 +31854,6 @@ parameters:
count: 2
path: ../../htdocs/salaries/payments.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../htdocs/salaries/payments.php

-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
Expand Down Expand Up @@ -32334,12 +32268,6 @@ parameters:
count: 1
path: ../../htdocs/societe/class/companybankaccount.class.php

-
message: '#^Property CompanyBankAccount\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/societe/class/companybankaccount.class.php

-
message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
Expand Down Expand Up @@ -33738,18 +33666,6 @@ parameters:
count: 1
path: ../../htdocs/ticket/class/ticket.class.php

-
message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 1
path: ../../htdocs/ticket/class/ticket.class.php

-
message: '#^Property CommonObject\:\:\$model_pdf \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
count: 2
path: ../../htdocs/ticket/class/ticket.class.php

-
message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
Expand Down Expand Up @@ -33960,18 +33876,6 @@ parameters:
count: 1
path: ../../htdocs/ticket/index.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 3
path: ../../htdocs/ticket/list.php

-
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
identifier: empty.variable
count: 1
path: ../../htdocs/ticket/list.php

-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
Expand Down Expand Up @@ -34320,12 +34224,6 @@ parameters:
count: 2
path: ../../htdocs/user/home.php

-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 2
path: ../../htdocs/user/list.php

-
message: '#^Offset ''u\.salary'' on array\{u\.salary\: \(float\|int\)\} in isset\(\) always exists and is not nullable\.$#'
identifier: isset.offset
Expand Down
2 changes: 2 additions & 0 deletions htdocs/accountancy/bookkeeping/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->hasRight('societe', 'creer');
$uploaddir = $conf->societe->dir_output;

global $error;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
Expand Down
2 changes: 2 additions & 0 deletions htdocs/accountancy/bookkeeping/listbyaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->hasRight('societe', 'creer');
$uploaddir = $conf->societe->dir_output;

global $error;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
Expand Down
1 change: 1 addition & 0 deletions htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ public function create($user, $notrigger = 0)
$this->fk_multicurrency = 0;
$this->multicurrency_tx = 1;
}
// setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active
$this->entity = setEntity($this);

dol_syslog(get_class($this)."::create user=".$user->id);
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/actions_massactions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
* @var string $objectclass
* @var string $uploaddir
* @var string $confirm
* @var int $error
*/
'
@phan-var-force ?string $permissiontoread
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ abstract class CommonObject
public $multicurrency_total_localtax2; // not in database

/**
* @var string
* @var ?string
* @see SetDocModel()
*/
public $model_pdf;
Expand Down
5 changes: 0 additions & 5 deletions htdocs/expedition/class/expedition.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ class Expedition extends CommonObject
*/
public $billed;

/**
* @var string name of pdf model
*/
public $model_pdf;

/**
* @var int|string
*/
Expand Down
2 changes: 2 additions & 0 deletions htdocs/projet/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@
$permissiontodelete = $user->hasRight('projet', 'supprimer');
$permissiontoadd = $user->hasRight('projet', 'creer');
$uploaddir = $conf->project->dir_output;

global $error;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

// Close records
Expand Down
4 changes: 0 additions & 4 deletions htdocs/reception/class/reception.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ class Reception extends CommonObject
* @var int<0,1>
*/
public $billed;
/**
* @var string
*/
public $model_pdf;

/**
* @var int|float
Expand Down
2 changes: 2 additions & 0 deletions htdocs/salaries/payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@
$objectclass = 'PaymentSalary';
$objectlabel = 'SalariesPayments';
$uploaddir = $conf->salaries->dir_output;

global $error;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

// Validate records
Expand Down
6 changes: 0 additions & 6 deletions htdocs/societe/class/companybankaccount.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ class CompanyBankAccount extends Account
*/
public $datem;

/**
* @var string
* @see SetDocModel()
*/
public $model_pdf;

/**
* @var string TRIGGER_PREFIX Dolibarr 16.0 and above use the prefix to prevent the creation of inconsistently
* named triggers
Expand Down
4 changes: 3 additions & 1 deletion htdocs/societe/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,11 @@
$permissiontodelete = $user->hasRight('societe', 'supprimer');
$permissiontoadd = $user->hasRight("societe", "creer");
$uploaddir = $conf->societe->dir_output;

global $error;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';

if ($action == 'setstcomm' && $permissiontoadd) {
if (!$error && $action == 'setstcomm' && $permissiontoadd) {
$object = new Client($db);
$result = $object->fetch(GETPOST('stcommsocid'));
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm');
Expand Down
3 changes: 2 additions & 1 deletion htdocs/ticket/class/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ public function create($user, $notrigger = 0)
$result = $this->verify();

if ($result >= 0) {
$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
// setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active
$this->entity = setEntity($this);

// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."ticket(";
Expand Down
Loading

0 comments on commit 286c3d1

Please sign in to comment.