Remove warnings

This commit is contained in:
Laurent Destailleur 2008-12-11 21:40:21 +00:00
parent f5931aa6f0
commit 51cf79a123
19 changed files with 314 additions and 246 deletions

View File

@ -71,7 +71,7 @@ class box_actions extends ModeleBoxes {
if ($user->rights->agenda->myactions->read) if ($user->rights->agenda->myactions->read)
{ {
$sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp , a.percent as percentage,"; $sql = "SELECT a.id, a.label, a.datep as dp , a.percent as percentage,";
$sql.= " ta.code,"; $sql.= " ta.code,";
$sql.= " s.nom, s.rowid as socid"; $sql.= " s.nom, s.rowid as socid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
@ -99,8 +99,9 @@ class box_actions extends ModeleBoxes {
{ {
$late = ''; $late = '';
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite=$db->jdate($obj->dp);
if (date("U",$objp->dp) < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) $late=img_warning($langs->trans("Late")); if ($datelimite < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) $late=img_warning($langs->trans("Late"));
$label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label); $label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label);
@ -118,7 +119,7 @@ class box_actions extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="left"', $this->info_box_contents[$i][3] = array('td' => 'align="left"',
'text' => dolibarr_print_date($objp->dp, "dayhour")); 'text' => dolibarr_print_date($datelimite, "dayhour"));
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',
'text' => $objp->percentage. "%"); 'text' => $objp->percentage. "%");

View File

@ -67,7 +67,7 @@ class box_clients extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, ".$db->pdate("s.datec")." as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.datec as dc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -85,12 +85,14 @@ class box_clients extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$datec=$db->jdate($objp->dc);
$i = 0; $i = 0;
//$customerstatic=new Client($db); //$customerstatic=new Client($db);
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->dc);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -101,7 +103,7 @@ class box_clients extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($datec, "day"));
$i++; $i++;
} }

View File

@ -89,7 +89,8 @@ class box_commandes extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows($result);
$datem=$db->jdate($objp->tms);
$i = 0; $i = 0;
@ -110,7 +111,7 @@ class box_commandes extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->tms,'day'), 'text' => dolibarr_print_date($datem,'day'),
); );
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',

View File

@ -62,9 +62,9 @@ class box_energie_releve extends ModeleBoxes {
$this->info_box_head = array('text' => $text,$max); $this->info_box_head = array('text' => $text,$max);
$sql = "SELECT ec.libelle, ".$db->pdate("date_releve")." as date_releve, ecr.valeur, ec.rowid"; $sql = "SELECT ec.libelle, ecr.valeur, ec.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr"; $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr,";
$sql .= " , ".MAIN_DB_PREFIX."energie_compteur as ec"; $sql .= " ".MAIN_DB_PREFIX."energie_compteur as ec";
$sql .= " WHERE ecr.fk_compteur = ec.rowid"; $sql .= " WHERE ecr.fk_compteur = ec.rowid";
$sql .= " ORDER BY ecr.date_releve DESC LIMIT 5"; $sql .= " ORDER BY ecr.date_releve DESC LIMIT 5";
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -16,144 +16,143 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/includes/boxes/box_factures.php \file htdocs/includes/boxes/box_factures.php
\ingroup factures \ingroup factures
\brief Module de génération de l'affichage de la box factures \brief Module de génération de l'affichage de la box factures
*/ \version $Id$
*/
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
class box_factures extends ModeleBoxes { class box_factures extends ModeleBoxes {
var $boxcode="lastcustomerbills"; var $boxcode="lastcustomerbills";
var $boximg="object_bill"; var $boximg="object_bill";
var $boxlabel; var $boxlabel;
var $depends = array("facture"); var $depends = array("facture");
var $db; var $db;
var $param; var $param;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/** /**
* \brief Constructeur de la classe * \brief Constructeur de la classe
*/ */
function box_factures() function box_factures()
{ {
global $langs; global $langs;
$langs->load("boxes"); $langs->load("boxes");
$this->boxlabel=$langs->trans("BoxLastCustomerBills"); $this->boxlabel=$langs->trans("BoxLastCustomerBills");
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les données en mémoire pour affichage ultérieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements à charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
global $user, $langs, $db; global $user, $langs, $db;
$this->max=$max; $this->max=$max;
include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); include_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$text = $langs->trans("BoxTitleLastCustomerBills",$max); $text = $langs->trans("BoxTitleLastCustomerBills",$max);
$this->info_box_head = array( $this->info_box_head = array(
'text' => $text, 'text' => $text,
'limit'=> strlen($text) 'limit'=> strlen($text)
); );
if ($user->rights->facture->lire) if ($user->rights->facture->lire)
{ {
$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, ".$db->pdate("f.datef")." as df,"; $sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.datec,"; $sql.= " f.paye, f.fk_statut, f.datec,";
$sql.= " s.nom, s.rowid as socid, "; $sql.= " s.nom, s.rowid as socid,";
$sql.= $db->pdate('f.date_lim_reglement')." as datelimite "; $sql.= " f.date_lim_reglement as datelimite ";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " WHERE f.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) if($user->societe_id)
{ {
$sql.= " AND s.rowid = ".$user->societe_id; $sql.= " AND s.rowid = ".$user->societe_id;
} }
$sql.= " ORDER BY f.datef DESC, f.facnumber DESC "; $sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($result) $i = 0;
{ $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
$num = $db->num_rows();
$i = 0; while ($i < $num)
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; {
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$datec=$db->jdate($objp->datec);
while ($i < $num) $picto='bill';
{ if ($objp->type == 1) $picto.='r';
$objp = $db->fetch_object($result); if ($objp->type == 2) $picto.='a';
$late = '';
if($objp->paye == 0 && $datelimite < (time() - $conf->facture->warning_delay)) { $late = img_warning(sprintf($l_due_date,dolibarr_print_date($datelimite,'day')));}
$picto='bill'; $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
if ($objp->type == 1) $picto.='r';
if ($objp->type == 2) $picto.='a';
$late = '';
if($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->warning_delay)) { $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day')));}
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $picto, 'logo' => $picto,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->facnumber, 'text' => $objp->facnumber,
'text2'=> $late, 'text2'=> $late,
'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid); 'url' => DOL_URL_ROOT."/compta/facture.php?facid=".$objp->facid);
$this->info_box_contents[$i][2] = array('td' => 'align="left"', $this->info_box_contents[$i][2] = array('td' => 'align="left"',
'text' => $objp->nom, 'text' => $objp->nom,
'maxlength'=>40, 'maxlength'=>40,
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day'), 'text' => dolibarr_print_date($datec,'day'),
); );
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;
} }
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices")); if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices"));
} }
else else
{ {
$this->info_box_contents[0][0] = array( 'td' => 'align="left"', $this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500, 'maxlength'=>500,
'text' => ($db->error().' sql='.$sql)); 'text' => ($db->error().' sql='.$sql));
} }
} }
else { else {
$this->info_box_contents[0][0] = array('td' => 'align="left"', $this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed")); 'text' => $langs->trans("ReadPermissionNotAllowed"));
} }
} }
function showBox() function showBox()
{ {
parent::showBox($this->info_box_head, $this->info_box_contents); parent::showBox($this->info_box_head, $this->info_box_contents);
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/includes/boxes/box_factures_fourn.php * \file htdocs/includes/boxes/box_factures_fourn.php
\ingroup fournisseur * \ingroup supplier
\brief Fichier de gestion d'une box des factures fournisseurs * \brief Fichier de gestion d'une box des factures fournisseurs
\version $Id$ * \version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
@ -71,9 +71,11 @@ class box_factures_fourn extends ModeleBoxes {
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.rowid as facid, f.facnumber, f.amount,".$db->pdate("f.datef")." as df,"; $sql.= " f.rowid as facid, f.facnumber, f.amount,";
$sql.= " f.paye, f.fk_statut, f.datec,"; $sql.= " f.paye, f.fk_statut,";
$sql.= ' '.$db->pdate('f.date_lim_reglement').' as datelimite '; $sql.= ' f.datef as df,';
$sql.= ' f.datec as datec,';
$sql.= ' f.date_lim_reglement as datelimite ';
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -87,7 +89,6 @@ class box_factures_fourn extends ModeleBoxes {
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -98,8 +99,11 @@ class box_factures_fourn extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite=$db->jdate($obj->datelimite);
$datec=$db->jdate($objp->datec);
$late = ''; $late = '';
if ($objp->paye == 0 && $objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($objp->datelimite,'day'))); if ($objp->paye == 0 && $datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($datelimite,'day')));
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -115,7 +119,7 @@ class box_factures_fourn extends ModeleBoxes {
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day')); 'text' => dolibarr_print_date($datec,'day'));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));

View File

@ -68,10 +68,9 @@ class box_factures_fourn_imp extends ModeleBoxes {
if ($user->rights->fournisseur->facture->lire) if ($user->rights->fournisseur->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.facnumber,".$db->pdate("f.date_lim_reglement")." as datelimite,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
$sql.= " f.amount,".$db->pdate("f.datef")." as df,"; $sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= " f.paye, f.fk_statut, f.rowid as facid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f";
@ -96,9 +95,10 @@ class box_factures_fourn_imp extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$late=''; $late='';
if ($objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day'))); if ($datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($datelimite,'day')));
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -114,7 +114,7 @@ class box_factures_fourn_imp extends ModeleBoxes {
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day')); 'text' => dolibarr_print_date($datelimite,'day'));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));

View File

@ -72,8 +72,8 @@ class box_factures_imp extends ModeleBoxes {
if ($user->rights->facture->lire) if ($user->rights->facture->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " f.facnumber,".$db->pdate("f.date_lim_reglement")." as datelimite,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
$sql.= " f.amount,".$db->pdate("f.datef")." as df,"; $sql.= " f.amount, f.datef as df,";
$sql.= " f.paye, f.fk_statut, f.rowid as facid"; $sql.= " f.paye, f.fk_statut, f.rowid as facid";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
@ -99,9 +99,10 @@ class box_factures_imp extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$late=''; $late='';
if ($objp->datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($objp->datelimite,'day'))); if ($datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($datelimite,'day')));
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -118,10 +119,10 @@ class box_factures_imp extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datelimite,'day'), 'text' => dolibarr_print_date($datelimite,'day'),
); );
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3)); 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3));
$i++; $i++;

View File

@ -66,7 +66,7 @@ class box_fournisseurs extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, ".$db->pdate("s.datec")." as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.datec as dc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -80,7 +80,6 @@ class box_fournisseurs extends ModeleBoxes {
$sql .= $db->plimit($max, 0); $sql .= $db->plimit($max, 0);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -90,6 +89,7 @@ class box_fournisseurs extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->dc);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -100,7 +100,7 @@ class box_fournisseurs extends ModeleBoxes {
'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/fourn/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($datec, "day"));
$i++; $i++;
} }

View File

@ -89,6 +89,7 @@ class box_produits extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datem=$db->jdate($obj->tms);
// Multilangs // Multilangs
if ($conf->global->MAIN_MULTILANGS) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
@ -130,7 +131,7 @@ class box_produits extends ModeleBoxes {
'text' => $price_base_type); 'text' => $price_base_type);
$this->info_box_contents[$i][4] = array('td' => 'align="right"', $this->info_box_contents[$i][4] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->tms,'day')); 'text' => dolibarr_print_date($datem,'day'));
$this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"',
'text' => $productstatic->LibStatut($objp->envente,3)); 'text' => $productstatic->LibStatut($objp->envente,3));

View File

@ -73,7 +73,7 @@ class box_propales extends ModeleBoxes {
{ {
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
$sql.= " p.rowid, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp, p.datec"; $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -90,13 +90,14 @@ class box_propales extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -111,7 +112,7 @@ class box_propales extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datec,'day')); 'text' => dolibarr_print_date($datec,'day'));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $propalstatic->LibStatut($objp->fk_statut,3)); 'text' => $propalstatic->LibStatut($objp->fk_statut,3));

View File

@ -71,7 +71,7 @@ class box_prospect extends ModeleBoxes {
if ($user->rights->societe->lire) if ($user->rights->societe->lire)
{ {
$sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, ".$db->pdate("s.datec")." as dc"; $sql = "SELECT s.nom, s.rowid as socid, s.fk_stcomm, s.datec as dc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -95,6 +95,7 @@ class box_prospect extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$datec=$db->jdate($objp->dc);
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -105,7 +106,7 @@ class box_prospect extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][2] = array('td' => 'align="right"', $this->info_box_contents[$i][2] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->dc, "day")); 'text' => dolibarr_print_date($datec, "day"));
$this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][3] = array('td' => 'align="right" width="18"',
'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3))); 'text' => eregi_replace('img ','img height="14px" ',$prospectstatic->LibStatut($objp->fk_stcomm,3)));

View File

@ -104,6 +104,7 @@ class box_services_vendus extends ModeleBoxes {
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datem=$db->jdate($objp->datem);
// Multilangs // Multilangs
if ($conf->global->MAIN_MULTILANGS) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
@ -135,7 +136,7 @@ class box_services_vendus extends ModeleBoxes {
'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid); 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'align="right"', $this->info_box_contents[$i][3] = array('td' => 'align="right"',
'text' => dolibarr_print_date($objp->datem,'day')); 'text' => dolibarr_print_date($datem,'day'));
$this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"', $this->info_box_contents[$i][4] = array('td' => 'align="right" width="18"',
'text' => $contratlignestatic->LibStatut($objp->statut,3) 'text' => $contratlignestatic->LibStatut($objp->statut,3)

View File

@ -103,6 +103,8 @@ class ModeleBoxes
$bcx[1] = 'class="box_impair"'; $bcx[1] = 'class="box_impair"';
$var = true; $var = true;
dolibarr_syslog("modules_box::showBox ".get_Class($this));
// Define nbcol and nblines of the box to show // Define nbcol and nblines of the box to show
$nbcol=0; $nbcol=0;
if (isset($contents[0])) $nbcol=sizeof($contents[0]); if (isset($contents[0])) $nbcol=sizeof($contents[0]);

View File

@ -80,7 +80,7 @@ class DoliDb
\param name Nom de la database \param name Nom de la database
\param port Port of database server \param port Port of database server
\return int 1 en cas de succ<EFBFBD>s, 0 sinon \return int 1 en cas de succ<EFBFBD>s, 0 sinon
*/ */
function DoliDb($type='mssql', $host, $user, $pass, $name='', $port=0) function DoliDb($type='mssql', $host, $user, $pass, $name='', $port=0)
{ {
global $conf,$langs; global $conf,$langs;
@ -165,7 +165,7 @@ class DoliDb
* \brief Selectionne une database. * \brief Selectionne une database.
* \param database Nom de la database * \param database Nom de la database
* \return boolean true si ok, false si ko * \return boolean true si ok, false si ko
*/ */
function select_db($database) function select_db($database)
{ {
return mssql_select_db($database, $this->db); return mssql_select_db($database, $this->db);
@ -180,7 +180,7 @@ class DoliDb
\param port Port of database server \param port Port of database server
\return resource handler d'acc<EFBFBD>s <EFBFBD> la bas \return resource handler d'acc<EFBFBD>s <EFBFBD> la bas
\seealso close \seealso close
*/ */
function connect($host, $login, $passwd, $name, $port=0) function connect($host, $login, $passwd, $name, $port=0)
{ {
dolibarr_syslog("DoliDB::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name"); dolibarr_syslog("DoliDB::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name");
@ -198,7 +198,7 @@ class DoliDb
/** /**
\brief Renvoie la version du serveur \brief Renvoie la version du serveur
\return string Chaine version \return string Chaine version
*/ */
function getVersion() function getVersion()
{ {
$resql=$this->query("SELECT @@VERSION"); $resql=$this->query("SELECT @@VERSION");
@ -210,7 +210,7 @@ class DoliDb
/** /**
\brief Renvoie la version du serveur dans un tableau \brief Renvoie la version du serveur dans un tableau
\return array Tableau de chaque niveau de version \return array Tableau de chaque niveau de version
*/ */
function getVersionArray() function getVersionArray()
{ {
return split('\.',$this->getVersion()); return split('\.',$this->getVersion());
@ -221,7 +221,7 @@ class DoliDb
\brief Fermeture d'une connexion vers une database. \brief Fermeture d'une connexion vers une database.
\return resource \return resource
\seealso connect \seealso connect
*/ */
function close() function close()
{ {
return mssql_close($this->db); return mssql_close($this->db);
@ -277,7 +277,7 @@ class DoliDb
/** /**
\brief Annulation d'une transaction et retour aux anciennes valeurs \brief Annulation d'une transaction et retour aux anciennes valeurs
\return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/ */
function rollback() function rollback()
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
@ -298,7 +298,7 @@ class DoliDb
\brief Effectue une requete et renvoi le resultset de r<EFBFBD>ponse de la base \brief Effectue une requete et renvoi le resultset de r<EFBFBD>ponse de la base
\param query Contenu de la query \param query Contenu de la query
\return resource Resultset de la reponse \return resource Resultset de la reponse
*/ */
function query($query) function query($query)
{ {
$query = trim($query); $query = trim($query);
@ -533,24 +533,37 @@ class DoliDb
} }
/** /**
\brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date. * \brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date.
Fonction <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les INSERT. * Fonction a utiliser pour generer les INSERT.
\param param Date TMS <EFBFBD> convertir * \param param Date TMS a convertir
\return date Date au format texte YYYYMMDDHHMMSS. * \return date Date au format texte YYYYMMDDHHMMSS.
*/ */
function idate($param) function idate($param)
{ {
//return "dbo.from_unixtime(".$param.")"; //return "dbo.from_unixtime(".$param.")";
return adodb_strftime("%d/%m/%Y %H:%M:%S",$param); return adodb_strftime("%Y-%m-%d %H:%M:%S",$param);
} }
/**
* \brief Convert a GM string date into a GM Timestamps date
* \param string Date in a string (YYYYMMDD, YYYYMMDDHHMMSS, YYYY-MM-DD HH:MM:SS)
* \return date Date
* \example 19700101020000 -> 7200
*/
function jdate($string)
{
$string=eregi_replace('[^0-9]','',$string);
$tmp=$string.'000000';
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
return $date;
}
/** /**
\brief Formatage d'un if SQL * \brief Formatage d'un if SQL
\param test chaine test * \param test chaine test
\param resok resultat si test egal * \param resok resultat si test egal
\param resko resultat si test non egal * \param resko resultat si test non egal
\return string chaine format<EFBFBD> SQL * \return string chaine format<EFBFBD> SQL
*/ */
function ifsql($test,$resok,$resko) function ifsql($test,$resok,$resko)
{ {
@ -559,8 +572,8 @@ class DoliDb
/** /**
\brief Renvoie la derniere requete soumise par la methode query() * \brief Renvoie la derniere requete soumise par la methode query()
\return lastquery * \return lastquery
*/ */
function lastquery() function lastquery()
{ {
@ -632,7 +645,7 @@ class DoliDb
1216 => 'DB_ERROR_NO_PARENT', 1216 => 'DB_ERROR_NO_PARENT',
1217 => 'DB_ERROR_CHILD_EXISTS', 1217 => 'DB_ERROR_CHILD_EXISTS',
1451 => 'DB_ERROR_CHILD_EXISTS' 1451 => 'DB_ERROR_CHILD_EXISTS'
); );
if (isset($errorcode_map[$this->lasterrno])) if (isset($errorcode_map[$this->lasterrno]))
{ {

View File

@ -514,12 +514,12 @@ class DoliDb
/** /**
* \brief Formatage (par la base de donn<EFBFBD>es) d'un champ de la base au format TMS ou Date (YYYY-MM-DD HH:MM:SS) * \brief Formatage (par la base de donn<EFBFBD>es) d'un champ de la base au format TMS ou Date (YYYY-MM-DD HH:MM:SS)
* afin de retourner une donn<EFBFBD>e toujours au format universel date TMS unix. * afin de retourner une donn<EFBFBD>e toujours au format universel date TMS unix.
* Fonction <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les SELECT. * Fonction <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les SELECT.
* \param param Nom champ base de type date ou chaine 'YYYY-MM-DD HH:MM:SS' * \param param Nom champ base de type date ou chaine 'YYYY-MM-DD HH:MM:SS'
* \return date Date au format TMS. * \return date Date au format TMS.
* \TODO Remove unix_timestamp functions * \TODO Remove unix_timestamp functions so use jdate instead
*/ */
function pdate($param) function pdate($param)
{ {
@ -527,23 +527,37 @@ class DoliDb
} }
/** /**
* \brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date. * \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
* Fonction <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les INSERT, UPDATE ou les clauses WHERE * Function to use to build INSERT, UPDATE or WHERE predica
* \param param Date TMS <EFBFBD> convertir * \param param Date TMS to convert
* \return date Date au format texte YYYYMMDDHHMMSS. * \return string Date in a string YYYYMMDDHHMMSS
*/ */
function idate($param) function idate($param)
{ {
return adodb_strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }
/**
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* \return date Date TMS
* \example 19700101020000 -> 7200
*/
function jdate($string)
{
$string=eregi_replace('[^0-9]','',$string);
$tmp=$string.'000000';
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
return $date;
}
/** /**
\brief Formatage d'un if SQL * \brief Formatage d'un if SQL
\param test chaine test * \param test chaine test
\param resok resultat si test egal * \param resok resultat si test egal
\param resko resultat si test non egal * \param resko resultat si test non egal
\return string chaine format<EFBFBD> SQL * \return string chaine format<EFBFBD> SQL
*/ */
function ifsql($test,$resok,$resko) function ifsql($test,$resok,$resko)
{ {
@ -552,8 +566,8 @@ class DoliDb
/** /**
\brief Renvoie la derniere requete soumise par la methode query() * \brief Renvoie la derniere requete soumise par la methode query()
\return lastquery * \return lastquery
*/ */
function lastquery() function lastquery()
{ {
@ -561,8 +575,8 @@ class DoliDb
} }
/** /**
\brief Renvoie la derniere requete en erreur * \brief Renvoie la derniere requete en erreur
\return string lastqueryerror * \return string lastqueryerror
*/ */
function lastqueryerror() function lastqueryerror()
{ {
@ -570,8 +584,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le libelle derniere erreur * \brief Renvoie le libelle derniere erreur
\return string lasterror * \return string lasterror
*/ */
function lasterror() function lasterror()
{ {
@ -579,8 +593,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le code derniere erreur * \brief Renvoie le code derniere erreur
\return string lasterrno * \return string lasterrno
*/ */
function lasterrno() function lasterrno()
{ {
@ -588,8 +602,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le code erreur generique de l'operation precedente. * \brief Renvoie le code erreur generique de l'operation precedente.
\return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) * \return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() function errno()
{ {

View File

@ -533,7 +533,7 @@ class DoliDb
* Fonction a utiliser pour generer les SELECT. * Fonction a utiliser pour generer les SELECT.
* \param param Nom champ base de type date ou chaine 'YYYY-MM-DD HH:MM:SS' * \param param Nom champ base de type date ou chaine 'YYYY-MM-DD HH:MM:SS'
* \return date Date au format TMS. * \return date Date au format TMS.
* \TODO Remove unix_timestamp functions * \TODO Remove unix_timestamp functions so use jdate instead
*/ */
function pdate($param) function pdate($param)
{ {
@ -541,23 +541,37 @@ class DoliDb
} }
/** /**
* \brief Formatage (par PHP) d'une date vers format texte pour insertion dans champ date. * \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
* Fonction a utiliser pour generer les INSERT, UPDATE ou les clauses WHERE * Function to use to build INSERT, UPDATE or WHERE predica
* \param param Date TMS to convert * \param param Date TMS to convert
* \return date Date au format texte YYYYMMDDHHMMSS. * \return string Date in a string YYYYMMDDHHMMSS
*/ */
function idate($param) function idate($param)
{ {
return adodb_strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }
/**
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* \return date Date TMS
* \example 19700101020000 -> 7200
*/
function jdate($string)
{
$string=eregi_replace('[^0-9]','',$string);
$tmp=$string.'000000';
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
return $date;
}
/** /**
\brief Formatage d'un if SQL * \brief Formatage d'un if SQL
\param test chaine test * \param test chaine test
\param resok resultat si test egal * \param resok resultat si test egal
\param resko resultat si test non egal * \param resko resultat si test non egal
\return string chaine format<EFBFBD> SQL * \return string chaine formatee SQL
*/ */
function ifsql($test,$resok,$resko) function ifsql($test,$resok,$resko)
{ {
@ -566,8 +580,8 @@ class DoliDb
/** /**
\brief Renvoie la derniere requete soumise par la methode query() * \brief Renvoie la derniere requete soumise par la methode query()
\return lastquery * \return lastquery
*/ */
function lastquery() function lastquery()
{ {
@ -575,8 +589,8 @@ class DoliDb
} }
/** /**
\brief Renvoie la derniere requete en erreur * \brief Renvoie la derniere requete en erreur
\return string lastqueryerror * \return string lastqueryerror
*/ */
function lastqueryerror() function lastqueryerror()
{ {
@ -584,8 +598,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le libelle derniere erreur * \brief Renvoie le libelle derniere erreur
\return string lasterror * \return string lasterror
*/ */
function lasterror() function lasterror()
{ {
@ -593,8 +607,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le code derniere erreur * \brief Renvoie le code derniere erreur
\return string lasterrno * \return string lasterrno
*/ */
function lasterrno() function lasterrno()
{ {
@ -602,8 +616,8 @@ class DoliDb
} }
/** /**
\brief Renvoie le code erreur generique de l'operation precedente. * \brief Renvoie le code erreur generique de l'operation precedente.
\return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) * \return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() function errno()
{ {

View File

@ -658,25 +658,38 @@ class DoliDb
return "unix_timestamp(".$param.")"; return "unix_timestamp(".$param.")";
} }
/** /**
\brief Formatage (par PHP) de la date en texte qui s'insere dans champ date. * \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
Fonction <EFBFBD> utiliser pour g<EFBFBD>n<EFBFBD>rer les INSERT. * Function to use to build INSERT, UPDATE or WHERE predica
\param param Date tms <EFBFBD> convertir * \param param Date TMS to convert
\return date Date au format text YYYYMMDDHHMMSS. * \return string Date in a string YYYYMMDDHHMMSS
*/ */
function idate($param) function idate($param)
{ {
return adodb_strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }
/**
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* \return date Date TMS
* \example 19700101020000 -> 7200
*/
function jdate($string)
{
$string=eregi_replace('[^0-9]','',$string);
$tmp=$string.'000000';
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
return $date;
}
/** /**
\brief Formatage d'un if SQL * \brief Formatage d'un if SQL
\param test chaine test * \param test chaine test
\param resok resultat si test egal * \param resok resultat si test egal
\param resko resultat si test non egal * \param resko resultat si test non egal
\return string chaine format<EFBFBD> SQL * \return string chaine format<EFBFBD> SQL
*/ */
function ifsql($test,$resok,$resko) function ifsql($test,$resok,$resko)
{ {
return 'IF('.$test.','.$resok.','.$resko.')'; return 'IF('.$test.','.$resok.','.$resko.')';
@ -684,18 +697,18 @@ class DoliDb
/** /**
\brief Renvoie la derniere requete soumise par la methode query() * \brief Renvoie la derniere requete soumise par la methode query()
\return lastquery * \return lastquery
*/ */
function lastquery() function lastquery()
{ {
return $this->lastquery; return $this->lastquery;
} }
/** /**
\brief Renvoie la derniere requete en erreur * \brief Renvoie la derniere requete en erreur
\return string lastqueryerror * \return string lastqueryerror
*/ */
function lastqueryerror() function lastqueryerror()
{ {
return $this->lastqueryerror; return $this->lastqueryerror;

View File

@ -475,7 +475,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$time,$reg)) if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$time,$reg))
{ {
// This part of code should not be used. // This part of code should not be used.
dolibarr_syslog("Functions.lib::dolibarr_print_date function call with deprecated parameter", LOG_WARNING); dolibarr_syslog("Functions.lib::dolibarr_print_date function call with deprecated parameter in page ".$_SERVER["PHP_SELF"], LOG_WARNING);
// Date est au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS' // Date est au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
$syear = $reg[1]; $syear = $reg[1];
$smonth = $reg[2]; $smonth = $reg[2];