New: add hook getFormMail

This commit is contained in:
Regis Houssin 2013-01-24 17:29:11 +01:00
parent beea9c2ec4
commit c688e2afab

View File

@ -217,10 +217,33 @@ class FormMail
function get_form($addfileaction='addfile',$removefileaction='removefile') function get_form($addfileaction='addfile',$removefileaction='removefile')
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
global $hookmanager;
$langs->load("other"); $langs->load("other");
$langs->load("mails"); $langs->load("mails");
if (! is_object($hookmanager))
{
if (! class_exists('HookManager')) {
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
require DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
}
$hookmanager->initHooks(array('formmail'));
$parameters=array(
'addfileaction' => $addfileaction,
'removefileaction'=> $removefileaction
);
$reshook=$hookmanager->executeHooks('getFormMail', $parameters, $this);
if (!empty($reshook))
{
return $hookmanager->resPrint;
}
else
{
$out=''; $out='';
// Define list of attached files // Define list of attached files
@ -231,7 +254,6 @@ class FormMail
if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]);
if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]);
$form=new Form($this->db); $form=new Form($this->db);
$out.= "\n<!-- Debut form mail -->\n"; $out.= "\n<!-- Debut form mail -->\n";
@ -634,6 +656,7 @@ class FormMail
return $out; return $out;
} }
}
} }
?> ?>