[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/script/tools/ -> search-line-wo-traffic.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: search-line-wo-traffic.php,v 1.1 2005/11/08 20:51:32 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/tools/search-line-wo-traffic.php,v $
  20   *
  21   * Recherche des lignes actives sans traffic
  22   *
  23   */
  24  require  ("../../../master.inc.php");
  25  /*
  26   *
  27   */
  28  $datetime = time();
  29  $datemax = $datetime - (86400 * 90);
  30  
  31  $sql  = "SELECT ligne";
  32  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
  33  $sql .= " WHERE statut = 3";
  34  $sql .= " AND unix_timestamp(datec) <".$datemax;
  35  
  36  $re2sql = $db->query($sql) ;
  37  
  38  if ( $re2sql )
  39  {
  40    $nu2m = $db->num_rows($re2sql);
  41    print "$nu2m lignes\n";
  42    $j = 0;
  43    while ($j < $nu2m)
  44      {
  45        $row = $db->fetch_row($re2sql);
  46  
  47        $sqlm  = "SELECT unix_timestamp(max(date)) as md";
  48        $sqlm .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
  49        $sqlm .= " WHERE ligne = '".$row[0]."'";
  50  
  51        $resqlm = $db->query($sqlm) ;
  52        if ( $resqlm )
  53      {
  54        $rowm = $db->fetch_row($resqlm);
  55        if ($rowm[0] < $datemax)
  56          {
  57            print $row[0]." ".strftime("%d/%m/%Y",$rowm[0])."\n";
  58          }
  59      }
  60        $j++;
  61      }
  62  }
  63  else
  64  {
  65    print $db->error();
  66  }
  67  
  68  $db->close();
  69  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics