diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0d52e4b9fd0..5ca66ac0cd3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5138,11 +5138,11 @@ class Facture extends CommonInvoice public function willBeLastOfSameType() { // get date of last validated invoices of same type - $sql = 'SELECT datef'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE type = ' . (int) $this->type ; - $sql .= ' AND date_valid IS NOT NULL'; - $sql .= ' ORDER BY datef DESC LIMIT 1'; + $sql = "SELECT datef"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE type = " . (int) $this->type ; + $sql .= " AND date_valid IS NOT NULL"; + $sql .= " ORDER BY datef DESC LIMIT 1"; $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index bdf13214717..39d99c4a03b 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1212,9 +1212,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) { if ($objecttmp->element == 'facture') { if (!empty($toselect) && !empty($conf->global->INVOICE_CHECK_POSTERIOR_DATE)) { // order $toselect by date - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture'; - $sql .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $toselect)).')'; - $sql .= ' ORDER BY datef'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE rowid IN (".$db->sanitize(implode(",", $toselect)).")"; + $sql .= " ORDER BY datef"; $resql = $db->query($sql); if ($resql) {