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