Merge branch 'develop' into develop#3

This commit is contained in:
Hystepik 2021-03-31 12:21:28 +02:00 committed by GitHub
commit 69c47f1d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
199 changed files with 1326 additions and 607 deletions

View File

@ -77,8 +77,8 @@ contact@dolibarr.org
## 10. License and attribution
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/).
This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](https://creativecommons.org/licenses/by-sa/3.0/).
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](https://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy).
Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/)
Retrieved on November 22, 2016 from [https://citizencodeofconduct.org/](http://citizencodeofconduct.org/)

View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@ -218,7 +218,7 @@ if ($db->type == 'pgsql') {
} else {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = aa.account_parent AND a2.entity = ".$conf->entity;
}
$sql .= " WHERE asy.rowid = ".$pcgver;
$sql .= " WHERE asy.rowid = ".((int) $pcgver);
//print $sql;
if (strlen(trim($search_account))) {
$lengthpaddingaccount = 0;

View File

@ -149,7 +149,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {
// Check that all fields are filled
$ok = 1;
foreach ($listfield as $f => $value) {
if ($value == 'formula' && empty($_POST['formula'])) {
if ($value == 'formula' && !GETPOST('formula')) {
continue;
}
if ($value == 'range_account' && empty($_POST['range_account'])) {

View File

@ -520,7 +520,7 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_export = '".$db->idate($now)."'";
$sql .= " , date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
$sql .= " WHERE rowid = ".((int) $movement->id);
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);

View File

@ -428,7 +428,7 @@ class AccountancyCategory // extends CommonObject
global $conf;
$sql = "SELECT t.rowid, t.account_number, t.label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$id;
$sql .= " WHERE t.fk_accounting_category = ".((int) $id);
$sql .= " AND t.entity = ".$conf->entity;
$this->lines_display = array();
@ -863,7 +863,7 @@ class AccountancyCategory // extends CommonObject
if (!empty($cat_id)) {
$sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " WHERE t.fk_accounting_category = ".((int) $cat_id);
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number";
} else {

View File

@ -1644,7 +1644,7 @@ class AccountancyExport
// Get new customer invoice ref and company name
$sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid';
$sql .= ' WHERE f.rowid = ' . $line->fk_doc;
$sql .= ' WHERE f.rowid = '.((int) $line->fk_doc);
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
@ -1658,7 +1658,7 @@ class AccountancyExport
// Get new supplier invoice ref and company name
$sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff';
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid';
$sql .= ' WHERE ff.rowid = ' . $line->fk_doc;
$sql .= ' WHERE ff.rowid = '.((int) $line->fk_doc);
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {

View File

@ -91,9 +91,9 @@ if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting-
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".$movement->id;
$sql .= " AND doc_date >= '" . dol_print_date($date_start, 'dayrfc') . "'";
$sql .= " AND doc_date <= '" . dol_print_date($date_end, 'dayrfc') . "'";
$sql .= " WHERE rowid = ".((int) $movement->id);
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated sql=".$sql, LOG_DEBUG);
$result = $db->query($sql);

View File

@ -208,7 +208,7 @@ if ($action == 'validatehistory') {
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
$resqlupdate = $db->query($sqlupdate);
if (!$resqlupdate) {

View File

@ -154,7 +154,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
$sql .= " SET fk_code_ventilation = ".((int) $monCompte);
$sql .= " WHERE rowid = ".$monId;
$sql .= " WHERE rowid = ".((int) $monId);
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '', 1);

View File

@ -421,7 +421,7 @@ if ($result) {
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);

View File

@ -194,7 +194,7 @@ if ($action == 'validatehistory') {
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $objp->aarowid_suggest);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $objp->rowid);
$resqlupdate = $db->query($sqlupdate);
if (!$resqlupdate) {

View File

@ -178,7 +178,7 @@ if ($massaction == 'ventil') {
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " SET fk_code_ventilation = ".((int) $monCompte);
$sql .= " WHERE rowid = ".$monId;
$sql .= " WHERE rowid = ".((int) $monId);
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '', 1);

View File

@ -273,7 +273,7 @@ abstract class ActionsAdherentCardCommon
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id) {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".((int) $this->object->country_id);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);

View File

@ -692,7 +692,7 @@ class Adherent extends CommonObject
$sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
}
$sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
// If we change the type of membership, we set also label of new type
if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) {
@ -964,7 +964,7 @@ class Adherent extends CommonObject
}
// Remove category
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@ -975,7 +975,7 @@ class Adherent extends CommonObject
// Remove subscription
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@ -1007,7 +1007,7 @@ class Adherent extends CommonObject
// Remove adherent
if (!$error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
@ -1154,7 +1154,7 @@ class Adherent extends CommonObject
// Set link to user
if ($userid > 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".((int) $this->id);
$sql .= " WHERE rowid = ".$userid;
$sql .= " WHERE rowid = ".((int) $userid);
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {

View File

@ -425,7 +425,7 @@ class AdherentType extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -72,7 +72,7 @@ class AdherentStats extends Stats
$this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($this->memberid) {
$this->where .= " AND m.rowid = ".$this->memberid;
$this->where .= " AND m.rowid = ".((int) $this->memberid);
}
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
}

View File

@ -15,8 +15,8 @@
* 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 <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* or see https://www.gnu.org/
*/
/**

View File

@ -93,7 +93,7 @@ if ($action == 'add') {
$arrayofexistingboxid = array();
$nbboxonleft = $nbboxonright = 0;
$sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
$sql .= " WHERE position = ".((int) $pos)." AND fk_user = ".((int) $fk_user)." AND entity = ".((int) $conf->entity);
dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {

View File

@ -7,7 +7,7 @@
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* https://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
@ -16,11 +16,11 @@
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
* needs please refer to https://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
* PrestaShop Webservice Library
* @package PrestaShopWebservice

View File

@ -140,7 +140,7 @@ if (GETPOST("delete")) {
$resql = $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE rowid = ".$obj->rowid;
$sql .= " WHERE rowid = ".((int) $obj->rowid);
$resql = $db->query($sql);
if (!$resql) {

View File

@ -162,13 +162,13 @@ if ($action == 'up') {
}
$sql = "UPDATE ".MAIN_DB_PREFIX."menu as m";
$sql .= " SET m.position = ".($current['order'] != $next['order'] ? $next['order'] : $current['order'] + 1); // Down the selected entry
$sql .= " WHERE m.rowid = ".$current['rowid'];
$sql .= " SET m.position = ".((int) ($current['order'] != $next['order'] ? $next['order'] : $current['order'] + 1)); // Down the selected entry
$sql .= " WHERE m.rowid = ".((int) $current['rowid']);
dol_syslog("admin/menus/index.php ".$sql);
$db->query($sql);
$sql = "UPDATE ".MAIN_DB_PREFIX."menu as m"; // Up the next entry
$sql .= " SET m.position = ".$current['order'];
$sql .= " WHERE m.rowid = ".$next['rowid'];
$sql .= " SET m.position = ".((int) $current['order']);
$sql .= " WHERE m.rowid = ".((int) $next['rowid']);
dol_syslog("admin/menus/index.php ".$sql);
$db->query($sql);
} elseif ($action == 'confirm_delete' && $confirm == 'yes') {

View File

@ -156,7 +156,7 @@ asort($listofmethods);
if (!count($listofmethods)) {
$descnosms = $langs->trans("NoSmsEngine", '{Dolistore}');
$descnosms = str_replace('{Dolistore}', '<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>', $descnosms);
$descnosms = str_replace('{Dolistore}', '<a href="https://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>', $descnosms);
print '<div class="warning">'.$descnosms.'</div>';
}

View File

@ -673,6 +673,17 @@ if (!empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
print "</td>\n";
print "</tr>\n";
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseOnThirparty").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('SOCIETE_ASK_FOR_WAREHOUSE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAskWarehouseDuringPropal").'</td>';
print '<td class="right">';

View File

@ -168,7 +168,7 @@ if ($action == 'add') {
// Delete line from delete picto
if ($action == 'delete') {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".$db->escape($id);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".((int) $id);
$result = $db->query($sql);
if ($result >= 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');

View File

@ -73,7 +73,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, libelle as label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -136,7 +136,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_input_reason as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -539,7 +539,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_availability as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -648,7 +648,7 @@ class Setup extends DolibarrApi
$sql = "SELECT id, code, type, libelle as label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
if ($type) {
$sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'";
}
@ -714,7 +714,7 @@ class Setup extends DolibarrApi
$sql = "SELECT id, code, label, accountancy_code, active, module, position";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
if ($module) {
$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
}
@ -778,7 +778,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, element as type, libelle as label, source, module, position";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
if ($type) {
$sql .= " AND type LIKE '%".$this->db->escape($type)."%'";
}
@ -843,7 +843,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, label, module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_civility as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
if ($module) {
$sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
}
@ -911,7 +911,7 @@ class Setup extends DolibarrApi
$sql .= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso";
$sql .= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)";
}
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
if (!empty($multicurrency)) {
$sql .= " AND m.entity IN (".getEntity('multicurrency').")";
if (!empty($multicurrency) && $multicurrency != 2) {
@ -1242,7 +1242,7 @@ class Setup extends DolibarrApi
//TODO link with multicurrency module
$sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_units as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -1365,7 +1365,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, pos, label, use_default, description";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {
@ -1423,7 +1423,7 @@ class Setup extends DolibarrApi
$sql = "SELECT rowid, code, pos, label, use_default, color, description";
$sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t";
$sql .= " WHERE t.active = ".$active;
$sql .= " WHERE t.active = ".((int) $active);
// Add sql filters
if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) {

View File

@ -238,7 +238,7 @@ class AssetType extends CommonObject
$error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_type";
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -869,7 +869,7 @@ class Categorie extends CommonObject
public function containsObject($type, $object_id)
{
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]);
$sql .= " WHERE fk_categorie = ".$this->id." AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".$object_id;
$sql .= " WHERE fk_categorie = ".$this->id." AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".((int) $object_id);
dol_syslog(get_class($this)."::containsObject", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -1367,7 +1367,7 @@ class ActionComm extends CommonObject
$sql .= ' fk_user_author,';
$sql .= ' fk_user_mod';
$sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
$sql .= ' WHERE a.id = '.$id;
$sql .= ' WHERE a.id = '.((int) $id);
dol_syslog(get_class($this)."::info", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -149,7 +149,7 @@ if (empty($reshook)) {
// or sent in error (statut=-1)
$sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id;
$sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $object->id);
$sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1
dol_syslog("card.php: select targets", LOG_DEBUG);

View File

@ -284,9 +284,9 @@ class AdvanceTargetingMailing extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
if (!empty($id)) {
$sql .= " WHERE t.fk_element = ".$id." AND type_element='mailing'";
$sql .= " WHERE t.fk_element = ".((int) $id)." AND type_element = 'mailing'";
} else {
$sql .= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'";
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = 'mailing'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
@ -347,9 +347,9 @@ class AdvanceTargetingMailing extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t";
if (!empty($id)) {
$sql .= " WHERE t.fk_element = ".$id." AND type_element='$type_element'";
$sql .= " WHERE t.fk_element = ".((int) $id)." AND type_element = '".$this->db->escape($type_element)."'";
} else {
$sql .= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'";
$sql .= " WHERE t.fk_element = ".((int) $this->fk_element)." AND type_element = '".$this->db->escape($type_element)."'";
}
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);

View File

@ -427,7 +427,7 @@ class Mailing extends CommonObject
$sql .= " source_id ,";
$sql .= " source_type";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " WHERE fk_mailing = ".$fromid;
$sql .= " WHERE fk_mailing = ".((int) $fromid);
$result = $this->db->query($sql);
if ($result) {
@ -499,7 +499,7 @@ class Mailing extends CommonObject
public function delete($rowid)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
$sql .= " WHERE rowid = ".$rowid;
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog("Mailing::delete", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -644,7 +644,7 @@ if (empty($reshook)) {
if ($object->statut == $object::STATUS_VALIDATED) {
$db->begin();
$result = $object->cloture($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml'));
$result = $object->signature($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;

View File

@ -140,6 +140,16 @@ class Propal extends CommonObject
*/
public $date_validation;
/**
* @var integer|string $date_signature;
*/
public $date_signature;
/**
* @var User $user_signature
*/
public $user_signature;
/**
* @var integer|string date of the quote;
*/
@ -2491,6 +2501,97 @@ class Propal extends CommonObject
}
}
/**
* Sign the commercial proposal
*
* @param User $user Object user that close
* @param int $statut Status
* @param string $note Complete private note with this note
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK
*/
public function signature($user, $statut, $note = '', $notrigger = 0)
{
global $langs,$conf;
$error = 0;
$now = dol_now();
$this->db->begin();
$newprivatenote = dol_concatdesc($this->note_private, $note);
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($newprivatenote)."', date_signature='".$this->db->idate($now)."', fk_user_signature=".$user->id;
$sql .= " WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);
if ($resql) {
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf;
$trigger_name = 'PROPAL_CLOSE_REFUSED';
if ($statut == self::STATUS_SIGNED) {
$trigger_name = 'PROPAL_CLOSE_SIGNED';
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->model_pdf;
// The connected company is classified as a client
$soc=new Societe($this->db);
$soc->id = $this->socid;
$result = $soc->set_as_client();
if ($result < 0) {
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language
$outputlangs = $langs;
if (!empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id', 'aZ09') ? GETPOST('lang_id', 'aZ09') : $this->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang);
}
//$ret=$object->fetch($id); // Reload to get new records
$this->generateDocument($modelpdf, $outputlangs);
}
if (!$error) {
$this->oldcopy= clone $this;
$this->statut = $statut;
$this->date_signature = $now;
$this->note_private = $newprivatenote;
}
if (!$notrigger && empty($error)) {
// Call trigger
$result=$this->call_trigger($trigger_name, $user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (!$error ) {
$this->db->commit();
return 1;
} else {
$this->statut = $this->oldcopy->statut;
$this->date_signature = $this->oldcopy->date_signature;
$this->note_private = $this->oldcopy->note_private;
$this->db->rollback();
return -1;
}
} else {
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
}
/**
* Close the commercial proposal
@ -2886,7 +2987,7 @@ class Propal extends CommonObject
// Delete extrafields of lines and lines
if (!$error && !empty($this->table_element_line)) {
$tabletodelete = $this->table_element_line;
$sqlef = "DELETE FROM ".MAIN_DB_PREFIX.$tabletodelete."_extrafields WHERE fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX.$tabletodelete." WHERE ".$this->fk_element." = ".$this->id.")";
$sqlef = "DELETE FROM ".MAIN_DB_PREFIX.$tabletodelete."_extrafields WHERE fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX.$tabletodelete." WHERE ".$this->fk_element." = ".((int) $this->id).")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabletodelete." WHERE ".$this->fk_element." = ".$this->id;
if (!$this->db->query($sqlef) || !$this->db->query($sql)) {
$error++;
@ -3115,8 +3216,8 @@ class Propal extends CommonObject
public function info($id)
{
$sql = "SELECT c.rowid, ";
$sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
$sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture as dateo,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
$sql .= " WHERE c.rowid = ".((int) $id);
@ -3130,6 +3231,7 @@ class Propal extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_signature = $this->db->jdate($obj->date_signature);
$this->date_cloture = $this->db->jdate($obj->dateo);
$cuser = new User($this->db);
@ -3142,6 +3244,12 @@ class Propal extends CommonObject
$this->user_validation = $vuser;
}
if ($obj->fk_user_signature) {
$user_signature = new User($this->db);
$user_signature->fetch($obj->fk_user_signature);
$this->user_signature = $user_signature;
}
if ($obj->fk_user_cloture) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);

View File

@ -100,18 +100,18 @@ class PropaleStats extends Stats
$this->where .= " AND p.fk_soc = ".$this->socid;
}
if ($this->userid > 0) {
$this->where .= ' AND fk_user_author = '.$this->userid;
$this->where .= ' AND fk_user_author = '.((int) $this->userid);
}
if ($typentid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc';
$this->where .= ' AND s.fk_typent = '.$typentid;
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
}
if ($categid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = p.fk_soc';
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie';
$this->where .= ' AND c.rowid = '.$categid;
$this->where .= ' AND c.rowid = '.((int) $categid);
}
}

View File

@ -423,7 +423,7 @@ if (empty($reshook)) {
$originidforcontact=$srcobject->origin_id;
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$db->escape($originforcontact)."'";
$sqlcontact.= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$db->escape($originforcontact)."'";
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)

View File

@ -1113,7 +1113,7 @@ class Commande extends CommonOrder
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$sqlcontact .= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact) {
@ -2331,7 +2331,7 @@ class Commande extends CommonOrder
$sql = "SELECT fk_product, qty";
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet";
$sql .= " WHERE rowid = ".$lineid;
$sql .= " WHERE rowid = ".((int) $lineid);
$result = $this->db->query($sql);
if ($result) {
@ -2417,7 +2417,7 @@ class Commande extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande';
$sql .= ' SET remise_percent = '.((float) $remise);
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT.' ;';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut = '.self::STATUS_DRAFT;
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -100,13 +100,13 @@ class CommandeStats extends Stats
if ($typentid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = c.fk_soc';
$this->where .= ' AND s.fk_typent = '.$typentid;
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
}
if ($categid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cats ON cats.fk_soc = c.fk_soc';
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie';
$this->where .= ' AND cat.rowid = '.$categid;
$this->where .= ' AND cat.rowid = '.((int) $categid);
}
}

View File

@ -451,9 +451,9 @@ class Account extends CommonObject
$sql = "SELECT fk_bank, url_id, url, label, type";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_url";
if ($fk_bank > 0) {
$sql .= " WHERE fk_bank = ".$fk_bank;
$sql .= " WHERE fk_bank = ".((int) $fk_bank);
} else {
$sql .= " WHERE url_id = ".$url_id." AND type = '".$this->db->escape($type)."'";
$sql .= " WHERE url_id = ".((int) $url_id)." AND type = '".$this->db->escape($type)."'";
}
$sql .= " ORDER BY type, label";
@ -2435,7 +2435,7 @@ class AccountLine extends CommonObject
$type = 'bank';
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".$this->id;
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $this->id);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);

View File

@ -425,7 +425,7 @@ class BankAccounts extends DolibarrApi
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank ";
$sql .= " WHERE fk_account = ".$id;
$sql .= " WHERE fk_account = ".((int) $id);
// Add sql filters
if ($sqlfilters) {

View File

@ -783,7 +783,7 @@ class PaymentVarious extends CommonObject
$type = 'bank';
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".$banklineid;
$sql = " SELECT COUNT(ab.rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='".$this->db->escape($type)."' AND ab.fk_doc = ".((int) $banklineid);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);

View File

@ -107,7 +107,7 @@ if ($user->rights->banque->consolidate && $action == 'donext') {
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier) {
$cat1 = GETPOST("cat1", 'int');
if (!empty($rowid) && !empty($cat1)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".$cat1;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid)." AND fk_categ = ".((int) $cat1);
if (!$db->query($sql)) {
dol_print_error($db);
}
@ -174,7 +174,7 @@ if ($user->rights->banque->modifier && $action == "update") {
}
}
$sql .= " fk_account = ".$actarget->id;
$sql .= " WHERE rowid = ".$acline->id;
$sql .= " WHERE rowid = ".((int) $acline->id);
$result = $db->query($sql);
if (!$result) {
@ -183,14 +183,14 @@ if ($user->rights->banque->modifier && $action == "update") {
if (!$error) {
$arrayofcategs = GETPOST('custcats', 'array');
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid);
if (!$db->query($sql)) {
$error++;
dol_print_error($db);
}
if (count($arrayofcategs)) {
foreach ($arrayofcategs as $val) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$val.")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".((int) $rowid).", ".((int) $val).")";
if (!$db->query($sql)) {
$error++;
dol_print_error($db);
@ -229,9 +229,9 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
if (empty($num_rel)) {
$sql .= ", rappro = 0";
} else {
$sql .= ", rappro = ".$rappro;
$sql .= ", rappro = ".((int) $rappro);
}
$sql .= " WHERE rowid = ".$rowid;
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog("line.php", LOG_DEBUG);
$result = $db->query($sql);

View File

@ -232,7 +232,7 @@ if (empty($numref)) {
// List of all standing receipts
$sql = "SELECT DISTINCT(b.num_releve) as numr";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " WHERE b.fk_account = ".$object->id;
$sql .= " WHERE b.fk_account = ".((int) $object->id);
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records

View File

@ -304,7 +304,7 @@ if ($action == "create" || $action == "start" || $action == 'close') {
if ($bankid > 0) {
$sql = "SELECT SUM(amount) as total FROM ".MAIN_DB_PREFIX."bank";
$sql .= " WHERE fk_account = ".$bankid;
$sql .= " WHERE fk_account = ".((int) $bankid);
if ($syear && !$smonth) {
$sql .= " AND dateo < '".$db->idate(dol_get_first_day($syear, 1))."'";
} elseif ($syear && $smonth && !$sday) {

View File

@ -405,7 +405,7 @@ while ($j < $numlt) {
$sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as pv";
$sql .= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j;
$sql .= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".((int) $j);
if ($year > 0) {
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire

View File

@ -441,7 +441,7 @@ class Deplacement extends CommonObject
$sql = "SELECT id, code, label";
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees";
$sql .= " WHERE active = ".$active;
$sql .= " WHERE active = ".((int) $active);
dol_syslog(get_class($this)."::listOfTypes", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -102,7 +102,7 @@ class DeplacementStats extends Stats
{
$sql = "SELECT MONTH(dated) as dm, count(*)";
$sql .= " FROM ".$this->from;
$sql .= " WHERE YEAR(dated) = ".$year;
$sql .= " WHERE YEAR(dated) = ".((int) $year);
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');

View File

@ -1743,7 +1743,7 @@ if (empty($reshook)) {
$originidforcontact=$srcobject->origin_id;
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$db->escape($originforcontact)."'";
$sqlcontact.= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$db->escape($originforcontact)."'";
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)
@ -3091,7 +3091,7 @@ if ($action == 'create') {
$sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as r';
$sql .= ' WHERE r.fk_soc = '.$invoice_predefined->socid;
$sql .= ' WHERE r.fk_soc = '.((int) $invoice_predefined->socid);
$resql = $db->query($sql);
if ($resql) {

View File

@ -1142,7 +1142,7 @@ class Invoices extends DolibarrApi
$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
$sql .= " re.description, re.fk_facture_source";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re";
$sql .= " WHERE fk_facture = ".$this->invoice->id;
$sql .= " WHERE fk_facture = ".((int) $this->invoice->id);
$resql = $this->db->query($sql);
if (!empty($resql)) {
while ($obj = $this->db->fetch_object($resql)) {

View File

@ -762,12 +762,12 @@ class FactureRec extends CommonInvoice
$main = MAIN_DB_PREFIX.'facturedet_rec';
$ef = $main."_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid);
dol_syslog($sqlef);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".((int) $rowid);
dol_syslog($sql);
if ($this->db->query($sqlef) && $this->db->query($sql)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".((int) $rowid);
dol_syslog($sql);
if ($this->db->query($sql)) {
// Delete linked object
@ -1151,7 +1151,7 @@ class FactureRec extends CommonInvoice
$sql .= ', multicurrency_total_ht = '.$multicurrency_total_ht;
$sql .= ', multicurrency_total_tva = '.$multicurrency_total_tva;
$sql .= ', multicurrency_total_ttc = '.$multicurrency_total_ttc;
$sql .= " WHERE rowid = ".$rowid;
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
if ($this->db->query($sql)) {

View File

@ -751,7 +751,7 @@ class Facture extends CommonInvoice
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$sqlcontact .= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact) {
@ -2233,7 +2233,7 @@ class Facture extends CommonInvoice
if (!$error) {
// If invoice was converted into a discount not yet consumed, we remove discount
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except';
$sql .= ' WHERE fk_facture_source = '.$rowid;
$sql .= ' WHERE fk_facture_source = '.((int) $rowid);
$sql .= ' AND fk_facture_line IS NULL';
$resql = $this->db->query($sql);
@ -2282,9 +2282,9 @@ class Facture extends CommonInvoice
// Invoice line extrafileds
$main = MAIN_DB_PREFIX.'facturedet';
$ef = $main."_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture = ".((int) $rowid).")";
// Delete invoice line
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
@ -3585,8 +3585,7 @@ class Facture extends CommonInvoice
{
$sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd
INNER JOIN '.MAIN_DB_PREFIX.'facture f ON (fd.fk_facture = f.rowid)
WHERE fd.fk_prev_id = '.$idline.'
AND f.fk_statut <> 0';
WHERE fd.fk_prev_id = '.((int) $idline).' AND f.fk_statut <> 0';
$result = $this->db->query($sql);
if (!$result) {
@ -3663,7 +3662,7 @@ class Facture extends CommonInvoice
// Libere remise liee a ligne de facture
$sql = 'UPDATE '.MAIN_DB_PREFIX.'societe_remise_except';
$sql .= ' SET fk_facture_line = NULL';
$sql .= ' WHERE fk_facture_line = '.$rowid;
$sql .= ' WHERE fk_facture_line = '.((int) $rowid);
dol_syslog(get_class($this)."::deleteline", LOG_DEBUG);
$result = $this->db->query($sql);
@ -4576,7 +4575,7 @@ class Facture extends CommonInvoice
global $conf;
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE situation_cycle_ref = '.$this->situation_cycle_ref;
$sql .= ' WHERE situation_cycle_ref = '.((int) $this->situation_cycle_ref);
$sql .= ' AND situation_counter < '.$this->situation_counter;
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);
@ -4655,7 +4654,7 @@ class Facture extends CommonInvoice
if (!empty($this->situation_cycle_ref)) {
// No point in testing anything if we're not inside a cycle
$sql = 'SELECT max(situation_counter) FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE situation_cycle_ref = '.$this->situation_cycle_ref;
$sql .= ' WHERE situation_cycle_ref = '.((int) $this->situation_cycle_ref);
$sql .= ' AND entity = '.($this->entity > 0 ? $this->entity : $conf->entity);
$resql = $this->db->query($sql);

View File

@ -105,13 +105,13 @@ class FactureStats extends Stats
if ($typentid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = f.fk_soc';
$this->where .= ' AND s.fk_typent = '.$typentid;
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
}
if ($categid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_soc = f.fk_soc';
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as c ON c.rowid = cs.fk_categorie';
$this->where .= ' AND c.rowid = '.$categid;
$this->where .= ' AND c.rowid = '.((int) $categid);
}
}

View File

@ -382,7 +382,7 @@ if ($massaction == 'makepayment') {
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
$rsql .= " WHERE fk_facture = ".$objecttmp->id;
$rsql .= " WHERE fk_facture = ".((int) $objecttmp->id);
$rsql .= " AND pfd.fk_user_demande = u.rowid";
$rsql .= " AND pfd.traite = 0";
$rsql .= " ORDER BY pfd.date_demande DESC";

View File

@ -560,7 +560,7 @@ class Localtax extends CommonObject
{
// phpcs:enable
$sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.((int) $id);
$sql .= ' WHERE rowid = '.$this->id;
$sql .= ' WHERE rowid = '.((int) $this->id);
$result = $this->db->query($sql);
if ($result) {
return 1;

View File

@ -54,7 +54,7 @@ print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Paym
$sql = "SELECT rowid, amount, label, f.datev, f.datep";
$sql .= " FROM ".MAIN_DB_PREFIX."localtax as f ";
$sql .= " WHERE f.entity = ".$conf->entity." AND localtaxtype = ".$db->escape($ltt);
$sql .= " WHERE f.entity = ".$conf->entity." AND localtaxtype = ".((int) $ltt);
$sql .= " ORDER BY datev DESC";
$result = $db->query($sql);

View File

@ -746,7 +746,7 @@ class RemiseCheque extends CommonObject
// Get invoices list to reopen them
$sql = 'SELECT pf.fk_facture, pf.amount';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql .= ' WHERE pf.fk_paiement = '.$payment->id;
$sql .= ' WHERE pf.fk_paiement = '.((int) $payment->id);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -187,7 +187,7 @@ class Cpaiement
$sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')';
$sql .= " AND t.code = '".$this->db->escape($ref)."'";
} else {
$sql .= ' WHERE t.id = '.$id;
$sql .= ' WHERE t.id = '.((int) $id);
}
$resql = $this->db->query($sql);

View File

@ -193,7 +193,7 @@ if ($action == 'create') {
$sql = "SELECT sum(p.amount) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql .= " WHERE p.fk_charge = ".$chid;
$sql .= " WHERE p.fk_charge = ".((int) $chid);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View File

@ -189,7 +189,7 @@ if ($action == 'create') {
$sql = "SELECT sum(p.amount) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p";
$sql .= " WHERE p.fk_tva = ".$chid;
$sql .= " WHERE p.fk_tva = ".((int) $chid);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View File

@ -1076,7 +1076,7 @@ class BonPrelevement extends CommonObject
$sql .= " SET traite = 1";
$sql .= ", date_traite = '".$this->db->idate($now)."'";
$sql .= ", fk_prelevement_bons = ".$this->id;
$sql .= " WHERE rowid = ".$fac[1];
$sql .= " WHERE rowid = ".((int) $fac[1]);
$resql = $this->db->query($sql);
if (!$resql) {
@ -1139,7 +1139,7 @@ class BonPrelevement extends CommonObject
if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " SET amount = ".price2num($this->total);
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".$conf->entity;
$resql = $this->db->query($sql);
@ -2107,7 +2107,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT rowid, ref";
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= " WHERE pb.rowid = ".$this->id;
$sql .= " WHERE pb.rowid = ".((int) $this->id);
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -162,7 +162,7 @@ if ($prev_id > 0 || $ref) {
$sql = "SELECT sum(pl.amount), pl.statut";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " WHERE pl.fk_prelevement_bons = ".$object->id;
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $object->id);
$sql .= " GROUP BY pl.statut";
$resql = $db->query($sql);

View File

@ -139,7 +139,7 @@ if ($id > 0) {
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql .= " u.login, u.rowid as userid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $object->id);
$sql .= " AND f.entity IN (".getEntity('invoice').")";
$sql .= " AND f.fk_user_valid = u.rowid";
$sql .= $db->order($sortfield, $sortorder);

View File

@ -613,7 +613,7 @@ if ($id > 0) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
$sql .= " WHERE p.fk_charge = ".$id;
$sql .= " WHERE p.fk_charge = ".((int) $id);
$sql .= " AND p.fk_charge = cs.rowid";
$sql .= " AND cs.entity IN (".getEntity('tax').")";
$sql .= " ORDER BY dp DESC";

View File

@ -190,7 +190,7 @@ class Cchargesociales
if (null !== $ref) {
$sql .= " WHERE t.code = '".$this->db->escape($ref)."'";
} else {
$sql .= ' WHERE t.id = '.$id;
$sql .= ' WHERE t.id = '.((int) $id);
}
$resql = $this->db->query($sql);

View File

@ -636,7 +636,7 @@ class PaymentSocialContribution extends CommonObject
public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".$this->id;
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET fk_bank = ".((int) $id_bank)." WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -233,7 +233,7 @@ if ($year > 0) {
if ($search_typeid) {
$sql .= " AND cs.fk_type=".$db->escape($search_typeid);
}
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos";
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
if (!empty($conf->projet->enabled)) {
$sql .= ", p.rowid, p.ref, p.title";
}

View File

@ -169,7 +169,8 @@ if (preg_match('/^cs\./', $sortfield)
|| preg_match('/^c\./', $sortfield)
|| preg_match('/^pc\./', $sortfield)
|| preg_match('/^pct\./', $sortfield)
|| preg_match('/^u\./', $sortfield)) {
|| preg_match('/^u\./', $sortfield)
|| preg_match('/^ba\./', $sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
@ -233,8 +234,8 @@ print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pc.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SocialContribution", $_SERVER["PHP_SELF"], "c.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("TypeContrib", $_SERVER["PHP_SELF"], "cs.fk_type", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "cs.periode", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pc.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.rowid", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
@ -316,7 +317,7 @@ while ($i < min($num, $limit)) {
print '</td>';
print '<td>';
if ($obj->fk_bank > 0) {
if ($obj->bid > 0) {
$accountstatic->id = $obj->bid;
$accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber;

View File

@ -618,7 +618,7 @@ if ($id) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id";
$sql .= ", ".MAIN_DB_PREFIX."tva as tva";
$sql .= " WHERE p.fk_tva = ".$id;
$sql .= " WHERE p.fk_tva = ".((int) $id);
$sql .= " AND p.fk_tva = tva.rowid";
$sql .= " AND tva.entity IN (".getEntity('tax').")";
$sql .= " ORDER BY dp DESC";

View File

@ -57,7 +57,6 @@ $search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth',
$search_datepayment_start = dol_mktime(0, 0, 0, GETPOST('search_datepayment_startmonth', 'int'), GETPOST('search_datepayment_startday', 'int'), GETPOST('search_datepayment_startyear', 'int'));
$search_datepayment_end = dol_mktime(23, 59, 59, GETPOST('search_datepayment_endmonth', 'int'), GETPOST('search_datepayment_endday', 'int'), GETPOST('search_datepayment_endyear', 'int'));
$search_type = GETPOST('search_type', 'int');
$search_cheque = GETPOST('search_cheque', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$search_status = GETPOST('search_status', 'int');
@ -123,7 +122,6 @@ if (empty($reshook)) {
$search_datepayment_start = '';
$search_datepayment_end = '';
$search_type = '';
$search_cheque = '';
$search_account = '';
$search_amount = '';
$search_status = '';
@ -268,9 +266,6 @@ if (!empty($search_datepayment_end)) {
if (!empty($search_type) && $search_type > 0) {
$param .= '&search_type='.$search_type;
}
if (!empty($search_cheque)) {
$param .= '&search_cheque="'.$search_cheque.'"';
}
if (!empty($search_account) && $search_account > 0) {
$param .= '&search_account='.$search_account;
}

View File

@ -120,11 +120,11 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) {
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "ptva.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATDeclaration", $_SERVER["PHP_SELF"], "tva.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATDeclaration", $_SERVER["PHP_SELF"], "tva.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "tva.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "ptva.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "pc.num_paiement", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber');
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "ptva.num_paiement", "", $param, '', $sortfield, $sortorder, '', 'ChequeOrTransferNumber');
if (!empty($conf->banque->enabled)) {
print_liste_field_titre("BankTransactionLine", $_SERVER["PHP_SELF"], "ptva.fk_bank", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "bank.ref", "", $param, '', $sortfield, $sortorder);

View File

@ -308,7 +308,7 @@ abstract class ActionsContactCardCommon
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id) {
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".((int) $this->object->country_id);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);

View File

@ -1652,7 +1652,7 @@ class Contact extends CommonObject
// Desactive utilisateur
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople";
$sql .= " SET statut = ".((int) $this->statut);
$sql .= " WHERE rowid = ".$this->id;
$sql .= " WHERE rowid = ".((int) $this->id);
$result = $this->db->query($sql);
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
@ -1882,7 +1882,7 @@ class Contact extends CommonObject
$sql = "SELECT id, code, libelle as label, picto FROM ".MAIN_DB_PREFIX."c_stcommcontact";
if ($active >= 0) {
$sql .= " WHERE active = ".$active;
$sql .= " WHERE active = ".((int) $active);
}
$resql = $this->db->query($sql);
$num = $this->db->num_rows($resql);

View File

@ -258,7 +258,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
// $documentstatic=new SupplierProposal($db);
// $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
// $tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d";
// $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
// $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
// $where.= " AND d.fk_supplier_proposal = c.rowid";
// $where.= " AND c.entity = ".$conf->entity;
// $dateprint = 'c.date_valid';

View File

@ -1057,7 +1057,7 @@ class Contrat extends CommonObject
}
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact .= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$sqlcontact .= " WHERE element_id = ".((int) $originidforcontact)." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$this->db->escape($originforcontact)."'";
$resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact) {
@ -1759,7 +1759,7 @@ class Contrat extends CommonObject
$sql .= ",date_cloture=null";
}
$sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
$sql .= " WHERE rowid = ".$rowid;
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -15,7 +15,7 @@
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
@ -83,7 +83,7 @@ class box_accountancy_suspense_account extends ModeleBoxes
if (!empty($suspenseAccount) && $suspenseAccount > 0) {
$sql = "SELECT COUNT(*) as nb_suspense_account";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b";
$sql .= " WHERE b.numero_compte = ".$suspenseAccount;
$sql .= " WHERE b.numero_compte = '".$this->db->escape($suspenseAccount)."'";
$sql .= " AND b.entity = ".$conf->entity;
$result = $this->db->query($sql);

View File

@ -87,7 +87,7 @@ class box_bookmarks extends ModeleBoxes
if ($user->rights->bookmark->lire) {
$sql = "SELECT b.title, b.url, b.target, b.favicon";
$sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
$sql .= " WHERE fk_user = ".$user->id;
$sql .= " WHERE fk_user = ".((int) $user->id);
$sql .= " AND b.entity = ".$conf->entity;
$sql .= $this->db->order("position", "ASC");
$sql .= $this->db->plimit($max, 0);

View File

@ -15,7 +15,7 @@
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**

View File

@ -195,7 +195,7 @@ class Canvas
// This functions should not be used anymore because canvas should contains only templates.
// http://wiki.dolibarr.org/index.php/Canvas_development
// https://wiki.dolibarr.org/index.php/Canvas_development
/**
* Return if a canvas contains an action controller
@ -216,7 +216,7 @@ class Canvas
* @param string $action Action string
* @param int $id Object id
* @return mixed Return return code of doActions of canvas
* @see http://wiki.dolibarr.org/index.php/Canvas_development
* @see https://wiki.dolibarr.org/index.php/Canvas_development
*/
public function doActions(&$action = 'view', $id = 0)
{

View File

@ -365,7 +365,7 @@ class Comment extends CommonObject
$sql = "SELECT";
$sql .= " c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
$sql .= " WHERE c.fk_element = ".$fk_element;
$sql .= " WHERE c.fk_element = ".((int) $fk_element);
$sql .= " AND c.element_type = '".$this->db->escape($element_type)."'";
$sql .= " AND c.entity = ".$conf->entity;
$sql .= " ORDER BY c.tms DESC";

View File

@ -801,7 +801,7 @@ abstract class CommonInvoice extends CommonObject
{
// phpcs:enable
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE rowid = '.$did;
$sql .= ' WHERE rowid = '.((int) $did);
$sql .= ' AND traite = 0';
if ($this->db->query($sql)) {
return 0;

View File

@ -1148,7 +1148,7 @@ abstract class CommonObject
if ($fk_socpeople) {
$sql .= ", fk_socpeople = ".((int) $fk_socpeople);
}
$sql .= " where rowid = ".$rowid;
$sql .= " where rowid = ".((int) $rowid);
$resql = $this->db->query($sql);
if ($resql) {
return 0;
@ -1548,7 +1548,7 @@ abstract class CommonObject
$sql .= " ".MAIN_DB_PREFIX."socpeople as c,";
}
$sql .= " ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql .= " WHERE ec.element_id = ".$id;
$sql .= " WHERE ec.element_id = ".((int) $id);
$sql .= " AND ec.fk_socpeople = c.rowid";
if ($source == 'internal') {
$sql .= " AND c.entity IN (".getEntity('user').")";
@ -1564,7 +1564,7 @@ abstract class CommonObject
}
$sql .= " AND tc.active = 1";
if ($status) {
$sql .= " AND ec.statut = ".$status;
$sql .= " AND ec.statut = ".((int) $status);
}
dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG);
@ -1706,7 +1706,7 @@ abstract class CommonObject
if (empty($this->barcode_type) || empty($this->barcode_type_code) || empty($this->barcode_type_label) || empty($this->barcode_type_coder)) { // If data not already loaded
$sql = "SELECT rowid, code, libelle as label, coder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql .= " WHERE rowid = ".$idtype;
$sql .= " WHERE rowid = ".((int) $idtype);
dol_syslog(get_class($this).'::fetch_barcode', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
@ -1939,7 +1939,7 @@ abstract class CommonObject
}
}
$sql .= " WHERE ".$id_field." = ".$id;
$sql .= " WHERE ".$id_field." = ".((int) $id);
dol_syslog(__METHOD__."", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -4047,7 +4047,7 @@ abstract class CommonObject
global $db;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.$fk_object_where;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table_element.' WHERE '.$field_where.' = '.((int) $fk_object_where);
$resql = $db->query($sql);
if (empty($resql)) {
@ -4221,7 +4221,7 @@ abstract class CommonObject
public function getSpecialCode($lineid)
{
$sql = 'SELECT special_code FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql .= ' WHERE rowid = '.$lineid;
$sql .= ' WHERE rowid = '.((int) $lineid);
$resql = $this->db->query($sql);
if ($resql) {
$row = $this->db->fetch_row($resql);
@ -4263,7 +4263,7 @@ abstract class CommonObject
//print $id.'-'.$table.'-'.$elementname.'<br>';
// Check if third party can be deleted
$sql = "SELECT COUNT(*) as nb from ".MAIN_DB_PREFIX.$table;
$sql .= " WHERE ".$this->fk_element." = ".$id;
$sql .= " WHERE ".$this->fk_element." = ".((int) $id);
$resql = $this->db->query($sql);
if ($resql) {
$obj = $this->db->fetch_object($resql);
@ -9267,7 +9267,7 @@ abstract class CommonObject
}
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files";
$sql .= " WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$sql .= " WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".((int) $this->id);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();

View File

@ -163,7 +163,6 @@ class Ctypent // extends CommonObject
*/
public function fetch($id, $code = '', $label = '')
{
global $langs;
$sql = "SELECT";
$sql .= " t.id,";
$sql .= " t.code,";
@ -173,7 +172,7 @@ class Ctypent // extends CommonObject
$sql .= " t.module";
$sql .= " FROM ".MAIN_DB_PREFIX."c_typent as t";
if ($id) {
$sql .= " WHERE t.id = ".$id;
$sql .= " WHERE t.id = ".((int) $id);
} elseif ($code) {
$sql .= " WHERE t.code = '".$this->db->escape($code)."'";
} elseif ($label) {

View File

@ -165,15 +165,12 @@ class Ctyperesource
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
if ($id) {
$sql .= " WHERE t.id = ".$id;
$sql .= " WHERE t.id = ".((int) $id);
} elseif ($code) {
$sql .= " WHERE t.code = '".$this->db->escape($code)."'";
} elseif ($label) {

View File

@ -337,11 +337,11 @@ class DiscountAbsolute
// Delete but only if not used
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except ";
if ($this->fk_facture_source) {
$sql .= " WHERE fk_facture_source = ".$this->fk_facture_source; // Delete all lines of same serie
$sql .= " WHERE fk_facture_source = ".((int) $this->fk_facture_source); // Delete all lines of same serie
} elseif ($this->fk_invoice_supplier_source) {
$sql .= " WHERE fk_invoice_supplier_source = ".$this->fk_invoice_supplier_source; // Delete all lines of same serie
$sql .= " WHERE fk_invoice_supplier_source = ".((int) $this->fk_invoice_supplier_source); // Delete all lines of same serie
} else {
$sql .= " WHERE rowid = ".$this->id; // Delete only line
$sql .= " WHERE rowid = ".((int) $this->id); // Delete only line
}
$sql .= " AND (fk_facture_line IS NULL"; // Not used as absolute simple discount
$sql .= " AND fk_facture IS NULL)"; // Not used as credit note and not used as deposit

View File

@ -784,7 +784,7 @@ class dolReceiptPrinter extends Printer
$sql .= " cp.code";
$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id";
$sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id;
$sql .= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".((int) $object->id);
$sql .= " ORDER BY p.datep";
$resql = $this->db->query($sql);
if ($resql) {
@ -879,7 +879,7 @@ class dolReceiptPrinter extends Printer
$error = 0;
$sql = 'SELECT rowid, name, fk_type, fk_profile, parameter';
$sql .= ' FROM '.MAIN_DB_PREFIX.'printer_receipt';
$sql .= ' WHERE rowid = '.$printerid;
$sql .= ' WHERE rowid = '.((int) $printerid);
$sql .= ' AND entity = '.$conf->entity;
$resql = $this->db->query($sql);
if ($resql) {

View File

@ -196,8 +196,8 @@ class Fiscalyear extends CommonObject
$sql .= ", date_start = '".$this->db->idate($this->date_start)."'";
$sql .= ", date_end = ".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null");
$sql .= ", statut = '".$this->db->escape($this->statut ? $this->statut : 0)."'";
$sql .= ", fk_user_modif = ".$user->id;
$sql .= " WHERE rowid = ".$this->id;
$sql .= ", fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -3530,7 +3530,7 @@ class Form
// looking for users
$sql = "SELECT a.rowid, a.label";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_address as a";
$sql .= " WHERE a.fk_soc = ".$socid;
$sql .= " WHERE a.fk_soc = ".((int) $socid);
$sql .= " ORDER BY a.label ASC";
dol_syslog(get_class($this)."::select_address", LOG_DEBUG);

View File

@ -114,7 +114,7 @@ class FormExpenseReport
$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 .= " WHERE c.active = ".((int) $active);
}
$sql .= " ORDER BY c.label ASC";
$resql = $this->db->query($sql);

View File

@ -234,7 +234,7 @@ class Link extends CommonObject
global $conf;
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
$sql .= " WHERE objecttype = '".$this->db->escape($objecttype)."' AND objectid = ".$objectid;
$sql .= " WHERE objecttype = '".$this->db->escape($objecttype)."' AND objectid = ".((int) $objectid);
if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity;
}
@ -284,7 +284,7 @@ class Link extends CommonObject
global $conf;
$sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."links";
$sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".$objectid;
$sql .= " WHERE objecttype = '".$db->escape($objecttype)."' AND objectid = ".((int) $objectid);
if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity;
}
@ -314,7 +314,7 @@ class Link extends CommonObject
}
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM ".MAIN_DB_PREFIX."links";
$sql .= " WHERE rowid = ".$rowid;
$sql .= " WHERE rowid = ".((int) $rowid);
if ($conf->entity != 0) {
$sql .= " AND entity = ".$conf->entity;
}

View File

@ -72,7 +72,7 @@ function bank_prepare_head(Account $object)
// List of all standing receipts
$sql = "SELECT COUNT(DISTINCT(b.num_releve)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " WHERE b.fk_account = ".$object->id;
$sql .= " WHERE b.fk_account = ".((int) $object->id);
$resql = $db->query($sql);
if ($resql) {
@ -83,7 +83,7 @@ function bank_prepare_head(Account $object)
$db->free($resql);
}
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id;
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".((int) $object->id);
$head[$h][1] = $langs->trans("AccountStatements");
if (($nbReceipts) > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbReceipts).'</span>';

View File

@ -507,6 +507,61 @@ function dol_print_object_info($object, $usetable = 0)
}
}
// User signature
if (!empty($object->user_signature)) {
if ($usetable) {
print '<tr><td class="titlefield">';
}
print $langs->trans('SignedBy');
if ($usetable) {
print '</td><td>';
} else {
print ': ';
}
if (is_object($object->user_signature)) {
if ($object->user_signature->id) {
print $object->user_signature->getNomUrl(-1, '', 0, 0, 0);
} else {
print $langs->trans('Unknown');
}
} else {
$userstatic = new User($db);
$userstatic->fetch($object->user_signature);
if ($userstatic->id) {
print $userstatic->getNomUrl(-1, '', 0, 0, 0);
} else {
print $langs->trans('Unknown');
}
}
if ($usetable) {
print '</td></tr>';
} else {
print '<br>';
}
}
// Date signature
if (!empty($object->date_signature)) {
if ($usetable) {
print '<tr><td class="titlefield">';
}
print $langs->trans('DateSigning');
if ($usetable) {
print '</td><td>';
} else {
print ': ';
}
print dol_print_date($object->date_signature, 'dayhour');
if ($deltadateforuser) {
print ' '.$langs->trans('CurrentHour').' &nbsp; / &nbsp; '.dol_print_date($object->date_signature, 'dayhour', 'tzuserrel').' &nbsp;'.$langs->trans('ClientHour');
}
if ($usetable) {
print '</td></tr>';
} else {
print '<br>';
}
}
// User close
if (!empty($object->user_cloture) || !empty($object->user_closing)) {
if (isset($object->user_cloture) && !empty($object->user_cloture)) {

View File

@ -96,7 +96,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
}
if (in_array('bank', $filter)) {
$sqlwhere .= " AND p.fk_bank = b.rowid";
$sqlwhere .= " AND b.fk_account = ".$paymentbankid;
$sqlwhere .= " AND b.fk_account = ".((int) $paymentbankid);
}
$sqlorder = " ORDER BY p.datep ASC";
}

View File

@ -151,8 +151,8 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
$sql .= " WHERE cv.taux = ".$txtva;
$sql .= " AND cv.fk_pays = ".$countryid;
$sql .= " WHERE cv.taux = ".((float) $txtva);
$sql .= " AND cv.fk_pays = ".((int) $countryid);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View File

@ -846,9 +846,9 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
if (is_array($otherfilters) && !empty($otherfilters['category'])) {
$sql .= ', '.MAIN_DB_PREFIX.'categorie_website_page as cwp';
}
$sql .= " WHERE wp.fk_website = ".$website->id;
$sql .= " WHERE wp.fk_website = ".((int) $website->id);
if ($status >= 0) {
$sql .= " AND wp.status = ".$status;
$sql .= " AND wp.status = ".((int) $status);
}
if ($langcode) {
$sql .= " AND wp.lang ='".$db->escape($langcode)."'";

View File

@ -1696,7 +1696,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// Search if perm already present
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
$sql .= " WHERE id = ".$r_id." AND entity = ".$entity;
$sql .= " WHERE id = ".((int) $r_id)." AND entity = ".((int) $entity);
$resqlselect = $this->db->query($sql);
if ($resqlselect) {

View File

@ -55,6 +55,7 @@ class mod_facture_mars extends ModeleNumRefFactures
*/
public function __construct()
{
global $conf;
if (!empty($conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX;
}

View File

@ -65,6 +65,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*/
public function __construct()
{
global $conf;
if (!empty($conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX)) {
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX;
}

View File

@ -790,7 +790,7 @@ class ImportCsv extends ModeleImports
if (empty($keyfield)) {
$keyfield = 'rowid';
}
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
$sqlSelect .= ' WHERE '.$keyfield.' = '.((int) $lastinsertid);
$resql = $this->db->query($sqlSelect);
if ($resql) {
@ -824,7 +824,7 @@ class ImportCsv extends ModeleImports
if (empty($keyfield)) {
$keyfield = 'rowid';
}
$sqlend = ' WHERE '.$keyfield.' = '.$lastinsertid;
$sqlend = ' WHERE '.$keyfield.' = '.((int) $lastinsertid);
$sql = $sqlstart.$sqlend;

View File

@ -830,7 +830,7 @@ class ImportXlsx extends ModeleImports
if (empty($keyfield)) {
$keyfield = 'rowid';
}
$sqlSelect .= ' WHERE ' . $keyfield . ' = ' . $lastinsertid;
$sqlSelect .= ' WHERE ' . $keyfield . ' = ' .((int) $lastinsertid);
$resql = $this->db->query($sqlSelect);
if ($resql) {
@ -864,7 +864,7 @@ class ImportXlsx extends ModeleImports
if (empty($keyfield)) {
$keyfield = 'rowid';
}
$sqlend = ' WHERE ' . $keyfield . ' = ' . $lastinsertid;
$sqlend = ' WHERE ' . $keyfield . ' = '.((int) $lastinsertid);
$sql = $sqlstart . $sqlend;

View File

@ -250,7 +250,7 @@ class MailingTargets // This can't be abstract as it is used for some method
{
// phpcs:enable
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " WHERE fk_mailing = ".$mailing_id;
$sql .= " WHERE fk_mailing = ".((int) $mailing_id);
if (!$this->db->query($sql)) {
dol_syslog($this->db->error());

Some files were not shown because too many files have changed in this diff Show More