use double quotes to compose SQL requests
This commit is contained in:
parent
93765add38
commit
7f527b85b0
@ -5138,11 +5138,11 @@ class Facture extends CommonInvoice
|
|||||||
public function willBeLastOfSameType()
|
public function willBeLastOfSameType()
|
||||||
{
|
{
|
||||||
// get date of last validated invoices of same type
|
// get date of last validated invoices of same type
|
||||||
$sql = 'SELECT datef';
|
$sql = "SELECT datef";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture';
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql .= ' WHERE type = ' . (int) $this->type ;
|
$sql .= " WHERE type = " . (int) $this->type ;
|
||||||
$sql .= ' AND date_valid IS NOT NULL';
|
$sql .= " AND date_valid IS NOT NULL";
|
||||||
$sql .= ' ORDER BY datef DESC LIMIT 1';
|
$sql .= " ORDER BY datef DESC LIMIT 1";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
@ -1212,9 +1212,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) {
|
|||||||
if ($objecttmp->element == 'facture') {
|
if ($objecttmp->element == 'facture') {
|
||||||
if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) {
|
if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||||
// order $toselect by date
|
// order $toselect by date
|
||||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture';
|
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture";
|
||||||
$sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')';
|
$sql .= " WHERE rowid IN (".$db->sanitize(implode(",", $toselect)).")";
|
||||||
$sql .= ' ORDER BY datef';
|
$sql .= " ORDER BY datef";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user