From 1d4962cf812aafdaddb87b2f8d806cb6613c4d4a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 15:57:16 +0200 Subject: [PATCH 01/13] fix scrutinizer --- htdocs/projet/class/project.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index fc0a52e4f62..c9fc3e8e35e 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1738,7 +1738,7 @@ class Project extends CommonObject $sql.= " AND pt.fk_projet = ".$this->id; $sql.= " AND (ptt.task_date >= '".$this->db->idate($datestart)."' "; $sql.= " AND ptt.task_date <= '".$this->db->idate(dol_time_plus_duree($datestart, 1, 'w') - 1)."')"; - if ($task_id) $sql.= " AND ptt.fk_task=".$taskid; + if ($taskid) $sql.= " AND ptt.fk_task=".$taskid; if (is_numeric($userid)) $sql.= " AND ptt.fk_user=".$userid; //print $sql; @@ -1794,7 +1794,7 @@ class Project extends CommonObject // For external user, no check is done on company because readability is managed by public status of project and assignement. //$socid=$user->societe_id; - if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1, $socid); + if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1); $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee"; $sql.= " FROM (".MAIN_DB_PREFIX."projet as p"; @@ -1804,7 +1804,7 @@ class Project extends CommonObject //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; $sql.= " WHERE p.fk_statut = 1"; $sql.= " AND p.entity IN (".getEntity('project').')'; - if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; + if (! empty($projectsListId)) $sql.= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; // For external user, no check is done on company permission because readability is managed by public status of project and assignement. From c5afc3131f81cf6dd0aa33d29df394282c8efb93 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 15:59:35 +0200 Subject: [PATCH 02/13] fix variable name --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c9fc3e8e35e..1694a3ff35e 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1660,7 +1660,7 @@ class Project extends CommonObject // phpcs:enable $sql="UPDATE ".MAIN_DB_PREFIX.$tableName; - if ($TableName=="actioncomm") + if ($tableName=="actioncomm") { $sql.= " SET fk_project=NULL"; $sql.= " WHERE id=".$elementSelectId; From d77de256ceaa71e9f815ddaf4ee2a69119a2fa01 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:01:02 +0200 Subject: [PATCH 03/13] fix scrutinizer --- htdocs/loan/class/loanschedule.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index f97a832239f..da871af0e26 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -48,13 +48,13 @@ class LoanSchedule extends CommonObject /** * @var string Create date */ - public $datec=''; - public $tms=''; + public $datec; + public $tms; /** * @var string Payment date */ - public $datep=''; + public $datep; public $amounts=array(); // Array of amounts public $amount_capital; // Total amount of payment From 18d7e15a230f1d3b638c85c68f8c85f7a1302d0a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:03:42 +0200 Subject: [PATCH 04/13] fix scrutinizer --- htdocs/loan/class/loanschedule.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index da871af0e26..e968daa69fe 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -275,17 +275,13 @@ class LoanSchedule extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_loan)) $this->fk_loan=trim($this->fk_loan); if (isset($this->amount_capital)) $this->amount_capital=trim($this->amount_capital); if (isset($this->amount_insurance)) $this->amount_insurance=trim($this->amount_insurance); if (isset($this->amount_interest)) $this->amount_interest=trim($this->amount_interest); - if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment); if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment); if (isset($this->note_private)) $this->note_private=trim($this->note_private); if (isset($this->note_public)) $this->note_public=trim($this->note_public); if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); - if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat); - if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif); // Check parameters // Put here code to add control on parameters values @@ -564,6 +560,9 @@ class LoanSchedule extends CommonObject */ public function paimenttorecord($loanid, $datemax) { + + $result=array(); + $sql = "SELECT p.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as p "; $sql.= " WHERE p.fk_loan = " . $loanid; From 45270786f9bb73b889ac8c5147224664445300e1 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:06:55 +0200 Subject: [PATCH 05/13] fix scrutinizer --- htdocs/expedition/class/expedition.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index c6870b64cac..a270af13217 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1145,9 +1145,10 @@ class Expedition extends CommonObject * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) * + * @param int $notrigger Disable triggers * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ - public function delete() + public function delete($notrigger = 0) { global $conf, $langs, $user; From 1cf38fa635f3248e41fbf3a510b168e5e7bab14e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:08:04 +0200 Subject: [PATCH 06/13] fix scrutinizer --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a709d502d93..f989f0bb431 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6227,6 +6227,7 @@ abstract class CommonObject $value=''; if (is_array($value_arr) && count($value_arr)>0) { + $toprint=array(); foreach ($value_arr as $keyval=>$valueval) { $toprint[]='
  • '.$param['options'][$valueval].'
  • '; } From 3927a74d6b7089b398218ec8d3d41e8a13baf455 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:30:22 +0200 Subject: [PATCH 07/13] fix scrunitizer --- htdocs/core/class/cstate.class.php | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 2487d87137f..3278eb037f9 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -247,25 +247,20 @@ class Cstate // extends CommonObject // } //} - // Commit or rollback - if ($error) - { - foreach($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); - } - $this->db->rollback(); - return -1*$error; - } - else - { - $this->db->commit(); - return 1; - } + // Commit or rollback + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return 1; + } } - /** * Delete object in database * From acad2e633be061910cfe0c3a48b031576c4d461e Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 16:34:32 +0200 Subject: [PATCH 08/13] fix scrutinzer --- htdocs/core/db/mysqli.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 2748a88cc98..98f2e5c5a1b 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -684,6 +684,7 @@ class DoliDBMysqli extends DoliDB // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql = "CREATE TABLE ".$table."("; $i=0; + $sqlfields=array(); foreach($fields as $field_name => $field_desc) { $sqlfields[$i] = $field_name." "; From f2171d466b4908e39dc10d5296829c7e258d5219 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 17:05:26 +0200 Subject: [PATCH 09/13] fix variable name --- .../modules/project/doc/doc_generic_project_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 2c217aec260..e682cfd9507 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -582,7 +582,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook - $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray); $reshook=$hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Open and load template From d98ce172adf64814c7efe25cb357d059a762797a Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 17:26:37 +0200 Subject: [PATCH 10/13] multicurrency:fix display error message on failed update --- htdocs/admin/multicurrency.php | 6 +++++- htdocs/multicurrency/class/multicurrency.class.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 31da8a68d2e..8fd6bb22c4d 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -91,7 +91,11 @@ elseif ($action == 'update_currency') { if ($currency->fetch($fk_multicurrency) > 0) { - $currency->updateRate($rate); + $result=$currency->updateRate($rate); + if ($result<0) { + setEventMessages(null,$currency->errors,'errors'); + } + } } } diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index a694b5396d7..6d0e948c4fb 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -417,6 +417,7 @@ class MultiCurrency extends CommonObject else { $this->rate = null; + $this->errors=$currencyRate->errors; return -1; } } From 21f6daae2a3be22c19aa7f558fb2753a40138251 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 5 Jun 2019 17:38:10 +0200 Subject: [PATCH 11/13] fix scrunitizer --- htdocs/accountancy/class/bookkeeping.class.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 3c985d325bc..b549a042bba 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -202,9 +202,6 @@ class BookKeeping extends CommonObject if (isset($this->sens)) { $this->sens = trim($this->sens); } - if (isset($this->fk_user_author)) { - $this->fk_user_author = trim($this->fk_user_author); - } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } @@ -522,9 +519,6 @@ class BookKeeping extends CommonObject if (isset($this->sens)) { $this->sens = trim($this->sens); } - if (isset($this->fk_user_author)) { - $this->fk_user_author = trim($this->fk_user_author); - } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } @@ -1139,9 +1133,6 @@ class BookKeeping extends CommonObject if (isset($this->sens)) { $this->sens = trim($this->sens); } - if (isset($this->fk_user_author)) { - $this->fk_user_author = trim($this->fk_user_author); - } if (isset($this->import_key)) { $this->import_key = trim($this->import_key); } From beb2a0131cf34b590bdb9dedd6feea09ea5e0aac Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 6 Jun 2019 16:11:12 +0200 Subject: [PATCH 12/13] fix travis --- htdocs/admin/multicurrency.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 8fd6bb22c4d..c8ba5b10505 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -93,9 +93,8 @@ elseif ($action == 'update_currency') { $result=$currency->updateRate($rate); if ($result<0) { - setEventMessages(null,$currency->errors,'errors'); + setEventMessages(null, $currency->errors, 'errors'); } - } } } From ed2d9435dbbbcb9fa49eac53bb3d94a2bba54f8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Jun 2019 15:21:15 +0200 Subject: [PATCH 13/13] Update project.class.php --- htdocs/projet/class/project.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1694a3ff35e..c762b7f65e7 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1794,6 +1794,7 @@ class Project extends CommonObject // For external user, no check is done on company because readability is managed by public status of project and assignement. //$socid=$user->societe_id; + $projectsListId = null; if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1); $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee";