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/compta/facture/card.php b/htdocs/compta/facture/card.php index 532067104e9..3270c3a9663 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3544,10 +3544,19 @@ if ($action == 'create') } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2'); + $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { + if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE)) { + // copy from thirdparty + $tpExtrafields = new Extrafields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + }; + print $object->showOptionals($extrafields, 'edit', $parameters); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b09f7f00ffe..6bb3e0cc5ca 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -455,6 +455,7 @@ if (!$sall) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.f if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -462,7 +463,7 @@ if ($search_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; + $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; 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 '