Perf: Reduce nb of call to time function.

This commit is contained in:
Laurent Destailleur 2009-01-07 15:21:16 +00:00
parent 00e25560c9
commit 754e0111f3
39 changed files with 225 additions and 126 deletions

View File

@ -386,6 +386,8 @@ class ActionComm
{ {
global $conf, $user; 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; $this->nbtodo=$this->nbtodolate=0;
$sql = "SELECT a.id, a.datep as dp"; $sql = "SELECT a.id, a.datep as dp";
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";
@ -400,7 +402,7 @@ class ActionComm
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -1699,10 +1699,12 @@ class Adherent extends CommonObject
{ {
global $conf; global $conf;
$now=gmmktime();
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$this->nbtodo=$this->nbtodolate=0; $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.= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql.= " WHERE a.statut=1"; $sql.= " WHERE a.statut=1";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -1711,7 +1713,7 @@ class Adherent extends CommonObject
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -636,7 +636,9 @@ if ($_GET["id"])
dolibarr_fiche_head($head, $hselected, $langs->trans("Action")); dolibarr_fiche_head($head, $hselected, $langs->trans("Action"));
$now=gmmktime();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
// Confirmation suppression action // Confirmation suppression action
if ($_GET["action"] == 'delete') 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); 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 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); 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 '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if ($_REQUEST["afaire"] == 1) $html->select_date($act->datef,'p2',1,1,1,"action",1,1); 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 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); 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 '</td></tr>'; print '</td></tr>';
// Status // Status
@ -820,13 +820,13 @@ if ($_GET["id"])
// Date debut // Date debut
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
print dolibarr_print_date($act->datep,'dayhour'); 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 '</td></tr>'; print '</td></tr>';
// Date fin // Date fin
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
print dolibarr_print_date($act->datef,'dayhour'); 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 '</td></tr>'; print '</td></tr>';
// Statut // Statut

View File

@ -101,8 +101,8 @@ llxHeader();
$form=new Form($db); $form=new Form($db);
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $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.= " a.id, a.datep as dp, a.datep2 as dp2,";
//$sql.= " ".$db->pdate("a.datea")." as da, ".$db->pdate("a.datea2")." as da2,"; //$sql.= " a.datea as da, a.datea2 as da2,";
$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; $sql.= " a.fk_contact, a.note, a.label, a.percent as percent,";
$sql.= " c.code as acode, c.libelle,"; $sql.= " c.code as acode, c.libelle,";
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
@ -233,8 +233,8 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode",$param,"","",$sortfield,$sortorder); 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("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("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','',$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("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("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); print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
@ -244,7 +244,9 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$now=gmmktime();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
$var=true; $var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
@ -268,17 +270,17 @@ if ($resql)
//print '</td>'; //print '</td>';
print '<td align="center" nowrap="nowrap">'; print '<td align="center" nowrap="nowrap">';
print dolibarr_print_date($obj->dp,"day"); print dolibarr_print_date($db->jdate($obj->dp),"day");
$late=0; $late=0;
if ($obj->percent == 0 && $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 && date("U",$obj->dp) < time()) $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 && date("U",$obj->dp2) < time()) $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 && date("U",$obj->dp) < time()) $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")); if ($late) print img_warning($langs->trans("Late"));
print '</td>'; print '</td>';
print '<td align="center" nowrap="nowrap">'; print '<td align="center" nowrap="nowrap">';
print dolibarr_print_date($obj->dp2,"day"); print dolibarr_print_date($db->jdate($obj->dp2),"day");
print '</td>'; print '</td>';
// Third party // Third party

View File

@ -345,7 +345,8 @@ if ($socid > 0)
print '</table>'; print '</table>';
print '<br>'; print '<br>';
$now=gmmktime();
/* /*
* Dernieres propales * Dernieres propales
*/ */
@ -380,7 +381,7 @@ if ($socid > 0)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td nowrap><a href=\"propal.php?propalid=$objp->propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n"; print "<td nowrap><a href=\"propal.php?propalid=$objp->propalid\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\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(); print " ".img_warning();
} }

View File

@ -418,6 +418,8 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
{ {
$langs->load("propal"); $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"; $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"; 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"; $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 $propalstatic->getNomUrl(1);
print '</td>'; print '</td>';
print '<td width="18" class="nobordernopadding" nowrap="nowrap">'; print '<td width="18" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="center" class="nobordernopadding">'; print '<td width="16" align="center" class="nobordernopadding">';
$filename=sanitizeFileName($obj->ref); $filename=sanitizeFileName($obj->ref);

View File

@ -857,6 +857,8 @@ if ($_GET['propalid'] > 0)
* *
*/ */
$now=gmmktime();
if ($mesg) print $mesg."<br>"; if ($mesg) print $mesg."<br>";
$propal = new Propal($db); $propal = new Propal($db);
@ -1001,7 +1003,7 @@ if ($_GET['propalid'] > 0)
if ($propal->fin_validite) if ($propal->fin_validite)
{ {
print dolibarr_print_date($propal->fin_validite,'daytext'); 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 else
{ {
@ -1872,6 +1874,8 @@ else
* Mode Liste des propales * * Mode Liste des propales *
* * * *
****************************************************************************/ ****************************************************************************/
$now=gmmktime();
$sortorder=$_GET['sortorder']; $sortorder=$_GET['sortorder'];
$sortfield=$_GET['sortfield']; $sortfield=$_GET['sortfield'];
@ -2009,7 +2013,7 @@ else
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';

View File

@ -98,6 +98,8 @@ if ($_GET['propalid'])
{ {
if ($mesg) print $mesg; if ($mesg) print $mesg;
$now=gmmktime();
$propal = new Propal($db); $propal = new Propal($db);
if ( $propal->fetch($_GET['propalid']) ) if ( $propal->fetch($_GET['propalid']) )
{ {
@ -111,7 +113,7 @@ if ($_GET['propalid'])
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref.'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref.'</td></tr>';
// Société // Soci<EFBFBD>t<EFBFBD>
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>'; print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
// Ligne info remises tiers // Ligne info remises tiers
@ -137,7 +139,7 @@ if ($_GET['propalid'])
if ($propal->fin_validite) if ($propal->fin_validite)
{ {
print dolibarr_print_date($propal->fin_validite,'daytext'); 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 else
{ {
@ -163,7 +165,7 @@ if ($_GET['propalid'])
} }
print "</td></tr>"; print "</td></tr>";
// Note privée // Note priv<EFBFBD>e
if (! $user->societe_id) if (! $user->societe_id)
{ {
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>'; print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';

View File

@ -191,6 +191,8 @@ if ($socid > 0)
print '</tr>'; print '</tr>';
} }
$now = gmmktime();
while ($i < $num && $i < $MAXLIST) while ($i < $num && $i < $MAXLIST)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
@ -198,8 +200,8 @@ if ($socid > 0)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td><a href=\"../propal.php?propalid=$objp->propalid\">"; print "<td><a href=\"../propal.php?propalid=$objp->propalid\">";
print img_object($langs->trans("ShowPropal"),"propal"); print img_object($langs->trans("ShowPropal"),"propal");
print " $objp->ref</a>\n"; print " ".$objp->ref."</a>\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(); print " ".img_warning();
} }

View File

@ -1811,10 +1811,12 @@ class Commande extends CommonObject
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = "WHERE"; $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'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -1830,7 +1832,7 @@ class Commande extends CommonObject
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -51,6 +51,8 @@ $result = restrictedArea($user, 'commande', $orderid,'');
* View * View
*/ */
$now=gmmktime();
$html = new Form($db); $html = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
@ -93,15 +95,15 @@ if ($viewstatut <> '')
{ {
if ($viewstatut < 4 && $viewstatut > -2) 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<EFBFBD>e, en cours, annul<75>e
if ($viewstatut == 3) if ($viewstatut == 3)
{ {
$sql .= ' AND c.facture = 0'; // à facturer $sql .= ' AND c.facture = 0'; // <EFBFBD> facturer
} }
} }
if ($viewstatut == 4) if ($viewstatut == 4)
{ {
$sql .= ' AND c.facture = 1'; // facturée $sql .= ' AND c.facture = 1'; // factur<EFBFBD>e
} }
if ($viewstatut == -2) if ($viewstatut == -2)
{ {
@ -204,7 +206,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';

View File

@ -695,8 +695,10 @@ class Account extends CommonObject
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $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.= " 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.= " WHERE b.rappro=0 AND b.fk_account = ba.rowid";
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable $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)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -54,6 +54,14 @@ $langs->load('companies');
$html = new Form($db); $html = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
/*
* View
*/
$now=gmmktime();
llxHeader(); llxHeader();
$sql = "SELECT s.nom, s.rowid as socid,"; $sql = "SELECT s.nom, s.rowid as socid,";
@ -104,7 +112,7 @@ if ($resql)
{ {
$title = $langs->trans("ListOfOrders"); $title = $langs->trans("ListOfOrders");
} }
// Si page des commandes à facturer // Si page des commandes <EFBFBD> facturer
$link=DOL_URL_ROOT."/compta/commande/fiche.php"; $link=DOL_URL_ROOT."/compta/commande/fiche.php";
$title.=" - ".$langs->trans("StatusOrderToBill"); $title.=" - ".$langs->trans("StatusOrderToBill");
$param="&amp;socid=".$socid."&amp;year=".$_GET["year"]."&amp;month=".$_GET["month"]; $param="&amp;socid=".$socid."&amp;year=".$_GET["year"]."&amp;month=".$_GET["month"];
@ -142,7 +150,7 @@ if ($resql)
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';

View File

@ -1880,6 +1880,8 @@ if ($_GET['action'] == 'create')
} }
else else
{ {
$now=gmmktime();
$id = $_GET['facid']; $id = $_GET['facid'];
$ref= $_GET['ref']; $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@ -2397,7 +2399,7 @@ else
else else
{ {
print dolibarr_print_date($fac->date_lim_reglement,'daytext'); 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 else
@ -3382,6 +3384,8 @@ else
* Mode Liste * * Mode Liste *
* * * *
***************************************************************************/ ***************************************************************************/
$now=gmmktime();
$page =$_GET['page']; $page =$_GET['page'];
$sortorder=$_GET['sortorder']; $sortorder=$_GET['sortorder'];
$sortfield=$_GET['sortfield']; $sortfield=$_GET['sortfield'];
@ -3546,7 +3550,7 @@ else
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1);
print $objp->increment; print $objp->increment;
print '</td>'; print '</td>';
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 '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
print img_warning($langs->trans('Late')); print img_warning($langs->trans('Late'));

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 <EFBFBD>ric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 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
@ -23,7 +23,7 @@
/** /**
\file htdocs/compta/facture/apercu.php \file htdocs/compta/facture/apercu.php
\ingroup facture \ingroup facture
\brief Page de l'onglet aperçu d'une facture \brief Page de l'onglet aper<EFBFBD>u d'une facture
\version $Revision$ \version $Revision$
*/ */
@ -39,7 +39,7 @@ if (!$user->rights->facture->lire)
$langs->load("bills"); $langs->load("bills");
// Sécurité accés client // S<EFBFBD>curit<EFBFBD> acc<63>s client
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -47,6 +47,13 @@ if ($user->societe_id > 0)
} }
/*
* View
*/
$now=gmmktime();
llxHeader('',$langs->trans("Bill"),'Facture'); llxHeader('',$langs->trans("Bill"),'Facture');
$html = new Form($db); $html = new Form($db);
@ -93,10 +100,10 @@ if ($_GET["facid"] > 0)
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>'; print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>';
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"daytext"); print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . 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 "</td></tr>"; print "</td></tr>";
// Conditions et modes de réglement // Conditions et modes de r<EFBFBD>glement
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none"); $html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
print '</td>'; print '</td>';
@ -137,7 +144,7 @@ if ($_GET["facid"] > 0)
$relativepath = "${facref}/${facref}.pdf"; $relativepath = "${facref}/${facref}.pdf";
$relativepathdetail = "${facref}/${facref}-detail.pdf"; $relativepathdetail = "${facref}/${facref}-detail.pdf";
// Chemin vers png aperçus // Chemin vers png aper<EFBFBD>us
$relativepathimage = "${facref}/${facref}.pdf.png"; $relativepathimage = "${facref}/${facref}.pdf.png";
$fileimage = $file.".png"; // Si PDF d'1 page $fileimage = $file.".png"; // Si PDF d'1 page
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page $fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
@ -160,9 +167,9 @@ if ($_GET["facid"] > 0)
print '</tr>'; print '</tr>';
// Si fichier detail PDF existe // Si fichier detail PDF existe
if (file_exists($filedetail)) // facture détaillée supplémentaire if (file_exists($filedetail)) // facture d<EFBFBD>taill<EFBFBD>e suppl<70>mentaire
{ {
print "<tr $bc[$var]><td>Facture détaillée</td>"; print "<tr $bc[$var]><td>Facture d<EFBFBD>taill<EFBFBD>e</td>";
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$fac->ref.'-detail.pdf</a></td>'; print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture&file='.urlencode($relativepathdetail).'">'.$fac->ref.'-detail.pdf</a></td>';
print '<td align="right">'.filesize($filedetail). ' bytes</td>'; print '<td align="right">'.filesize($filedetail). ' bytes</td>';
@ -244,17 +251,17 @@ if ($_GET["facid"] > 0)
} }
else else
{ {
// Facture non trouvée // Facture non trouv<EFBFBD>e
print $langs->trans("ErrorBillNotFound",$_GET["facid"]); print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
} }
} }
// Si fichier png PDF d'1 page trouvé // Si fichier png PDF d'1 page trouv<EFBFBD>
if (file_exists($fileimage)) if (file_exists($fileimage))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">'; print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
} }
// Si fichier png PDF de plus d'1 page trouvé // Si fichier png PDF de plus d'1 page trouv<EFBFBD>
elseif (file_exists($fileimagebis)) elseif (file_exists($fileimagebis))
{ {
$multiple = $relativepathimage . "."; $multiple = $relativepathimage . ".";
@ -274,7 +281,7 @@ elseif (file_exists($fileimagebis))
print '</div>'; print '</div>';
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent // Juste pour <EFBFBD>viter bug IE qui r<>organise mal div pr<70>c<EFBFBD>dents si celui-ci absent
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '</div>'; print '</div>';

View File

@ -144,6 +144,9 @@ $formfile = new FormFile($db);
* Mode Liste * * Mode Liste *
* * * *
***************************************************************************/ ***************************************************************************/
$now=gmmktime();
$page = $_GET["page"]; $page = $_GET["page"];
$sortfield=$_GET["sortfield"]; $sortfield=$_GET["sortfield"];
$sortorder=$_GET["sortorder"]; $sortorder=$_GET["sortorder"];
@ -311,7 +314,7 @@ if ($result)
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 <EFBFBD>ric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2008 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
@ -36,7 +36,7 @@ $langs->load("bills");
$langs->load("banks"); $langs->load("banks");
$langs->load("withdrawals"); $langs->load("withdrawals");
// Sécurité accés client // S<EFBFBD>curit<EFBFBD> acc<63>s client
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -85,6 +85,8 @@ if ($_GET["action"] == "delete")
* View * View
*/ */
$now=gmmktime();
llxHeader('',$langs->trans("Bill")); llxHeader('',$langs->trans("Bill"));
$html = new Form($db); $html = new Form($db);
@ -135,10 +137,10 @@ if ($_GET["facid"] > 0)
print '<tr><td>'.$langs->trans("Date").'</td>'; print '<tr><td>'.$langs->trans("Date").'</td>';
print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>'; print '<td colspan="3">'.dolibarr_print_date($fac->date,"daytext").'</td>';
print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . dolibarr_print_date($fac->date_lim_reglement,"daytext"); print '<td>'.$langs->trans("DateMaxPayment").'</td><td>' . 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 "</td></tr>"; print "</td></tr>";
// Conditions et modes de réglement // Conditions et modes de r<EFBFBD>glement
print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("PaymentConditions").'</td><td colspan="3">';
$html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none"); $html->form_conditions_reglement($_SERVER["PHP_SELF"]."?facid=$fac->id",$fac->cond_reglement_id,"none");
print '</td>'; print '</td>';
@ -162,7 +164,7 @@ if ($_GET["facid"] > 0)
print '</div>'; print '</div>';
/* /*
* Demande de prélèvement * Demande de pr<EFBFBD>l<EFBFBD>vement
* *
*/ */
@ -198,7 +200,7 @@ if ($_GET["facid"] > 0)
/* /*
* Prélèvement * Pr<EFBFBD>l<EFBFBD>vement
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -297,7 +299,7 @@ if ($_GET["facid"] > 0)
} }
else else
{ {
/* Facture non trouvée */ /* Facture non trouv<EFBFBD>e */
print $langs->trans("ErrorBillNotFound",$_GET["facid"]); print $langs->trans("ErrorBillNotFound",$_GET["facid"]);
} }
} }

View File

@ -85,6 +85,8 @@ if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
* *
*/ */
$now=gmmktime();
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$facturesupplierstatic=new FactureFournisseur($db); $facturesupplierstatic=new FactureFournisseur($db);
@ -611,7 +613,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
print $facturestatic->getNomUrl(1,''); print $facturestatic->getNomUrl(1,'');
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitizeFileName($obj->facnumber); $filename=sanitizeFileName($obj->facnumber);

View File

@ -376,8 +376,10 @@ class RemiseCheque extends CommonObject
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $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.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0"; $sql.= " WHERE b.fk_type = 'CHQ' AND b.fk_bordereau = 0";
$sql.= " AND b.amount > 0"; $sql.= " AND b.amount > 0";
@ -388,7 +390,7 @@ class RemiseCheque extends CommonObject
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -110,6 +110,11 @@ if ( $action == 'delete' )
} }
/*
* View
*/
$now=gmmktime();
llxHeader(); llxHeader();
@ -195,7 +200,7 @@ if ($_GET["propalid"] > 0)
if ($propal->fin_validite) if ($propal->fin_validite)
{ {
print dolibarr_print_date($propal->fin_validite,'daytext'); 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 else
{ {
@ -641,6 +646,7 @@ else
* *
*/ */
$now=gmmktime();
$limit = $conf->liste_limit; $limit = $conf->liste_limit;
$offset = $limit * $page ; $offset = $limit * $page ;
@ -753,7 +759,7 @@ else
print '</td>'; print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">'; print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
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 '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding">'; print '<td width="16" align="right" class="nobordernopadding">';

View File

@ -1225,10 +1225,12 @@ class Contrat extends CommonObject
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
if ($mode == 'inactives') 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"; 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"; $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"; 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') 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"; 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"; $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"; 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++; $this->nbtodo++;
if ($mode == 'inactives') 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 ($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; return 1;
} }

View File

@ -605,6 +605,8 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
{ {
$now=gmmktime();
$id = $_GET["id"]; $id = $_GET["id"];
if ($id > 0) if ($id > 0)
{ {
@ -867,14 +869,14 @@ else
if ($objp->date_debut) { if ($objp->date_debut) {
print dolibarr_print_date($objp->date_debut); print dolibarr_print_date($objp->date_debut);
// Warning si date prevu passee et pas en service // 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"); else print $langs->trans("Unknown");
print ' &nbsp;-&nbsp; '; print ' &nbsp;-&nbsp; ';
print $langs->trans("DateEndPlanned").': '; print $langs->trans("DateEndPlanned").': ';
if ($objp->date_fin) { if ($objp->date_fin) {
print dolibarr_print_date($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"); else print $langs->trans("Unknown");

View File

@ -2506,10 +2506,12 @@ class Facture extends CommonObject
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = "WHERE"; $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'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -2525,7 +2527,7 @@ class Facture extends CommonObject
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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; return 1;
} }

View File

@ -439,6 +439,8 @@ else
/* */ /* */
/* *************************************************************************** */ /* *************************************************************************** */
$now=gmmktime();
$productstatic = new Product($db); $productstatic = new Product($db);
$fac = new FactureFournisseur($db); $fac = new FactureFournisseur($db);
@ -482,7 +484,7 @@ else
print '<tr><td>'.$langs->trans('DateEcheance').'</td><td nowrap="nowrap">'; print '<tr><td>'.$langs->trans('DateEcheance').'</td><td nowrap="nowrap">';
$html->select_date($fac->date_echeance,'ech','','','',"update"); $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 '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans('AmountHT').'</td><td nowrap="nowrap"><b>'.price($fac->total_ht).'</b></td></tr>'; print '<tr><td>'.$langs->trans('AmountHT').'</td><td nowrap="nowrap"><b>'.price($fac->total_ht).'</b></td></tr>';
@ -607,7 +609,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateEcheance').'</td><td colspan="3">'; print '<td>'.$langs->trans('DateEcheance').'</td><td colspan="3">';
print dolibarr_print_date($fac->date_echeance,'daytext'); 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 '</td></tr>'; print '</td></tr>';
// Status // Status

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Éric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 <EFBFBD>ric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2008 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
@ -21,7 +21,7 @@
/** /**
\file htdocs/fourn/facture/impayees.php \file htdocs/fourn/facture/impayees.php
\ingroup facture \ingroup facture
\brief Page de liste des factures fournisseurs impayées \brief Page de liste des factures fournisseurs impay<EFBFBD>es
\version $Id$ \version $Id$
*/ */
@ -39,7 +39,7 @@ $langs->load("bills");
if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($_GET["socid"]) { $socid=$_GET["socid"]; }
// Sécurité accés client // S<EFBFBD>curit<EFBFBD> acc<63>s client
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
@ -47,6 +47,12 @@ if ($user->societe_id > 0)
} }
/*
* View
*/
$now=gmmktime();
llxHeader('',$langs->trans("BillsSuppliersUnpayed")); llxHeader('',$langs->trans("BillsSuppliersUnpayed"));
@ -200,7 +206,7 @@ if ($user->rights->fournisseur->facture->lire)
print '<td nowrap><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill")."</a> "; print '<td nowrap><a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.img_object($langs->trans("ShowBill"),"bill")."</a> ";
print '<a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.$objp->ref.'</a>'; print '<a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$objp->facid.'">'.$objp->ref.'</a>';
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 "</td>\n"; print "</td>\n";
print "<td nowrap>".dolibarr_trunc($objp->facnumber,12)."</td>\n"; print "<td nowrap>".dolibarr_trunc($objp->facnumber,12)."</td>\n";

View File

@ -83,6 +83,8 @@ if ($_POST["mode"] == 'search')
* View * View
*/ */
$now=gmmktime();
llxHeader(); llxHeader();
$sql = "SELECT s.rowid as socid, s.nom, "; $sql = "SELECT s.rowid as socid, s.nom, ";
@ -206,7 +208,7 @@ if ($resql)
$facturestatic->id=$obj->facid; $facturestatic->id=$obj->facid;
$facturestatic->ref=$obj->ref; $facturestatic->ref=$obj->ref;
print $facturestatic->getNomUrl(1); 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 "</td>\n"; print "</td>\n";
print '<td nowrap>'.dolibarr_trunc($obj->facnumber,10)."</td>"; print '<td nowrap>'.dolibarr_trunc($obj->facnumber,10)."</td>";
print '<td align="center" nowrap="1">'.dolibarr_print_date($obj->datef,'day').'</td>'; print '<td align="center" nowrap="1">'.dolibarr_print_date($obj->datef,'day').'</td>';

View File

@ -647,8 +647,10 @@ class FactureFournisseur extends Facture
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $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"; 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'; $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"; 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)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $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); $this->db->free($resql);
return 1; return 1;

View File

@ -93,6 +93,9 @@ class box_actions extends ModeleBoxes {
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$now=gmmktime();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
@ -100,8 +103,8 @@ class box_actions extends ModeleBoxes {
$late = ''; $late = '';
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->dp); $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); $label=($langs->transnoentities("Action".$objp->code)!=("Action".$objp->code) ? $langs->transnoentities("Action".$objp->code) : $objp->label);

View File

@ -21,7 +21,7 @@
/** /**
\file htdocs/includes/boxes/box_clients.php \file htdocs/includes/boxes/box_clients.php
\ingroup societes \ingroup societes
\brief Module de génération de l'affichage de la box clients \brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box clients
\version $Id$ \version $Id$
*/ */
@ -53,8 +53,8 @@ class box_clients extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -85,7 +85,6 @@ 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);

View File

@ -90,14 +90,14 @@ class box_commandes extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$datem=$db->jdate($objp->tms);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$datem=$db->jdate($objp->tms);
$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,
'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/commande/fiche.php?id=".$objp->rowid);

View File

@ -21,7 +21,7 @@
/** /**
\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<EFBFBD>n<EFBFBD>ration de l'affichage de la box factures
\version $Id$ \version $Id$
*/ */
@ -53,8 +53,8 @@ class box_factures extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -93,7 +93,8 @@ class box_factures extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$now=gmmktime();
$i = 0; $i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; $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 == 1) $picto.='r';
if ($objp->type == 2) $picto.='a'; if ($objp->type == 2) $picto.='a';
$late = ''; $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"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $picto, 'logo' => $picto,

View File

@ -92,7 +92,8 @@ class box_factures_fourn extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$now=gmmktime();
$i = 0; $i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; $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); $datec=$db->jdate($objp->datec);
$late = ''; $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"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,

View File

@ -87,8 +87,9 @@ class box_factures_fourn_imp extends ModeleBoxes {
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows(); $num = $db->num_rows($result);
$now=gmmktime();
$i = 0; $i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; $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); $datelimite=$db->jdate($objp->datelimite);
$late=''; $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"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,

View File

@ -21,7 +21,7 @@
/** /**
\file htdocs/includes/boxes/box_factures_imp.php \file htdocs/includes/boxes/box_factures_imp.php
\ingroup factures \ingroup factures
\brief Module de génération de l'affichage de la box factures impayees \brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box factures impayees
\version $Id$ \version $Id$
*/ */
@ -55,8 +55,8 @@ class box_factures_imp extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -92,7 +92,8 @@ class box_factures_imp extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$now=gmmktime();
$i = 0; $i = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)'; $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); $datelimite=$db->jdate($objp->datelimite);
$late=''; $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"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,

View File

@ -21,7 +21,7 @@
/** /**
\file htdocs/includes/boxes/box_propales.php \file htdocs/includes/boxes/box_propales.php
\ingroup propales \ingroup propales
\brief Module de génération de l'affichage de la box propales \brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box propales
\version $Id$ \version $Id$
*/ */
@ -54,13 +54,13 @@ class box_propales extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
global $user, $langs, $db; global $user, $langs, $db, $conf;
$this->max=$max; $this->max=$max;
@ -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, 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"; 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";
@ -91,13 +91,19 @@ class box_propales extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$now=gmmktime();
$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); $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"', $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
'logo' => $this->boximg, 'logo' => $this->boximg,
@ -105,6 +111,7 @@ class box_propales extends ModeleBoxes {
$this->info_box_contents[$i][1] = array('td' => 'align="left"', $this->info_box_contents[$i][1] = array('td' => 'align="left"',
'text' => $objp->ref, 'text' => $objp->ref,
'text2'=> $late,
'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid); 'url' => DOL_URL_ROOT."/comm/propal.php?propalid=".$objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left"', $this->info_box_contents[$i][2] = array('td' => 'align="left"',

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/includes/boxes/box_services_vendus.php * \file htdocs/includes/boxes/box_services_vendus.php
* \ingroup produits,services * \ingroup produits,services
* \brief Module de génération de l'affichage de la box services_vendus * \brief Module de g<EFBFBD>n<EFBFBD>ration de l'affichage de la box services_vendus
* \version $Id$ * \version $Id$
*/ */
@ -53,8 +53,8 @@ class box_services_vendus extends ModeleBoxes {
} }
/** /**
* \brief Charge les données en mémoire pour affichage ultérieur * \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
* \param $max Nombre maximum d'enregistrements à charger * \param $max Nombre maximum d'enregistrements <EFBFBD> charger
*/ */
function loadBox($max=5) function loadBox($max=5)
{ {
@ -98,7 +98,8 @@ class box_services_vendus extends ModeleBoxes {
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$now=gmmktime();
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)

View File

@ -287,9 +287,9 @@ if ($conf->agenda->enabled && $user->rights->agenda->myactions->read)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Actions"),"task").'</td><td>'.$board->label.'</td>'; print '<tr '.$bc[$var].'><td width="16">'.img_object($langs->trans("Actions"),"task").'</td><td>'.$board->label.'</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/action/index.php?status=todo">'.$board->nbtodo.'</a></td>'; print '<td align="right"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">'.$board->nbtodo.'</a></td>';
print '<td align="right">'; print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?status=todo">'; print '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?status=todo">';
print $board->nbtodolate; print $board->nbtodolate;
print '</a></td><td nowrap align="right">'; print '</a></td><td nowrap align="right">';
print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')'; print ' (>'.ceil($board->warning_delay).' '.$langs->trans("days").')';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Océbo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Océbo <marc@ocebo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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'), $migrationscript=array(array('from'=>'2.0.0', 'to'=>'2.1.0'),
array('from'=>'2.1.0', 'to'=>'2.2.0'), array('from'=>'2.1.0', 'to'=>'2.2.0'),
array('from'=>'2.2.0', 'to'=>'2.4.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 # Upgrade lines
foreach ($migrationscript as $migarray) foreach ($migrationscript as $migarray)
{ {

View File

@ -1663,10 +1663,12 @@ class Propal extends CommonObject
{ {
global $conf, $user; global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = "WHERE"; $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"; $sql.=" FROM ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -1680,16 +1682,22 @@ class Propal extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) 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)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nbtodo++; $this->nbtodo++;
if ($obj->datefin < (time() - $conf->propal->cloture->warning_delay)) if ($mode == 'opened')
{ {
if ($mode == 'opened') $this->nbtodolate++; $datelimit = $this->db->jdate($obj->datefin);
if ($mode == 'signed') $this->nbtodolate++; if ($datelimit < ($now - $delay_warning))
// \todo Definir r<>gle des propales <20> facturer en retard {
// if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; $this->nbtodolate++;
}
} }
// \todo Definir r<>gle des propales <20> facturer en retard
// if ($mode == 'signed' && ! sizeof($this->FactureListeArray($obj->rowid))) $this->nbtodolate++;
} }
return 1; return 1;
} }