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 print '<tr><td>'.$extrafields->attributes[$elementtype]['label'][$key];
318 if (!empty($array_query['options_'.$key]) || (is_array($array_query['options_'.$key]) && count($array_query['options_'.$key]) > 0)) {
319 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
320 }
321 print '</td><td>';
322 if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
323 print '<input type="text" name="options_'.$key.'"/></td><td>'."\n";
324 print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
325 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
326 print $langs->trans("AdvTgtMinVal").'<input type="text" name="options'.$key.'_min"/>';
327 print $langs->trans("AdvTgtMaxVal").'<input type="text" name="options'.$key.'_max"/>';
328 print '</td><td>'."\n";
329 print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
330 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
331 print '<table class="nobordernopadding"><tr>';
332 print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
333 print $form->selectDate('', 'options_'.$key.'_st_dt');
334 print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
335 print $form->selectDate('', 'options_'.$key.'_end_dt');
336 print '</td></tr></table>';
337
338 print '</td><td>'."\n";
339 print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
340 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) {
341 print $form->selectarray(
342 'options_'.$key,
343 array(
344 '' => '',
345 '1' => $langs->trans('Yes'),
346 '0' => $langs->trans('No')
347 ),
348 $array_query['options_'.$key]
349 );
350 print '</td><td>'."\n";
351 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
352 print $formadvtargetemaling->advMultiselectarray('options_'.$key, $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key]);
353 print '</td><td>'."\n";
354 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
355 print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key, $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key]);
356 print '</td><td>'."\n";
357 } else {
358 print '<table class="nobordernopadding"><tr>';
359 print '<td></td><td>';
360 if (is_array($array_query['options_'.$key])) {
361 print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key]));
362 } else {
363 print $extrafields->showInputField($key, $array_query['options_'.$key]);
364 }
365 print '</td></tr></table>';
366
367 print '</td><td>'."\n";
368 }
369 print '</td></tr>'."\n";
370 }
371 }
372} else {
373 $std_soc = new Societe($db);
374 $action_search = 'query';
375
376 $parameters = array('advtarget' => 1);
377 if (!empty($advTarget->id)) {
378 $parameters = array('array_query' => $advTarget->filtervalue);
379 }
380 // Other attributes
381 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search);
382 print $hookmanager->resPrint;
383}
384
385// State Contact
386print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('Contact');
387if (!empty($array_query['contact_status'])) {
388 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
389}
390print '</td><td>';
391print $formadvtargetemaling->advMultiselectarray(
392 'contact_status',
393 array(
394 '0' => $langs->trans('ActivityCeased'),
395 '1' => $langs->trans('InActivity')
396 ),
397 $array_query['contact_status']
398);
399print '</td><td>'."\n";
400print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help');
401print '</td></tr>'."\n";
402
403// Civility
404print '<tr><td width="15%">'.$langs->trans("UserTitle");
405if (!empty($array_query['contact_civility'])) {
406 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
407}
408print '</td><td>';
409print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']);
410print '</td></tr>';
411
412// contact name
413print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans('Lastname');
414if (!empty($array_query['contact_lastname'])) {
415 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
416}
417print '</td><td><input type="text" name="contact_lastname" value="'.$array_query['contact_lastname'].'"/></td><td>'."\n";
418print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
419print '</td></tr>'."\n";
420print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans('Firstname');
421if (!empty($array_query['contact_firstname'])) {
422 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
423}
424print '</td><td><input type="text" name="contact_firstname" value="'.$array_query['contact_firstname'].'"/></td><td>'."\n";
425print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
426print '</td></tr>'."\n";
427
428// Contact Country
429print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("Country");
430if (!empty($array_query['contact_country'])) {
431 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
432}
433print '</td><td>'."\n";
434print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']);
435print '</td><td>'."\n";
436print '</td></tr>'."\n";
437
438// Never send mass mailing
439print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("No_Email");
440if (!empty($array_query['contact_no_email'])) {
441 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
442}
443print '</td><td>'."\n";
444print $form->selectarray(
445 'contact_no_email',
446 array(
447 '' => '',
448 '1' => $langs->trans('Yes'),
449 '0' => $langs->trans('No')
450 ),
451 $array_query['contact_no_email']
452);
453print '</td><td>'."\n";
454print '</td></tr>'."\n";
455
456// Contact Date Create
457print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("DateCreation");
458if (!empty($array_query['contact_create_st_dt'])) {
459 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
460}
461print '</td><td>'."\n";
462print '<table class="nobordernopadding"><tr>';
463print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
464print $form->selectDate($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1);
465print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
466print $form->selectDate($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1);
467print '</td></tr></table>';
468print '</td><td>'."\n";
469print '</td></tr>'."\n";
470
471// Contact update Create
472print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("DateLastModification");
473if (!empty($array_query['contact_update_st_dt'])) {
474 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
475}
476print '</td><td>'."\n";
477print '<table class="nobordernopadding"><tr>';
478print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
479print $form->selectDate($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1);
480print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
481print $form->selectDate($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1);
482print '</td></tr></table>';
483print '</td><td>'."\n";
484print '</td></tr>'."\n";
485
486if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
487 // Customer Categories
488 print '<tr><td>'.$langs->trans("ContactCategoriesShort");
489 if (!empty($array_query['contact_categ'])) {
490 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
491 }
492 print '</td><td>'."\n";
493 $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, '', 'parent', 0, 0, 1);
494 print $form->multiselectarray('contact_categ', $cate_arbo, GETPOST('contact_categ', 'array'), 0, 0, '', 0, "90%");
495 print '</td><td>'."\n";
496 print '</td></tr>'."\n";
497}
498
499// Standard Extrafield feature
500if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
501 $contactstatic = new Contact($db);
502 $elementype = $contactstatic->table_element;
503 // fetch optionals attributes and labels
504 dol_include_once('/core/class/extrafields.class.php');
505 $extrafields = new ExtraFields($db);
506 $extrafields->fetch_name_optionals_label($elementype);
507 if (!empty($extrafields->attributes[$elementtype]['type'])) {
508 foreach ($extrafields->attributes[$elementtype]['type'] as $key => &$value) {
509 if ($value == 'radio') {
510 $value = 'select';
511 }
512 }
513 }
514 if (!empty($extrafields->attributes[$elementtype]['label'])) {
515 foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
516 print '<tr><td>'.$extrafields->attributes[$elementtype]['label'][$key];
517 if ($array_query['options_'.$key.'_cnct'] != '' || (is_array($array_query['options_'.$key.'_cnct']) && count($array_query['options_'.$key.'_cnct']) > 0)) {
518 print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
519 }
520 print '</td><td>';
521 if (($extrafields->attributes[$elementtype]['type'][$key] == 'varchar') || ($extrafields->attributes[$elementtype]['type'][$key] == 'text')) {
522 print '<input type="text" name="options_'.$key.'_cnct"/></td><td>'."\n";
523 print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
524 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) {
525 print $langs->trans("AdvTgtMinVal").'<input type="text" name="options_'.$key.'_min_cnct"/>';
526 print $langs->trans("AdvTgtMaxVal").'<input type="text" name="options_'.$key.'_max_cnct"/>';
527 print '</td><td>'."\n";
528 print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
529 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
530 print '<table class="nobordernopadding"><tr>';
531 print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
532 print $form->selectDate('', 'options_'.$key.'_st_dt_cnct');
533 print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
534 print $form->selectDate('', 'options_'.$key.'_end_dt_cnct');
535 print '</td></tr></table>';
536 print '</td><td>'."\n";
537 print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
538 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'boolean')) {
539 print $form->selectarray(
540 'options_'.$key.'_cnct',
541 array(
542 '' => '',
543 '1' => $langs->trans('Yes'),
544 '0' => $langs->trans('No')
545 ),
546 $array_query['options_'.$key.'_cnct']
547 );
548 print '</td><td>'."\n";
549 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
550 print $formadvtargetemaling->advMultiselectarray('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']);
551 print '</td><td>'."\n";
552 } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
553 print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']);
554 print '</td><td>'."\n";
555 } else {
556 if (is_array($array_query['options_'.$key.'_cnct'])) {
557 print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct');
558 } else {
559 print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct');
560 }
561 print '</td><td>'."\n";
562 }
563 print '</td></tr>'."\n";
564 }
565 }
566}
567print '<tr>'."\n";
568print '<td colspan="3" class="right">'."\n";
569print '<input type="button" name="addcontact" id="addcontact" value="'.$langs->trans('AdvTgtAddContact').'" class="butAction"/>'."\n";
570print '</td>'."\n";
571print '</tr>'."\n";
572print '</table>'."\n";
573print '</form>'."\n";
574print '</div>'."\n";
575print '<form action="'.$_SERVER['PHP_SELF'].'?action=clear&id='.$object->id.'" method="POST">';
576print '<input type="hidden" name="token" value="'.newToken().'">';
577print load_fiche_titre($langs->trans("ToClearAllRecipientsClickHere"));
578print '<table class="noborder centpercent">';
579print '<tr class="liste_titre">';
580print '<td class="liste_titre right"><input type="submit" class="button" value="'.$langs->trans("TargetsReset").'"></td>';
581print '</tr>';
582print '</table>';
583print '</form>';
584print '<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.