';
/*
if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid)))
diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php
index 8c2476b973946..9c28468c1c74f 100644
--- a/htdocs/comm/action/class/cactioncomm.class.php
+++ b/htdocs/comm/action/class/cactioncomm.class.php
@@ -82,7 +82,7 @@ class CActionComm
public $picto;
/**
- * @var array array of type_actions
+ * @var array array of type_actions // TODO: Remove or explain
*/
public $type_actions = array();
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index b1b37b1661d86..8eb19ae19cd74 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -6,6 +6,7 @@
* Copyright (C) 2005 Simon TOSSER
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -278,7 +279,7 @@
$listofuserid = array();
if (empty($donotclearsession)) {
if ($object->userownerid > 0) {
- $listofuserid[$object->userownerid] = array('id'=>$object->userownerid, 'transparency'=>$object->transparency); // Owner first
+ $listofuserid[$object->userownerid] = array('id' => $object->userownerid, 'transparency' => $object->transparency); // Owner first
}
if (!empty($object->userassigned)) { // Now concat assigned users
// Restore array with key with same value than param 'id'
@@ -298,7 +299,7 @@
$listofcontactid = array(); // not used yet
$listofotherid = array(); // not used yet
print '
';
@@ -606,7 +612,7 @@ function setPaymentType()
$morehtmlref = '
';
// Project
- if (isModEnabled('project')) {
+ if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
//$morehtmlref .= ' ';
if ($permissiontoadd) {
diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php
index 9c5798c4a3d87..be2f81dc20ff2 100644
--- a/htdocs/contrat/index.php
+++ b/htdocs/contrat/index.php
@@ -334,7 +334,7 @@
$sql .= " sum(".$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".$db->idate($now - $conf->contrat->services->expires->warning_delay)."')", 1, 0).') as nb_late,';
$sql .= " sum(".$db->ifsql("cd.statut=5", 1, 0).') as nb_closed,';
$sql .= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut,";
-$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
+$sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,";
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
@@ -351,7 +351,7 @@
$sql .= " AND s.rowid = ".((int) $socid);
}
$sql .= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.statut,";
-$sql .= " s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
+$sql .= " s.nom, s.name_alias, s.logo, s.rowid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
$sql .= " ORDER BY c.tms DESC";
$sql .= $db->plimit($max);
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 4f8b20293f184..482e6af0088aa 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -769,7 +769,8 @@ function(response) {
$formcontract = new FormContract($this->db);
print '
';
print img_picto('', 'contract', 'class="pictofixedwidth"');
- print $formcontract->select_contract(-1, GETPOSTINT('contactid'), 'contractid', 0, 1, 1, 1);
+ // socid is for internal users null and not 0 or -1
+ print $formcontract->select_contract($user->socid ?? -1, GETPOSTINT('contactid'), 'contractid', 0, 1, 1, 1);
print '
';
}
}
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index 8aa20523f7de8..e45bd655ef3f6 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -449,4 +449,20 @@ public function getSqlArrayForStats()
dol_syslog($msg, LOG_ERR);
return array();
}
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Add destinations in the targets table
+ *
+ * @param int $mailing_id Id of emailing
+ * @return int Return integer < 0 on error, count of added when ok
+ */
+ public function add_to_target($mailing_id)
+ {
+ // phpcs:enable
+ // Needs to be implemented in child class
+ $msg = get_class($this)."::".__FUNCTION__." not implemented";
+ dol_syslog($msg, LOG_ERR);
+ return -1;
+ }
}
diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php
index a498ab0cf67f2..6df9d1ec060b0 100644
--- a/htdocs/opensurvey/wizard/create_survey.php
+++ b/htdocs/opensurvey/wizard/create_survey.php
@@ -3,6 +3,7 @@
* Copyright (C) 2014 Marcos García
* Copyright (C) 2015-2016 Alexandre Spangaro
* Copyright (C) 2018-2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* 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
@@ -90,9 +91,9 @@
}
$testdate = false;
- $champdatefin = dol_mktime(23, 59, 59, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear'));
+ $champdatefin = (int) dol_mktime(23, 59, 59, GETPOSTINT('champdatefinmonth'), GETPOSTINT('champdatefinday'), GETPOSTINT('champdatefinyear'));
- if (! $error && $champdatefin && ($champdatefin > 0)) { // A date was provided
+ if ($champdatefin > 0) { // A date was provided, $error still 0 here
// Expire date is not before today
if ($champdatefin >= dol_now()) {
$testdate = true;