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");
} }
/*
* /**
* * \brief Envoi mail et sauve trace
* *
*/ */
function send($action, $socid, $texte, $objet_type, $objet_id, $file="")
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,
$sendto,
$replyto,
$message,
array($file),
array("application/pdf"),
array($filename[sizeof($filename)-1])
);
if ( $mailfile->sendfile() )
{
$sendto = htmlentities($sendto);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)";
$sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);";
$db2 = $this->db->dbclone();
if (! $db2->query($sql) )
{
print $db2->error();
print "<p>$sql</p>";
}
} if (strlen($sendto))
else {
{ $subject = $langs->trans("DolibarrNotififcation");
print "envoi failed"; $message = $texte;
} $filename = split("/",$file);
} $replyto = $conf->email_from;
$i++;
} $mailfile = new CMailFile($subject,
} $sendto,
else $replyto,
{ $message,
print $this->db->error(); array($file),
} array("application/pdf"),
/* array($filename[sizeof($filename)-1])
* Insertion dans la base de la trace );
*/
if ( $mailfile->sendfile() )
{
$sendto = htmlentities($sendto);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id)";
$sql .= " VALUES (now(), $action ,$obj->idp , '$objet_type', $objet_id);";
if (! $db->query($sql) )
{
dolibarr_print_error($db);
}
}
else
{
$this->error=$mailfile->error;
}
}
$i++;
}
}
else
{
$this->error=$this->db->error();
}
} }
} }
?> ?>