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