* Copyright (C) 2016 Laurent Destailleur * * 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 * the Free Software Foundation; either version 3 of the License, or * (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 * along with this program. If not, see . */ /** * \file htdocs/comm/mailing/advtargetemailing.php * \ingroup mailing * \brief Page to define emailing targets */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/emailing.lib.php'; require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/advtargetemailing.class.php'; require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/html.formadvtargetemailing.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/modules/mailings/advthirdparties.modules.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Translations $langs->load("mails"); $langs->load("companies"); if (! empty($conf->categorie->enabled)) { $langs->load("categories"); } // Security check if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); if ($page == - 1) { $page = 0; } $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder = "ASC"; if (! $sortfield) $sortfield = "email"; $id = GETPOST('id', 'int'); $rowid = GETPOST('rowid', 'int'); $action = GETPOST("action"); $search_nom = GETPOST("search_nom"); $search_prenom = GETPOST("search_prenom"); $search_email = GETPOST("search_email"); $template_id = GETPOST('template_id', 'int'); // Do we click on purge search criteria ? if (GETPOST("button_removefilter_x")) { $search_nom = ''; $search_prenom = ''; $search_email = ''; } $array_query = array (); $object = new Mailing($db); $advTarget = new AdvanceTargetingMailing($db); if (empty($template_id)) { $advTarget->fk_mailing = $id; $result = $advTarget->fetch_by_mailing(); } else { $result = $advTarget->fetch($template_id); } if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } else { if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } } /* * Actions */ if ($action == 'loadfilter') { if (! empty($template_id)) { $result = $advTarget->fetch($template_id); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } else { if (! empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } } } } if ($action == 'add') { $user_contact_query = false; $array_query = array (); // Get extra fields foreach ( $_POST as $key => $value ) { // print '$key='.$key.' $value='.$value.'
'; if (preg_match("/^options_.*(?query_thirdparty($array_query); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } /*} else { $advTarget->thirdparty_lines = array (); }*/ if ($user_contact_query && ($array_query['type_of_target'] == 1 || $array_query['type_of_target'] == 2)) { $result = $advTarget->query_contact($array_query); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } // If use contact but no result use artefact to so not use socid into add_to_target if (count($advTarget->contact_lines) == 0) { $advTarget->contact_lines = array ( 0 ); } } else { $advTarget->contact_lines = array (); } if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) { // Add targets into database $obj = new mailing_advthirdparties($db); $result = $obj->add_to_target($id, $advTarget->thirdparty_lines, $array_query['type_of_target'], $advTarget->contact_lines); } else { $result = 0; } if ($result > 0) { $query_temlate_id = ''; if (! empty($template_id)) { $query_temlate_id = '&template_id=' . $template_id; } header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id . $query_temlate_id); exit(); } if ($result == 0) { setEventMessage($langs->trans("WarningNoEMailsAdded"), 'warnings'); } if ($result < 0) { setEventMessage($obj->error, 'errors'); } } if ($action == 'clear') { // Chargement de la classe $classname = "MailingTargets"; $obj = new $classname($db); $obj->clear_target($id); header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit(); } if ($action == 'savefilter' || $action == 'createfilter') { $template_name = GETPOST('template_name'); $error = 0; if ($action == 'createfilter' && empty($template_name)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->trans('AdvTgtOrCreateNewFilter')), 'errors'); $error ++; } if (empty($error)) { $array_query = array (); // Get extra fields foreach ( $_POST as $key => $value ) { if (preg_match("/^options_.*(?filtervalue = json_encode($array_query); if ($action == 'createfilter') { $advTarget->name = $template_name; $result = $advTarget->create($user); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } } elseif ($action == 'savefilter') { $result = $advTarget->update($user); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } } $template_id = $advTarget->id; } } if ($action == 'deletefilter') { $result = $advTarget->delete($user); if ($result < 0) { setEventMessage($advTarget->error, 'errors'); } header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit(); } if ($action == 'delete') { // Ici, rowid indique le destinataire et id le mailing $sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing_cibles WHERE rowid=" . $rowid; $resql = $db->query($sql); if ($resql) { if (! empty($id)) { $classname = "MailingTargets"; $obj = new $classname($db); $obj->update_nb($id); header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id); exit(); } else { header("Location: liste.php"); exit(); } } else { dol_print_error($db); } } if ($_POST["button_removefilter"]) { $search_nom = ''; $search_prenom = ''; $search_email = ''; } /* * View */ $extrajs = array ( '/includes/jquery/plugins/multiselect/js/ui.multiselect.js' ); $extracss = array ( '/includes/jquery/plugins/multiselect/css/ui.multiselect.css', ); llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss); print ''; $form = new Form($db); $formadvtargetemaling = new FormAdvTargetEmailing($db); $formcompany = new FormCompany($db); $formother = new FormOther($db); if ($object->fetch($id) >= 0) { $head = emailing_prepare_head($object); dol_fiche_head($head, 'advtargets', $langs->trans("Mailing"), 0, 'email'); print ''; $linkback = '' . $langs->trans("BackToList") . ''; print ''; print ''; print ''; print ''; // Errors to print ''; // Status print ''; // Nb of distinct emails print ''; print '
' . $langs->trans("Ref") . ''; print $form->showrefnav($object, 'id', $linkback); print '
' . $langs->trans("MailTitle") . '' . $object->titre . '
' . $langs->trans("MailFrom") . '' . dol_print_email($object->email_from, 0, 0, 0, 0, 1) . '
' . $langs->trans("MailErrorsTo") . '' . dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1); print '
' . $langs->trans("Status") . '' . $object->getLibStatut(4) . '
'; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; $nbemail = ($object->nbemail ? $object->nbemail : '0'); if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text = $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail, $text, 1, 'warning'); } else { print $nbemail; } print '
'; print ""; // Show email selectors if ($object->statut == 0 && $user->rights->mailing->creer) { print_fiche_titre($langs->trans("AdvTgtTitle")); print '
' . "\n"; print '
' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; print '' . "\n"; // Customer name print '' . "\n"; // Code Client print '' . "\n"; // Address Client print '' . "\n"; // Zip Client print '' . "\n"; // City Client print '' . "\n"; // Customer Country print '' . "\n"; // State Customer print '' . "\n"; // Mother Company print '' . "\n"; // Prospect/Customer $selected = $array_query['cust_typecust']; print '' . "\n"; // Prospection status print '' . "\n"; // Prospection comm status print '' . "\n"; // Customer Type print '' . "\n"; // Staff number print '' . "\n"; // Sales manager print '' . "\n"; // Customer Default Langauge if (! empty($conf->global->MAIN_MULTILANGS)) { print '' . "\n"; } if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // Customer Categories print '' . "\n"; } // Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // fetch optionals attributes and labels dol_include_once('/core/class/extrafields.class.php'); $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('societe'); foreach ( $extralabels as $key => $val ) { if ($key != 'ts_nameextra' && $key != 'ts_payeur') { print '' . "\n"; } } } else { $std_soc = new Societe($db); $action_search = 'query'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array ( 'thirdpartycard' )); if (! empty($advTarget->id)) { $parameters = array ( 'array_query' => $advTarget->filtervalue ); } // Module extrafield feature $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); } // State Contact print '' . "\n"; // Civility print ''; // contact name print '' . "\n"; print '' . "\n"; // Contact Country print '' . "\n"; // Never send mass mailing print '' . "\n"; // Contact Date Create print '' . "\n"; // Contact update Create print '' . "\n"; if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // Customer Categories print '' . "\n"; } // Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // fetch optionals attributes and labels dol_include_once('/core/class/extrafields.class.php'); $extrafields = new ExtraFields($db); $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); foreach ( $extralabels as $key => $val ) { print '' . "\n"; } } print '' . "\n"; print '' . "\n"; print '' . "\n"; print '
' . "\n"; print '' . "\n"; print '
' . $langs->trans('AdvTgtNameTemplate') . ''; if (! empty($template_id)) { $default_template = $template_id; } else { $default_template = $advTarget->id; } print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template); print ''; print ''; print ''; print $langs->trans('AdvTgtOrCreateNewFilter'); print ''; print ''; print '' . "\n"; print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); print '
' . $langs->trans('ThirdPartyName'); if (! empty($array_query['cust_name'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('CustomerCode'); if (! empty($array_query['cust_code'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('Address'); if (! empty($array_query['cust_adress'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('Zip'); if (! empty($array_query['cust_zip'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('Town'); if (! empty($array_query['cust_city'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans("Country"); if (count($array_query['cust_country']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); print '' . "\n"; print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); if (count($array_query['cust_status']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->advMultiselectarray('cust_status', array ( '0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity') ), $array_query['cust_status']); print '' . "\n"; print '
' . $langs->trans("Maison mère"); if (! empty($array_query['cust_mothercompany'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print ''; print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); if (count($array_query['cust_typecust']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; $options_array = array ( 2 => $langs->trans('Prospect'), 3 => $langs->trans('ProspectCustomer'), 1 => $langs->trans('Customer'), 0 => $langs->trans('NorProspectNorCustomer') ); print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); print '' . "\n"; print '
' . $langs->trans('ProspectLevel'); if (count($array_query['cust_prospect_status']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); print '' . "\n"; print '
' . $langs->trans('StatusProsp'); if (count($array_query['cust_comm_status']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); print '' . "\n"; print '
' . $langs->trans("ThirdPartyType"); if (count($array_query['cust_typeent']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); print '' . "\n"; print '
' . $langs->trans("Staff"); if (count($array_query['cust_effectif_id']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); print '' . "\n"; print '
' . $langs->trans("SalesRepresentatives"); if (count($array_query['cust_saleman']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); print '' . "\n"; print '
' . $langs->trans("DefaultLang"); if (count($array_query['cust_language']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); print '' . "\n"; print '
' . $langs->trans("CustomersCategoryShort"); if (count($array_query['cust_categ']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); print '' . "\n"; print '
' . $extrafields->attribute_label[$key]; if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { print $langs->trans("AdvTgtMinVal") . ''; print $langs->trans("AdvTgtMaxVal") . ''; print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { print ''; print '
' . $langs->trans("AdvTgtStartDt") . ''; print $form->select_date('', 'options_' . $key . '_st_dt'); print '' . $langs->trans("AdvTgtEndDt") . ''; print $form->select_date('', 'options_' . $key . '_end_dt'); print '
'; print '
' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'boolean')) { print $form->selectarray('options_' . $key, array ( '' => '', '1' => $langs->trans('Yes'), '0' => $langs->trans('No') ), $array_query['options_' . $key]); print '' . "\n"; } elseif (($extrafields->attribute_type[$key] == 'select')) { print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); print '' . "\n"; } elseif (($extrafields->attribute_type[$key] == 'sellist')) { print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); print '' . "\n"; } else { print ''; print '
'; if (is_array($array_query['options_' . $key])) { print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); } else { print $extrafields->showInputField($key, $array_query['options_' . $key]); } print '
'; print '
' . "\n"; } print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); if (count($array_query['contact_status']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->advMultiselectarray('contact_status', array ( '0' => $langs->trans('ActivityCeased'), '1' => $langs->trans('InActivity') ), $array_query['contact_status']); print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); print '
' . $langs->trans("UserTitle"); if (count($array_query['contact_civility']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); if (! empty($array_query['contact_lastname'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); if (! empty($array_query['contact_firstname'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); if (count($array_query['contact_country']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); print '' . "\n"; print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); if (! empty($array_query['contact_no_email'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $form->selectarray('contact_no_email', array ( '' => '', '1' => $langs->trans('Yes'), '0' => $langs->trans('No') ), $array_query['contact_no_email']); print '' . "\n"; print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); if (! empty($array_query['contact_create_st_dt'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print ''; print '
' . $langs->trans("AdvTgtStartDt") . ''; print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); print '' . $langs->trans("AdvTgtEndDt") . ''; print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); print '
'; print '
' . "\n"; print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); if (! empty($array_query['contact_update_st_dt'])) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print ''; print '
' . $langs->trans("AdvTgtStartDt") . ''; print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); print '' . $langs->trans("AdvTgtEndDt") . ''; print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); print '
'; print '
' . "\n"; print '
' . $langs->trans("ContactCategoriesShort"); if (count($array_query['contact_categ']) > 0) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print '' . "\n"; print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); print '' . "\n"; print '
' . $extrafields->attribute_label[$key]; if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); } print ''; if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { print $langs->trans("AdvTgtMinVal") . ''; print $langs->trans("AdvTgtMaxVal") . ''; print '' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { print ''; print '
' . $langs->trans("AdvTgtStartDt") . ''; print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct'); print '' . $langs->trans("AdvTgtEndDt") . ''; print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct'); print '
'; print '
' . "\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); } elseif (($extrafields->attribute_type[$key] == 'boolean')) { print $form->selectarray('options_' . $key . '_cnct', array ( '' => '', '1' => $langs->trans('Yes'), '0' => $langs->trans('No') ), $array_query['options_' . $key . '_cnct']); print '' . "\n"; } elseif (($extrafields->attribute_type[$key] == 'select')) { print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); print '' . "\n"; } elseif (($extrafields->attribute_type[$key] == 'sellist')) { print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); print '' . "\n"; } else { print ''; print '
'; if (is_array($array_query['options_' . $key . '_cnct'])) { print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); } else { print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); } print '
'; print '
' . "\n"; } print '
' . "\n"; print '' . "\n"; print '
' . "\n"; print '
' . "\n"; print '
' . "\n"; print '
'; print ''; print_titre($langs->trans("ToClearAllRecipientsClickHere")); print ''; print ''; print ''; print ''; print '
'; print '
'; print '
'; } if (empty($conf->mailchimp->enabled) || (! empty($conf->mailchimp->enabled) && $object->statut != 3)) { // List of recipients (TODO Move code of page cibles.php into a .tpl.php file and make an include here to avoid duplicate content) } } llxFooter(); $db->close();