2009-07-29 18:41:39 +00:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
2024-09-22 22:37:30 +00:00
|
|
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
2009-07-29 18:41:39 +00:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2009-07-29 18:41:39 +00:00
|
|
|
* (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
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
* or see https://www.gnu.org/
|
2009-07-29 18:41:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2011-10-24 10:59:44 +00:00
|
|
|
* \file htdocs/core/lib/emailing.lib.php
|
2009-07-29 18:41:39 +00:00
|
|
|
* \brief Library file with function for emailing module
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2012-02-04 09:48:47 +00:00
|
|
|
* Prepare array with list of tabs
|
2009-07-29 18:41:39 +00:00
|
|
|
*
|
2015-02-10 10:38:13 +00:00
|
|
|
* @param Mailing $object Object related to tabs
|
2024-09-22 22:37:30 +00:00
|
|
|
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
|
2009-07-29 18:41:39 +00:00
|
|
|
*/
|
2015-02-10 10:38:13 +00:00
|
|
|
function emailing_prepare_head(Mailing $object)
|
2009-07-29 18:41:39 +00:00
|
|
|
{
|
2012-06-14 18:08:46 +00:00
|
|
|
global $user, $langs, $conf;
|
2009-07-29 18:41:39 +00:00
|
|
|
|
|
|
|
|
$h = 0;
|
|
|
|
|
$head = array();
|
|
|
|
|
|
2014-09-18 19:18:25 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id;
|
2009-07-29 18:41:39 +00:00
|
|
|
$head[$h][1] = $langs->trans("MailCard");
|
|
|
|
|
$head[$h][2] = 'card';
|
|
|
|
|
$h++;
|
2016-04-01 08:52:19 +00:00
|
|
|
|
2023-11-27 10:39:32 +00:00
|
|
|
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('mailing', 'mailing_advance', 'recipient'))) {
|
2025-03-25 12:35:55 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/targetemailing.php?id=".$object->id;
|
2020-10-31 13:32:18 +00:00
|
|
|
$head[$h][1] = $langs->trans("MailRecipients");
|
2021-02-23 21:03:23 +00:00
|
|
|
if ($object->nbemail > 0) {
|
|
|
|
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$object->nbemail.'</span>';
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
$head[$h][2] = 'targets';
|
|
|
|
|
$h++;
|
2012-06-14 18:08:46 +00:00
|
|
|
}
|
2018-07-26 17:05:34 +00:00
|
|
|
|
2023-11-27 10:39:32 +00:00
|
|
|
if (getDolGlobalString('EMAILING_USE_ADVANCED_SELECTOR')) {
|
2016-12-10 10:49:35 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
|
|
|
|
$head[$h][2] = 'advtargets';
|
|
|
|
|
$h++;
|
|
|
|
|
}
|
2016-12-09 18:06:59 +00:00
|
|
|
|
2012-02-04 09:48:47 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
|
2009-07-29 18:41:39 +00:00
|
|
|
$head[$h][1] = $langs->trans("Info");
|
|
|
|
|
$head[$h][2] = 'info';
|
|
|
|
|
$h++;
|
2016-04-01 08:52:19 +00:00
|
|
|
|
2023-10-26 11:40:44 +00:00
|
|
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/note.php?id=".$object->id;
|
|
|
|
|
$head[$h][1] = $langs->trans("Note");
|
|
|
|
|
$head[$h][2] = 'note';
|
|
|
|
|
$h++;
|
|
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing');
|
2009-07-29 18:41:39 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailing', 'remove');
|
2013-02-14 15:25:43 +00:00
|
|
|
|
2009-07-29 18:41:39 +00:00
|
|
|
return $head;
|
|
|
|
|
}
|