Doc: Commentaires doxygen

This commit is contained in:
Laurent Destailleur 2005-07-14 13:03:20 +00:00
parent 46c291bacd
commit 7991dee770

View File

@ -18,111 +18,115 @@
* *
* $Id$ * $Id$
* $Source$ * $Source$
*
*/ */
/** /**
\file htdocs/notify.class.php \file htdocs/notify.class.php
\brief Fichier de la classe de gestion des notifications \brief Fichier de la classe de gestion des notifications
\version $Revision$ \version $Revision$
*/ */
/** /**
\class Notify \class Notify
\brief Classe de gestion des notifications \brief Classe de gestion des notifications
*/ */
class Notify class Notify
{ {
var $id; var $id;
var $db; var $db;
var $socidp; var $error;
var $author;
var $ref;
var $date;
var $duree;
var $note;
var $projet_id;
function Notify($DB) var $socidp;
var $author;
var $ref;
var $date;
var $duree;
var $note;
var $projet_id;
/**
* \brief Constructeur
* \param DB Handler accès base
*/
function Notify($DB)
{ {
$this->db = $DB ; $this->db = $DB ;
include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
} }
/*
*
*
*
*/
function send($action, $socid, $texte, $objet_type, $objet_id, $file="") /**
* \brief Envoi mail et sauve trace
*
*/
function send($action, $socid, $texte, $objet_type, $objet_id, $file="")
{ {
$sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid"; global $conf,$langs;
$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";
$sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
$sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action;
$sql .= " AND s.idp = ".$socid;
$result = $this->db->query($sql); $sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid";
if ($result) $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";
{ $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action";
$num = $this->db->num_rows(); $sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action;
$i = 0; $sql .= " AND s.idp = ".$socid;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">"; $result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if (strlen($sendto)) $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">";
{
$subject = "Notification Dolibarr";
$message = $texte;
$filename = split("/",$file);
$replyto = MAIN_MAIL_FROM;
$mailfile = new CMailFile($subject, if (strlen($sendto))
$sendto, {
$replyto, $subject = $langs->trans("DolibarrNotififcation");
$message, $message = $texte;
array($file), $filename = split("/",$file);
array("application/pdf"), $replyto = $conf->email_from;
array($filename[sizeof($filename)-1])
);
if ( $mailfile->sendfile() ) $mailfile = new CMailFile($subject,
{ $sendto,
$sendto = htmlentities($sendto); $replyto,
$message,
array($file),
array("application/pdf"),
array($filename[sizeof($filename)-1])
);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)"; if ( $mailfile->sendfile() )
$sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);"; {
$db2 = $this->db->dbclone(); $sendto = htmlentities($sendto);
if (! $db2->query($sql) )
{
print $db2->error();
print "<p>$sql</p>";
}
} $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)";
else $sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);";
{ if (! $db->query($sql) )
print "envoi failed"; {
} dolibarr_print_error($db);
} }
$i++;
} }
} else
else {
{ $this->error=$mailfile->error;
print $this->db->error(); }
} }
/* $i++;
* Insertion dans la base de la trace }
*/ }
else
{
$this->error=$this->db->error();
}
} }
} }
?> ?>