Nouveau fichier
This commit is contained in:
parent
25a7e7094b
commit
7fd6a929a4
115
htdocs/comm/mailing/cibles.php
Normal file
115
htdocs/comm/mailing/cibles.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
$mesg = '';
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader("","","Fiche mailing");
|
||||||
|
|
||||||
|
if ($cancel == $langs->trans("Cancel"))
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Création
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
|
||||||
|
$html = new Form($db);
|
||||||
|
if ($mil->fetch($_GET["id"]) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$h=0;
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id;
|
||||||
|
$head[$h][1] = $langs->trans("Fiche");
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id;
|
||||||
|
$head[$h][1] = $langs->trans('Destinatires');
|
||||||
|
$hselected = $h;
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dolibarr_fiche_head($head, $hselected, substr($mil->titre,0,20));
|
||||||
|
|
||||||
|
|
||||||
|
print_titre("Mailing");
|
||||||
|
|
||||||
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Nom</td><td>'.$mil->titre.'</td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$sql = "SELECT mc.nom, mc.prenom, mc.email";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||||
|
$sql .= " WHERE mc.fk_mailing=".$mil->id;
|
||||||
|
|
||||||
|
if ( $db->query($sql) )
|
||||||
|
{
|
||||||
|
$num = $db->num_rows();
|
||||||
|
|
||||||
|
print '<br /><table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Destinataires").'</td></tr>';
|
||||||
|
$var = true;
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num )
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object();
|
||||||
|
$var=!$var;
|
||||||
|
|
||||||
|
print "<tr $bc[$var]>";
|
||||||
|
print '<td>'.stripslashes($obj->prenom).'</a></td>';
|
||||||
|
print '<td>'.stripslashes($obj->nom).'</a></td>';
|
||||||
|
print '<td>'.$obj->email.'</td>';
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table><br>";
|
||||||
|
|
||||||
|
$db->free();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
?>
|
||||||
261
htdocs/comm/mailing/fiche.php
Normal file
261
htdocs/comm/mailing/fiche.php
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
<?PHP
|
||||||
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
require("./pre.inc.php");
|
||||||
|
|
||||||
|
$mesg = '';
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'add')
|
||||||
|
{
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
$mil->titre = $_POST["titre"];
|
||||||
|
$mil->sujet = $_POST["sujet"];
|
||||||
|
$mil->body = $_POST["body"];
|
||||||
|
|
||||||
|
|
||||||
|
if ( $mil->create($user) == 0)
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=".$mil->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'update')
|
||||||
|
{
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
$mil->id = $_GET["id"];
|
||||||
|
$mil->titre = $_POST["titre"];
|
||||||
|
$mil->sujet = $_POST["sujet"];
|
||||||
|
$mil->body = $_POST["body"];
|
||||||
|
|
||||||
|
|
||||||
|
if ( $mil->update() == 0)
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=".$mil->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'confirm_valide')
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($_POST["confirm"] == 'yes')
|
||||||
|
{
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
if ($mil->fetch($_GET["id"]) == 0)
|
||||||
|
{
|
||||||
|
$mil->valid($user);
|
||||||
|
|
||||||
|
Header("Location: fiche.php?id=".$mil->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Erreur";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_POST["action"] == 'confirm_approve')
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($_POST["confirm"] == 'yes')
|
||||||
|
{
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
if ($mil->fetch($_GET["id"]) == 0)
|
||||||
|
{
|
||||||
|
$mil->approve($user);
|
||||||
|
|
||||||
|
Header("Location: fiche.php?id=".$mil->id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "Erreur";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader("","","Fiche Mailing");
|
||||||
|
|
||||||
|
if ($cancel == $langs->trans("Cancel"))
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Création
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$mil = new Mailing($db);
|
||||||
|
|
||||||
|
if ($_GET["action"] == 'create')
|
||||||
|
{
|
||||||
|
print '<form action="fiche.php" method="post">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
|
print_titre("Nouveau Mailing");
|
||||||
|
|
||||||
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Titre</td><td><input name="titre" size="30" value=""></td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Sujet</td><td><input name="sujet" size="40" value=""> (sujet du mail)</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%" valign="top">Message</td><td><textarea cols="30" rows="8" name="body"></textarea></td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td colspan="2" align="center"><input type="submit" value="Créer"></td></tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$html = new Form($db);
|
||||||
|
if ($mil->fetch($_GET["id"]) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$h=0;
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id;
|
||||||
|
$head[$h][1] = $langs->trans("Fiche");
|
||||||
|
$hselected = $h;
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id;
|
||||||
|
$head[$h][1] = $langs->trans('Destinatires');
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
dolibarr_fiche_head($head, $hselected, substr($mil->titre,0,20));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Confirmation de la validation du mailing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'valide')
|
||||||
|
{
|
||||||
|
$html->form_confirm("fiche.php?id=".$mil->id,
|
||||||
|
"Valider le mailing",
|
||||||
|
"Confirmez-vous la validation du mailing ?",
|
||||||
|
"confirm_valide");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Confirmation de l'approbation du mailing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if ($_GET["action"] == 'approve')
|
||||||
|
{
|
||||||
|
$html->form_confirm("fiche.php?id=".$mil->id,
|
||||||
|
"Approuver le mailing",
|
||||||
|
"Confirmez-vous l'approbation du mailing ?",
|
||||||
|
"confirm_approve");
|
||||||
|
}
|
||||||
|
|
||||||
|
print_titre("Mailing");
|
||||||
|
|
||||||
|
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Titre</td><td colspan="3">'.$mil->titre.'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Emetteur</td><td>'.htmlentities($mil->email_from).'</td>';
|
||||||
|
print '<td>Email</td><td>'.htmlentities($mil->email_from).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td width="20%" valign="top">Message</td><td colspan="3">';
|
||||||
|
|
||||||
|
print 'Sujet : '.$mil->sujet.'<br/><br />';
|
||||||
|
print nl2br($mil->body).'</td></tr>';
|
||||||
|
|
||||||
|
//print '<tr><td width="20%">Réponse</td><td>'.htmlentities($mil->email_replyto).'</td></tr>';
|
||||||
|
//print '<tr><td width="20%">Retour Erreur</td><td>'.htmlentities($mil->email_errorsto).'</td></tr>';
|
||||||
|
|
||||||
|
if ($mil->statut > 0)
|
||||||
|
{
|
||||||
|
print '<tr><td width="20%">Nb destinataires</td><td colspan="3">'.$mil->nbemail.'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td width="20%">Statut</td><td colspan="3">'.$mil->statuts[$mil->statut].'</td></tr>';
|
||||||
|
|
||||||
|
$uc = new User($db, $mil->user_creat);
|
||||||
|
$uc->fetch();
|
||||||
|
print '<tr><td width="20%">Créé par</td><td>'.$uc->fullname.'</td>';
|
||||||
|
print '<td>le</td>';
|
||||||
|
print '<td>'.strftime("%d %b %Y %H:%M", $mil->date_creat).'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
|
if ($mil->statut > 0)
|
||||||
|
{
|
||||||
|
$uv = new User($db, $mil->user_valid);
|
||||||
|
$uv->fetch();
|
||||||
|
print '<tr><td width="20%">Validé par</td><td>'.$uv->fullname.'</td>';
|
||||||
|
print '<td>le</td>';
|
||||||
|
print '<td>'.strftime("%d %b %Y %H:%M", $mil->date_valid).'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mil->statut > 1)
|
||||||
|
{
|
||||||
|
$ua = new User($db, $mil->user_appro);
|
||||||
|
$ua->fetch();
|
||||||
|
print '<tr><td width="20%">Approuvé par</td><td>'.$ua->fullname.'</td>';
|
||||||
|
print '<td>le</td>';
|
||||||
|
print '<td>'.strftime("%d %b %Y %H:%M", $mil->date_appro).'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print "\n\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
|
if ($_GET["action"] == '')
|
||||||
|
{
|
||||||
|
|
||||||
|
print '<a class="tabAction" href="fiche.php?action=test&id='.$mil->id.'">'.$langs->trans("Tester").'</a>';
|
||||||
|
|
||||||
|
if ($mil->statut == 0)
|
||||||
|
{
|
||||||
|
print '<a class="tabAction" href="fiche.php?action=valide&id='.$mil->id.'">'.$langs->trans("Valider").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mil->statut == 1 && $mil->nbemail > 0)
|
||||||
|
{
|
||||||
|
print '<a class="tabAction" href="fiche.php?action=approve&id='.$mil->id.'">'.$langs->trans("Approuver").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
print '<br /><br /></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||||
|
?>
|
||||||
217
htdocs/comm/mailing/mailing.class.php
Normal file
217
htdocs/comm/mailing/mailing.class.php
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* $Source$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*! \class Mailing
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Mailing
|
||||||
|
{
|
||||||
|
var $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Constructeur de la classe
|
||||||
|
* \param DB handler accès base de données
|
||||||
|
*/
|
||||||
|
function Mailing($DB, $soc_idp="")
|
||||||
|
{
|
||||||
|
$this->db = $DB ;
|
||||||
|
$this->db_table = MAIN_DB_PREFIX."mailing";
|
||||||
|
|
||||||
|
$this->statuts[0] = "En préparation";
|
||||||
|
$this->statuts[1] = "Validé";
|
||||||
|
$this->statuts[2] = "Approuvé";
|
||||||
|
$this->statuts[3] = "Envoyé";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Création du mailing
|
||||||
|
* \param user object utilisateur qui crée
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function create($user)
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Create");
|
||||||
|
$sql = "INSERT INTO ".$this->db_table;
|
||||||
|
$sql .= " (date_creat, fk_user_creat)";
|
||||||
|
$sql .= " VALUES (now(), ".$user->id.")";
|
||||||
|
|
||||||
|
if (strlen(trim($this->titre)) == 0)
|
||||||
|
{
|
||||||
|
$this->titre = "Sans titre";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$this->id = $this->db->last_insert_id();
|
||||||
|
|
||||||
|
return $this->update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Create Erreur -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* \brief Update les infos du mailing
|
||||||
|
*/
|
||||||
|
function update()
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Update");
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
|
||||||
|
$sql .= " SET titre = '".$this->titre."'";
|
||||||
|
$sql .= " , sujet = '".$this->sujet."'";
|
||||||
|
$sql .= " , body = '".$this->body."'";
|
||||||
|
$sql .= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Update Erreur -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* \brief Recupére l'objet mailing
|
||||||
|
* \param rowid id du mailing
|
||||||
|
*/
|
||||||
|
function fetch($rowid)
|
||||||
|
{
|
||||||
|
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body";
|
||||||
|
$sql .= " , m.email_from, m.email_replyto, m.email_errorsto";
|
||||||
|
$sql .= " , m.statut, m.nbemail";
|
||||||
|
$sql .= ", m.fk_user_creat, m.fk_user_valid, m.fk_user_appro";
|
||||||
|
$sql .= ", ".$this->db->pdate("m.date_creat") . " as date_creat";
|
||||||
|
$sql .= ", ".$this->db->pdate("m.date_valid") . " as date_valid";
|
||||||
|
$sql .= ", ".$this->db->pdate("m.date_appro") . " as date_appro";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
|
||||||
|
$sql .= " WHERE m.rowid = ".$rowid;
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
if ($this->db->num_rows())
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object();
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
$this->statut = $obj->statut;
|
||||||
|
$this->nbemail = $obj->nbemail;
|
||||||
|
$this->titre = stripslashes($obj->titre);
|
||||||
|
$this->sujet = stripslashes($obj->sujet);
|
||||||
|
$this->body = stripslashes($obj->body);
|
||||||
|
|
||||||
|
$this->email_from = $obj->email_from;
|
||||||
|
$this->email_replyto = $obj->email_replyto;
|
||||||
|
$this->email_errorsto = $obj->email_errorsto;
|
||||||
|
|
||||||
|
$this->user_creat = $obj->fk_user_creat;
|
||||||
|
$this->user_valid = $obj->fk_user_valid;
|
||||||
|
$this->user_appro = $obj->fk_user_appro;
|
||||||
|
|
||||||
|
$this->date_creat = $obj->date_creat;
|
||||||
|
$this->date_valid = $obj->date_valid;
|
||||||
|
$this->date_appro = $obj->date_appro;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Fetch Erreur -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Fetch Erreur -2");
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Valide le mailing
|
||||||
|
* \param userid id de l'utilisateur qui valide
|
||||||
|
*/
|
||||||
|
function valid($user)
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Valid");
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
|
||||||
|
$sql .= " SET statut = 1, date_valid = now(), fk_user_valid=".$user->id;
|
||||||
|
|
||||||
|
$sql .= " WHERE rowid = ".$this->id." AND statut = 0 ;";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Valid Erreur -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Approuve le mailing
|
||||||
|
* \param userid id de l'utilisateur qui valide
|
||||||
|
*/
|
||||||
|
function approve($user)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
|
||||||
|
$sql .= " SET statut = 2, date_appro = now(), fk_user_appro=".$user->id;
|
||||||
|
|
||||||
|
$sql .= " WHERE rowid = ".$this->id." AND statut = 1 ;";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_syslog("Mailing::Valid Erreur -1");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Supprime le mailing
|
||||||
|
* \param rowid id à supprimer
|
||||||
|
*/
|
||||||
|
function delete($rowid)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
|
||||||
|
$sql .= " WHERE fk_facture = ".$rowid;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user