From 62f4345e9234d6e6a949478421206f9b2776d52b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jan 2010 18:51:19 +0000 Subject: [PATCH] Fix: Remove usage of pdate() --- htdocs/adherents/adherent.class.php | 34 +- htdocs/adherents/card_subscriptions.php | 8 +- htdocs/adherents/cotisation.class.php | 14 +- htdocs/chargesociales.class.php | 24 +- htdocs/compta/facture.php | 3 +- htdocs/compta/resultat/index.php | 670 +++++++++---------- htdocs/contact.class.php | 13 +- htdocs/contrat/contrat.class.php | 34 +- htdocs/core/events.class.php | 8 +- htdocs/don.class.php | 8 +- htdocs/expedition/expedition.class.php | 4 +- htdocs/facture.class.php | 34 +- htdocs/fichinter/fichinter.class.php | 30 +- htdocs/fourn/facture/paiementfourn.class.php | 17 +- htdocs/fourn/fournisseur.commande.class.php | 8 +- htdocs/fourn/fournisseur.facture.class.php | 10 +- htdocs/html.formactions.class.php | 22 +- htdocs/livraison/livraison.class.php | 8 +- htdocs/paiement.class.php | 18 +- htdocs/product/liste.php | 4 +- htdocs/product/stock/entrepot.class.php | 16 +- htdocs/projet/liste.php | 2 +- htdocs/propal.class.php | 12 +- htdocs/public/donations/donateurs_code.php | 10 +- htdocs/societe.class.php | 24 +- htdocs/societe.php | 2 +- htdocs/user.class.php | 24 +- scripts/banks/build-graph-sold-example.php | 10 +- 28 files changed, 537 insertions(+), 534 deletions(-) diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index 362bdb67e9b..fe20a37d4fb 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -586,7 +586,7 @@ class Adherent extends CommonObject $this->db->begin(); // Search for last subscription id and end date - $sql = "SELECT rowid, ".$this->db->pdate("datef")." as datef"; + $sql = "SELECT rowid, datef"; $sql.= " FROM ".MAIN_DB_PREFIX."cotisation"; $sql.= " WHERE fk_adherent='".$this->id."'"; $sql.= " ORDER by dateadh DESC"; // Sort by start subscription date @@ -596,7 +596,7 @@ class Adherent extends CommonObject if ($resql) { $obj=$this->db->fetch_object($resql); - $datefin=$obj->datef; + $datefin=$this->db->jdate($obj->datef); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql.= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null"); @@ -924,11 +924,11 @@ class Adherent extends CommonObject $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, d.fk_soc, d.statut, d.public, d.adresse, d.cp, d.ville, d.note,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy,"; - $sql.= " ".$this->db->pdate("d.datec")." as datec,"; - $sql.= " ".$this->db->pdate("d.tms")." as datem,"; - $sql.= " ".$this->db->pdate("d.datefin")." as datefin,"; + $sql.= " d.datec as datec,"; + $sql.= " d.tms as datem,"; + $sql.= " d.datefin as datefin,"; $sql.= " d.naiss as datenaiss,"; - $sql.= " ".$this->db->pdate("d.datevalid")." as datev,"; + $sql.= " d.datevalid as datev,"; $sql.= " d.pays,"; $sql.= " p.rowid as pays_id, p.code as pays_code, p.libelle as pays_lib,"; $sql.= " t.libelle as type, t.cotisation as cotisation,"; @@ -976,11 +976,11 @@ class Adherent extends CommonObject $this->statut = $obj->statut; $this->public = $obj->public; - $this->datec = $obj->datec; - $this->datem = $obj->datem; - $this->datefin = $obj->datefin; - $this->datevalid = $obj->datevalid; - $this->naiss = $obj->datenaiss; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); + $this->datefin = $this->db->jdate($obj->datefin); + $this->datevalid = $this->db->jdate($obj->datev); + $this->naiss = $this->db->jdate($obj->datenaiss); $this->note = $obj->note; $this->morphy = $obj->morphy; @@ -2007,9 +2007,9 @@ class Adherent extends CommonObject */ function info($id) { - $sql = 'SELECT a.rowid, '.$this->db->pdate('a.datec').' as datec,'; - $sql.= ' '.$this->db->pdate('a.datevalid').' as datev,'; - $sql.= ' '.$this->db->pdate('a.tms').' as datem,'; + $sql = 'SELECT a.rowid, a.datec as datec,'; + $sql.= ' a.datevalid as datev,'; + $sql.= ' a.tms as datem,'; $sql.= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod'; $sql.= ' FROM '.MAIN_DB_PREFIX.'adherent as a'; $sql.= ' WHERE a.rowid = '.$id; @@ -2043,9 +2043,9 @@ class Adherent extends CommonObject $this->user_modification = $muser; } - $this->date_creation = $obj->datec; - $this->date_validation = $obj->datev; - $this->date_modification = $obj->datem; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->datev); + $this->date_modification = $this->db->jdate($obj->datem); } $this->db->free($result); diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index ace88e753c4..37b64790141 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -267,8 +267,8 @@ print ''; */ $sql = "SELECT d.rowid, d.prenom, d.nom, d.societe,"; $sql.= " c.rowid as crowid, c.cotisation,"; -$sql.= " ".$db->pdate("c.dateadh")." as dateadh,"; -$sql.= " ".$db->pdate("c.datef")." as datef,"; +$sql.= " c.dateadh,"; +$sql.= " c.datef,"; $sql.= " c.fk_bank,"; $sql.= " b.rowid as bid,"; $sql.= " ba.rowid as baid, ba.label, ba.bank"; @@ -308,8 +308,8 @@ if ($result) $cotisationstatic->ref=$objp->crowid; $cotisationstatic->id=$objp->crowid; print ''.$cotisationstatic->getNomUrl(1).''; - print ''.dol_print_date($objp->dateadh,'day')."\n"; - print ''.dol_print_date($objp->datef,'day')."\n"; + print ''.dol_print_date($this->db->jdate($objp->dateadh),'day')."\n"; + print ''.dol_print_date($this->db->jdate($objp->datef),'day')."\n"; print ''.price($objp->cotisation).''; if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) { diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index 43de79f9b6d..3cf7ec3a0c3 100644 --- a/htdocs/adherents/cotisation.class.php +++ b/htdocs/adherents/cotisation.class.php @@ -100,10 +100,10 @@ class Cotisation extends CommonObject */ function fetch($rowid) { - $sql ="SELECT rowid, fk_adherent, ".$this->db->pdate("datec")." as datec,"; + $sql ="SELECT rowid, fk_adherent, datec,"; $sql.=" tms,"; - $sql.=" ".$this->db->pdate("dateadh")." as dateadh,"; - $sql.=" ".$this->db->pdate("datef")." as datef,"; + $sql.=" dateadh,"; + $sql.=" datef,"; $sql.=" cotisation, note, fk_bank"; $sql.=" FROM ".MAIN_DB_PREFIX."cotisation"; $sql.=" WHERE rowid=".$rowid; @@ -120,10 +120,10 @@ class Cotisation extends CommonObject $this->ref = $obj->rowid; $this->fk_adherent = $obj->fk_adherent; - $this->datec = $obj->datec; - $this->datem = $obj->tms; - $this->dateh = $obj->dateadh; - $this->datef = $obj->datef; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->tms); + $this->dateh = $this->db->jdate($obj->dateadh); + $this->datef = $this->db->jdate($obj->datef); $this->amount = $obj->cotisation; $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index dec84f08600..b3a7b795639 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -18,19 +18,19 @@ */ /** - \file htdocs/chargesociales.class.php - \ingroup facture - \brief Fichier de la classe des charges sociales - \version $Id$ -*/ + * \file htdocs/chargesociales.class.php + * \ingroup facture + * \brief Fichier de la classe des charges sociales + * \version $Id$ + */ require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); /** \class ChargeSociales - \brief Classe permettant la gestion des paiements des charges - La tva collectee n'est calculee que sur les factures payees. -*/ + * \brief Classe permettant la gestion des paiements des charges + * La tva collectee n'est calculee que sur les factures payees. + */ class ChargeSociales extends CommonObject { var $db; @@ -61,8 +61,8 @@ class ChargeSociales extends CommonObject */ function fetch($id) { - $sql = "SELECT cs.rowid,".$this->db->pdate("cs.date_ech")." as date_ech,"; - $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, ".$this->db->pdate("cs.periode")." as periode,"; + $sql = "SELECT cs.rowid, cs.date_ech,"; + $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,"; $sql.= " c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " WHERE cs.fk_type = c.id"; @@ -78,13 +78,13 @@ class ChargeSociales extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->date_ech = $obj->date_ech; + $this->date_ech = $this->db->jdate($obj->date_ech); $this->lib = $obj->lib; $this->type = $obj->fk_type; $this->type_libelle = $obj->libelle; $this->amount = $obj->amount; $this->paye = $obj->paye; - $this->periode = $obj->periode; + $this->periode = $this->db->jdate($obj->periode); return 1; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f753a406b94..141d0df7883 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2024,7 +2024,7 @@ else * Show object in view mode */ - $now=gmmktime(); + $now=dol_now(); $id = $_GET['facid']; $ref= $_GET['ref']; @@ -2393,6 +2393,7 @@ else if ($fac->type != 2 && $_GET['action'] != 'editinvoicedate' && $fac->brouillon && $user->rights->facture->creer) print 'id.'">'.img_edit($langs->trans('SetDate'),1).''; print ''; print ''; + if ($fac->type != 2) { if ($_GET['action'] == 'editinvoicedate') diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 48b832ff9c8..0c80d6dfc37 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -19,10 +19,10 @@ */ /** - \file htdocs/compta/resultat/index.php - \brief Page reporting resultat - \version $Id$ -*/ + * \file htdocs/compta/resultat/index.php + * \brief Page reporting resultat + * \version $Id$ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/report.lib.php"); @@ -32,19 +32,19 @@ $year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"]; $year_current = strftime("%Y",time()); $nbofyear=4; if (! $year_start) { - $year_start = $year_current - ($nbofyear-1); - $year_end = $year_current; + $year_start = $year_current - ($nbofyear-1); + $year_end = $year_current; } else { - $year_end=$year_start + ($nbofyear-1); + $year_end=$year_start + ($nbofyear-1); } /* * Securite acces client */ -if ($user->societe_id > 0) +if ($user->societe_id > 0) { - $socid = $user->societe_id; + $socid = $user->societe_id; } // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') @@ -59,22 +59,22 @@ $html=new Form($db); // Affiche en-tete du rapport if ($modecompta=="CREANCES-DETTES") { - $nom=$langs->trans("AnnualSummaryDueDebtMode"); - $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $period="$year_start - $year_end"; - $periodlink=($year_start?"".img_previous()." ".img_next()."":""); - $description=$langs->trans("RulesResultDue"); - $builddate=time(); - $exportlink=$langs->trans("NotYetAvailable"); + $nom=$langs->trans("AnnualSummaryDueDebtMode"); + $nom.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + $period="$year_start - $year_end"; + $periodlink=($year_start?"".img_previous()." ".img_next()."":""); + $description=$langs->trans("RulesResultDue"); + $builddate=time(); + $exportlink=$langs->trans("NotYetAvailable"); } else { - $nom=$langs->trans("AnnualSummaryInputOutputMode"); - $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $period="$year_start - $year_end"; - $periodlink=($year_start?"".img_previous()." ".img_next()."":""); - $description=$langs->trans("RulesResultInOut"); - $builddate=time(); - $exportlink=$langs->trans("NotYetAvailable"); + $nom=$langs->trans("AnnualSummaryInputOutputMode"); + $nom.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + $period="$year_start - $year_end"; + $periodlink=($year_start?"".img_previous()." ".img_next()."":""); + $description=$langs->trans("RulesResultInOut"); + $builddate=time(); + $exportlink=$langs->trans("NotYetAvailable"); } report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink); @@ -84,96 +84,96 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl */ $subtotal_ht = 0; $subtotal_ttc = 0; -if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."facture as f"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND f.fk_statut in (1,2)"; +if ($modecompta == 'CREANCES-DETTES') { + $sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= ", ".MAIN_DB_PREFIX."facture as f"; + $sql.= " WHERE f.fk_soc = s.rowid"; + $sql.= " AND f.fk_statut in (1,2)"; } else { - /* - * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les - * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) - */ + /* + * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les + * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) + */ $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; - $sql.= " WHERE p.rowid = pf.fk_paiement"; - $sql.= " AND pf.fk_facture = f.rowid"; + $sql.= " WHERE p.rowid = pf.fk_paiement"; + $sql.= " AND pf.fk_facture = f.rowid"; } $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = $socid"; $sql.= " GROUP BY dm"; $sql.= " ORDER BY dm"; - +print $sql; $result=$db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_object($result); - $encaiss[$row->dm] = $row->amount_ht; - $encaiss_ttc[$row->dm] = $row->amount_ttc; - $i++; - } - $db->free($result); + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_object($result); + $encaiss[$row->dm] = $row->amount_ht; + $encaiss_ttc[$row->dm] = $row->amount_ttc; + $i++; + } + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } // On ajoute les paiements clients anciennes version, non lies par paiement_facture -if ($modecompta != 'CREANCES-DETTES') { - $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; - $sql.= " WHERE pf.rowid IS NULL"; - $sql.= " AND p.fk_bank = b.rowid"; - $sql.= " AND b.fk_account = ba.rowid"; - $sql.= " AND ba.entity = ".$conf->entity; - $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; +if ($modecompta != 'CREANCES-DETTES') { + $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; + $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; + $sql.= ", ".MAIN_DB_PREFIX."paiement as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; + $sql.= " WHERE pf.rowid IS NULL"; + $sql.= " AND p.fk_bank = b.rowid"; + $sql.= " AND b.fk_account = ba.rowid"; + $sql.= " AND ba.entity = ".$conf->entity; + $sql.= " GROUP BY dm"; + $sql.= " ORDER BY dm"; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_object($result); + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_object($result); - $encaiss[$row->dm] += $row->amount_ht; - $encaiss_ttc[$row->dm] += $row->amount_ttc; + $encaiss[$row->dm] += $row->amount_ht; + $encaiss_ttc[$row->dm] += $row->amount_ttc; // For DEBUG Only if (preg_match('/^2007/',$row->dm)) { - $subtotal_ht = $subtotal_ht + $row->amount_ht; - $subtotal_ttc = $subtotal_ttc + $row->amount_ttc; + $subtotal_ht = $subtotal_ht + $row->amount_ht; + $subtotal_ttc = $subtotal_ttc + $row->amount_ttc; } - $i++; - } - } - else { - dol_print_error($db); - } + $i++; + } + } + else { + dol_print_error($db); + } } /* -print "
Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; -for ($mois = 1 ; $mois <= 12 ; $mois++) -{ - $annee = 2007; - $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); - print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; - print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; -} -*/ + print "
Facture clients: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; + for ($mois = 1 ; $mois <= 12 ; $mois++) + { + $annee = 2007; + $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); + print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; + print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; + } + */ /* * Frais, factures fournisseurs. @@ -181,10 +181,10 @@ for ($mois = 1 ; $mois <= 12 ; $mois++) $subtotal_ht = 0; $subtotal_ttc = 0; -if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; - $sql.= " WHERE f.fk_statut IN (1,2)"; +if ($modecompta == 'CREANCES-DETTES') { + $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " WHERE f.fk_statut IN (1,2)"; } else { $sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; @@ -200,171 +200,171 @@ $sql.= " GROUP BY dm"; $result=$db->query($sql); if ($result) { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_object($result); + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_object($result); - $decaiss[$row->dm] = $row->amount_ht; - $decaiss_ttc[$row->dm] = $row->amount_ttc; + $decaiss[$row->dm] = $row->amount_ht; + $decaiss_ttc[$row->dm] = $row->amount_ttc; // For DEBUG Only if (preg_match('/^2007/',$row->dm)) { - $subtotal_ht = $subtotal_ht + $row->amount_ht; - $subtotal_ttc = $subtotal_ttc + $row->amount_ttc; + $subtotal_ht = $subtotal_ht + $row->amount_ht; + $subtotal_ttc = $subtotal_ttc + $row->amount_ttc; } - $i++; - } - $db->free($result); + $i++; + } + $db->free($result); } else { - dol_print_error($db); + dol_print_error($db); } /* -print "
Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; -for ($mois = 1 ; $mois <= 12 ; $mois++) -{ - $annee = 2007; - $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); - print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; - print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; -} -*/ - + print "
Facture fournisseurs: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; + for ($mois = 1 ; $mois <= 12 ; $mois++) + { + $annee = 2007; + $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); + print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; + print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; + } + */ + /* * TVA */ $subtotal_ht = 0; $subtotal_ttc = 0; if ($modecompta == 'CREANCES-DETTES') { - // TVA a payer - $sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql.= " WHERE f.fk_statut IN (1,2)"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY dm DESC"; - - $result=$db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $decaiss[$obj->dm] += $obj->amount; - $decaiss_ttc[$obj->dm] += $obj->amount; - - $i++; - } - } - } else { - dol_print_error($db); - } - // TVA a recuperer - $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; - $sql.= " WHERE f.fk_statut IN (1,2)"; - $sql.= " AND f.entity = ".$conf->entity; - $sql.= " GROUP BY dm"; - - $result=$db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $encaiss[$obj->dm] += $obj->amount; - $encaiss_ttc[$obj->dm] += $obj->amount; - - $i++; - } - } - } else { - dol_print_error($db); - } + // TVA a payer + $sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql.= " WHERE f.fk_statut IN (1,2)"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " GROUP BY dm DESC"; + + $result=$db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); + + $decaiss[$obj->dm] += $obj->amount; + $decaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } + } else { + dol_print_error($db); + } + // TVA a recuperer + $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; + $sql.= " WHERE f.fk_statut IN (1,2)"; + $sql.= " AND f.entity = ".$conf->entity; + $sql.= " GROUP BY dm"; + + $result=$db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); + + $encaiss[$obj->dm] += $obj->amount; + $encaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } + } else { + dol_print_error($db); + } } else { - // TVA reellement deja payee - $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; - $sql.= " WHERE amount > 0"; - $sql.= " AND t.entity = ".$conf->entity; - $sql.= " GROUP BY dm"; - - $result=$db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $decaiss[$obj->dm] += $obj->amount; - $decaiss_ttc[$obj->dm] += $obj->amount; - // For DEBUG Only - if (preg_match('/^2007/',$obj->dm)) - { - $subtotal_ht = $subtotal_ht + $obj->amount; - $subtotal_ttc = $subtotal_ttc + $obj->amount; + // TVA reellement deja payee + $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; + $sql.= " WHERE amount > 0"; + $sql.= " AND t.entity = ".$conf->entity; + $sql.= " GROUP BY dm"; + + $result=$db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); + + $decaiss[$obj->dm] += $obj->amount; + $decaiss_ttc[$obj->dm] += $obj->amount; + // For DEBUG Only + if (preg_match('/^2007/',$obj->dm)) + { + $subtotal_ht = $subtotal_ht + $obj->amount; + $subtotal_ttc = $subtotal_ttc + $obj->amount; + } + + $i++; } - - $i++; - } - } - } else { - dol_print_error($db); - } - // TVA recuperee - $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; - $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; - $sql.= " WHERE amount < 0"; - $sql.= " AND t.entity = ".$conf->entity; - $sql.= " GROUP BY dm"; - - $result=$db->query($sql); - if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $encaiss[$obj->dm] += $obj->amount; - $encaiss_ttc[$obj->dm] += $obj->amount; - // For DEBUG Only - if (preg_match('/^2007/',$obj->dm)) - { - $subtotal_ht = $subtotal_ht + $obj->amount; - $subtotal_ttc = $subtotal_ttc + $obj->amount; + } + } else { + dol_print_error($db); + } + // TVA recuperee + $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; + $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; + $sql.= " WHERE amount < 0"; + $sql.= " AND t.entity = ".$conf->entity; + $sql.= " GROUP BY dm"; + + $result=$db->query($sql); + if ($result) { + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); + + $encaiss[$obj->dm] += $obj->amount; + $encaiss_ttc[$obj->dm] += $obj->amount; + // For DEBUG Only + if (preg_match('/^2007/',$obj->dm)) + { + $subtotal_ht = $subtotal_ht + $obj->amount; + $subtotal_ttc = $subtotal_ttc + $obj->amount; + } + + $i++; } - - $i++; - } - } - } else { - dol_print_error($db); - } + } + } else { + dol_print_error($db); + } } /* -print "
TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; -for ($mois = 1 ; $mois <= 12 ; $mois++) -{ - $annee = 2007; - $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); - print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; - print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; -} -*/ + print "
TVA: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; + for ($mois = 1 ; $mois <= 12 ; $mois++) + { + $annee = 2007; + $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); + print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; + print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; + } + */ /* * Charges sociales non deductibles @@ -372,26 +372,26 @@ for ($mois = 1 ; $mois <= 12 ; $mois++) $subtotal_ht = 0; $subtotal_ttc = 0; if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; - $sql.= " WHERE s.fk_type = c.id"; - $sql.= " AND c.deductible = 0"; - if ($year) { - $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; - } + $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; + $sql.= " WHERE s.fk_type = c.id"; + $sql.= " AND c.deductible = 0"; + if ($year) { + $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; + } } else { - $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; - $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= " WHERE p.fk_charge = s.rowid"; - $sql.= " AND s.fk_type = c.id"; - $sql.= " AND c.deductible = 0"; - if ($year) { - $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; - } + $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; + $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= " WHERE p.fk_charge = s.rowid"; + $sql.= " AND s.fk_type = c.id"; + $sql.= " AND c.deductible = 0"; + if ($year) { + $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; + } } $sql.= " AND s.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; @@ -399,39 +399,39 @@ $sql.= " GROUP BY c.libelle, dm"; $result=$db->query($sql); if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $decaiss[$obj->dm] += $obj->amount_ht; - $decaiss_ttc[$obj->dm] += $obj->amount_ttc; + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); - // For DEBUG Only - if (preg_match('/^2007/',$obj->dm)) - { - $subtotal_ht = $subtotal_ht + $obj->amount_ht; - $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; + $decaiss[$obj->dm] += $obj->amount_ht; + $decaiss_ttc[$obj->dm] += $obj->amount_ttc; + + // For DEBUG Only + if (preg_match('/^2007/',$obj->dm)) + { + $subtotal_ht = $subtotal_ht + $obj->amount_ht; + $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; + } + + $i++; } - - $i++; - } - } + } } else { - dol_print_error($db); + dol_print_error($db); } /* -print "
Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; -for ($mois = 1 ; $mois <= 12 ; $mois++) -{ - $annee = 2007; - $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); - print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; - print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; -} -*/ + print "
Charges sociales non deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; + for ($mois = 1 ; $mois <= 12 ; $mois++) + { + $annee = 2007; + $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); + print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; + print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; + } + */ /* * Charges sociales deductibles @@ -440,66 +440,66 @@ $subtotal_ht = 0; $subtotal_ttc = 0; if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; - $sql.= " WHERE s.fk_type = c.id"; - $sql.= " AND c.deductible = 1"; - if ($year) { - $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; - } + $sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; + $sql.= " WHERE s.fk_type = c.id"; + $sql.= " AND c.deductible = 1"; + if ($year) { + $sql.= " AND s.date_ech between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; + } } else { - $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; - $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; - $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; - $sql.= " WHERE p.fk_charge = s.rowid"; - $sql.= " AND s.fk_type = c.id"; - $sql.= " AND c.deductible = 1"; - if ($year) { - $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; - } + $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; + $sql.= ", ".MAIN_DB_PREFIX."chargesociales as s"; + $sql.= ", ".MAIN_DB_PREFIX."paiementcharge as p"; + $sql.= " WHERE p.fk_charge = s.rowid"; + $sql.= " AND s.fk_type = c.id"; + $sql.= " AND c.deductible = 1"; + if ($year) { + $sql.= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; + } } $sql.= " AND s.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, dm"; $result=$db->query($sql); if ($result) { - $num = $db->num_rows($result); - $var=false; - $i = 0; - if ($num) { - while ($i < $num) { - $obj = $db->fetch_object($result); - - $decaiss[$obj->dm] += $obj->amount_ht; - $decaiss_ttc[$obj->dm] += $obj->amount_ttc; + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) { + while ($i < $num) { + $obj = $db->fetch_object($result); - // For DEBUG Only - if (preg_match('/^2007/',$obj->dm)) - { - $subtotal_ht = $subtotal_ht + $obj->amount_ht; - $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; + $decaiss[$obj->dm] += $obj->amount_ht; + $decaiss_ttc[$obj->dm] += $obj->amount_ttc; + + // For DEBUG Only + if (preg_match('/^2007/',$obj->dm)) + { + $subtotal_ht = $subtotal_ht + $obj->amount_ht; + $subtotal_ttc = $subtotal_ttc + $obj->amount_ttc; + } + + $i++; } - - $i++; - } - } + } } else { - dol_print_error($db); + dol_print_error($db); } /* -print "
Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; -for ($mois = 1 ; $mois <= 12 ; $mois++) -{ - $annee = 2007; - $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); - print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; - print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; -} -*/ + print "
Charges sociales deduc: subtotal_ht=".$subtotal_ht.' - subtotal_ttc='.$subtotal_ttc."
\n"; + for ($mois = 1 ; $mois <= 12 ; $mois++) + { + $annee = 2007; + $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois,1,$annee)); + print 'Mois '.$mois.': '.$decaiss_ttc[$case].' '; + print 'Mois '.$mois.': '.$encaiss_ttc[$case].' '; + } + */ /* @@ -513,14 +513,14 @@ print ''.$langs->trans("Month").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''.$annee.''; + print ''.$annee.''; } print ''; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''.$langs->trans("Outcome").''; - print ''.$langs->trans("Income").''; + print ''.$langs->trans("Outcome").''; + print ''.$langs->trans("Income").''; } print ''; @@ -560,9 +560,9 @@ $nbcols=0; print ''.$langs->trans("TotalTTC").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - $nbcols+=2; - print ''.(isset($totsorties[$annee])?price($totsorties[$annee]):' ').''; - print ''.(isset($totentrees[$annee])?price($totentrees[$annee]):' ').''; + $nbcols+=2; + print ''.(isset($totsorties[$annee])?price($totsorties[$annee]):' ').''; + print ''.(isset($totentrees[$annee])?price($totentrees[$annee]):' ').''; } print "\n"; @@ -576,11 +576,11 @@ $var=!$var; print ''.$langs->trans("Profit").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ' '; - if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { - print price($totentrees[$annee]-$totsorties[$annee]).''; -// print ' '; - } + print ' '; + if (isset($totentrees[$annee]) || isset($totsorties[$annee])) { + print price($totentrees[$annee]-$totsorties[$annee]).''; + // print ' '; + } } print "\n"; diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 789e65b9dde..af2f7aa96bb 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -654,10 +654,10 @@ class Contact extends CommonObject */ function info($id) { - $sql = "SELECT c.rowid, ".$this->db->pdate("c.datec")." as datec, c.fk_user_creat"; - $sql .= ", ".$this->db->pdate("c.tms")." as tms, c.fk_user_modif"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= " WHERE c.rowid = ".$id; + $sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,"; + $sql.= " c.tms as tms, c.fk_user_modif"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c"; + $sql.= " WHERE c.rowid = ".$id; $resql=$this->db->query($sql); if ($resql) @@ -680,9 +680,8 @@ class Contact extends CommonObject $this->user_modification = $muser; } - $this->date_creation = $obj->datec; - $this->date_modification = $obj->tms; - + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($resql); diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 3bb0d154f7e..c20fc68c227 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -1125,8 +1125,8 @@ class Contrat extends CommonObject */ function info($id) { - $sql = "SELECT c.rowid, c.ref, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("date_cloture")." as date_cloture,"; - $sql.= $this->db->pdate("c.tms")." as date_modification,"; + $sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,"; + $sql.= " c.tms as date_modification,"; $sql.= " fk_user_author, fk_user_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " WHERE c.rowid = ".$id; @@ -1152,9 +1152,9 @@ class Contrat extends CommonObject $this->user_cloture = $cuser; } $this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref; - $this->date_creation = $obj->datec; - $this->date_modification = $obj->date_modification; - $this->date_cloture = $obj->date_cloture; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->date_modification); + $this->date_cloture = $this->db->jdate($obj->date_cloture); } $this->db->free($result); @@ -1529,17 +1529,17 @@ class ContratLigne $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " ".$this->db->pdate('t.tms')." as tms,"; + $sql.= " t.tms,"; $sql.= " t.fk_contrat,"; $sql.= " t.fk_product,"; $sql.= " t.statut,"; $sql.= " t.label,"; $sql.= " t.description,"; - $sql.= " ".$this->db->pdate('t.date_commande')." as date_commande,"; - $sql.= " ".$this->db->pdate('t.date_ouverture_prevue')." as date_ouverture_prevue,"; - $sql.= " ".$this->db->pdate('t.date_ouverture')." as date_ouverture,"; - $sql.= " ".$this->db->pdate('t.date_fin_validite')." as date_fin_validite,"; - $sql.= " ".$this->db->pdate('t.date_cloture')." as date_cloture,"; + $sql.= " t.date_commande,"; + $sql.= " t.date_ouverture_prevue as date_ouverture_prevue,"; + $sql.= " t.date_ouverture as date_ouverture,"; + $sql.= " t.date_fin_validite as date_fin_validite,"; + $sql.= " t.date_cloture as date_cloture,"; $sql.= " t.tva_tx,"; $sql.= " t.qty,"; $sql.= " t.remise_percent,"; @@ -1570,17 +1570,17 @@ class ContratLigne $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->tms = $obj->tms; + $this->tms = $this->db->jdate($obj->tms); $this->fk_contrat = $obj->fk_contrat; $this->fk_product = $obj->fk_product; $this->statut = $obj->statut; $this->label = $obj->label; $this->description = $obj->description; - $this->date_commande = $obj->date_commande; - $this->date_ouverture_prevue = $obj->date_ouverture_prevue; - $this->date_ouverture = $obj->date_ouverture; - $this->date_fin_validite = $obj->date_fin_validite; - $this->date_cloture = $obj->date_cloture; + $this->date_commande = $this->db->jdate($obj->date_commande); + $this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue); + $this->date_ouverture = $this->db->jdate($obj->date_ouverture); + $this->date_fin_validite = $this->db->jdate($obj->date_fin_validite); + $this->date_cloture = $this->db->jdate($obj->date_cloture); $this->tva_tx = $obj->tva_tx; $this->qty = $obj->qty; $this->remise_percent = $obj->remise_percent; diff --git a/htdocs/core/events.class.php b/htdocs/core/events.class.php index 71397a1e4ff..3aea6c07d21 100644 --- a/htdocs/core/events.class.php +++ b/htdocs/core/events.class.php @@ -166,10 +166,10 @@ class Events // extends CommonObject $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " ".$this->db->pdate('t.tms').","; + $sql.= " t.tms,"; $sql.= " t.type,"; $sql.= " t.entity,"; - $sql.= " ".$this->db->pdate('t.dateevent').","; + $sql.= " t.dateevent,"; $sql.= " t.description,"; $sql.= " t.ip,"; $sql.= " t.user_agent"; @@ -185,10 +185,10 @@ class Events // extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->tms = $obj->tms; + $this->tms = $this->db->jdate($obj->tms); $this->type = $obj->type; $this->entity = $obj->entity; - $this->dateevent = $obj->dateevent; + $this->dateevent = $this->db->jdate($obj->dateevent); $this->description = $obj->description; $this->ip = $obj->ip; $this->user_agent = $obj->user_agent; diff --git a/htdocs/don.class.php b/htdocs/don.class.php index dd9f49829b4..6de6cd53d54 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -426,8 +426,8 @@ class Don extends CommonObject */ function fetch($rowid) { - $sql = "SELECT d.rowid, ".$this->db->pdate("d.datec")." as datec,"; - $sql.= " ".$this->db->pdate("d.datedon")." as datedon,"; + $sql = "SELECT d.rowid, d.datec,"; + $sql.= " d.datedon,"; $sql.= " d.prenom, d.nom, d.societe, d.amount, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet,"; $sql.= " p.title as projet"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."don as d"; @@ -445,8 +445,8 @@ class Don extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->datec = $obj->datec; - $this->date = $obj->datedon; + $this->datec = $this->db->jdate($obj->datec); + $this->date = $this->db->jdate($obj->datedon); $this->prenom = $obj->prenom; $this->nom = $obj->nom; $this->societe = $obj->societe; diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index ecd266438fb..1ec800d66c7 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -227,7 +227,7 @@ class Expedition extends CommonObject $sql = "SELECT e.rowid, e.fk_soc as socid, e.date_creation, e.ref, e.fk_user_author, e.fk_statut"; $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; - $sql.= ", ".$this->db->pdate("e.date_expedition")." as date_expedition, e.model_pdf, e.fk_adresse_livraison"; + $sql.= ", e.date_expedition as date_expedition, e.model_pdf, e.fk_adresse_livraison"; $sql.= ", e.fk_expedition_methode, e.tracking_number"; $sql.= ", el.fk_source as origin_id"; $sql.= ", ori.ref_client"; @@ -263,7 +263,7 @@ class Expedition extends CommonObject $this->origin_id = $obj->origin_id; $this->livraison_id = $obj->livraison_id; $this->user_author_id = $obj->fk_user_author; - $this->date = $obj->date_expedition; + $this->date = $this->db->jdate($obj->date_expedition); $this->adresse_livraison_id = $obj->fk_adresse_livraison; // TODO obsolete $this->fk_delivery_address = $obj->fk_adresse_livraison; $this->modelpdf = $obj->model_pdf; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 615d4a88b55..f91ff0cbf56 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -545,11 +545,11 @@ class Facture extends CommonObject global $conf; $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.type,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; - $sql.= ','.$this->db->pdate('f.datef').' as df'; - $sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr'; - $sql.= ','.$this->db->pdate('f.datec').' as datec'; - $sql.= ','.$this->db->pdate('f.date_valid').' as datev'; - $sql.= ','.$this->db->pdate('f.tms').' as datem'; + $sql.= ', f.datef as df'; + $sql.= ', f.date_lim_reglement as dlr'; + $sql.= ', f.datec as datec'; + $sql.= ', f.date_valid as datev'; + $sql.= ', f.tms as datem'; $sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf'; $sql.= ', f.fk_facture_source'; $sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet'; @@ -576,9 +576,9 @@ class Facture extends CommonObject $this->ref = $obj->facnumber; $this->ref_client = $obj->ref_client; $this->type = $obj->type; - $this->date = $obj->df; - $this->date_creation = $obj->datec; - $this->date_validation = $obj->datev; + $this->date = $this->db->jdate($obj->df); + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); $this->amount = $obj->amount; $this->remise_percent = $obj->remise_percent; @@ -592,7 +592,7 @@ class Facture extends CommonObject $this->close_note = $obj->close_note; $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; - $this->date_lim_reglement = $obj->dlr; + $this->date_lim_reglement = $this->db->jdate($obj->dlr); $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement = $obj->mode_reglement_libelle; @@ -666,7 +666,7 @@ class Facture extends CommonObject { $sql = 'SELECT l.rowid, l.fk_product, l.description, l.product_type, l.price, l.qty, l.tva_taux, '; $sql.= ' l.remise, l.remise_percent, l.fk_remise_except, l.subprice,'; - $sql.= ' '.$this->db->pdate('l.date_start').' as date_start,'.$this->db->pdate('l.date_end').' as date_end,'; + $sql.= ' l.date_start as date_start, l.date_end as date_end,'; $sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta,'; $sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as label, p.description as product_desc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l'; @@ -699,10 +699,10 @@ class Facture extends CommonObject $faclig->fk_remise_except = $objp->fk_remise_except; $faclig->produit_id = $objp->fk_product; $faclig->fk_product = $objp->fk_product; - $faclig->date_start = $objp->date_start; - $faclig->date_end = $objp->date_end; - $faclig->date_start = $objp->date_start; - $faclig->date_end = $objp->date_end; + $faclig->date_start = $this->db->jdate($objp->date_start); + $faclig->date_end = $this->db->jdate($objp->date_end); + $faclig->date_start = $this->db->jdate($objp->date_start); + $faclig->date_end = $this->db->jdate($objp->date_end); $faclig->info_bits = $objp->info_bits; $faclig->total_ht = $objp->total_ht; $faclig->total_tva = $objp->total_tva; @@ -2865,7 +2865,7 @@ class FactureLigne { $sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_product, fd.product_type, fd.description, fd.price, fd.qty, fd.tva_taux,'; $sql.= ' fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,'; - $sql.= ' '.$this->db->pdate('fd.date_start').' as date_start,'.$this->db->pdate('fd.date_end').' as date_end,'; + $sql.= ' fd.date_start as date_start, fd.date_end as date_end,'; $sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.rang,'; $sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc'; @@ -2887,8 +2887,8 @@ class FactureLigne $this->produit_id = $objp->fk_product; // Ne plus utiliser $this->fk_product = $objp->fk_product; $this->product_type = $objp->product_type; - $this->date_start = $objp->date_start; - $this->date_end = $objp->date_end; + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); $this->info_bits = $objp->info_bits; $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php index 1cbe8a1d17c..c103f187c60 100644 --- a/htdocs/fichinter/fichinter.class.php +++ b/htdocs/fichinter/fichinter.class.php @@ -186,9 +186,9 @@ class Fichinter extends CommonObject function fetch($rowid,$ref='') { $sql = "SELECT rowid, ref, description, fk_soc, fk_statut,"; - $sql.= " ".$this->db->pdate("datec")." as datec,"; - $sql.= " ".$this->db->pdate("date_valid")." as datev,"; - $sql.= " ".$this->db->pdate("tms")." as datem,"; + $sql.= " datec,"; + $sql.= " as datev,"; + $sql.= " datem,"; $sql.= " duree, fk_projet, note_public, note_private, model_pdf"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; if ($ref) $sql.= " WHERE f.ref='".$ref."'"; @@ -208,9 +208,9 @@ class Fichinter extends CommonObject $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->duree = $obj->duree; - $this->datec = $obj->datec; - $this->datev = $obj->datev; - $this->datem = $obj->datem; + $this->datec = $this->db->jdate($obj->datec); + $this->datev = $this->db->jdate($obj->datev); + $this->datem = $this->db->jdate($obj->datem); $this->projetidp = $obj->fk_projet; $this->projet_id = $obj->fk_projet; $this->note_public = $obj->note_public; @@ -449,11 +449,11 @@ class Fichinter extends CommonObject { global $conf; - $sql = "SELECT f.rowid, "; - $sql.= $this->db->pdate("f.datec")." as datec"; - $sql.= ", ".$this->db->pdate("f.date_valid")." as datev"; - $sql.= ", f.fk_user_author"; - $sql.= ", f.fk_user_valid"; + $sql = "SELECT f.rowid,"; + $sql.= " datec,"; + $sql.= " f.date_valid as datev,"; + $sql.= " f.fk_user_author,"; + $sql.= " f.fk_user_valid"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " WHERE f.rowid = ".$id; $sql.= " AND f.entity = ".$conf->entity; @@ -468,8 +468,8 @@ class Fichinter extends CommonObject $this->id = $obj->rowid; - $this->date_creation = $obj->datec; - $this->date_validation = $obj->datev; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->datev); $cuser = new User($this->db, $obj->fk_user_author); $cuser->fetch(); @@ -818,7 +818,7 @@ class FichinterLigne function fetch($rowid) { $sql = 'SELECT ft.rowid, ft.fk_fichinter, ft.description, ft.duree, ft.rang,'; - $sql.= ' '.$this->db->pdate('ft.date').' as datei'; + $sql.= ' ft.date as datei'; $sql.= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql.= ' WHERE ft.rowid = '.$rowid; @@ -829,7 +829,7 @@ class FichinterLigne $objp = $this->db->fetch_object($result); $this->rowid = $objp->rowid; $this->fk_fichinter = $objp->fk_fichinter; - $this->datei = $objp->datei; + $this->datei = $this->db->jdate($objp->datei); $this->desc = $objp->description; $this->duration = $objp->duree; $this->rang = $objp->rang; diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php index 8af057bbbab..77dd62841b6 100644 --- a/htdocs/fourn/facture/paiementfourn.class.php +++ b/htdocs/fourn/facture/paiementfourn.class.php @@ -73,7 +73,7 @@ class PaiementFourn */ function fetch($id) { - $sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank,'; + $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.libelle as paiement_type,'; $sql.= ' p.num_paiement, p.note, b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiementfourn as p'; @@ -89,7 +89,7 @@ class PaiementFourn $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->date = $obj->dp; + $this->date = $this->db->jdate($obj->dp); $this->numero = $obj->num_paiement; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; @@ -342,10 +342,9 @@ class PaiementFourn */ function info($id) { - $sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_author'; - $sql .= ', '.$this->db->pdate('tms').' as tms'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; - $sql .= ' WHERE c.rowid = '.$id; + $sql = 'SELECT c.rowid, datec, fk_user_author, tms'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as c'; + $sql.= ' WHERE c.rowid = '.$id; $resql = $this->db->query($sql); if ($resql) @@ -367,8 +366,8 @@ class PaiementFourn $muser->fetch(); $this->user_modification = $muser; } - $this->date_creation = $obj->datec; - $this->date_modification = $obj->tms; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($resql); } @@ -538,7 +537,7 @@ class PaiementFourn $sql = "UPDATE ".MAIN_DB_PREFIX."paiementfourn"; $sql.= " SET datep = ".$this->db->idate($date); $sql.= " WHERE rowid = ".$this->id; - + dol_syslog("PaiementFourn::update_date sql=".$sql); $result = $this->db->query($sql); if ($result) diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 8a4c9f2b2c2..609a4323057 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -57,7 +57,7 @@ class CommandeFournisseur extends Commande { $this->db = $DB; $this->products = array(); - + // List of language codes for status $this->statuts[0] = 'StatusOrderDraft'; $this->statuts[1] = 'StatusOrderValidated'; @@ -81,7 +81,7 @@ class CommandeFournisseur extends Commande global $conf; $sql = "SELECT c.rowid, c.ref, c.date_creation, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva,"; - $sql.= " ".$this->db->pdate("c.date_commande")." as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,"; + $sql.= " c.date_commande as date_commande, c.fk_projet as fk_project, c.remise_percent, c.source, c.fk_methode_commande,"; $sql.= " c.note, c.note_public, c.model_pdf,"; $sql.= " cm.libelle as methode_commande"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; @@ -105,8 +105,8 @@ class CommandeFournisseur extends Commande $this->total_ht = $obj->total_ht; $this->total_tva = $obj->tva; $this->total_ttc = $obj->total_ttc; - $this->date_commande = $obj->date_commande; // date a laquelle la commande a ete transmise - $this->date = $obj->date_creation; + $this->date_commande = $this->db->jdate($obj->date_commande); // date a laquelle la commande a ete transmise + $this->date = $this->db->jdate($obj->date_creation); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_methode_commande; $this->methode_commande = $obj->methode_commande; diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 46b298f2a0c..e24be2a3283 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -216,10 +216,10 @@ class FactureFournisseur extends Facture { global $conf; - $sql = 'SELECT libelle, facnumber, amount, remise, '.$this->db->pdate(datef).'as df,'; + $sql = 'SELECT libelle, facnumber, amount, remise, datef as df,'; $sql.= ' total_ht, total_tva, total_ttc, fk_user_author,'; $sql.= ' fk_statut, fk_projet as fk_project, paye, f.note, f.note_public,'; - $sql.= ' '.$this->db->pdate('date_lim_reglement').'as de,'; + $sql.= ' date_lim_reglement as de,'; $sql.= ' s.nom as socnom, s.rowid as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' WHERE f.rowid='.$rowid.' AND f.fk_soc = s.rowid'; @@ -239,9 +239,9 @@ class FactureFournisseur extends Facture $this->type = 0; - $this->datep = $obj->df; - $this->date = $obj->df; - $this->date_echeance = $obj->de; + $this->datep = $this->db->jdate($obj->df); + $this->date = $this->db->jdate($obj->df); + $this->date_echeance = $this->db->jdate($obj->de); $this->libelle = $obj->libelle; $this->remise = $obj->remise; diff --git a/htdocs/html.formactions.class.php b/htdocs/html.formactions.class.php index cef201b5087..06ec32a5a01 100644 --- a/htdocs/html.formactions.class.php +++ b/htdocs/html.formactions.class.php @@ -31,7 +31,7 @@ class FormActions { var $db; var $error; - + /** * \brief Constructeur @@ -40,7 +40,7 @@ class FormActions function FormActions($DB) { $this->db = $DB; - + return 1; } @@ -85,7 +85,7 @@ class FormActions } } - + /** * \brief Show list of actions for element * \param object Object @@ -97,8 +97,8 @@ class FormActions { global $langs,$conf,$user; global $bc; - - $sql = 'SELECT a.id, '.$this->db->pdate('a.datep').' as da, a.label, a.note,'; + + $sql = 'SELECT a.id, a.datep as da, a.label, a.note,'; $sql.= ' u.login'; $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; $sql.= ' WHERE a.fk_user_author = u.rowid'; @@ -133,7 +133,7 @@ class FormActions $var=!$var; print ''; print ''.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''; - print ''.dol_print_date($objp->da,'day').''; + print ''.dol_print_date($this->db->jdate($objp->da),'day').''; print ''.dol_trunc($objp->label,32).''; print ''.$objp->login.''; print ''; @@ -141,7 +141,7 @@ class FormActions } print ''; } - + return $num; } else @@ -151,10 +151,10 @@ class FormActions } } - + /** * \brief Retourne la liste des types de comptes financiers - * \param selected Type pr�-s�lectionn� + * \param selected Type pre-selectionne * \param htmlname Nom champ formulaire */ function select_type_actions($selected='',$htmlname='actioncode') @@ -165,7 +165,7 @@ class FormActions require_once(DOL_DOCUMENT_ROOT."/html.form.class.php"); $caction=new CActionComm($this->db); $form=new Form($this->db); - + $arraylist=$caction->liste_array(1,'code'); $arraylist[0]=' '; asort($arraylist); @@ -173,5 +173,5 @@ class FormActions $form->select_array($htmlname, $arraylist, $selected); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); } - + } diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php index 5d164883567..8b446587ec7 100644 --- a/htdocs/livraison/livraison.class.php +++ b/htdocs/livraison/livraison.class.php @@ -250,7 +250,7 @@ class Livraison extends CommonObject $sql = "SELECT l.rowid, l.fk_soc, l.date_creation, l.date_valid, l.ref, l.ref_client, l.fk_user_author,"; $sql.=" l.total_ht, l.fk_statut, l.fk_expedition, l.fk_user_valid, l.note, l.note_public"; - $sql.= ", ".$this->db->pdate("l.date_livraison")." as date_livraison, l.fk_adresse_livraison, l.model_pdf"; + $sql.= ", l.date_livraison as date_livraison, l.fk_adresse_livraison, l.model_pdf"; $sql.= ", el.fk_source as origin_id"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON l.rowid = el.fk_target"; @@ -265,9 +265,9 @@ class Livraison extends CommonObject $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - $this->date_livraison = $obj->date_livraison; - $this->date_creation = $obj->date_creation; - $this->date_valid = $obj->date_valid; + $this->date_livraison = $this->db->jdate($obj->date_livraison); + $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_valid = $this->db->jdate($obj->date_valid); $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; $this->socid = $obj->fk_soc; diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index 9748d1a2ae9..3e34c2ff4b3 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -69,7 +69,7 @@ class Paiement */ function fetch($id) { - $sql = 'SELECT p.rowid,'.$this->db->pdate('p.datep').' as dp, p.amount, p.statut, p.fk_bank'; + $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank'; $sql.= ', c.code as type_code, c.libelle as type_libelle'; $sql.= ', p.num_paiement, p.note, b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p'; @@ -87,8 +87,8 @@ class Paiement $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; $this->ref = $obj->rowid; - $this->date = $obj->dp; - $this->datepaye = $obj->dp; + $this->date = $this->db->jdate($obj->dp); + $this->datepaye = $this->db->jdate($obj->dp); $this->numero = $obj->num_paiement; $this->bank_account = $obj->fk_account; $this->bank_line = $obj->fk_bank; @@ -337,10 +337,10 @@ class Paiement */ function info($id) { - $sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec, fk_user_creat, fk_user_modif'; - $sql .= ', '.$this->db->pdate('tms').' as tms'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as c'; - $sql .= ' WHERE c.rowid = '.$id; + $sql = 'SELECT c.rowid, c.datec, c.fk_user_creat, c.fk_user_modif,'; + $sql.= ' c.tms'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as c'; + $sql.= ' WHERE c.rowid = '.$id; dol_syslog('Paiement::info sql='.$sql); $result = $this->db->query($sql); @@ -363,8 +363,8 @@ class Paiement $muser->fetch(); $this->user_modification = $muser; } - $this->date_creation = $obj->datec; - $this->date_modification = $obj->tms; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); } diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 1c39958f604..a7dc682d60d 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -100,7 +100,7 @@ else } $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,'; -$sql.= ' p.fk_product_type, '.$db->pdate('p.tms').' as datem,'; +$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; if ($conf->categorie->enabled && ($catid || !$user->rights->categorie->voir)) @@ -340,7 +340,7 @@ if ($resql) } // Date - print ''.dol_print_date($objp->datem,'day')."\n"; + print ''.dol_print_date($this->db->jdate($objp->datem),'day')."\n"; // Duration if ($conf->service->enabled && $type != 0) diff --git a/htdocs/product/stock/entrepot.class.php b/htdocs/product/stock/entrepot.class.php index 88780fc97ce..f14c9c3977f 100644 --- a/htdocs/product/stock/entrepot.class.php +++ b/htdocs/product/stock/entrepot.class.php @@ -180,17 +180,17 @@ class Entrepot extends CommonObject $sql.= " WHERE fk_entrepot = " . $this->id; dol_syslog("Entrepot::delete sql=".$sql); $resql1=$this->db->query($sql); - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = " . $this->id; dol_syslog("Entrepot::delete sql=".$sql); $resql2=$this->db->query($sql); - + if ($resql1 && $resql2) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."entrepot"; $sql.= " WHERE rowid = " . $this->id; - + dol_syslog("Entrepot::delete sql=".$sql); $resql=$this->db->query($sql); if ($resql) @@ -213,7 +213,7 @@ class Entrepot extends CommonObject dol_syslog("Entrepot::delete ".$this->error, LOG_ERR); return -1; } - + } @@ -276,8 +276,8 @@ class Entrepot extends CommonObject */ function info($id) { - $sql = "SELECT e.rowid, ".$this->db->pdate("datec")." as datec,"; - $sql .= " ".$this->db->pdate("tms")." as datem,"; + $sql = "SELECT e.rowid, e.datec,"; + $sql .= " e.datem,"; $sql .= " fk_user_author"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql .= " WHERE e.rowid = ".$id; @@ -303,8 +303,8 @@ class Entrepot extends CommonObject $this->user_validation = $vuser; } - $this->date_creation = $obj->datec; - $this->date_modification = $obj->datem; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datem); } diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index a651b1dee92..b1f29f63ee6 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -69,7 +69,7 @@ $projectstatic = new Project($db); $userstatic = new User($db); $staticsoc=new Societe($db); -$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, ".$db->pdate("p.dateo")." as do, p.fk_user_resp,"; +$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.dateo as do, p.fk_user_resp,"; $sql.= " u.login,"; $sql.= " s.nom, s.rowid as socid, s.client"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 41a25810438..a5510470117 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -1514,7 +1514,7 @@ class Propal extends CommonObject } } - $sql= "SELECT rowid as facid, facnumber, total,".$this->db->pdate("datef")." as df, fk_user_author, fk_statut, paye"; + $sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye"; $sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; @@ -1692,8 +1692,8 @@ class Propal extends CommonObject function info($id) { $sql = "SELECT c.rowid, "; - $sql.= $this->db->pdate("datec")." as datec, ".$this->db->pdate("date_valid")." as datev, ".$this->db->pdate("date_cloture")." as dateo"; - $sql.= ", fk_user_author, fk_user_valid, fk_user_cloture"; + $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.= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql.= " WHERE c.rowid = ".$id; @@ -1707,9 +1707,9 @@ class Propal extends CommonObject $this->id = $obj->rowid; - $this->date_creation = $obj->datec; - $this->date_validation = $obj->datev; - $this->date_cloture = $obj->dateo; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_validation = $this->db->jdate($obj->datev); + $this->date_cloture = $this->db->jdate($obj->dateo); $cuser = new User($this->db, $obj->fk_user_author); $cuser->fetch(); diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index f8335ccf4e0..ea8305f3985 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -39,9 +39,9 @@ $langs->load("donations"); * View */ -$sql = "SELECT ".$db->pdate("d.datedon")." as datedon, d.nom, d.prenom, d.amount, d.public, d.societe"; -$sql .= " FROM ".MAIN_DB_PREFIX."don as d"; -$sql .= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC"; +$sql = "SELECT d.datedon as datedon, d.nom, d.prenom, d.amount, d.public, d.societe"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as d"; +$sql.= " WHERE d.fk_statut in (2, 3) ORDER BY d.datedon DESC"; if ( $db->query( $sql) ) { @@ -69,13 +69,13 @@ if ( $db->query( $sql) ) print ""; if ($objp->public) { - print "".stripslashes($objp->prenom)." ".stripslashes($objp->nom)." ".stripslashes($objp->societe)."\n"; + print "".$objp->prenom." ".$objp->nom." ".$objp->societe."\n"; } else { print "Anonyme Anonyme\n"; } - print "".dol_print_date($objp->datedon)."\n"; + print "".dol_print_date($this->db->jdate($objp->datedon))."\n"; print ''.number_format($objp->amount,2,'.',' ').' '.$langs->trans("Currency".$conf->monnaie).''; print ""; $i++; diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index f3789df8e37..1b13c4eee7c 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -102,6 +102,9 @@ class Societe extends CommonObject var $price_level; + var $datec; + var $date_update; + var $commercial_id; //Id du commercial affecte var $import_key; @@ -532,9 +535,9 @@ class Societe extends CommonObject } } - $sql = 'SELECT s.rowid, s.nom, s.entity, s.address,'.$this->db->pdate('s.datec').' as dc, s.prefix_comm'; + $sql = 'SELECT s.rowid, s.nom, s.entity, s.address, s.datec as dc, s.prefix_comm'; $sql .= ', s.price_level'; - $sql .= ','. $this->db->pdate('s.tms').' as date_update'; + $sql .= ', s.tms as date_update'; $sql .= ', s.tel, s.fax, s.email, s.url, s.cp, s.ville, s.note, s.client, s.fournisseur'; $sql .= ', s.siren, s.siret, s.ape, s.idprof4'; $sql .= ', s.capital, s.tva_intra'; @@ -580,7 +583,8 @@ class Societe extends CommonObject $this->ref = $obj->rowid; $this->entity = $obj->entity; - $this->date_update = $obj->date_update; + $this->datec = $this->db->jdate($obj->datec); + $this->date_update = $this->db->jdate($obj->date_update); $this->nom = $obj->nom; $this->address = $obj->address; @@ -640,7 +644,7 @@ class Societe extends CommonObject $this->prefix_comm = $obj->prefix_comm; - $this->remise_client = $obj->remise_client; + $this->remise_client = $obj->remise_client; $this->mode_reglement = $obj->mode_reglement; $this->cond_reglement = $obj->cond_reglement; $this->client = $obj->client; @@ -686,7 +690,7 @@ class Societe extends CommonObject global $conf,$langs; $sql = "SELECT l.rowid, l.label, l.fk_societe, l.nom, l.address, l.cp"; - $sql .= ", ".$this->db->pdate("l.tms")."as dm, ".$this->db->pdate("l.datec")."as dc"; + $sql .= ", l.tms as dm, l.datec as dc"; $sql .= ", l.ville, l.fk_pays, l.note, l.tel, l.fax"; $sql .= ", p.libelle as pays, p.code as pays_code, s.nom as socname"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_adresse_livraison as l"; @@ -701,8 +705,8 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - $this->datec = $obj->dc; - $this->datem = $obj->dm; + $this->datec = $this->db->jdate($obj->dc); + $this->datem = $this->db->jdate($obj->dm); $this->label = $obj->label; $this->socid = $obj->fk_societe; $this->societe = $obj->socname; @@ -1829,7 +1833,7 @@ class Societe extends CommonObject */ function info($id) { - $sql = "SELECT s.rowid, s.nom, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("datea")." as datea,"; + $sql = "SELECT s.rowid, s.nom, s.datec, s.datea,"; $sql.= " fk_user_creat, fk_user_modif"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE s.rowid = ".$id; @@ -1855,8 +1859,8 @@ class Societe extends CommonObject $this->user_modification = $muser; } $this->ref = $obj->nom; - $this->date_creation = $obj->datec; - $this->date_modification = $obj->datea; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->datea); } $this->db->free($result); diff --git a/htdocs/societe.php b/htdocs/societe.php index cb697d06695..061bc61f47a 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -153,7 +153,7 @@ if ($_GET['delsoc']) print '
'.$langs->trans("CompanyDeleted */ $title=$langs->trans("ListOfThirdParties"); -$sql = "SELECT s.rowid, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea"; +$sql = "SELECT s.rowid, s.nom, s.ville, s.datec, s.datea"; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur,"; $sql.= " s.siren as idprof1, s.siret as idprof2, ape as idprof3, idprof4 as idprof4"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 1b1d3c13cae..7e27e6ed06f 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -150,10 +150,10 @@ class User extends CommonObject $sql.= " u.pass, u.pass_crypted, u.pass_temp,"; $sql.= " u.fk_societe, u.fk_socpeople, u.fk_member, u.ldap_sid,"; $sql.= " u.statut, u.lang, u.entity,"; - $sql.= " ".$this->db->pdate("u.datec")." as datec,"; - $sql.= " ".$this->db->pdate("u.tms")." as datem,"; - $sql.= " ".$this->db->pdate("u.datelastlogin")." as datel,"; - $sql.= " ".$this->db->pdate("u.datepreviouslogin")." as datep"; + $sql.= " u.datec as datec,"; + $sql.= " u.tms as datem,"; + $sql.= " u.datelastlogin as datel,"; + $sql.= " u.datepreviouslogin as datep"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.entity IN (0,".$conf->entity.")"; if ($sid) @@ -200,10 +200,10 @@ class User extends CommonObject $this->lang = $obj->lang; $this->entity = $obj->entity; - $this->datec = $obj->datec; - $this->datem = $obj->datem; - $this->datelastlogin = $obj->datel; - $this->datepreviouslogin = $obj->datep; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); + $this->datelastlogin = $this->db->jdate($obj->datel); + $this->datepreviouslogin = $this->db->jdate($obj->datep); $this->webcal_login = $obj->webcal_login; $this->phenix_login = $obj->phenix_login; @@ -1765,8 +1765,8 @@ class User extends CommonObject */ function info($id) { - $sql = "SELECT u.rowid, u.login as ref, ".$this->db->pdate("datec")." as datec,"; - $sql.= $this->db->pdate("u.tms")." as date_modification, u.entity"; + $sql = "SELECT u.rowid, u.login as ref, u.datec,"; + $sql.= " u.tms as date_modification, u.entity"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE u.rowid = ".$id; @@ -1780,8 +1780,8 @@ class User extends CommonObject $this->id = $obj->rowid; $this->ref = (! $obj->ref) ? $obj->rowid : $obj->ref; - $this->date_creation = $obj->datec; - $this->date_modification = $obj->date_modification; + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_modification = $this->db->jdate($obj->date_modification); $this->entity = $obj->entity; } diff --git a/scripts/banks/build-graph-sold-example.php b/scripts/banks/build-graph-sold-example.php index efcb568b7a1..9caf28aaf55 100644 --- a/scripts/banks/build-graph-sold-example.php +++ b/scripts/banks/build-graph-sold-example.php @@ -141,16 +141,16 @@ foreach ($accounts as $account) $height = 280; // Calcul de $min et $max - $sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; + $sql = "SELECT min(datev), max(datev)"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank"; + $sql.= " WHERE fk_account = ".$account; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $row = $db->fetch_row($resql); - $min = $row[0]; - $max = $row[1]; + $min = $this->db->jdate($row[0]); + $max = $this->db->jdate($row[1]); } else {