diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index b6690a2cba2..763c195010d 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -130,8 +130,8 @@ abstract class CommonInvoice extends CommonObject $field = 'fk_facturefourn'; } - $sql = 'SELECT sum(amount) as amount, sum(multicurrency_amount) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().$table; + $sql = "SELECT sum(amount) as amount, sum(multicurrency_amount) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix().$table; $sql .= " WHERE ".$field." = ".((int) $this->id); dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); @@ -226,10 +226,10 @@ abstract class CommonInvoice extends CommonObject { $idarray = array(); - $sql = 'SELECT rowid'; + $sql = "SELECT rowid"; $sql .= " FROM ".$this->db->prefix().$this->table_element; $sql .= " WHERE fk_facture_source = ".((int) $this->id); - $sql .= ' AND type = 2'; + $sql .= " AND type = 2"; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -253,10 +253,10 @@ abstract class CommonInvoice extends CommonObject */ public function getIdReplacingInvoice($option = '') { - $sql = 'SELECT rowid'; + $sql = "SELECT rowid"; $sql .= " FROM ".$this->db->prefix().$this->table_element; $sql .= " WHERE fk_facture_source = ".((int) $this->id); - $sql .= ' AND type < 2'; + $sql .= " AND type < 2"; if ($option == 'validated') { $sql .= ' AND fk_statut = 1'; } @@ -265,7 +265,7 @@ abstract class CommonInvoice extends CommonObject // and another no, priority is given to the valid one. // Should not happen (unless concurrent access and 2 people have created a // replacement invoice for the same invoice at the same time) - $sql .= ' ORDER BY fk_statut DESC'; + $sql .= " ORDER BY fk_statut DESC"; $resql = $this->db->query($sql); if ($resql) { @@ -601,8 +601,8 @@ abstract class CommonInvoice extends CommonObject $cdr_type = 0; $cdr_decalage = 0; - $sqltemp = 'SELECT c.type_cdr, c.nbjour, c.decalage'; - $sqltemp .= ' FROM '.$this->db->prefix().'c_payment_term as c'; + $sqltemp = "SELECT c.type_cdr, c.nbjour, c.decalage"; + $sqltemp .= " FROM ".$this->db->prefix()."c_payment_term as c"; if (is_numeric($cond_reglement)) { $sqltemp .= " WHERE c.rowid=".((int) $cond_reglement); } else { @@ -697,15 +697,15 @@ abstract class CommonInvoice extends CommonObject $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $this->socid); - $sql = 'SELECT count(*)'; - $sql .= ' FROM '.$this->db->prefix().'prelevement_facture_demande'; + $sql = "SELECT count(*)"; + $sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande"; if ($type == 'bank-transfer') { - $sql .= ' WHERE fk_facture_fourn = '.((int) $this->id); + $sql .= " WHERE fk_facture_fourn = ".((int) $this->id); } else { - $sql .= ' WHERE fk_facture = '.((int) $this->id); + $sql .= " WHERE fk_facture = ".((int) $this->id); } - $sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments - $sql .= ' AND traite = 0'; + $sql .= " AND ext_payment_id IS NULL"; // To exclude record done for some online payments + $sql .= " AND traite = 0"; dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 962ad8450b1..867020b915d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3777,8 +3777,8 @@ abstract class CommonObject }*/ // Links between objects are stored in table element_element - $sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype'; - $sql .= ' FROM '.$this->db->prefix().'element_element'; + $sql = "SELECT rowid, fk_source, sourcetype, fk_target, targettype"; + $sql .= " FROM ".$this->db->prefix()."element_element"; $sql .= " WHERE "; if ($justsource || $justtarget) { if ($justsource) { @@ -3796,7 +3796,7 @@ abstract class CommonObject $sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')"; $sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')"; } - $sql .= ' ORDER BY '.$orderby; + $sql .= " ORDER BY ".$orderby; dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/core/class/cproductnature.class.php b/htdocs/core/class/cproductnature.class.php index 1fe72f46738..d0c8a5d3933 100644 --- a/htdocs/core/class/cproductnature.class.php +++ b/htdocs/core/class/cproductnature.class.php @@ -197,12 +197,12 @@ class CProductNature // extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; + $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.code,"; $sql .= " t.label,"; $sql .= " t.active"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index 9c568be4165..32fe3164ad8 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -163,12 +163,12 @@ class Ctyperesource { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.code,"; $sql .= " t.label,"; $sql .= " t.active"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; if ($id) { $sql .= " WHERE t.id = ".((int) $id); } elseif ($code) { @@ -228,12 +228,12 @@ class Ctyperesource { dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; - $sql .= ' t.rowid,'; + $sql = "SELECT"; + $sql .= " t.rowid,"; $sql .= " t.code,"; $sql .= " t.label,"; $sql .= " t.active"; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; // Manage filter $sqlwhere = array(); diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 5e7188c63ac..d7571b8ca90 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -237,7 +237,7 @@ class CUnits // extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); - $sql = 'SELECT'; + $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.code,"; $sql .= " t.sortorder,"; @@ -246,7 +246,7 @@ class CUnits // extends CommonObject $sql .= " t.unit_type,"; $sql .= " t.scale,"; $sql .= " t.active"; - $sql .= ' FROM '.$this->db->prefix().'c_units as t'; + $sql .= " FROM ".$this->db->prefix()."c_units as t"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { @@ -471,7 +471,7 @@ class CUnits // extends CommonObject { $base = 10; // TODO : add base col into unit dictionary table - $unit = $this->db->getRow('SELECT scale, unit_type from '.$this->db->prefix().'c_units WHERE rowid = '.intval($id)); + $unit = $this->db->getRow("SELECT scale, unit_type from ".$this->db->prefix()."c_units WHERE rowid = ".intval($id)); if ($unit) { // TODO : if base exist in unit dictionary table remove this convertion exception and update convertion infos in database exemple time hour currently scale 3600 will become scale 2 base 60 if ($unit->unit_type == 'time') { diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index bab0204fb3b..278b5d5e0e6 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -259,10 +259,10 @@ class DefaultValues extends CommonObject $records = array(); - $sql = 'SELECT '; + $sql = "SELECT "; $sql .= $this->getFieldList(); - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - $sql .= ' WHERE 1 = 1'; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " WHERE 1 = 1"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 42b22473f10..7939965828a 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -553,15 +553,15 @@ class DiscountAbsolute dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG); if ($invoice->element == 'facture' || $invoice->element == 'invoice') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture as f'; - $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $invoice->id); - $sql .= ' AND f.type = 3'; + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture as f"; + $sql .= " WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = ".((int) $invoice->id); + $sql .= " AND f.type = 3"; } elseif ($invoice->element == 'invoice_supplier') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f'; - $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $invoice->id); - $sql .= ' AND f.type = 3'; + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture_fourn as f"; + $sql .= " WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = ".((int) $invoice->id); + $sql .= " AND f.type = 3"; } else { $this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter"; dol_print_error($this->error); @@ -594,15 +594,15 @@ class DiscountAbsolute dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); if ($invoice->element == 'facture' || $invoice->element == 'invoice') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture as f'; - $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.((int) $invoice->id); - $sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE.", ".$invoice::TYPE_SITUATION).')'; // Find discount coming from credit note or excess received + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture as f"; + $sql .= " WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = ".((int) $invoice->id); + $sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE.", ".$invoice::TYPE_SITUATION).")"; // Find discount coming from credit note or excess received } elseif ($invoice->element == 'invoice_supplier') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f'; - $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $invoice->id); - $sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE).')'; // Find discount coming from credit note or excess paid + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc, ".$this->db->prefix()."facture_fourn as f"; + $sql .= " WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = ".((int) $invoice->id); + $sql .= " AND f.type IN (".$this->db->sanitize($invoice::TYPE_STANDARD.", ".$invoice::TYPE_CREDIT_NOTE).")"; // Find discount coming from credit note or excess paid } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); @@ -634,13 +634,13 @@ class DiscountAbsolute dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); if ($invoice->element == 'facture' || $invoice->element == 'invoice') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc'; - $sql .= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.((int) $invoice->id); + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc"; + $sql .= " WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = ".((int) $invoice->id); } elseif ($invoice->element == 'invoice_supplier') { - $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; - $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc'; - $sql .= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.((int) $invoice->id); + $sql = "SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount"; + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as rc"; + $sql .= " WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = ".((int) $invoice->id); } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 62f9b15e8b2..7653fd24437 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -242,9 +242,9 @@ class dolReceiptPrinter extends Printer $error = 0; $line = 0; $obj = array(); - $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; - $sql .= ' FROM '.$this->db->prefix().'printer_receipt'; - $sql .= ' WHERE entity = '.$conf->entity; + $sql = "SELECT rowid, name, fk_type, fk_profile, parameter"; + $sql .= " FROM ".$this->db->prefix()."printer_receipt"; + $sql .= " WHERE entity = ".$conf->entity; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -310,9 +310,9 @@ class dolReceiptPrinter extends Printer $error = 0; $line = 0; $obj = array(); - $sql = 'SELECT rowid, name, template'; - $sql .= ' FROM '.$this->db->prefix().'printer_receipt_template'; - $sql .= ' WHERE entity = '.$conf->entity; + $sql = "SELECT rowid, name, template"; + $sql .= " FROM ".$this->db->prefix()."printer_receipt_template"; + $sql .= " WHERE entity = ".$conf->entity; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -873,10 +873,10 @@ class dolReceiptPrinter extends Printer { global $conf; $error = 0; - $sql = 'SELECT template'; - $sql .= ' FROM '.$this->db->prefix().'printer_receipt_template'; - $sql .= ' WHERE rowid = '.((int) $templateid); - $sql .= ' AND entity = '.$conf->entity; + $sql = "SELECT template"; + $sql .= " FROM ".$this->db->prefix()."printer_receipt_template"; + $sql .= " WHERE rowid = ".((int) $templateid); + $sql .= " AND entity = ".$conf->entity; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_array($resql); @@ -910,10 +910,10 @@ class dolReceiptPrinter extends Printer return; } $error = 0; - $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; - $sql .= ' FROM '.$this->db->prefix().'printer_receipt'; - $sql .= ' WHERE rowid = '.((int) $printerid); - $sql .= ' AND entity = '.((int) $conf->entity); + $sql = "SELECT rowid, name, fk_type, fk_profile, parameter"; + $sql .= " FROM ".$this->db->prefix()."printer_receipt"; + $sql .= " WHERE rowid = ".((int) $printerid); + $sql .= " AND entity = ".((int) $conf->entity); $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_array($resql); diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index a381b4d96c7..517fc953830 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -347,9 +347,9 @@ class EmailSenderProfile extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem'; - $sql .= ' FROM '.$this->db->prefix().$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.((int) $id); + $sql = "SELECT rowid, date_creation as datec, tms as datem"; + $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " WHERE t.rowid = ".((int) $id); $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 66eb09d62a4..772c67ff282 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -414,10 +414,10 @@ class Fiscalyear extends CommonObject */ public function info($id) { - $sql = 'SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,'; - $sql .= ' fy.tms'; - $sql .= ' FROM '.$this->db->prefix().'accounting_fiscalyear as fy'; - $sql .= ' WHERE fy.rowid = '.((int) $id); + $sql = "SELECT fy.rowid, fy.datec, fy.fk_user_author, fy.fk_user_modif,"; + $sql .= " fy.tms"; + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear as fy"; + $sql .= " WHERE fy.rowid = ".((int) $id); dol_syslog(get_class($this)."::fetch info", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 06450a3214f..2e1b9661f58 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -307,7 +307,7 @@ class FormAccounting extends Form // phpcs:enable $options = array(); - $sql = 'SELECT DISTINCT import_key from '.$this->db->prefix().'accounting_bookkeeping'; + $sql = "SELECT DISTINCT import_key FROM ".$this->db->prefix()."accounting_bookkeeping"; $sql .= " WHERE entity IN (".getEntity('accountancy').")"; $sql .= ' ORDER BY import_key DESC'; diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index b99952e4a73..f3798181bcd 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -64,7 +64,7 @@ class FormContract public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0) { // phpcs:enable - global $db, $user, $conf, $langs; + global $user, $conf, $langs; $hideunselectables = false; if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) { @@ -72,9 +72,9 @@ class FormContract } // Search all contacts - $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut,'; - $sql .= ' c.ref_customer, c.ref_supplier'; - $sql .= ' FROM '.$this->db->prefix().'contrat as c'; + $sql = "SELECT c.rowid, c.ref, c.fk_soc, c.statut,"; + $sql .= " c.ref_customer, c.ref_supplier"; + $sql .= " FROM ".$this->db->prefix()."contrat as c"; $sql .= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$this->db->sanitize($contratListId).")"; if ($socid > 0) { diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index 8dfa32189aa..107e9ba378a 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -64,15 +64,15 @@ class FormIntervention public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1, $draftonly = false) { // phpcs:enable - global $db, $user, $conf, $langs; + global $user, $conf, $langs; $out = ''; $hideunselectables = false; // Search all contacts - $sql = 'SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut'; - $sql .= ' FROM '.$this->db->prefix().'fichinter as f'; + $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut"; + $sql .= " FROM ".$this->db->prefix()."fichinter as f"; $sql .= " WHERE f.entity = ".$conf->entity; if ($socid != '') { if ($socid == '0') { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index d002ff47850..752f57dfdf9 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -602,9 +602,9 @@ class FormMail extends Form } // Add also email aliases from the c_email_senderprofile table - $sql = 'SELECT rowid, label, email FROM '.$this->db->prefix().'c_email_senderprofile'; - $sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')'; - $sql .= ' ORDER BY position'; + $sql = "SELECT rowid, label, email FROM ".$this->db->prefix()."c_email_senderprofile"; + $sql .= " WHERE active = 1 AND (private = 0 OR private = ".((int) $user->id).")"; + $sql .= " ORDER BY position"; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 4c3a88652e5..aa7a38969be 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -164,8 +164,8 @@ class FormProjets } // Search all projects - $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias'; - $sql .= ' FROM '.$this->db->prefix().'projet as p LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc'; + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, s.nom as name, s.name_alias"; + $sql .= " FROM ".$this->db->prefix()."projet as p LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; if ($projectsListId !== false) { $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; @@ -338,12 +338,12 @@ class FormProjets } // Search all projects - $sql = 'SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,'; - $sql .= ' p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,'; - $sql .= ' s.nom as name'; - $sql .= ' FROM '.$this->db->prefix().'projet as p'; - $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,'; - $sql .= ' '.$this->db->prefix().'projet_task as t'; + $sql = "SELECT t.rowid, t.ref as tref, t.label as tlabel, t.progress,"; + $sql .= " p.rowid as pid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public, p.usage_task,"; + $sql .= " s.nom as name"; + $sql .= " FROM ".$this->db->prefix()."projet as p"; + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = p.fk_soc,"; + $sql .= " ".$this->db->prefix()."projet_task as t"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND t.fk_projet = p.rowid"; if ($projectsListId) { @@ -566,7 +566,7 @@ class FormProjets $sql = "SELECT t.rowid, t.ref"; break; case 'stock_mouvement': - $sql = 'SELECT t.rowid, t.label as ref'; + $sql = "SELECT t.rowid, t.label as ref"; $projectkey = 'fk_origin'; break; case "payment_salary":