' . "\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,0,$advTarget->type_element);
print '';
print '';
print '';
print $langs->trans('AdvTgtOrCreateNewFilter');
print '';
print '';
print ' | ' . "\n";
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 ' |
' . "\n";
// Customer name
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 ' |
' . "\n";
// Code Client
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 ' |
' . "\n";
// Address Client
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 ' |
' . "\n";
// Zip Client
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 ' |
' . "\n";
// City Client
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 ' |
' . "\n";
// Customer Country
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 ' |
' . "\n";
// State Customer
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 ' |
' . "\n";
// Mother Company
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 ' |
' . "\n";
// Prospect/Customer
$selected = $array_query['cust_typecust'];
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 ' |
' . "\n";
// Prospection status
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 ' |
' . "\n";
// Prospection comm status
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 ' |
' . "\n";
// Customer Type
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 ' |
' . "\n";
// Staff number
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 ' | ' . "\n";
// Sales manager
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 ' |
' . "\n";
// Customer Default Langauge
if (! empty($conf->global->MAIN_MULTILANGS)) {
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 ' |
' . "\n";
}
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
// Customer Categories
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 ' |
' . "\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 '| ' . $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 ' |
' . "\n";
}
}
} else {
$std_soc = new Societe($db);
$action_search = 'query';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array ('thirdpartycard'));
$parameters=array();
if (! empty($advTarget->id)) {
$parameters = array('array_query' => $advTarget->filtervalue);
}
// Other attributes
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);
print $hookmanager->resPrint;
}
// State Contact
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 ' |
' . "\n";
// Civility
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 ' |
';
// contact name
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 ' |
' . "\n";
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 ' |
' . "\n";
// Contact Country
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 ' |
' . "\n";
// Never send mass mailing
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 ' |
' . "\n";
// Contact Date Create
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 ' |
' . "\n";
// Contact update Create
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 ' |
' . "\n";
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
// Customer Categories
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 ' |
' . "\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($extrafields->attribute_type as $key=>&$value) {
if($value == 'radio')$value = 'select';
}
foreach ( $extralabels as $key => $val ) {
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 '
' . "\n";
print '
' . "\n";
print '