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);
}
diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php
index 31da8a68d2e..c8ba5b10505 100644
--- a/htdocs/admin/multicurrency.php
+++ b/htdocs/admin/multicurrency.php
@@ -91,7 +91,10 @@ 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/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].'';
}
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
*
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." ";
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
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;
diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php
index f97a832239f..e968daa69fe 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
@@ -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;
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;
}
}
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index fc0a52e4f62..c762b7f65e7 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;
@@ -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,8 @@ 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);
+ $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";
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
@@ -1804,7 +1805,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.