dolibarr 21.0.0-beta
advtarget.tpl.php
1<?php
2/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 */
5/*
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
35if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
36 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
37}
38
39// From controller using view
40'
41@phan-var-force FormAdvTargetEmailing $formadvtargetemaling
42@phan-var-force AdvanceTargetingMailing $advTarget
43@phan-var-force array<string,string|int|string[]> $array_query
44';
45
46print '<script>
47 $(document).ready(function() {
48
49 // Click Function
50 $(":button[name=addcontact]").click(function() {
51 $(":hidden[name=action]").val("add");
52 $("#find_customer").submit();
53 });
54
55 $(":button[name=loadfilter]").click(function() {
56 $(":hidden[name=action]").val("loadfilter");
57 $("#find_customer").submit();
58 });
59
60 $(":button[name=deletefilter]").click(function() {
61 $(":hidden[name=action]").val("deletefilter");
62 $("#find_customer").submit();
63 });
64
65 $(":button[name=savefilter]").click(function() {
66 $(":hidden[name=action]").val("savefilter");
67 $("#find_customer").submit();
68 });
69
70 $(":button[name=createfilter]").click(function() {
71 $(":hidden[name=action]").val("createfilter");
72 $("#find_customer").submit();
73 });
74 });
75</script>';
76
77
78print load_fiche_titre($langs->trans("AdvTgtTitle"));
79
80print '<div class="tabBar">'."\n";
81print '<form name="find_customer" id="find_customer" action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'."\n";
82print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
83print '<input type="hidden" name="action" value="">'."\n";
84print '<table class="border centpercent">'."\n";
85
86print '<tr>'."\n";
87print '<td colspan="3" class="right">'."\n";
88
89print '<input type="button" name="addcontact" id="addcontact" value="'.$langs->trans('AdvTgtAddContact').'" class="button"/>'."\n";
90
91print '</td>'."\n";
92print '</tr>'."\n";
93
94print '<tr><td>'.$langs->trans('AdvTgtNameTemplate').'</td><td class="valignmiddle">';
95if (!empty($template_id)) {
96 $default_template = $template_id;
97} else {
98 $default_template = $advTarget->id;
99}
100print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template, 0, $advTarget->type_element, 'valignmiddle');
101print '<input type="button" name="loadfilter" id="loadfilter" value="'.$langs->trans('AdvTgtLoadFilter').'" class="button"/>';
102print '<input type="button" name="deletefilter" id="deletefilter" value="'.$langs->trans('AdvTgtDeleteFilter').'" class="button"/>';
103print '<input type="button" name="savefilter" id="savefilter" value="'.$langs->trans('AdvTgtSaveFilter').'" class="button"/>';
104print '</td><td>'."\n";
105print '</td></tr>'."\n";
106
107print '<tr><td>'.$langs->trans('AdvTgtOrCreateNewFilter').'</td><td>';
108print '<input type="text" name="template_name" id="template_name" value=""/>';
109print '<input type="button" name="createfilter" id="createfilter" value="'.$langs->trans('AdvTgtCreateFilter').'" class="button"/>';
110print '</td><td>'."\n";
111print '</td></tr>'."\n";
112
113print '<tr><td>'.$langs->trans('AdvTgtTypeOfIncude').'</td><td>';
114print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']);
115print '</td><td>'."\n";
116print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help');
117print '</td></tr>'."\n";
118
119// Customer name
120print '<tr><td>'.$langs->trans('ThirdPartyName');
121if (!empty($array_query['cust_name'])) {
122 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
123}
124print '</td><td><input type="text" name="cust_name" value="'.$array_query['cust_name'].'"/></td><td>'."\n";
125print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
126print '</td></tr>'."\n";
127
128// Code Client
129print '<tr><td>'.$langs->trans('CustomerCode');
130if (!empty($array_query['cust_code'])) {
131 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
132 $cust_code_str = (string) $array_query['cust_code'];
133} else {
134 $cust_code_str = null;
135}
136print '</td><td><input type="text" name="cust_code"'.($cust_code_str != null ? ' value="'.$cust_code_str : '').'"/></td><td>'."\n";
137print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
138print '</td></tr>'."\n";
139
140// Address Client
141print '<tr><td>'.$langs->trans('Address');
142if (!empty($array_query['cust_adress'])) {
143 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
144}
145print '</td><td><input type="text" name="cust_adress" value="'.$array_query['cust_adress'].'"/></td><td>'."\n";
146print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
147print '</td></tr>'."\n";
148
149// Zip Client
150print '<tr><td>'.$langs->trans('Zip');
151if (!empty($array_query['cust_zip'])) {
152 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
153}
154print '</td><td><input type="text" name="cust_zip" value="'.$array_query['cust_zip'].'"/></td><td>'."\n";
155print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
156print '</td></tr>'."\n";
157
158// City Client
159print '<tr><td>'.$langs->trans('Town');
160if (!empty($array_query['cust_city'])) {
161 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
162}
163print '</td><td><input type="text" name="cust_city" value="'.$array_query['cust_city'].'"/></td><td>'."\n";
164print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
165print '</td></tr>'."\n";
166
167// State Client
168print '<tr><td>'.$langs->trans('State');
169if (!empty($array_query['cust_state'])) {
170 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
171}
172print '</td><td>'."\n";
173print $formadvtargetemaling->multiselectState('cust_state', $array_query['cust_state']);
174print '</td><td>'."\n";
175print '</td></tr>'."\n";
176
177// Customer Country
178print '<tr><td>'.$langs->trans("Country");
179if (!empty($array_query['cust_country'])) {
180 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
181}
182print '</td><td>'."\n";
183print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']);
184print '</td><td>'."\n";
185print '</td></tr>'."\n";
186
187// State Customer
188print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('ThirdParty');
189if (!empty($array_query['cust_status'])) {
190 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
191}
192print '</td><td>';
193print $formadvtargetemaling->advMultiselectarray(
194 'cust_status',
195 array(
196 '0' => $langs->trans('ActivityCeased'),
197 '1' => $langs->trans('InActivity')
198 ),
199 $array_query['cust_status']
200);
201print '</td><td>'."\n";
202print '</td></tr>'."\n";
203
204// Mother Company
205print '<tr><td>'.$langs->trans("ParentCompany");
206if (!empty($array_query['cust_mothercompany'])) {
207 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
208}
209print '</td><td>'."\n";
210print '<input type="text" name="cust_mothercompany" value="'.$array_query['cust_mothercompany'].'"/>';
211print '</td><td>'."\n";
212print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
213print '</td></tr>'."\n";
214
215// Prospect/Customer
216$selected = $array_query['cust_typecust'];
217print '<tr><td>'.$langs->trans('ProspectCustomer').' '.$langs->trans('ThirdParty');
218if (!empty($array_query['cust_typecust'])) {
219 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
220}
221print '</td><td>';
222$options_array = array(
223 2 => $langs->trans('Prospect'),
224 3 => $langs->trans('ProspectCustomer'),
225 1 => $langs->trans('Customer'),
226 0 => $langs->trans('NorProspectNorCustomer')
227);
228print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']);
229print '</td><td>'."\n";
230print '</td></tr>'."\n";
231
232// Prospection status
233print '<tr><td>'.$langs->trans('ProspectLevel');
234if (!empty($array_query['cust_prospect_status'])) {
235 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
236}
237print '</td><td>';
238print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status');
239print '</td><td>'."\n";
240print '</td></tr>'."\n";
241
242// Prospection comm status
243print '<tr><td>'.$langs->trans('StatusProsp');
244if (!empty($array_query['cust_comm_status'])) {
245 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
246}
247print '</td><td>';
248print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']);
249print '</td><td>'."\n";
250print '</td></tr>'."\n";
251
252// Customer Type
253print '<tr><td>'.$langs->trans("ThirdPartyType");
254if (!empty($array_query['cust_typeent'])) {
255 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
256}
257print '</td><td>'."\n";
258print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']);
259print '</td><td>'."\n";
260print '</td></tr>'."\n";
261
262// Staff number
263print '<td>'.$langs->trans("Staff");
264if (!empty($array_query['cust_effectif_id'])) {
265 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
266}
267print '</td><td>';
268print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']);
269print '</td><td>'."\n";
270print '</td></tr>'."\n";
271
272// Sales manager
273print '<tr><td>'.$langs->trans("SalesRepresentatives");
274if (!empty($array_query['cust_saleman'])) {
275 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
276}
277print '</td><td>'."\n";
278print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user);
279print '</td><td>'."\n";
280print '</td></tr>'."\n";
281
282// Customer Default Language
283if (getDolGlobalInt('MAIN_MULTILANGS')) {
284 print '<tr><td>'.$langs->trans("DefaultLang");
285 if (!empty($array_query['cust_language'])) {
286 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
287 }
288 print '</td><td>'."\n";
289 print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']);
290 print '</td><td>'."\n";
291 print '</td></tr>'."\n";
292}
293
294if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
295 // Customer Categories
296 print '<tr><td>'.$langs->trans("CustomersCategoryShort");
297 if (!empty($array_query['cust_categ'])) {
298 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
299 }
300 print '</td><td>'."\n";
301 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, '', 'parent', 0, 0, 1);
302 print $form->multiselectarray('cust_categ', $cate_arbo, GETPOST('cust_categ', 'array'), 0, 0, '', 0, "90%");
303 print '</td><td>'."\n";
304 print '</td></tr>'."\n";
305}
306
307// Standard Extrafield feature
308if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
309 $socstatic = new Societe($db);
310 $elementtype = $socstatic->table_element;
311 // fetch optionals attributes and labels
312 require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
313 $extrafields = new ExtraFields($db);
314 $extrafields->fetch_name_optionals_label($elementtype);
315 foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
316 if ($key != 'ts_nameextra' && $key != 'ts_payeur') {
317 if (isset($extrafields->attributes[$elementtype]['langfile'][$key])) {
318 $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
319 }
320 print '<tr><td>'.$langs->trans($extrafields->attributes[$elementtype]['label'][$key]);
321 if (!empty($array_query['options_'.$key]) || (is_array($array_query['options_'.$key]) && count($array_query['options_'.$key]) > 0)) {
322 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
323 }
324 print '</td><td>';
325 if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
326 print '<input type="text" name="options_'.$key.'"/></td><td>'."\n";
327 print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
328 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
329 print $langs->trans("AdvTgtMinVal").'<input type="text" name="options'.$key.'_min"/>';
330 print $langs->trans("AdvTgtMaxVal").'<input type="text" name="options'.$key.'_max"/>';
331 print '</td><td>'."\n";
332 print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
333 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
334 print '<table class="nobordernopadding"><tr>';
335 print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
336 print $form->selectDate('', 'options_'.$key.'_st_dt', 0, 0, 1);
337 print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
338 print $form->selectDate('', 'options_'.$key.'_end_dt', 0, 0, 1);
339 print '</td></tr></table>';
340
341 print '</td><td>'."\n";
342 print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
343 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) {
344 print $form->selectarray(
345 'options_'.$key,
346 array(
347 '' => '',
348 '1' => $langs->trans('Yes'),
349 '0' => $langs->trans('No')
350 ),
351 $array_query['options_'.$key]
352 );
353 print '</td><td>'."\n";
354 } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'select') {
355 print $formadvtargetemaling->advMultiselectarray('options_'.$key, $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key]);
356 print '</td><td>'."\n";
357 } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'sellist') {
358 print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key, $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key]);
359 print '</td><td>'."\n";
360 } else {
361 print '<table class="nobordernopadding"><tr>';
362 print '<td></td><td>';
363 if (is_array($array_query['options_'.$key])) {
364 print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key]), '', '', '', '', 0, 'societe', 1);
365 } else {
366 print $extrafields->showInputField($key, $array_query['options_'.$key], '', '', '', '', 0, 'societe', 1);
367 }
368 print '</td></tr></table>';
369
370 print '</td><td>'."\n";
371 }
372 print '</td></tr>'."\n";
373 }
374 }
375} else {
376 $std_soc = new Societe($db);
377 $action_search = 'query';
378
379 $parameters = array('advtarget' => 1);
380 if (!empty($advTarget->id)) {
381 $parameters = array('array_query' => $advTarget->filtervalue);
382 }
383 // Other attributes
384 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);
385 print $hookmanager->resPrint;
386}
387
388// State Contact
389print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('Contact');
390if (!empty($array_query['contact_status'])) {
391 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
392}
393print '</td><td>';
394print $formadvtargetemaling->advMultiselectarray(
395 'contact_status',
396 array(
397 '0' => $langs->trans('ActivityCeased'),
398 '1' => $langs->trans('InActivity')
399 ),
400 $array_query['contact_status']
401);
402print '</td><td>'."\n";
403print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help');
404print '</td></tr>'."\n";
405
406// Civility
407print '<tr><td width="15%">'.$langs->trans("UserTitle");
408if (!empty($array_query['contact_civility'])) {
409 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
410}
411print '</td><td>';
412print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']);
413print '</td></tr>';
414
415// contact name
416print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans('Lastname');
417if (!empty($array_query['contact_lastname'])) {
418 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
419}
420print '</td><td><input type="text" name="contact_lastname" value="'.$array_query['contact_lastname'].'"/></td><td>'."\n";
421print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
422print '</td></tr>'."\n";
423print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans('Firstname');
424if (!empty($array_query['contact_firstname'])) {
425 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
426}
427print '</td><td><input type="text" name="contact_firstname" value="'.$array_query['contact_firstname'].'"/></td><td>'."\n";
428print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
429print '</td></tr>'."\n";
430
431// Contact Country
432print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("Country");
433if (!empty($array_query['contact_country'])) {
434 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
435}
436print '</td><td>'."\n";
437print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']);
438print '</td><td>'."\n";
439print '</td></tr>'."\n";
440
441// Never send mass mailing
442print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("No_Email");
443if (!empty($array_query['contact_no_email'])) {
444 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
445}
446print '</td><td>'."\n";
447print $form->selectarray(
448 'contact_no_email',
449 array(
450 '' => '',
451 '1' => $langs->trans('Yes'),
452 '0' => $langs->trans('No')
453 ),
454 $array_query['contact_no_email']
455);
456print '</td><td>'."\n";
457print '</td></tr>'."\n";
458
459// Contact Date Create
460print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("DateCreation");
461if (!empty($array_query['contact_create_st_dt'])) {
462 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
463}
464print '</td><td>'."\n";
465print '<table class="nobordernopadding"><tr>';
466print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
467print $form->selectDate($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1);
468print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
469print $form->selectDate($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1);
470print '</td></tr></table>';
471print '</td><td>'."\n";
472print '</td></tr>'."\n";
473
474// Contact update Create
475print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("DateLastModification");
476if (!empty($array_query['contact_update_st_dt'])) {
477 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
478}
479print '</td><td>'."\n";
480print '<table class="nobordernopadding"><tr>';
481print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
482print $form->selectDate($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1);
483print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
484print $form->selectDate($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1);
485print '</td></tr></table>';
486print '</td><td>'."\n";
487print '</td></tr>'."\n";
488
489if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
490 // Customer Categories
491 print '<tr><td>'.$langs->trans("ContactCategoriesShort");
492 if (!empty($array_query['contact_categ'])) {
493 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
494 }
495 print '</td><td>'."\n";
496 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, '', 'parent', 0, 0, 1);
497 print $form->multiselectarray('contact_categ', $cate_arbo, GETPOST('contact_categ', 'array'), 0, 0, '', 0, "90%");
498 print '</td><td>'."\n";
499 print '</td></tr>'."\n";
500}
501
502// Standard Extrafield feature
503if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
504 $contactstatic = new Contact($db);
505 $elementype = $contactstatic->table_element;
506 // fetch optionals attributes and labels
507 dol_include_once('/core/class/extrafields.class.php');
508 $extrafields = new ExtraFields($db);
509 $extrafields->fetch_name_optionals_label($elementype);
510 if (!empty($extrafields->attributes[$elementtype]['type'])) {
511 foreach ($extrafields->attributes[$elementtype]['type'] as $key => &$value) {
512 if ($value == 'radio') {
513 $value = 'select';
514 }
515 }
516 }
517 if (!empty($extrafields->attributes[$elementtype]['label'])) {
518 foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
519 print '<tr><td>'.$extrafields->attributes[$elementtype]['label'][$key];
520 if ($array_query['options_'.$key.'_cnct'] != '' || (is_array($array_query['options_'.$key.'_cnct']) && count($array_query['options_'.$key.'_cnct']) > 0)) {
521 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
522 }
523 print '</td><td>';
524 if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
525 print '<input type="text" name="options_'.$key.'_cnct"/></td><td>'."\n";
526 print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
527 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
528 print $langs->trans("AdvTgtMinVal").'<input type="text" name="options_'.$key.'_min_cnct"/>';
529 print $langs->trans("AdvTgtMaxVal").'<input type="text" name="options_'.$key.'_max_cnct"/>';
530 print '</td><td>'."\n";
531 print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
532 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
533 print '<table class="nobordernopadding"><tr>';
534 print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
535 print $form->selectDate('', 'options_'.$key.'_st_dt_cnct', 0, 0, 1);
536 print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
537 print $form->selectDate('', 'options_'.$key.'_end_dt_cnct', 0, 0, 1);
538 print '</td></tr></table>';
539 print '</td><td>'."\n";
540 print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
541 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) {
542 print $form->selectarray(
543 'options_'.$key.'_cnct',
544 array(
545 '' => '',
546 '1' => $langs->trans('Yes'),
547 '0' => $langs->trans('No')
548 ),
549 $array_query['options_'.$key.'_cnct']
550 );
551 print '</td><td>'."\n";
552 } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'select') {
553 print $formadvtargetemaling->advMultiselectarray('options_'.$key.'_cnct', $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key.'_cnct']);
554 print '</td><td>'."\n";
555 } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'sellist') {
556 print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key.'_cnct']);
557 print '</td><td>'."\n";
558 } else {
559 if (is_array($array_query['options_'.$key.'_cnct'])) {
560 print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct', '', '', 0, 'socpeople', 1);
561 } else {
562 print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct', '', '', 0, 'socpeople', 1);
563 }
564 print '</td><td>'."\n";
565 }
566 print '</td></tr>'."\n";
567 }
568 }
569}
570print '<tr>'."\n";
571print '<td colspan="3" class="right">'."\n";
572print '<input type="button" name="addcontact" id="addcontact" value="'.$langs->trans('AdvTgtAddContact').'" class="butAction"/>'."\n";
573print '</td>'."\n";
574print '</tr>'."\n";
575print '</table>'."\n";
576print '</form>'."\n";
577print '</div>'."\n";
578print '<form action="'.$_SERVER['PHP_SELF'].'?action=clear&id='.$object->id.'" method="POST">';
579print '<input type="hidden" name="token" value="'.newToken().'">';
580print load_fiche_titre($langs->trans("ToClearAllRecipientsClickHere"));
581print '<table class="noborder centpercent">';
582print '<tr class="liste_titre">';
583print '<td class="liste_titre right"><input type="submit" class="button" value="'.$langs->trans("TargetsReset").'"></td>';
584print '</tr>';
585print '</table>';
586print '</form>';
587print '<br>';
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
Class to manage contact/addresses.
Class to manage standard extra fields.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.