diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php
index 92373d7c01e..31e0f896633 100644
--- a/htdocs/admin/menus/edit.php
+++ b/htdocs/admin/menus/edit.php
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$langs->loadLangs(array("other", "admin"));
$cancel = GETPOST('cancel', 'alphanohtml'); // We click on a Cancel button
+$confirm = GETPOST('confirm');
if (!$user->admin) accessforbidden();
@@ -231,7 +232,7 @@ if ($action == 'add')
}
// delete
-if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
+if ($action == 'confirm_delete' && $confirm == 'yes')
{
$db->begin();
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 842a41c1a46..a5084bfac74 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1160,32 +1160,32 @@ class ActionComm extends CommonObject
$sql .= " element_type = 'socpeople' AND fk_element = ".$fk_element.')';
}
else {
- $sql .= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$this->db->escape($elementtype)."'";
+ $sql .= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$db->escape($elementtype)."'";
}
}
if (!empty($filter)) $sql .= $filter;
- if ($sortorder && $sortfield) $sql .= $this->db->order($sortfield, $sortorder);
- $sql .= $this->db->plimit($limit, 0);
+ if ($sortorder && $sortfield) $sql .= $db->order($sortfield, $sortorder);
+ $sql .= $db->plimit($limit, 0);
- $resql = $this->db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $num = $this->db->num_rows($resql);
+ $num = $db->num_rows($resql);
if ($num)
{
for ($i = 0; $i < $num; $i++)
{
- $obj = $this->db->fetch_object($resql);
- $actioncommstatic = new ActionComm($this->db);
+ $obj = $db->fetch_object($resql);
+ $actioncommstatic = new ActionComm($db);
$actioncommstatic->fetch($obj->id);
$resarray[$i] = $actioncommstatic;
}
}
- $this->db->free($resql);
+ $db->free($resql);
return $resarray;
} else {
- return $this->db->lasterror();
+ return $db->lasterror();
}
}
diff --git a/htdocs/core/class/html.formexpensereport.class.php b/htdocs/core/class/html.formexpensereport.class.php
new file mode 100644
index 00000000000..e8079b77ed6
--- /dev/null
+++ b/htdocs/core/class/html.formexpensereport.class.php
@@ -0,0 +1,136 @@
+
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/class/html.formexpensereport.class.php
+ * \ingroup core
+ * \brief File of class with all html predefined components
+ */
+
+/**
+ * Class to manage generation of HTML components for contract module
+ */
+class FormExpenseReport
+{
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db = $db;
+ }
+
+
+ /**
+ * Retourne la liste deroulante des differents etats d'une note de frais.
+ * Les valeurs de la liste sont les id de la table c_expensereport_statuts
+ *
+ * @param int $selected preselect status
+ * @param string $htmlname Name of HTML select
+ * @param int $useempty 1=Add empty line
+ * @param int $useshortlabel Use short labels
+ * @return string HTML select with status
+ */
+ public function selectExpensereportStatus($selected = '', $htmlname = 'fk_statut', $useempty = 1, $useshortlabel = 0)
+ {
+ global $langs;
+
+ $tmpep = new ExpenseReport($this->db);
+
+ print '';
+ }
+
+ /**
+ * Return list of types of notes with select value = id
+ *
+ * @param int $selected Preselected type
+ * @param string $htmlname Name of field in form
+ * @param int $showempty Add an empty field
+ * @param int $active 1=Active only, 0=Unactive only, -1=All
+ * @return string Select html
+ */
+ public function selectTypeExpenseReport($selected = '', $htmlname = 'type', $showempty = 0, $active = 1)
+ {
+ // phpcs:enable
+ global $langs, $user;
+ $langs->load("trips");
+
+ $out = '';
+
+ $out .= '';
+ $out .= ajax_combobox($htmlname);
+
+ return $out;
+ }
+}
diff --git a/htdocs/core/class/link.class.php b/htdocs/core/class/link.class.php
index ceba7fa17f7..9d70458a198 100644
--- a/htdocs/core/class/link.class.php
+++ b/htdocs/core/class/link.class.php
@@ -286,7 +286,7 @@ class Link extends CommonObject
global $conf;
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
- $sql .= " WHERE objecttype = '".$this->db->escape($objecttype)."' AND objectid = ".$objectid;
+ $sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".$objectid;
if ($conf->entity != 0) $sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 77960bf2ed8..fa2e30ed31d 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -27,10 +27,11 @@
*/
require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@@ -1362,6 +1363,7 @@ $projecttmp = new Project($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$bankaccountstatic = new Account($db);
$ecmfilesstatic = new EcmFiles($db);
+$formexpensereport = new FormExpenseReport($db);
// Create
if ($action == 'create')
@@ -2289,7 +2291,7 @@ if ($action == 'create')
// Select type
print '
';
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 610e749da16..b06e34eb92a 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -2724,88 +2724,3 @@ class ExpenseReportLine
}
}
}
-
-
-/**
- * Retourne la liste deroulante des differents etats d'une note de frais.
- * Les valeurs de la liste sont les id de la table c_expensereport_statuts
- *
- * @param int $selected preselect status
- * @param string $htmlname Name of HTML select
- * @param int $useempty 1=Add empty line
- * @param int $useshortlabel Use short labels
- * @return string HTML select with status
- */
-function select_expensereport_statut($selected = '', $htmlname = 'fk_statut', $useempty = 1, $useshortlabel = 0)
-{
- global $db, $langs;
-
- $tmpep = new ExpenseReport($this->db);
-
- print '';
-}
-
-/**
- * Return list of types of notes with select value = id
- *
- * @param int $selected Preselected type
- * @param string $htmlname Name of field in form
- * @param int $showempty Add an empty field
- * @param int $active 1=Active only, 0=Unactive only, -1=All
- * @return string Select html
- */
-function select_type_fees_id($selected = '', $htmlname = 'type', $showempty = 0, $active = 1)
-{
- global $db, $langs, $user;
- $langs->load("trips");
-
- $out = '';
-
- $out .= '';
- $out .= ajax_combobox($htmlname);
-
- return $out;
-}
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index dd8c49aae28..bfc5ed64f5e 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formexpensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
@@ -251,6 +252,7 @@ if (empty($reshook))
$form = new Form($db);
$formother = new FormOther($db);
$formfile = new FormFile($db);
+$formexpensereport = new FormExpenseReport($db);
$fuser = new User($db);
@@ -599,7 +601,7 @@ if ($resql)
if (!empty($arrayfields['d.fk_statut']['checked']))
{
print '