diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 81d77d1f2c9229e920055c0b12d8277881817274..b47532e4a8c368772cd867b9cdd7195e01d3e0dc 100755 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -22,7 +22,7 @@ * \file htdocs/adherents/class/adherentstats.class.php * \ingroup member * \brief Fichier de la classe de gestion des stats des adhérents - * \version $Id$ + * \version $Id: adherentstats.class.php,v 1.2 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; @@ -90,7 +90,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -126,7 +126,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -144,7 +144,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql.= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.dateadh,'%Y') = ".$year; + $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 81169c18ab8ac8590a9834584b77c5d499c914f9..fd08c7bc5f5d0d5eac6a524623e038be899b5f63 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -27,7 +27,7 @@ * \file htdocs/comm/propal.php * \ingroup propale * \brief Page of commercial proposals card and list - * \version $Id: propal.php,v 1.607 2011/07/02 16:48:32 eldy Exp $ + * \version $Id: propal.php,v 1.608 2011/07/04 10:30:02 eldy Exp $ */ require("../main.inc.php"); @@ -1805,13 +1805,13 @@ else if ($month > 0) { if ($year > 0) - $sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; + $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'"; else - $sql.= " AND date_format(p.datep, '%m') = '$month'"; + $sql.= " AND date_format(p.datep, '%m') = '".$month."'"; } if ($year > 0) { - $sql.= " AND date_format(p.datep, '%Y') = $year"; + $sql.= " AND date_format(p.datep, '%Y') = '".$year."'"; } if (dol_strlen($_POST['sf_ref']) > 0) { @@ -1975,6 +1975,6 @@ else } $db->close(); -llxFooter('$Date: 2011/07/02 16:48:32 $ - $Revision: 1.607 $'); +llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.608 $'); ?> diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index ac120ef6d4dcee17d2e4f21a5af52c9067a08d33..d880478352ec0fa190cd9bfe0e82dd55064a889d 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/comm/propal/class/propalestats.class.php * \ingroup propales * \brief Fichier de la classe de gestion des stats des propales - * \version $Id$ + * \version $Id: propalestats.class.php,v 1.5 2011/07/04 10:30:03 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; @@ -91,7 +91,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, count(*)"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -127,7 +127,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, sum(p.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -145,7 +145,7 @@ class PropaleStats extends Stats $sql = "SELECT date_format(p.datep,'%m') as dm, avg(p.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(p.datep,'%Y') = ".$year; + $sql.= " WHERE date_format(p.datep,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 95ab36d59ff56c521aba65f70b931cbbc26c22a0..9523d879cd90c6e4a550f8e6dd596ca571a5a8c0 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/commande/class/commandestats.class.php * \ingroup commandes * \brief Fichier de la classe de gestion des stats des commandes - * \version $Id$ + * \version $Id: commandestats.class.php,v 1.5 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php"; @@ -102,7 +102,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, count(*) nb"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -141,7 +141,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, sum(c.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -161,7 +161,7 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_valid,'%m') as dm, avg(c.".$this->field.")"; $sql.= " FROM ".$this->from; if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE date_format(c.date_valid,'%Y') = ".$year; + $sql.= " WHERE date_format(c.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 4e1c0f03c1e466872eb91938b4451cdaca15ffc1..871fe80c49893774be5fc263279ea46b60e7a9ca 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -23,7 +23,7 @@ * \file htdocs/commande/liste.php * \ingroup commande * \brief Page to list orders - * \version $Id$ + * \version $Id: liste.php,v 1.77 2011/07/04 10:30:02 eldy Exp $ */ @@ -115,19 +115,19 @@ if ($viewstatut <> '') } if ($_GET['ordermonth'] > 0) { - $sql.= " AND date_format(c.date_valid, '%Y-%m') = '$orderyear-$ordermonth'"; + $sql.= " AND date_format(c.date_valid, '%Y-%m') = '".$orderyear."-".$ordermonth."'"; } if ($_GET['orderyear'] > 0) { - $sql.= " AND date_format(c.date_valid, '%Y') = $orderyear"; + $sql.= " AND date_format(c.date_valid, '%Y') = '".$orderyear."'"; } if ($_GET['deliverymonth'] > 0) { - $sql.= " AND date_format(c.date_livraison, '%Y-%m') = '$deliveryyear-$deliverymonth'"; + $sql.= " AND date_format(c.date_livraison, '%Y-%m') = '".$deliveryyear."-".$deliverymonth."'"; } if ($_GET['deliveryyear'] > 0) { - $sql.= " AND date_format(c.date_livraison, '%Y') = $deliveryyear"; + $sql.= " AND date_format(c.date_livraison, '%Y') = '".$deliveryyear."'"; } if (!empty($snom)) { @@ -278,5 +278,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:02 $ - $Revision: 1.77 $'); ?> diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index eb317b6d5f5c20b9bf0f76cb41653438351953e6..375d2901b1f9f592d7824628b96df14eb47d5672 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -22,7 +22,7 @@ * \file htdocs/compta/deplacement/class/deplacementstats.class.php * \ingroup factures * \brief Fichier de la classe de gestion des stats des deplacement et notes de frais - * \version $Id$ + * \version $Id: deplacementstats.class.php,v 1.5 2011/07/04 10:30:02 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.php"; @@ -117,7 +117,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(dated,'%Y') = ".$year; + $sql.= " WHERE date_format(dated,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -136,7 +136,7 @@ class DeplacementStats extends Stats { $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(dated,'%Y') = ".$year; + $sql.= " WHERE date_format(dated,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 2953c14ba1913d7d0efe6f172e71c846107209ef..9ae7ef1aad9204f4df8d5f07bfae139758f081c5 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -22,7 +22,7 @@ * \file htdocs/compta/facture/class/facturestats.class.php * \ingroup factures * \brief Fichier de la classe de gestion des stats des factures - * \version $Id$ + * \version $Id: facturestats.class.php,v 1.6 2011/07/04 10:30:01 eldy Exp $ */ include_once DOL_DOCUMENT_ROOT . "/core/class/stats.class.php"; include_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; @@ -78,7 +78,7 @@ class FactureStats extends Stats $this->where = " fk_statut > 0"; $this->where.= " AND entity = ".$conf->entity; - if ($mode == 'customer') $this->where.=" AND (fk_statut != 3 OR close_code != 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons) + if ($mode == 'customer') $this->where.=" AND (fk_statut <> 3 OR close_code <> 'replaced')"; // Exclude replaced invoices as they are duplicated (we count closed invoices for other reasons) if ($this->socid) { $this->where.=" AND fk_soc = ".$this->socid; @@ -132,7 +132,7 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, SUM(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(datef,'%Y') = ".$year; + $sql.= " WHERE date_format(datef,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index bbe0895a61a055d3d77ccfc2a84f59aa402e3fc1..d4db8280805dcce52ac39f1a92b09e609269add6 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -25,7 +25,7 @@ * \file htdocs/compta/propal.php * \ingroup propale * \brief Page liste des propales (vision compta) - * \version $Id$ + * \version $Id: propal.php,v 1.193 2011/07/04 10:30:00 eldy Exp $ */ require('../main.inc.php'); @@ -561,11 +561,11 @@ else if ($month > 0) { if ($year > 0) - $sql.= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; + $sql.= " AND date_format(p.datep, '%Y-%m') = '".$year."-".$month."'"; else - $sql.= " AND date_format(p.datep, '%m') = '$month'"; + $sql.= " AND date_format(p.datep, '%m') = '".$month."'"; } - if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = $year"; + if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = '".$year."'"; if (!empty($_GET['search_ref'])) { $sql.= " AND p.ref LIKE '%".$db->escape($_GET['search_ref'])."%'"; @@ -702,6 +702,6 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.193 $'); ?> diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index daafa781843676303c5a33798480fa78b2d2efba..2aa820b029cb0b97f5212b1251b69b02f50444ea 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -22,7 +22,7 @@ * \file htdocs/compta/sociales/index.php * \ingroup tax * \brief Page to list all social contributions - * \version $Id$ + * \version $Id: index.php,v 1.65 2011/07/04 10:30:01 eldy Exp $ */ require('../../main.inc.php'); @@ -86,8 +86,8 @@ if ($year > 0) $sql .= " AND ("; // 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 - $sql .= " (s.periode is not null and date_format(s.periode, '%Y') = ".$year.") "; - $sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = ".$year.")"; + $sql .= " (s.periode is not null and date_format(s.periode, '%Y') = '".$year."') "; + $sql .= "or (s.periode is null and date_format(s.date_ech, '%Y') = '".$year."')"; $sql .= ")"; } if ($filtre) { @@ -229,5 +229,5 @@ else $db->close(); -llxFooter('$Date$ - $Revision$'); +llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.65 $'); ?> diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index 5bee40758d86848c3b8ba1585f9f94cfc235f6a3..e431ec86b78380770318a243417f1c242482b45f 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -21,7 +21,7 @@ /** * \file htdocs/compta/stats/comp.php * \ingroup commercial - * \version $Id: comp.php,v 1.43 2011/06/29 11:22:36 eldy Exp $ + * \version $Id: comp.php,v 1.44 2011/07/04 10:30:01 eldy Exp $ * TODO Remove or add page in menus */ @@ -47,8 +47,9 @@ function propals ($db, $year, $month) $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.fk_statut in (1,2,4)"; - $sql.= " AND date_format(p.datep, '%Y') = ".$year; - $sql.= " AND round(date_format(p.datep, '%m')) = ".$month; + // TODO Use between instead of date_format + $sql.= " AND date_format(p.datep, '%Y') = '".$year."'"; + $sql.= " AND round(date_format(p.datep, '%m')) = '".$month."'"; $sql.= " ORDER BY p.fk_statut"; $result = $db->query($sql); @@ -121,7 +122,7 @@ function factures ($db, $year, $month, $paye) $sql.= " AND f.entity = ".$conf->entity; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = ".$paye; $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND date_format(f.datef, '%Y') = ".$year; + $sql.= " AND date_format(f.datef, '%Y') = '".$year."'"; $sql.= " AND round(date_format(f.datef, '%m')) = ".$month; $sql.= " ORDER BY f.datef DESC "; @@ -271,7 +272,7 @@ function ppt ($db, $year, $socid) $sql.= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql.= " WHERE p.fk_statut in (1,2,4)"; $sql.= " AND p.entity = ".$conf->entity; - $sql.= " AND date_format(p.datep,'%Y') = ".$year; + $sql.= " AND date_format(p.datep,'%Y') = '".$year."'"; if ($socid) $sql.= " AND p.fk_soc = ".$socid; $sql.= " GROUP BY dm"; @@ -284,7 +285,7 @@ function ppt ($db, $year, $socid) $sql.= " WHERE f.fk_statut in (1,2)"; $sql.= " AND f.entity = ".$conf->entity; if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = 1"; - $sql.= " AND date_format(f.datef,'%Y') = ".$year; + $sql.= " AND date_format(f.datef,'%Y') = '".$year."'"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY dm"; @@ -350,5 +351,5 @@ if ($details == 1) $db->close(); -llxFooter('$Date: 2011/06/29 11:22:36 $ - $Revision: 1.43 $'); +llxFooter('$Date: 2011/07/04 10:30:01 $ - $Revision: 1.44 $'); ?> diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 8ada959f602b1c15a590b7b1e8489370dc6ae805..f85c447f3830a64b71223fba0e21fef803584cc8 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -24,7 +24,7 @@ \file htdocs/compta/tva/quadri.php \ingroup tax \brief Trimestrial page - \version $Id: quadri.php,v 1.14 2011/07/04 09:01:38 eldy Exp $ + \version $Id: quadri.php,v 1.15 2011/07/04 10:30:00 eldy Exp $ \todo Deal with recurrent invoices as well */ @@ -70,9 +70,9 @@ function tva_coll($db,$y,$q) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.rowid = d.fk_facture "; - $sql.= " AND date_format(f.datef,'%Y') = ".$y; - $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); - $sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; + $sql.= " AND date_format(f.datef,'%Y') = '".$y."'"; + $sql.= " AND (round(date_format(f.datef,'%m') > ".(($q-1)*3); + $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")"; $sql.= " ORDER BY rate, facid"; } @@ -136,9 +136,9 @@ function tva_paye($db, $y,$q) $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND f.fk_statut = 1 "; $sql.= " AND f.rowid = d.fk_facture_fourn "; - $sql.= " AND date_format(f.datef,'%Y') = ".$y; - $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3); - $sql.= " AND date_format(f.datef,'%m') <= ".($q*3).")"; + $sql.= " AND date_format(f.datef,'%Y') = '".$y."'"; + $sql.= " AND (round(date_format(f.datef,'%m')) > ".(($q-1)*3); + $sql.= " AND round(date_format(f.datef,'%m')) <= ".($q*3).")"; $sql.= " ORDER BY rate, facid "; } else @@ -315,5 +315,5 @@ echo '</table>'; $db->close(); -llxFooter('$Date: 2011/07/04 09:01:38 $ - $Revision: 1.14 $'); +llxFooter('$Date: 2011/07/04 10:30:00 $ - $Revision: 1.15 $'); ?> diff --git a/htdocs/expedition/class/expeditionstats.class.php b/htdocs/expedition/class/expeditionstats.class.php index 13e7de1b5890ec7986a2281d0ef7b700858e3f77..d7bf1e9dd7aa669ba7b443e89222d539e9581458 100644 --- a/htdocs/expedition/class/expeditionstats.class.php +++ b/htdocs/expedition/class/expeditionstats.class.php @@ -21,7 +21,7 @@ * \file htdocs/expedition/class/expeditionstats.class.php * \ingroup expedition * \brief Fichier des classes expedition - * \version $Id$ + * \version $Id: expeditionstats.class.php,v 1.4 2011/07/04 10:30:01 eldy Exp $ */ /** @@ -78,7 +78,7 @@ class ExpeditionStats $result = array(); $sql = "SELECT count(*), date_format(date_expedition,'%m') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition"; - $sql.= " WHERE date_format(date_expedition,'%Y') = ".$year; + $sql.= " WHERE date_format(date_expedition,'%Y') = '".$year."'"; $sql.= " AND fk_statut > 0"; $sql.= " AND entity = ".$conf->entity; $sql.= " GROUP BY dm DESC"; diff --git a/htdocs/lib/accountancy.lib.php b/htdocs/lib/accountancy.lib.php index 57072ea1baddab9ad76f7ec6e34d14a301d6b52d..6ef49c8af6acb8299f667bbc237459dd20f69aed 100644 --- a/htdocs/lib/accountancy.lib.php +++ b/htdocs/lib/accountancy.lib.php @@ -20,21 +20,23 @@ /** * \file htdocs/lib/accountancy.lib.php * \brief Library of accountancy functions - * \version $Id$ + * \version $Id: accountancy.lib.php,v 1.2 2011/07/04 10:30:01 eldy Exp $ */ - +/** + * @param $db + * @param $year + * @param $socid + */ function get_ca_propal ($db, $year, $socid) { - - $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year "; + $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = '".$year."'"; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); - if ($result) { $res = $db->fetch_object($result); @@ -56,14 +58,13 @@ function get_ca ($db, $year, $socid) if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } - $sql .= " AND date_format(f.datef , '%Y') = $year "; + $sql .= " AND date_format(f.datef , '%Y') = '".$year."'"; if ($socid) { $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); - if ($result) { $res = $db->fetch_object($result);