/[dolibarr]/dolibarr/htdocs/contact.class.php
ViewVC logotype

Diff of /dolibarr/htdocs/contact.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.69 by eldy, Tue Aug 30 20:39:08 2005 UTC revision 1.70 by eldy, Sun Sep 18 18:23:12 2005 UTC
# Line 653  class Contact Line 653  class Contact
653          }          }
654      }      }
655        
656    /*      /*
657     *    \brief      Charge les informations sur le contact, depuis la base       *    \brief      Charge les informations sur le contact, depuis la base
658     *    \param      id      id du contact à charger       *    \param      id      id du contact à charger
659     */       */
660    function info($id)      function info($id)
661      {      {
662        $sql = "SELECT c.idp, ".$this->db->pdate("datec")." as datec, fk_user";          $sql = "SELECT c.idp, ".$this->db->pdate("datec")." as datec, fk_user";
663        $sql .= ", ".$this->db->pdate("tms")." as tms, fk_user_modif";          $sql .= ", ".$this->db->pdate("tms")." as tms, fk_user_modif";
664        $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";          $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
665        $sql .= " WHERE c.idp = $id";          $sql .= " WHERE c.idp = $id";
666        if ($this->db->query($sql))          
667          {          $resql=$this->db->query($sql);
668            if ($this->db->num_rows())          if ($resql)
669              {          {
670                $obj = $this->db->fetch_object();              if ($this->db->num_rows($resql))
671                {
672                $this->id                = $obj->idp;                  $obj = $this->db->fetch_object($resql);
673        
674            if ($obj->fk_user) {                  $this->id                = $obj->idp;
675              $cuser = new User($this->db, $obj->fk_user);      
676              $cuser->fetch();                  if ($obj->fk_user) {
677              $this->user_creation     = $cuser;                      $cuser = new User($this->db, $obj->fk_user);
678            }                      $cuser->fetch();
679                                  $this->user_creation     = $cuser;
680                if ($obj->fk_user_modif) {                  }
681              $muser = new User($this->db, $obj->fk_user_modif);      
682              $muser->fetch();                  if ($obj->fk_user_modif) {
683              $this->user_modification = $muser;                      $muser = new User($this->db, $obj->fk_user_modif);
684            }                      $muser->fetch();
685                        $this->user_modification = $muser;
686                $this->date_creation     = $obj->datec;                  }
687                $this->date_modification = $obj->tms;      
688                    $this->date_creation     = $obj->datec;
689              }                  $this->date_modification = $obj->tms;
690        
691            $this->db->free();              }
692          }      
693        else              $this->db->free($resql);
694          {          }
695            print $this->db->error();          else
696          }          {
697                print $this->db->error();
698            }
699      }      }
700        
701        /*
702         *    \brief        Renvoi nombre d'emailings reçu par le contact avec son email
703         *    \return       int     Nombre d'emailings
704         */
705        function getNbOfEMailings()
706        {
707            $sql = "SELECT count(mc.email) as nb";
708            $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
709            $sql.= " WHERE mc.email = '".$this->email."'";
710            $sql.= " AND mc.statut=1";      // -1 erreur, 0 non envoyé, 1 envoyé avec succès
711            $resql=$this->db->query($sql);
712            if ($resql)
713            {
714                $obj = $this->db->fetch_object($resql);
715                $nb=$obj->nb;
716                
717                $this->db->free($resql);
718                return $nb;
719            }
720            else
721            {
722                $this->error=$this->db->error();
723                return -1;
724            }
725        }    
726        
727  }  }
728  ?>  ?>

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26