[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: notify.class.php,v 1.15 2005/11/30 23:15:20 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/notify.class.php,v $ 21 */ 22 23 /** 24 \file htdocs/notify.class.php 25 \brief Fichier de la classe de gestion des notifications 26 \version $Revision: 1.15 $ 27 */ 28 29 30 /** 31 \class Notify 32 \brief Classe de gestion des notifications 33 */ 34 35 class Notify 36 { 37 var $id; 38 var $db; 39 var $error; 40 41 var $socidp; 42 var $author; 43 var $ref; 44 var $date; 45 var $duree; 46 var $note; 47 var $projet_id; 48 49 50 51 /** 52 * \brief Constructeur 53 * \param DB Handler accès base 54 */ 55 function Notify($DB) 56 { 57 $this->db = $DB ; 58 include_once (DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); 59 } 60 61 62 /** 63 * \brief Envoi mail et sauve trace 64 * 65 */ 66 function send($action, $socid, $texte, $objet_type, $objet_id, $file="") 67 { 68 global $conf,$langs; 69 70 $sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid"; 71 $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; 72 $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action"; 73 $sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action; 74 $sql .= " AND s.idp = ".$socid; 75 76 $result = $this->db->query($sql); 77 if ($result) 78 { 79 $num = $this->db->num_rows($result); 80 $i = 0; 81 while ($i < $num) 82 { 83 $obj = $this->db->fetch_object($result); 84 85 $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">"; 86 87 if (strlen($sendto)) 88 { 89 $subject = $langs->trans("DolibarrNotififcation"); 90 $message = $texte; 91 $filename = split("/",$file); 92 $replyto = $conf->email_from; 93 94 $mailfile = new CMailFile($subject, 95 $sendto, 96 $replyto, 97 $message, 98 array($file), 99 array("application/pdf"), 100 array($filename[sizeof($filename)-1]) 101 ); 102 103 if ( $mailfile->sendfile() ) 104 { 105 $sendto = htmlentities($sendto); 106 107 $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)"; 108 $sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);"; 109 if (! $this->db->query($sql) ) 110 { 111 dolibarr_print_error($db); 112 } 113 114 } 115 else 116 { 117 $this->error=$mailfile->error; 118 } 119 } 120 $i++; 121 } 122 } 123 else 124 { 125 $this->error=$this->db->error(); 126 } 127 128 } 129 130 } 131 132 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |