Fix warnings
This commit is contained in:
parent
2fca5e928b
commit
b3dd51b790
@ -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();
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
136
htdocs/core/class/html.formexpensereport.class.php
Normal file
136
htdocs/core/class/html.formexpensereport.class.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
* 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 '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($useempty) print '<option value="-1"> </option>';
|
||||
$arrayoflabels = $tmpep->statuts;
|
||||
if ($useshortlabel) $arrayoflabels = $tmpep->statuts_short;
|
||||
foreach ($arrayoflabels as $key => $val)
|
||||
{
|
||||
if ($selected != '' && $selected == $key)
|
||||
{
|
||||
print '<option value="'.$key.'" selected>';
|
||||
} else {
|
||||
print '<option value="'.$key.'">';
|
||||
}
|
||||
print $langs->trans($val);
|
||||
print '</option>';
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($showempty)
|
||||
{
|
||||
$out .= '<option value="-1"';
|
||||
if ($selected == -1) $out .= ' selected';
|
||||
$out .= '> </option>';
|
||||
}
|
||||
|
||||
$sql = "SELECT c.id, c.code, c.label as type FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||
if ($active >= 0) $sql .= " WHERE c.active = ".$active;
|
||||
$sql .= " ORDER BY c.label ASC";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$out .= '<option value="'.$obj->id.'"';
|
||||
if ($obj->code == $selected || $obj->id == $selected) $out .= ' selected';
|
||||
$out .= '>';
|
||||
if ($obj->code != $langs->trans($obj->code)) $out .= $langs->trans($obj->code);
|
||||
else $out .= $langs->trans($obj->type);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
@ -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 '<td class="center">';
|
||||
print select_type_fees_id($line->fk_c_type_fees, 'fk_c_type_fees');
|
||||
print $formexpensereport->selectTypeExpenseReport($line->fk_c_type_fees, 'fk_c_type_fees');
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||
@ -2448,7 +2450,7 @@ if ($action == 'create')
|
||||
|
||||
// Select type
|
||||
print '<td class="center">';
|
||||
print select_type_fees_id($fk_c_type_fees, 'fk_c_type_fees', 1);
|
||||
print $formexpensereport->selectTypeExpenseReport($fk_c_type_fees, 'fk_c_type_fees', 1);
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
|
||||
|
||||
@ -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 '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($useempty) print '<option value="-1"> </option>';
|
||||
$arrayoflabels = $tmpep->statuts;
|
||||
if ($useshortlabel) $arrayoflabels = $tmpep->statuts_short;
|
||||
foreach ($arrayoflabels as $key => $val)
|
||||
{
|
||||
if ($selected != '' && $selected == $key)
|
||||
{
|
||||
print '<option value="'.$key.'" selected>';
|
||||
} else {
|
||||
print '<option value="'.$key.'">';
|
||||
}
|
||||
print $langs->trans($val);
|
||||
print '</option>';
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 .= '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
if ($showempty)
|
||||
{
|
||||
$out .= '<option value="-1"';
|
||||
if ($selected == -1) $out .= ' selected';
|
||||
$out .= '> </option>';
|
||||
}
|
||||
|
||||
$sql = "SELECT c.id, c.code, c.label as type FROM ".MAIN_DB_PREFIX."c_type_fees as c";
|
||||
if ($active >= 0) $sql .= " WHERE c.active = ".$active;
|
||||
$sql .= " ORDER BY c.label ASC";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$out .= '<option value="'.$obj->id.'"';
|
||||
if ($obj->code == $selected || $obj->id == $selected) $out .= ' selected';
|
||||
$out .= '>';
|
||||
if ($obj->code != $langs->trans($obj->code)) $out .= $langs->trans($obj->code);
|
||||
else $out .= $langs->trans($obj->type);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -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 '<td class="liste_titre right">';
|
||||
select_expensereport_statut($search_status, 'search_status', 1, 1);
|
||||
$formexpensereport->selectExpensereportStatus($search_status, 'search_status', 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
|
||||
@ -1081,7 +1081,7 @@ if ($step == 4 && $datatoexport)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -593,7 +593,7 @@ function createProductOrService($authentication, $product)
|
||||
|
||||
if ($savstockreal != $getstockreal)
|
||||
{
|
||||
$warehouse = new Entrepot($this->db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch(0, $product['warehouse_ref']);
|
||||
if ($warehouse->id > 0)
|
||||
{
|
||||
@ -762,7 +762,7 @@ function updateProductOrService($authentication, $product)
|
||||
|
||||
if ($savstockreal != $getstockreal)
|
||||
{
|
||||
$warehouse = new Entrepot($this->db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch(0, $product['warehouse_ref']);
|
||||
if ($warehouse->id > 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user