diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
index b9782515735..06962600edf 100644
--- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
@@ -341,74 +341,6 @@ class FormAdvTargetEmailing extends Form
return $return;
}
- /**
- * Return combo list with customer categories
- *
- * @param string $htmlname Name of categorie
- * @param array $selected_array value selected
- * @return string HTML combo
- */
- public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
- {
- return $this->multiselectCategories($htmlname, $selected_array, 2);
- }
-
- /**
- * Return combo list with customer contact
- *
- * @param string $htmlname Name of categorie
- * @param array $selected_array value selected
- * @return string HTML combo
- */
- public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
- {
- return $this->multiselectCategories($htmlname, $selected_array, 4);
- }
-
- /**
- * Return combo list of categories
- *
- * @param string $htmlname Name of categorie
- * @param array $selected_array Value selected
- * @param int $type Type
- * @return string HTML combo
- */
- public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0)
- {
- global $conf, $langs, $user;
- $langs->load("dict");
-
- $options_array = array();
-
- $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
- $sql .= " WHERE type=".$type;
-
- dol_syslog(__METHOD__, LOG_DEBUG);
- $resql = $this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
- $i = 0;
- if ($num)
- {
- while ($i < $num)
- {
- $obj = $this->db->fetch_object($resql);
-
- $options_array[$obj->rowid] = $obj->label;
-
- $i++;
- }
- }
- }
- else
- {
- dol_print_error($this->db);
- }
-
- return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
- }
-
/**
* Return a combo list to select emailing target selector
*
diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php
index 839be4c4e3d..8afbf7a654d 100644
--- a/htdocs/core/lib/emailing.lib.php
+++ b/htdocs/core/lib/emailing.lib.php
@@ -48,7 +48,7 @@ function emailing_prepare_head(Mailing $object)
$h++;
}
- if (empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
+ if (!empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
{
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php
index 23727e4ad97..245cd4f7f00 100644
--- a/htdocs/core/tpl/advtarget.tpl.php
+++ b/htdocs/core/tpl/advtarget.tpl.php
@@ -15,6 +15,10 @@
* along with this program. If not, see .
*/
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+}
+
print '