diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index d7c493b613a..65b4dbb4df2 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -386,6 +386,8 @@ class ActionComm { global $conf, $user; + $now=gmmktime(); // gmmktime(0,0,0,1,1,1970) -> 0, mktime(0,0,0,1,1,1970) -> -3600; + $this->nbtodo=$this->nbtodolate=0; $sql = "SELECT a.id, a.datep as dp"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; @@ -400,7 +402,7 @@ class ActionComm while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($this->db->jdate($obj->dp) < (time() - $conf->actions->warning_delay)) $this->nbtodolate++; + if (isset($obj->dp) && $this->db->jdate($obj->dp) < ($now - $conf->actions->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/adherents/adherent.class.php b/htdocs/adherents/adherent.class.php index c372224af6a..d4ee294eac9 100644 --- a/htdocs/adherents/adherent.class.php +++ b/htdocs/adherents/adherent.class.php @@ -1699,10 +1699,12 @@ class Adherent extends CommonObject { global $conf; + $now=gmmktime(); + if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT a.rowid,".$this->db->pdate("a.datefin")." as datefin"; + $sql = "SELECT a.rowid, a.datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " WHERE a.statut=1"; $resql=$this->db->query($sql); @@ -1711,7 +1713,7 @@ class Adherent extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->adherent->cotisation->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->adherent->cotisation->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index cae63b638ad..6935a41ac56 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -636,7 +636,9 @@ if ($_GET["id"]) dolibarr_fiche_head($head, $hselected, $langs->trans("Action")); - + $now=gmmktime(); + $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + // Confirmation suppression action if ($_GET["action"] == 'delete') { @@ -700,14 +702,12 @@ if ($_GET["id"]) if ($_REQUEST["afaire"] == 1) $html->select_date($act->datep,'ap',1,1,0,"action",1,1); else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datep,'ap',1,1,1,"action",1,1); else $html->select_date($act->datep,'ap',1,1,1,"action",1,1); - if ($act->percentage == 0 && $act->datep && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); print ''; // Date end print ''.$langs->trans("DateActionEnd").''; if ($_REQUEST["afaire"] == 1) $html->select_date($act->datef,'p2',1,1,1,"action",1,1); else if ($_REQUEST["afaire"] == 2) $html->select_date($act->datef,'p2',1,1,1,"action",1,1); else $html->select_date($act->datef,'p2',1,1,1,"action",1,1); - if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); print ''; // Status @@ -820,13 +820,13 @@ if ($_GET["id"]) // Date debut print ''.$langs->trans("DateActionStart").''; print dolibarr_print_date($act->datep,'dayhour'); - if ($act->percentage == 0 && $act->datep && $act->datep < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); + if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late")); print ''; // Date fin print ''.$langs->trans("DateActionEnd").''; print dolibarr_print_date($act->datef,'dayhour'); - if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) print img_warning($langs->trans("Late")); + if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late")); print ''; // Statut diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index d58d53e2063..38722e50c57 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -101,8 +101,8 @@ llxHeader(); $form=new Form($db); $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; -$sql.= " a.id, ".$db->pdate("a.datep")." as dp, ".$db->pdate("a.datep2")." as dp2,"; -//$sql.= " ".$db->pdate("a.datea")." as da, ".$db->pdate("a.datea2")." as da2,"; +$sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; +//$sql.= " a.datea as da, a.datea2 as da2,"; $sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; $sql.= " c.code as acode, c.libelle,"; $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; @@ -233,8 +233,8 @@ if ($resql) print ''; print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder); //print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder); @@ -244,7 +244,9 @@ if ($resql) print "\n"; $contactstatic = new Contact($db); - + $now=gmmktime(); + $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + $var=true; while ($i < min($num,$limit)) { @@ -268,17 +270,17 @@ if ($resql) //print ''; print ''; - print dolibarr_print_date($obj->dp,"day"); + print dolibarr_print_date($db->jdate($obj->dp),"day"); $late=0; - if ($obj->percent == 0 && $obj->dp && date("U",$obj->dp) < time()) $late=1; - if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && date("U",$obj->dp) < time()) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && date("U",$obj->dp2) < time()) $late=1; - if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && date("U",$obj->dp) < time()) $late=1; + if ($obj->percent == 0 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; + if ($obj->percent == 0 && ! $obj->dp && $obj->dp2 && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && $db->jdate($obj->dp2) < ($now - $delay_warning)) $late=1; + if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && $db->jdate($obj->dp) < ($now - $delay_warning)) $late=1; if ($late) print img_warning($langs->trans("Late")); print ''; print ''; - print dolibarr_print_date($obj->dp2,"day"); + print dolibarr_print_date($db->jdate($obj->dp2),"day"); print ''; // Third party diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index f0ef4bf6c5c..152df021102 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -345,7 +345,8 @@ if ($socid > 0) print ''; print '
'; - + $now=gmmktime(); + /* * Dernieres propales */ @@ -380,7 +381,7 @@ if ($socid > 0) $objp = $db->fetch_object($resql); print ""; print "propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."\n"; - if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + if ( ($objp->dp < $now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) { print " ".img_warning(); } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0907640b534..935e8304aa7 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -418,6 +418,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire) { $langs->load("propal"); + $now=gmmktime(); + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; @@ -454,7 +456,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) print $propalstatic->getNomUrl(1); print ''; print ''; - if ($obj->dp < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($obj->dp < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; print ''; $filename=sanitizeFileName($obj->ref); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e95dc4c20db..20fc071dfed 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -857,6 +857,8 @@ if ($_GET['propalid'] > 0) * */ + $now=gmmktime(); + if ($mesg) print $mesg."
"; $propal = new Propal($db); @@ -1001,7 +1003,7 @@ if ($_GET['propalid'] > 0) if ($propal->fin_validite) { print dolibarr_print_date($propal->fin_validite,'daytext'); - if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($propal->statut == 1 && $propal->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { @@ -1872,6 +1874,8 @@ else * Mode Liste des propales * * * ****************************************************************************/ + + $now=gmmktime(); $sortorder=$_GET['sortorder']; $sortfield=$_GET['sortfield']; @@ -2009,7 +2013,7 @@ else print ''; print ''; - if ($objp->fk_statut == 1 && $objp->dfv < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($objp->fk_statut == 1 && $objp->dfv < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; print ''; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index f59add5c70f..eb6ba741996 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -98,6 +98,8 @@ if ($_GET['propalid']) { if ($mesg) print $mesg; + $now=gmmktime(); + $propal = new Propal($db); if ( $propal->fetch($_GET['propalid']) ) { @@ -111,7 +113,7 @@ if ($_GET['propalid']) print ''.$langs->trans('Ref').''.$propal->ref.''; - // Société + // Soci�t� print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; // Ligne info remises tiers @@ -137,7 +139,7 @@ if ($_GET['propalid']) if ($propal->fin_validite) { print dolibarr_print_date($propal->fin_validite,'daytext'); - if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($propal->statut == 1 && $propal->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { @@ -163,7 +165,7 @@ if ($_GET['propalid']) } print ""; - // Note privée + // Note priv�e if (! $user->societe_id) { print ''.$langs->trans("NotePrivate").' :'; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 37bd45e7b2b..69c11c96804 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -191,6 +191,8 @@ if ($socid > 0) print ''; } + $now = gmmktime(); + while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); @@ -198,8 +200,8 @@ if ($socid > 0) print ""; print "propalid\">"; print img_object($langs->trans("ShowPropal"),"propal"); - print " $objp->ref\n"; - if ( ($objp->dp < time() - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) + print " ".$objp->ref."\n"; + if ( $objp->dp < ($now - $conf->propal->cloture->warning_delay) && $objp->fk_statut == 1 ) { print " ".img_warning(); } diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 132f4e7b43b..efa78320e59 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -1811,10 +1811,12 @@ class Commande extends CommonObject { global $conf, $user; + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; $clause = "WHERE"; - $sql = 'SELECT c.rowid,'.$this->db->pdate('c.date_creation').' as datec'; + $sql = 'SELECT c.rowid, c.date_creation as datec'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -1830,7 +1832,7 @@ class Commande extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datec < (time() - $conf->commande->traitement->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datec) < ($now - $conf->commande->traitement->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index a15d2ed004c..b436f5fb776 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -51,6 +51,8 @@ $result = restrictedArea($user, 'commande', $orderid,''); * View */ +$now=gmmktime(); + $html = new Form($db); $formfile = new FormFile($db); @@ -93,15 +95,15 @@ if ($viewstatut <> '') { if ($viewstatut < 4 && $viewstatut > -2) { - $sql .= ' AND c.fk_statut ='.$viewstatut; // brouillon, validée, en cours, annulée + $sql .= ' AND c.fk_statut ='.$viewstatut; // brouillon, valid�e, en cours, annul�e if ($viewstatut == 3) { - $sql .= ' AND c.facture = 0'; // à facturer + $sql .= ' AND c.facture = 0'; // � facturer } } if ($viewstatut == 4) { - $sql .= ' AND c.facture = 1'; // facturée + $sql .= ' AND c.facture = 1'; // factur�e } if ($viewstatut == -2) { @@ -204,7 +206,7 @@ if ($resql) print ''; print ''; - if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < (time() - $conf->commande->traitement->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print ''; print ''; diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index a3f1c1ac493..00a201aef66 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -695,8 +695,10 @@ class Account extends CommonObject if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid,".$this->db->pdate("b.datev")." as datefin"; + $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE b.rappro=0 AND b.fk_account = ba.rowid"; $sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable @@ -709,7 +711,7 @@ class Account extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php index 22277bf0b32..d0194da62b0 100644 --- a/htdocs/compta/commande/liste.php +++ b/htdocs/compta/commande/liste.php @@ -54,6 +54,14 @@ $langs->load('companies'); $html = new Form($db); $formfile = new FormFile($db); + + +/* + * View + */ + +$now=gmmktime(); + llxHeader(); $sql = "SELECT s.nom, s.rowid as socid,"; @@ -104,7 +112,7 @@ if ($resql) { $title = $langs->trans("ListOfOrders"); } - // Si page des commandes à facturer + // Si page des commandes � facturer $link=DOL_URL_ROOT."/compta/commande/fiche.php"; $title.=" - ".$langs->trans("StatusOrderToBill"); $param="&socid=".$socid."&year=".$_GET["year"]."&month=".$_GET["month"]; @@ -142,7 +150,7 @@ if ($resql) print ''; print ''; - if (($objp->date_commande < (time() - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning"); + if (($objp->date_commande < ($now - $conf->commande->traitement->warning_delay)) && $objp->statutid == 1 ) print img_picto($langs->trans("Late"),"warning"); print ''; print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 31c8a543102..db76fdd926f 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1880,6 +1880,8 @@ if ($_GET['action'] == 'create') } else { + $now=gmmktime(); + $id = $_GET['facid']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) @@ -2397,7 +2399,7 @@ else else { print dolibarr_print_date($fac->date_lim_reglement,'daytext'); - if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late')); + if ($fac->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans('Late')); } } else @@ -3382,6 +3384,8 @@ else * Mode Liste * * * ***************************************************************************/ + $now=gmmktime(); + $page =$_GET['page']; $sortorder=$_GET['sortorder']; $sortfield=$_GET['sortfield']; @@ -3546,7 +3550,7 @@ else print $facturestatic->getNomUrl(1); print $objp->increment; print ''; - if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) + if ($objp->datelimite < ($now - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) { print ''; print img_warning($langs->trans('Late')); diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 815ea416ecd..04ae706134f 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2004 �ric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ /** \file htdocs/compta/facture/apercu.php \ingroup facture - \brief Page de l'onglet aperçu d'une facture + \brief Page de l'onglet aper�u d'une facture \version $Revision$ */ @@ -39,7 +39,7 @@ if (!$user->rights->facture->lire) $langs->load("bills"); -// Sécurité accés client +// S�curit� acc�s client if ($user->societe_id > 0) { $action = ''; @@ -47,6 +47,13 @@ if ($user->societe_id > 0) } + +/* + * View + */ + +$now=gmmktime(); + llxHeader('',$langs->trans("Bill"),'Facture'); $html = new Form($db); @@ -93,10 +100,10 @@ if ($_GET["facid"] > 0) print ''.$langs->trans("Date").''; print ''.dolibarr_print_date($fac->date,"daytext").''; print ''.$langs->trans("DateMaxPayment").'' . dolibarr_print_date($fac->date_lim_reglement,"daytext"); - if ($fac->paye == 0 && $fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); + if ($fac->paye == 0 && $fac->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); print ""; - // Conditions et modes de réglement + // Conditions et modes de r�glement print ''.$langs->trans("PaymentConditions").''; $html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none"); print ''; @@ -137,7 +144,7 @@ if ($_GET["facid"] > 0) $relativepath = "${facref}/${facref}.pdf"; $relativepathdetail = "${facref}/${facref}-detail.pdf"; - // Chemin vers png aperçus + // Chemin vers png aper�us $relativepathimage = "${facref}/${facref}.pdf.png"; $fileimage = $file.".png"; // Si PDF d'1 page $fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page @@ -160,9 +167,9 @@ if ($_GET["facid"] > 0) print ''; // Si fichier detail PDF existe - if (file_exists($filedetail)) // facture détaillée supplémentaire + if (file_exists($filedetail)) // facture d�taill�e suppl�mentaire { - print "Facture détaillée"; + print "Facture d�taill�e"; print ''.$fac->ref.'-detail.pdf'; print ''.filesize($filedetail). ' bytes'; @@ -244,17 +251,17 @@ if ($_GET["facid"] > 0) } else { - // Facture non trouvée + // Facture non trouv�e print $langs->trans("ErrorBillNotFound",$_GET["facid"]); } } -// Si fichier png PDF d'1 page trouvé +// Si fichier png PDF d'1 page trouv� if (file_exists($fileimage)) { print ''; } -// Si fichier png PDF de plus d'1 page trouvé +// Si fichier png PDF de plus d'1 page trouv� elseif (file_exists($fileimagebis)) { $multiple = $relativepathimage . "."; @@ -274,7 +281,7 @@ elseif (file_exists($fileimagebis)) print ''; -// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent +// Juste pour �viter bug IE qui r�organise mal div pr�c�dents si celui-ci absent print '
'; print '
'; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 972fd4d034b..2ee3aca349c 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -144,6 +144,9 @@ $formfile = new FormFile($db); * Mode Liste * * * ***************************************************************************/ + +$now=gmmktime(); + $page = $_GET["page"]; $sortfield=$_GET["sortfield"]; $sortorder=$_GET["sortorder"]; @@ -311,7 +314,7 @@ if ($result) print ''; print ''; - if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); + if ($objp->datelimite < ($now - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); print ''; print ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 3f50379d568..20b0efcc68c 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2004 �ric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ $langs->load("bills"); $langs->load("banks"); $langs->load("withdrawals"); -// Sécurité accés client +// S�curit� acc�s client if ($user->societe_id > 0) { $action = ''; @@ -85,6 +85,8 @@ if ($_GET["action"] == "delete") * View */ +$now=gmmktime(); + llxHeader('',$langs->trans("Bill")); $html = new Form($db); @@ -135,10 +137,10 @@ if ($_GET["facid"] > 0) print ''.$langs->trans("Date").''; print ''.dolibarr_print_date($fac->date,"daytext").''; print ''.$langs->trans("DateMaxPayment").'' . dolibarr_print_date($fac->date_lim_reglement,"daytext"); - if ($fac->date_lim_reglement < (time() - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans("Late")); + if ($fac->date_lim_reglement < ($now - $conf->facture->client->warning_delay) && ! $fac->paye && $fac->statut == 1 && ! $fac->am) print img_warning($langs->trans("Late")); print ""; - // Conditions et modes de réglement + // Conditions et modes de r�glement print ''.$langs->trans("PaymentConditions").''; $html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none"); print ''; @@ -162,7 +164,7 @@ if ($_GET["facid"] > 0) print ''; /* - * Demande de prélèvement + * Demande de pr�l�vement * */ @@ -198,7 +200,7 @@ if ($_GET["facid"] > 0) /* - * Prélèvement + * Pr�l�vement */ print ''; @@ -297,7 +299,7 @@ if ($_GET["facid"] > 0) } else { - /* Facture non trouvée */ + /* Facture non trouv�e */ print $langs->trans("ErrorBillNotFound",$_GET["facid"]); } } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index a7081cca17c..fa232644ffe 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -85,6 +85,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark') * */ +$now=gmmktime(); + $facturestatic=new Facture($db); $facturesupplierstatic=new FactureFournisseur($db); @@ -611,7 +613,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire) print $facturestatic->getNomUrl(1,''); print ''; print ''; print ''; print ''; print ''; print ''; @@ -607,7 +609,7 @@ else print ''; print ''; // Status diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 4f707a652b9..346124791bd 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Éric Seigne + * Copyright (C) 2004 �ric Seigne * Copyright (C) 2004-2008 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -21,7 +21,7 @@ /** \file htdocs/fourn/facture/impayees.php \ingroup facture - \brief Page de liste des factures fournisseurs impayées + \brief Page de liste des factures fournisseurs impay�es \version $Id$ */ @@ -39,7 +39,7 @@ $langs->load("bills"); if ($_GET["socid"]) { $socid=$_GET["socid"]; } -// Sécurité accés client +// S�curit� acc�s client if ($user->societe_id > 0) { $action = ''; @@ -47,6 +47,12 @@ if ($user->societe_id > 0) } +/* + * View + */ + +$now=gmmktime(); + llxHeader('',$langs->trans("BillsSuppliersUnpayed")); @@ -200,7 +206,7 @@ if ($user->rights->fournisseur->facture->lire) print '\n"; print "\n"; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index e4f308b4f72..86bbfceb386 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -83,6 +83,8 @@ if ($_POST["mode"] == 'search') * View */ +$now=gmmktime(); + llxHeader(); $sql = "SELECT s.rowid as socid, s.nom, "; @@ -206,7 +208,7 @@ if ($resql) $facturestatic->id=$obj->facid; $facturestatic->ref=$obj->ref; print $facturestatic->getNomUrl(1); - if (($obj->paye == 0) && ($obj->fk_statut > 0) && $obj->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($obj->paye == 0) && ($obj->fk_statut > 0) && $obj->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print "\n"; print '"; print ''; diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index f4283471d17..2eb5ba53a6e 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -647,8 +647,10 @@ class FactureFournisseur extends Facture { global $conf, $user; + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; - $sql = 'SELECT ff.rowid,'.$this->db->pdate('ff.date_lim_reglement').' as datefin'; + $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -661,7 +663,7 @@ class FactureFournisseur extends Facture while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->facture->fournisseur->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->fournisseur->warning_delay)) $this->nbtodolate++; } $this->db->free($resql); return 1; diff --git a/htdocs/includes/boxes/box_actions.php b/htdocs/includes/boxes/box_actions.php index fd0bc76d08f..7a57b192b55 100644 --- a/htdocs/includes/boxes/box_actions.php +++ b/htdocs/includes/boxes/box_actions.php @@ -93,6 +93,9 @@ class box_actions extends ModeleBoxes { $result = $db->query($sql); if ($result) { + $now=gmmktime(); + $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; + $num = $db->num_rows($result); $i = 0; while ($i < $num) @@ -100,8 +103,8 @@ class box_actions extends ModeleBoxes { $late = ''; $objp = $db->fetch_object($result); $datelimite=$db->jdate($objp->dp); - - if ($datelimite < (time() - $conf->global->MAIN_DELAY_ACTIONS_TODO)) $late=img_warning($langs->trans("Late")); + + if ($datelimite < ($now - $delay_warning)) $late=img_warning($langs->trans("Late")); $label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label); diff --git a/htdocs/includes/boxes/box_clients.php b/htdocs/includes/boxes/box_clients.php index 23f56090f1d..b98cd9cb285 100644 --- a/htdocs/includes/boxes/box_clients.php +++ b/htdocs/includes/boxes/box_clients.php @@ -21,7 +21,7 @@ /** \file htdocs/includes/boxes/box_clients.php \ingroup societes - \brief Module de génération de l'affichage de la box clients + \brief Module de g�n�ration de l'affichage de la box clients \version $Id$ */ @@ -53,8 +53,8 @@ class box_clients extends ModeleBoxes { } /** - * \brief Charge les données en mémoire pour affichage ultérieur - * \param $max Nombre maximum d'enregistrements à charger + * \brief Charge les donn�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � charger */ function loadBox($max=5) { @@ -85,7 +85,6 @@ class box_clients extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - $datec=$db->jdate($objp->dc); $i = 0; //$customerstatic=new Client($db); diff --git a/htdocs/includes/boxes/box_commandes.php b/htdocs/includes/boxes/box_commandes.php index e8221fea5df..4a41e852626 100644 --- a/htdocs/includes/boxes/box_commandes.php +++ b/htdocs/includes/boxes/box_commandes.php @@ -90,14 +90,14 @@ class box_commandes extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - $datem=$db->jdate($objp->tms); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); - + $datem=$db->jdate($objp->tms); + $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid); diff --git a/htdocs/includes/boxes/box_factures.php b/htdocs/includes/boxes/box_factures.php index 26a37d5a4d4..77d7ae7b952 100644 --- a/htdocs/includes/boxes/box_factures.php +++ b/htdocs/includes/boxes/box_factures.php @@ -21,7 +21,7 @@ /** \file htdocs/includes/boxes/box_factures.php \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$ */ @@ -53,8 +53,8 @@ class box_factures extends ModeleBoxes { } /** - * \brief Charge les données en mémoire pour affichage ultérieur - * \param $max Nombre maximum d'enregistrements à charger + * \brief Charge les donn�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � charger */ function loadBox($max=5) { @@ -93,7 +93,8 @@ class box_factures extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - + $now=gmmktime(); + $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; @@ -107,7 +108,7 @@ class box_factures extends ModeleBoxes { if ($objp->type == 1) $picto.='r'; 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')));} + if($objp->paye == 0 && $datelimite < ($now - $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"', 'logo' => $picto, diff --git a/htdocs/includes/boxes/box_factures_fourn.php b/htdocs/includes/boxes/box_factures_fourn.php index c05be17953a..ab2e584b51c 100644 --- a/htdocs/includes/boxes/box_factures_fourn.php +++ b/htdocs/includes/boxes/box_factures_fourn.php @@ -92,7 +92,8 @@ class box_factures_fourn extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - + $now=gmmktime(); + $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; @@ -103,7 +104,7 @@ class box_factures_fourn extends ModeleBoxes { $datec=$db->jdate($objp->datec); $late = ''; - if ($objp->paye == 0 && $datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dolibarr_print_date($datelimite,'day'))); + if ($objp->paye == 0 && $datelimite < ($now - $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"', 'logo' => $this->boximg, diff --git a/htdocs/includes/boxes/box_factures_fourn_imp.php b/htdocs/includes/boxes/box_factures_fourn_imp.php index 39c44df026a..9e2661bf0e4 100644 --- a/htdocs/includes/boxes/box_factures_fourn_imp.php +++ b/htdocs/includes/boxes/box_factures_fourn_imp.php @@ -87,8 +87,9 @@ class box_factures_fourn_imp extends ModeleBoxes { $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); - + $num = $db->num_rows($result); + $now=gmmktime(); + $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; @@ -98,7 +99,7 @@ class box_factures_fourn_imp extends ModeleBoxes { $datelimite=$db->jdate($objp->datelimite); $late=''; - if ($datelimite < (time() - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dolibarr_print_date($datelimite,'day'))); + if ($datelimite < ($now - $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"', 'logo' => $this->boximg, diff --git a/htdocs/includes/boxes/box_factures_imp.php b/htdocs/includes/boxes/box_factures_imp.php index b9f92ad121d..ff4c81f753d 100644 --- a/htdocs/includes/boxes/box_factures_imp.php +++ b/htdocs/includes/boxes/box_factures_imp.php @@ -21,7 +21,7 @@ /** \file htdocs/includes/boxes/box_factures_imp.php \ingroup factures - \brief Module de génération de l'affichage de la box factures impayees + \brief Module de g�n�ration de l'affichage de la box factures impayees \version $Id$ */ @@ -55,8 +55,8 @@ class box_factures_imp extends ModeleBoxes { } /** - * \brief Charge les données en mémoire pour affichage ultérieur - * \param $max Nombre maximum d'enregistrements à charger + * \brief Charge les donn�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � charger */ function loadBox($max=5) { @@ -92,7 +92,8 @@ class box_factures_imp extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - + $now=gmmktime(); + $i = 0; $l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; @@ -102,7 +103,7 @@ class box_factures_imp extends ModeleBoxes { $datelimite=$db->jdate($objp->datelimite); $late=''; - if ($datelimite < (time() - $conf->facture->warning_delay)) $late = img_warning(sprintf($l_due_date,dolibarr_print_date($datelimite,'day'))); + if ($datelimite < ($now - $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"', 'logo' => $this->boximg, diff --git a/htdocs/includes/boxes/box_propales.php b/htdocs/includes/boxes/box_propales.php index 07e723cbffe..61d79d686db 100644 --- a/htdocs/includes/boxes/box_propales.php +++ b/htdocs/includes/boxes/box_propales.php @@ -21,7 +21,7 @@ /** \file htdocs/includes/boxes/box_propales.php \ingroup propales - \brief Module de génération de l'affichage de la box propales + \brief Module de g�n�ration de l'affichage de la box propales \version $Id$ */ @@ -54,13 +54,13 @@ class box_propales extends ModeleBoxes { } /** - * \brief Charge les données en mémoire pour affichage ultérieur - * \param $max Nombre maximum d'enregistrements à charger + * \brief Charge les donn�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � charger */ function loadBox($max=5) { - global $user, $langs, $db; + global $user, $langs, $db, $conf; $this->max=$max; @@ -73,7 +73,7 @@ class box_propales extends ModeleBoxes { { $sql = "SELECT s.nom, s.rowid as socid,"; - $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec"; + $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture"; 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"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -91,13 +91,19 @@ class box_propales extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - + $now=gmmktime(); + $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $datec=$db->jdate($objp->datec); + $dateterm=$db->jdate($objp->fin_validite); + $dateclose=$db->jdate($objp->date_cloture); + + $late = ''; + if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, @@ -105,6 +111,7 @@ class box_propales extends ModeleBoxes { $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $objp->ref, + 'text2'=> $late, 'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid); $this->info_box_contents[$i][2] = array('td' => 'align="left"', diff --git a/htdocs/includes/boxes/box_services_vendus.php b/htdocs/includes/boxes/box_services_vendus.php index 87d9c399948..9f9b68da3c2 100644 --- a/htdocs/includes/boxes/box_services_vendus.php +++ b/htdocs/includes/boxes/box_services_vendus.php @@ -21,7 +21,7 @@ /** * \file htdocs/includes/boxes/box_services_vendus.php * \ingroup produits,services - * \brief Module de génération de l'affichage de la box services_vendus + * \brief Module de g�n�ration de l'affichage de la box services_vendus * \version $Id$ */ @@ -53,8 +53,8 @@ class box_services_vendus extends ModeleBoxes { } /** - * \brief Charge les données en mémoire pour affichage ultérieur - * \param $max Nombre maximum d'enregistrements à charger + * \brief Charge les donn�es en m�moire pour affichage ult�rieur + * \param $max Nombre maximum d'enregistrements � charger */ function loadBox($max=5) { @@ -98,7 +98,8 @@ class box_services_vendus extends ModeleBoxes { if ($result) { $num = $db->num_rows($result); - + $now=gmmktime(); + $i = 0; while ($i < $num) diff --git a/htdocs/index.php b/htdocs/index.php index e381335fceb..112a47d07e7 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -287,9 +287,9 @@ if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $var=!$var; print ''; - print ''; + print ''; print '
'; - if ($obj->datelimite < (time() - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); + if ($obj->datelimite < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late")); print ''; $filename=sanitizeFileName($obj->facnumber); diff --git a/htdocs/compta/paiement/cheque/remisecheque.class.php b/htdocs/compta/paiement/cheque/remisecheque.class.php index ecdd27068a0..fec22a33ba5 100644 --- a/htdocs/compta/paiement/cheque/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/remisecheque.class.php @@ -376,8 +376,10 @@ class RemiseCheque extends CommonObject if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; - $sql = "SELECT b.rowid,".$this->db->pdate("b.datev")." as datefin"; + $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0"; $sql.= " AND b.amount > 0"; @@ -388,7 +390,7 @@ class RemiseCheque extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->bank->cheque->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->cheque->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 53461ea3144..f4b365e527d 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -110,6 +110,11 @@ if ( $action == 'delete' ) } +/* + * View + */ + +$now=gmmktime(); llxHeader(); @@ -195,7 +200,7 @@ if ($_GET["propalid"] > 0) if ($propal->fin_validite) { print dolibarr_print_date($propal->fin_validite,'daytext'); - if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($propal->statut == 1 && $propal->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { @@ -641,6 +646,7 @@ else * */ + $now=gmmktime(); $limit = $conf->liste_limit; $offset = $limit * $page ; @@ -753,7 +759,7 @@ else print ''; - if ($objp->fk_statut == 1 && $objp->din < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); + if ($objp->fk_statut == 1 && $objp->din < ($now() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); print ''; diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 2e3bd7ccdb6..ec32bbde9cc 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -1225,10 +1225,12 @@ class Contrat extends CommonObject { global $conf, $user; + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; if ($mode == 'inactives') { - $sql = "SELECT cd.rowid,".$this->db->pdate("cd.date_ouverture_prevue")." as datefin"; + $sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1237,7 +1239,7 @@ class Contrat extends CommonObject } if ($mode == 'expired') { - $sql = "SELECT cd.rowid,".$this->db->pdate("cd.date_fin_validite")." as datefin"; + $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1254,9 +1256,9 @@ class Contrat extends CommonObject { $this->nbtodo++; if ($mode == 'inactives') - if ($obj->datefin && $obj->datefin < (time() - $conf->contrat->services->inactifs->warning_delay)) $this->nbtodolate++; + if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->inactifs->warning_delay)) $this->nbtodolate++; if ($mode == 'expired') - if ($obj->datefin && $obj->datefin < (time() - $conf->contrat->services->expires->warning_delay)) $this->nbtodolate++; + if ($obj->datefin && $this->db->jdate($obj->datefin) < ($now - $conf->contrat->services->expires->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index b4decc30b95..23042510f05 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -605,6 +605,8 @@ else /* */ /* *************************************************************************** */ { + $now=gmmktime(); + $id = $_GET["id"]; if ($id > 0) { @@ -867,14 +869,14 @@ else if ($objp->date_debut) { print dolibarr_print_date($objp->date_debut); // Warning si date prevu passee et pas en service - if ($objp->statut == 0 && $objp->date_debut < time() - $conf->contrat->warning_delay) { print " ".img_warning($langs->trans("Late")); } + if ($objp->statut == 0 && $objp->date_debut < ($now - $conf->contrat->warning_delay)) { print " ".img_warning($langs->trans("Late")); } } else print $langs->trans("Unknown"); print '  -  '; print $langs->trans("DateEndPlanned").': '; if ($objp->date_fin) { print dolibarr_print_date($objp->date_fin); - if ($objp->statut == 4 && $objp->date_fin < time() - $conf->contrat->services->inactifs->warning_delay) { print " ".img_warning($langs->trans("Late")); } + if ($objp->statut == 4 && $objp->date_fin < ($now - $conf->contrat->services->inactifs->warning_delay)) { print " ".img_warning($langs->trans("Late")); } } else print $langs->trans("Unknown"); diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 70a50962716..4aef1df762a 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -2506,10 +2506,12 @@ class Facture extends CommonObject { global $conf, $user; + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; $clause = "WHERE"; - $sql = 'SELECT f.rowid,'.$this->db->pdate('f.date_lim_reglement').' as datefin'; + $sql = 'SELECT f.rowid, f.date_lim_reglement as datefin'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -2525,7 +2527,7 @@ class Facture extends CommonObject while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->facture->client->warning_delay)) $this->nbtodolate++; + if ($this->db->jdate($obj->datefin) < ($now - $conf->facture->client->warning_delay)) $this->nbtodolate++; } return 1; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index b6936c5d7e6..a6ab51319f8 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -439,6 +439,8 @@ else /* */ /* *************************************************************************** */ + $now=gmmktime(); + $productstatic = new Product($db); $fac = new FactureFournisseur($db); @@ -482,7 +484,7 @@ else print '
'.$langs->trans('DateEcheance').''; $html->select_date($fac->date_echeance,'ech','','','',"update"); - if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print '
'.$langs->trans('AmountHT').''.price($fac->total_ht).'
'.$langs->trans('DateEcheance').''; print dolibarr_print_date($fac->date_echeance,'daytext'); - if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < (time() - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); + if (($fac->paye == 0) && ($fac->statut > 0) && $fac->date_echeance < ($now - $conf->facture->fournisseur->warning_delay)) print img_picto($langs->trans("Late"),"warning"); print '
'.img_object($langs->trans("ShowBill"),"bill")." "; print ''.$objp->ref.''; - if ($objp->datelimite < (time() - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); + if ($objp->datelimite < ($now - $conf->facture->fournisseur->warning_delay) && ! $objp->paye && $objp->fk_statut == 1) print img_warning($langs->trans("Late")); print "".dolibarr_trunc($objp->facnumber,12)."'.dolibarr_trunc($obj->facnumber,10)."'.dolibarr_print_date($obj->datef,'day').'
'.img_object($langs->trans("Actions"),"task").''.$board->label.''.$board->nbtodo.''.$board->nbtodo.''; - print ''; + print ''; print $board->nbtodolate; print ''; print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')'; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index a3ecb437c57..aeb8bed0c28 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Océbo * * This program is free software; you can redistribute it and/or modify @@ -268,7 +268,9 @@ else $migrationscript=array(array('from'=>'2.0.0', 'to'=>'2.1.0'), array('from'=>'2.1.0', 'to'=>'2.2.0'), array('from'=>'2.2.0', 'to'=>'2.4.0'), - array('from'=>'2.4.0', 'to'=>'2.5.0')); + array('from'=>'2.4.0', 'to'=>'2.5.0'), + array('from'=>'2.5.0', 'to'=>'2.6.0') + ); # Upgrade lines foreach ($migrationscript as $migarray) { diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index e2d366af99f..7d88f162ec4 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -1663,10 +1663,12 @@ class Propal extends CommonObject { global $conf, $user; + $now=gmmktime(); + $this->nbtodo=$this->nbtodolate=0; $clause = "WHERE"; - $sql ="SELECT p.rowid, p.ref, ".$this->db->pdate("p.datec")." as datec,".$this->db->pdate("p.fin_validite")." as datefin"; + $sql ="SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -1680,16 +1682,22 @@ class Propal extends CommonObject $resql=$this->db->query($sql); if ($resql) { + if ($mode == 'opened') $delay_warning=$conf->propal->cloture->warning_delay; + if ($mode == 'signed') $delay_warning=$conf->propal->facture->warning_delay; + while ($obj=$this->db->fetch_object($resql)) { $this->nbtodo++; - if ($obj->datefin < (time() - $conf->propal->cloture->warning_delay)) + if ($mode == 'opened') { - if ($mode == 'opened') $this->nbtodolate++; - if ($mode == 'signed') $this->nbtodolate++; - // \todo Definir r�gle des propales � facturer en retard - // if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; + $datelimit = $this->db->jdate($obj->datefin); + if ($datelimit < ($now - $delay_warning)) + { + $this->nbtodolate++; + } } + // \todo Definir r�gle des propales � facturer en retard + // if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } return 1; }