From 7fef9a813e5d9a0403b3de310df1e75b324e73b4 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 18 Jun 2020 20:03:03 +0200 Subject: [PATCH 1/2] fix warning and clean old code about multiselect category --- .../html.formadvtargetemailing.class.php | 68 -------- htdocs/core/tpl/advtarget.tpl.php | 148 ++++++++++-------- 2 files changed, 79 insertions(+), 137 deletions(-) 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/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 '