38require
'../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
54 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
58$langs->loadLangs(array(
'contracts',
'products',
'companies',
'compta'));
60$action =
GETPOST(
'action',
'aZ09');
61$massaction =
GETPOST(
'massaction',
'alpha');
63$confirm =
GETPOST(
'confirm',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contractlist';
66$optioncss =
GETPOST(
'optioncss',
'alpha');
67$mode =
GETPOST(
'mode',
'alpha');
71$search_name =
GETPOST(
'search_name',
'alpha');
72$search_phone =
GETPOST(
'search_phone',
'alpha');
73$search_phone_mobile =
GETPOST(
'search_phone_mobile',
'alpha');
74$search_email =
GETPOST(
'search_email',
'alpha');
75$search_town =
GETPOST(
'search_town',
'alpha');
76$search_zip =
GETPOST(
'search_zip',
'alpha');
77$search_state =
GETPOST(
"search_state",
'alpha');
78$search_country =
GETPOST(
"search_country",
'aZ09');
79$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
80$search_contract =
GETPOST(
'search_contract',
'alpha');
81$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
82$search_ref_supplier =
GETPOST(
'search_ref_supplier',
'alpha');
83$search_all =
GETPOST(
'search_all',
'alphanohtml');
84$search_status =
GETPOST(
'search_status',
'alpha');
85$search_signed_status =
GETPOST(
'search_signed_status',
'alpha');
86$search_note_public =
GETPOST(
'search_note_public',
'alpha');
87$search_note_private =
GETPOST(
'search_note_private',
'alpha');
89$search_user =
GETPOST(
'search_user',
'intcomma');
90$search_sale =
GETPOST(
'search_sale',
'intcomma');
91$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
94$search_op2df =
GETPOST(
'search_op2df',
'alpha');
95$search_date_startday =
GETPOSTINT(
'search_date_startday');
96$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
97$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
98$search_date_endday =
GETPOSTINT(
'search_date_endday');
99$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
100$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
101$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
102$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
103$searchCategoryCustomerOperator = 0;
104if (GETPOSTISSET(
'formfilteraction')) {
105 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
107 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
109$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
111$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
112$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
113$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
114$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
115$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
116$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
117$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
118$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
120$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
121$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
122$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
123$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
124$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
125$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
126$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
127$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
131$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
132$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
134if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
138$offset = $limit * $page;
139$pageprev = $page - 1;
140$pagenext = $page + 1;
142 $sortfield =
'c.ref';
150if ($user->socid > 0) {
151 $socid = $user->socid;
154$hookmanager->initHooks(array(
'contractlist'));
158$diroutputmassaction =
$conf->contract->dir_output.
'/temp/massgeneration/'.$user->id;
160if ($search_status ==
'') {
169$extrafields->fetch_name_optionals_label(
$object->table_element);
171$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
173$fieldstosearchall = array();
174foreach (
$object->fields as $key => $val) {
175 if (!empty($val[
'searchall'])) {
176 $fieldstosearchall[
'c.'.$key] = $val[
'label'];
179$fieldstosearchall[
"s.nom"] =
"ThirdParty";
180if (empty($user->socid)) {
181 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
183$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
184$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
186 $fieldstosearchall = $hookmanager->resArray[
'fieldstosearchall'];
187} elseif ($reshook == 0) {
188 if (!empty($hookmanager->resArray[
'fieldstosearchall'])) {
189 $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray[
'fieldstosearchall']);
194 'c.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1',
'position' => 10),
195 'c.ref_customer' => array(
'label' => $langs->trans(
"RefCustomer"),
'checked' =>
'1',
'position' => 12),
196 'c.ref_supplier' => array(
'label' => $langs->trans(
"RefSupplier"),
'checked' =>
'1',
'position' => 14),
197 's.nom' => array(
'label' => $langs->trans(
"ThirdParty"),
'checked' =>
'1',
'position' => 30),
198 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' =>
'0',
'position' => 31),
199 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' =>
'1',
'position' => 32),
200 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' =>
'0',
'position' => 33),
201 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' =>
'0',
'position' => 34),
202 's.phone' => array(
'label' => $langs->trans(
"Phone"),
'checked' =>
'1',
'position' => 100),
203 's.phone_mobile' => array(
'label' => $langs->trans(
"PhoneMobile"),
'checked' =>
'1',
'position' => 102),
204 's.email' => array(
'label' => $langs->trans(
"ThirdPartyEmail"),
'checked' =>
'0',
'position' => 115),
205 'sale_representative' => array(
'label' => $langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked' =>
'-1',
'position' => 130),
206 'c.date_contrat' => array(
'label' => $langs->trans(
"DateContract"),
'checked' =>
'1',
'position' => 140),
207 'c.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
208 'c.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 500),
209 'c.note_public' => array(
'label' => $langs->trans(
"NotePublic"),
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
210 'c.note_private' => array(
'label' => $langs->trans(
"NotePrivate"),
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
211 'lower_planned_end_date' => array(
'label' => $langs->trans(
"LowerDateEndPlannedShort"),
'checked' =>
'1',
'position' => 900,
'help' => $langs->trans(
"LowerDateEndPlannedShort")),
212 'status' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
213 'c.signed_status' => array(
'label' => $langs->trans(
'SignedStatus'),
'checked' =>
'0',
'position' => 1001),
216include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
221if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
222 $search_sale = $user->id;
225$permissiontoread = $user->hasRight(
'contrat',
'lire');
226$permissiontoadd = $user->hasRight(
'contrat',
'creer');
227$permissiontodelete = $user->hasRight(
'contrat',
'supprimer');
237if (
GETPOST(
'cancel',
'alpha')) {
241if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
245$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
246$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
251include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
253if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
254 $search_dfmonth =
'';
261 $search_country =
'';
263 $search_phone_mobile =
"";
265 $search_type_thirdparty =
'';
266 $search_contract =
"";
267 $search_ref_customer =
"";
268 $search_ref_supplier =
"";
271 $search_product_category =
'';
272 $search_date_startday =
'';
273 $search_date_startmonth =
'';
274 $search_date_startyear =
'';
275 $search_date_endday =
'';
276 $search_date_endmonth =
'';
277 $search_date_endyear =
'';
278 $search_date_start =
'';
279 $search_date_end =
'';
281 $search_date_creation_startmonth =
"";
282 $search_date_creation_startyear =
"";
283 $search_date_creation_startday =
"";
284 $search_date_creation_start =
"";
285 $search_date_creation_endmonth =
"";
286 $search_date_creation_endyear =
"";
287 $search_date_creation_endday =
"";
288 $search_date_creation_end =
"";
289 $search_date_modif_startmonth =
"";
290 $search_date_modif_startyear =
"";
291 $search_date_modif_startday =
"";
292 $search_date_modif_start =
"";
293 $search_date_modif_endmonth =
"";
294 $search_date_modif_endyear =
"";
295 $search_date_modif_endday =
"";
296 $search_date_modif_end =
"";
298 $search_signed_status =
'';
299 $search_note_public =
"";
300 $search_note_private =
"";
302 $searchCategoryCustomerList = array();
303 $search_array_options = array();
306if (empty($reshook)) {
307 $objectclass =
'Contrat';
308 $objectlabel =
'Contracts';
309 $uploaddir =
$conf->contract->dir_output;
310 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
330$sql .=
" c.rowid, c.ref, c.datec as date_creation, c.tms as date_modification, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity, c.signed_status,";
331$sql .=
' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.phone, s.phone_mobile, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
332$sql .=
" typent.code as typent_code, c.note_public, c.note_private,";
333$sql .=
" state.code_departement as state_code, state.nom as state_name,";
335if ($arrayfields[
'lower_planned_end_date'][
'checked'] || ($search_dfyear > 0 && $search_op2df)) {
336 $sql .=
" (SELECT MIN(".$db->ifsql(
"cd.statut=4",
"cd.date_fin_validite",
"null").
") FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as lower_planned_end_date,";
338$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=0",
'1',
'0').
') FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_initial,';
339$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".
$db->idate($now).
"')",
'1',
'0').
') FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_running,';
340$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".
$db->idate($now).
"')",
'1',
'0').
') FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_expired,';
341$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=4 AND (cd.date_fin_validite IS NOT NULL AND cd.date_fin_validite < '".
$db->idate($now -
$conf->contract->services->expires->warning_delay).
"')",
'1',
'0').
') FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_late,';
342$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=5",
'1',
'0').
') FROM llx_contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_closed';
344if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
345 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
346 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
350$parameters = array();
351$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
352$sql .= $hookmanager->resPrint;
353$sql = preg_replace(
'/,\s*$/',
'', $sql);
357$sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c";
358$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON (c.fk_soc = s.rowid)";
359$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
360$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
361$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
362if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
363 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (c.rowid = ef.fk_object)";
365if ($search_user > 0) {
366 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
367 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
370$parameters = array();
371$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
372$sql .= $hookmanager->resPrint;
373$sql .=
" WHERE c.entity IN (".getEntity(
'contract').
")";
374if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
375 $sql .=
" AND s.fk_typent IN (".$db->sanitize(
$db->escape($search_type_thirdparty)).
')';
378 $sql .=
" AND s.rowid = ".((int) $socid);
380if ($search_date_start) {
381 $sql .=
" AND c.date_contrat >= '".$db->idate($search_date_start).
"'";
383if ($search_date_end) {
384 $sql .=
" AND c.date_contrat <= '".$db->idate($search_date_end).
"'";
393 $sql .=
natural_search(array(
's.phone',
's.phone_mobile'), $search_phone);
395if ($search_phone_mobile) {
396 $sql .=
natural_search(array(
's.phone',
's.phone_mobile'), $search_phone_mobile);
398if ($search_contract) {
399 $sql .=
natural_search(array(
'c.rowid',
'c.ref'), $search_contract);
401if (!empty($search_ref_customer)) {
402 $sql .=
natural_search(array(
'c.ref_customer'), $search_ref_customer);
404if (!empty($search_ref_supplier)) {
405 $sql .=
natural_search(array(
'c.ref_supplier'), $search_ref_supplier);
413if ($search_country && $search_country !=
'-1') {
414 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
416if (!empty($search_note_private)) {
417 $sql .=
natural_search(array(
'c.note_private'), $search_note_private);
419if (!empty($search_note_public)) {
420 $sql .=
natural_search(array(
'c.note_public'), $search_note_public);
427 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
429if ($search_user > 0) {
430 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
433if ($search_sale && $search_sale !=
'-1') {
434 if ($search_sale == -2) {
435 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
436 } elseif ($search_sale > 0) {
437 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
441$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
442$searchCategoryProductList = array($search_product_category);
443if (!empty($searchCategoryProductList)) {
444 $searchCategoryProductSqlList = array();
445 $listofcategoryid =
'';
446 foreach ($searchCategoryProductList as $searchCategoryProduct) {
447 if (intval($searchCategoryProduct) == -2) {
448 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product)";
449 } elseif (intval($searchCategoryProduct) > 0) {
450 if ($searchCategoryProductOperator == 0) {
451 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
453 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
457 if ($listofcategoryid) {
458 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"contratdet as cd WHERE cd.fk_contrat = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
460 if ($searchCategoryProductOperator == 1) {
461 if (!empty($searchCategoryProductSqlList)) {
462 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
465 if (!empty($searchCategoryProductSqlList)) {
466 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
470$searchCategoryCustomerSqlList = array();
471if ($searchCategoryCustomerOperator == 1) {
472 $existsCategoryCustomerList = array();
473 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
474 if (intval($searchCategoryCustomer) == -2) {
475 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
476 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
477 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
478 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
479 $sqlCategoryCustomerNotExists .=
" )";
480 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
481 } elseif (intval($searchCategoryCustomer) > 0) {
482 $existsCategoryCustomerList[] =
$db->escape($searchCategoryCustomer);
485 if (!empty($existsCategoryCustomerList)) {
486 $sqlCategoryCustomerExists =
" EXISTS (";
487 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
488 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
489 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = s.rowid";
490 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
491 $sqlCategoryCustomerExists .=
" )";
492 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
494 if (!empty($searchCategoryCustomerSqlList)) {
495 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
498 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
499 if (intval($searchCategoryCustomer) == -2) {
500 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
501 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
502 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
503 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
504 $sqlCategoryCustomerNotExists .=
" )";
505 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
506 } elseif (intval($searchCategoryCustomer) > 0) {
507 $searchCategoryCustomerSqlList[] =
"s.rowid IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
510 if (!empty($searchCategoryCustomerSqlList)) {
511 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
515if ($search_date_creation_start) {
516 $sql .=
" AND c.datec >= '".$db->idate($search_date_creation_start).
"'";
518if ($search_date_creation_end) {
519 $sql .=
" AND c.datec <= '".$db->idate($search_date_creation_end).
"'";
522if ($search_date_modif_start) {
523 $sql .=
" AND c.tms >= '".$db->idate($search_date_modif_start).
"'";
525if ($search_date_modif_end) {
526 $sql .=
" AND c.tms <= '".$db->idate($search_date_modif_end).
"'";
528if ($search_signed_status !=
'' && $search_signed_status >= 0) {
529 $sql .=
" AND c.signed_status = ".((int) $search_signed_status);
533include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
535$parameters = array();
536$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
537$sql .= $hookmanager->resPrint;
539$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
540$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
541$sql .= $hookmanager->resPrint;
543$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
544$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
545if (empty($reshook)) {
546 if ($search_dfyear > 0 && $search_op2df) {
547 if ($search_op2df ==
'<=') {
549 $sql .=
" HAVING lower_planned_end_date <= '".$db->idate(
dol_get_last_day($search_dfyear, $search_dfmonth,
false)).
"'";
550 } elseif ($search_op2df ==
'>=') {
552 $sql .=
" HAVING lower_planned_end_date >= '".$db->idate(
dol_get_first_day($search_dfyear, $search_dfmonth,
false)).
"'";
555 $sql .=
" HAVING lower_planned_end_date <= '".$db->idate(
dol_get_last_day($search_dfyear, $search_dfmonth,
false)).
"' AND lower_planned_end_date >= '".
$db->idate(
dol_get_first_day($search_dfyear, $search_dfmonth,
false)).
"'";
557 $sql .= empty($hookmanager->resPrint) ?
"" :
" AND ".$hookmanager->resPrint;
559 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
562 $sql = $hookmanager->resPrint;
566$nbtotalofrecords =
'';
571 if ($search_dfyear > 0 && $search_op2df) {
572 $resql =
$db->query($sql, 0,
'auto', 1);
574 while (
$db->fetch_object($resql)) {
575 if (empty($nbtotalofrecords)) {
576 $nbtotalofrecords = 1;
586 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
588 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as country on (country.rowid = s.fk_pays)',
'', $sqlforcount);
589 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as typent on (typent.id = s.fk_typent)',
'', $sqlforcount);
590 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as state on (state.rowid = s.fk_departement)',
'', $sqlforcount);
591 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'contratdet as cd ON c.rowid = cd.fk_contrat',
'', $sqlforcount);
593 $sqlforcount = preg_replace(
'/GROUP BY.*$/',
'', $sqlforcount);
595 $resql =
$db->query($sqlforcount);
597 $objforcount =
$db->fetch_object($resql);
598 $nbtotalofrecords = $objforcount->nbtotalofrecords;
604 if (($page * $limit) > (
int) $nbtotalofrecords) {
612$sql .=
$db->order($sortfield, $sortorder);
614 $sql .=
$db->plimit($limit + 1, $offset);
617$resql =
$db->query($sql);
623$num =
$db->num_rows($resql);
626if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
627 $obj =
$db->fetch_object($resql);
629 header(
"Location: ".DOL_URL_ROOT.
'/contrat/card.php?id='.
$id);
636$title = $langs->trans(
"Contracts");
637$help_url =
'EN:Module_Contracts|FR:Module_Contrat|ES:Contratos_de_servicio';
639llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-contrat page-list bodyforlist');
643$arrayofselected = is_array($toselect) ? $toselect : array();
648 if (empty($search_name)) {
649 $search_name = $soc->name;
655 $param .=
'&mode='.urlencode($mode);
657if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
658 $param .=
'&contextpage='.urlencode($contextpage);
660if ($limit > 0 && $limit !=
$conf->liste_limit) {
661 $param .=
'&limit='.((int) $limit);
663if ($search_all !=
'') {
664 $param .=
'&search_all='.urlencode($search_all);
666if ($search_contract !=
'') {
667 $param .=
'&search_contract='.urlencode($search_contract);
669if ($search_name !=
'') {
670 $param .=
'&search_name='.urlencode($search_name);
672if ($search_phone !=
'') {
673 $param .=
'&search_phone='.urlencode($search_phone);
675if ($search_phone_mobile !=
'') {
676 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
678if ($search_email !=
'') {
679 $param .=
'&search_email='.urlencode($search_email);
681if ($search_ref_customer !=
'') {
682 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
684if ($search_ref_supplier !=
'') {
685 $param .=
'&search_ref_supplier='.urlencode($search_ref_supplier);
687if ($search_note_private !=
'') {
688 $param .=
'&search_note_private='.urlencode($search_note_private);
690if ($search_note_public !=
'') {
691 $param .=
'&search_note_public='.urlencode($search_note_public);
693if ($search_op2df !=
'') {
694 $param .=
'&search_op2df='.urlencode($search_op2df);
696if ($search_date_creation_startmonth) {
697 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
699if ($search_date_creation_startyear) {
700 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
702if ($search_date_creation_startday) {
703 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
705if ($search_date_creation_start) {
706 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
708if ($search_date_creation_endmonth) {
709 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
711if ($search_date_creation_endyear) {
712 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
714if ($search_date_creation_endday) {
715 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
717if ($search_date_creation_end) {
718 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
720if ($search_date_modif_startmonth) {
721 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
723if ($search_date_modif_startyear) {
724 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
726if ($search_date_modif_startday) {
727 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
729if ($search_date_modif_start) {
730 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
732if ($search_date_modif_endmonth) {
733 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
735if ($search_date_modif_endyear) {
736 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
738if ($search_date_modif_endday) {
739 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
741if ($search_date_modif_end) {
742 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
744if ($search_date_startday > 0) {
745 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
747if ($search_date_startmonth > 0) {
748 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
750if ($search_date_startyear > 0) {
751 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
753if ($search_date_endday > 0) {
754 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
756if ($search_date_endmonth > 0) {
757 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
759if ($search_date_endyear > 0) {
760 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
762if ($search_dfyear > 0) {
763 $param .=
'&search_dfyear='.urlencode((
string) ($search_dfyear));
765if ($search_dfmonth > 0) {
766 $param .=
'&search_dfmonth='.urlencode((
string) ($search_dfmonth));
768if ($search_signed_status !=
'' && $search_signed_status >= 0) {
769 $param .=
'&search_signed_status='.urlencode($search_signed_status);
771if ($search_sale > 0) {
772 $param .=
'&search_sale='.urlencode($search_sale);
774if ($search_user > 0) {
775 $param .=
'&search_user='.urlencode((
string) ($search_user));
777if ($search_type_thirdparty > 0) {
778 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
780if ($search_country !=
'') {
781 $param .=
"&search_country=".urlencode($search_country);
783if ($search_product_category > 0) {
784 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
787 $param .=
'&show_files='.urlencode((
string) ($show_files));
789if ($optioncss !=
'') {
790 $param .=
'&optioncss='.urlencode($optioncss);
792foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
793 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
796include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
799$arrayofmassactions = array(
800 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
801 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
802 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
804if (!empty($permissiontodelete)) {
805 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
807if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
808 $arrayofmassactions = array();
810$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
812$url = DOL_URL_ROOT.
'/contrat/card.php?action=create';
814 $url .=
'&socid='.((int) $socid);
817$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
818$newcardbutton .= dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
819$newcardbutton .= dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/contrat/stats/index.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
820$newcardbutton .= dolGetButtonTitleSeparator();
821$newcardbutton .= dolGetButtonTitle($langs->trans(
'NewContractSubscription'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'contrat',
'creer'));
823print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
'PHP_SELF'].
'">'.
"\n";
824if ($optioncss !=
'') {
825 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
827print
'<input type="hidden" name="token" value="'.newToken().
'">';
828print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
829print
'<input type="hidden" name="action" value="list">';
830print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
831print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
832print
'<input type="hidden" name="page" value="'.$page.
'">';
833print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
834print
'<input type="hidden" name="page_y" value="">';
835print
'<input type="hidden" name="mode" value="'.$mode.
'">';
838print_barre_liste($langs->trans(
"Contracts"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contract', 0, $newcardbutton,
'', $limit, 0, 0, 1);
840$topicmail =
"SendContractRef";
841$modelmail =
"contract";
843$trackid =
'con'.$object->id;
844include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
848 foreach ($fieldstosearchall as $key => $val) {
849 $fieldstosearchall[$key] = $langs->trans($val);
850 $setupstring .= $key.
"=".$val.
";";
852 print
'<!-- Search done like if CONTRACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
853 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
859if ($user->hasRight(
'user',
'user',
'lire')) {
860 $langs->load(
"commercial");
861 $moreforfilter .=
'<div class="divsearchfield">';
862 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
863 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'widthcentpercentminusx maxwidth300');
864 $moreforfilter .=
'</div>';
867if ($user->hasRight(
'user',
'user',
'lire')) {
868 $moreforfilter .=
'<div class="divsearchfield">';
869 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
870 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
871 $moreforfilter .=
'</div>';
874if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
875 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
876 $moreforfilter .=
'<div class="divsearchfield">';
877 $tmptitle = $langs->trans(
'IncludingProductWithTag');
878 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 64, 0, 2);
879 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'widthcentpercentminusx maxwidth300', 1);
880 $moreforfilter .=
'</div>';
884 $moreforfilter .=
'<div class="divsearchfield">';
885 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
886 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
887 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 2);
888 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
889 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
890 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
891 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
892 $moreforfilter .=
'</div>';
895$parameters = array();
896$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
897if (empty($reshook)) {
898 $moreforfilter .= $hookmanager->resPrint;
900 $moreforfilter = $hookmanager->resPrint;
903if (!empty($moreforfilter)) {
904 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
905 print $moreforfilter;
909$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
910$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
911if ($massactionbutton) {
912 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
915print
'<div class="div-table-responsive">';
916print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
920print
'<tr class="liste_titre_filter">';
922if (
$conf->main_checkbox_left_column) {
923 print
'<td class="liste_titre maxwidthsearch center">';
924 $searchpicto = $form->showFilterButtons(
'left');
928if (!empty($arrayfields[
'c.ref'][
'checked'])) {
929 print
'<td class="liste_titre">';
930 print
'<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).
'">';
933if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
934 print
'<td class="liste_titre">';
935 print
'<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
938if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
939 print
'<td class="liste_titre">';
940 print
'<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
943if (!empty($arrayfields[
's.nom'][
'checked'])) {
944 print
'<td class="liste_titre">';
945 print
'<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).
'"'.($user->socid > 0 ?
" disabled" :
"").
'>';
949if (!empty($arrayfields[
's.town'][
'checked'])) {
950 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
953if (!empty($arrayfields[
's.zip'][
'checked'])) {
954 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
957if (!empty($arrayfields[
'state.nom'][
'checked'])) {
958 print
'<td class="liste_titre">';
959 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
963if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
964 print
'<td class="liste_titre center">';
965 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
969if (!empty($arrayfields[
's.phone'][
'checked'])) {
970 print
'<td class="liste_titre">';
971 print
'<input type="text" class="flat width50" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
975if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
976 print
'<td class="liste_titre">';
977 print
'<input type="text" class="flat width50" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
981if (!empty($arrayfields[
's.email'][
'checked'])) {
982 print
'<td class="liste_titre">';
983 print
'<input type="text" class="flat width75" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
987if (!empty($arrayfields[
'typent.code'][
'checked'])) {
988 print
'<td class="liste_titre maxwidthonsmartphone center">';
989 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'', 1);
992if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
993 print
'<td class="liste_titre"></td>';
995if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
996 print
'<td class="liste_titre center">';
997 print
'<div class="nowrapfordate">';
998 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1000 print
'<div class="nowrapfordate">';
1001 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1006if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1007 print
'<td class="liste_titre center">';
1008 $list_signed_status =
$object->getSignedStatusLocalisedArray();
1009 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
1013if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1014 print
'<td class="liste_titre center">';
1015 print
'<input class="flat" size="10" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1019if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1020 print
'<td class="liste_titre center">';
1021 print
'<input class="flat" size="10" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1025include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1028$parameters = array(
'arrayfields' => $arrayfields);
1029$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1030print $hookmanager->resPrint;
1032if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1033 print
'<td class="liste_titre center nowraponall">';
1034 print
'<div class="nowrapfordate">';
1035 print $form->selectDate($search_date_creation_start ? $search_date_creation_start : -1,
'search_date_creation_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1037 print
'<div class="nowrapfordate">';
1038 print $form->selectDate($search_date_creation_end ? $search_date_creation_end : -1,
'search_date_creation_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1043if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1044 print
'<td class="liste_titre center nowraponall">';
1045 print
'<div class="nowrapfordate">';
1046 print $form->selectDate($search_date_modif_start ? $search_date_modif_start : -1,
'search_date_modif_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1048 print
'<div class="nowrapfordate">';
1049 print $form->selectDate($search_date_modif_end ? $search_date_modif_end : -1,
'search_date_modif_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1054if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1055 print
'<td class="liste_titre nowraponall center">';
1056 $arrayofoperators = array(
'0' =>
'',
'=' =>
'=',
'<=' =>
'<=',
'>=' =>
'>=');
1057 print $form->selectarray(
'search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth50imp');
1059 print $formother->select_month($search_dfmonth,
'search_dfmonth', 1, 0);
1061 print $formother->selectyear($search_dfyear,
'search_dfyear', 1, 20, 5, 0, 0,
'');
1065if (!empty($arrayfields[
'status'][
'checked'])) {
1066 print
'<td class="liste_titre right" colspan="4"></td>';
1070if (!
$conf->main_checkbox_left_column) {
1071 print
'<td class="liste_titre center">';
1072 $searchpicto = $form->showFilterButtons();
1083print
'<tr class="liste_titre">';
1084if (
$conf->main_checkbox_left_column) {
1085 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1088if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1090 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
1093if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1094 print_liste_field_titre($arrayfields[
'c.ref_customer'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_customer",
"", $param,
'', $sortfield, $sortorder);
1097if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1098 print_liste_field_titre($arrayfields[
'c.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
1101if (!empty($arrayfields[
's.nom'][
'checked'])) {
1102 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1105if (!empty($arrayfields[
's.town'][
'checked'])) {
1106 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1109if (!empty($arrayfields[
's.zip'][
'checked'])) {
1110 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1113if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1114 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1117if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1118 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1121if (!empty($arrayfields[
's.phone'][
'checked'])) {
1122 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1125if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1126 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1129if (!empty($arrayfields[
's.email'][
'checked'])) {
1130 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1133if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1134 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1137if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1138 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder);
1141if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1142 print_liste_field_titre($arrayfields[
'c.date_contrat'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_contrat",
"", $param,
'', $sortfield, $sortorder,
'center ');
1145if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1146 print_liste_field_titre($arrayfields[
'c.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"c.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1149if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1150 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1153if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1154 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1158include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1160$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
1161$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1162print $hookmanager->resPrint;
1163if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1164 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1167if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1168 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1171if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1172 print_liste_field_titre($arrayfields[
'lower_planned_end_date'][
'label'], $_SERVER[
"PHP_SELF"],
"lower_planned_end_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1175if (!empty($arrayfields[
'status'][
'checked'])) {
1176 print_liste_field_titre($staticcontratligne->LibStatut(0, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1178 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1180 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1182 print_liste_field_titre($staticcontratligne->LibStatut(5, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1185if (!
$conf->main_checkbox_left_column) {
1186 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1197$typenArray = array();
1198$cacheCountryIDCode = array();
1199$imaxinloop = ($limit ? min($num, $limit) : $num);
1200while ($i < $imaxinloop) {
1201 $obj =
$db->fetch_object($resql);
1206 $contracttmp->ref = $obj->ref;
1207 $contracttmp->id = $obj->rowid;
1208 $contracttmp->ref_customer = $obj->ref_customer;
1209 $contracttmp->ref_supplier = $obj->ref_supplier;
1211 $contracttmp->nbofserviceswait = $obj->nb_initial;
1212 $contracttmp->nbofservicesopened = $obj->nb_running;
1213 $contracttmp->nbofservicesexpired = $obj->nb_expired;
1214 $contracttmp->nbofservicesclosed = $obj->nb_closed;
1215 $contracttmp->signed_status = $obj->signed_status;
1217 $socstatic->id = $obj->socid;
1218 $socstatic->name = $obj->name;
1219 $socstatic->name_alias = $obj->name_alias;
1220 $socstatic->email = $obj->email;
1221 $socstatic->status = $obj->company_status;
1222 $socstatic->logo = $obj->company_logo;
1223 $socstatic->country_id = $obj->country_id;
1224 $socstatic->country_code =
'';
1225 $socstatic->country =
'';
1227 if ($obj->country_id > 0) {
1228 if (!isset($cacheCountryIDCode[$obj->country_id][
'code'])) {
1229 $tmparray =
getCountry($obj->country_id,
'all');
1230 $cacheCountryIDCode[$obj->country_id] = array(
'code' => empty($tmparray[
'code']) ?
'' : $tmparray[
'code'],
'label' => empty($tmparray[
'label']) ?
'' : $tmparray[
'label']);
1232 $socstatic->country_code = $cacheCountryIDCode[$obj->country_id][
'code'];
1233 $socstatic->country = $cacheCountryIDCode[$obj->country_id][
'label'];
1236 if ($mode ==
'kanban') {
1238 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1239 print
'<div class="box-flex-container kanban">';
1242 $arraydata = array();
1243 $arraydata[
'thirdparty'] = $socstatic;
1244 $arraydata[
'selected'] = in_array($obj->rowid, $arrayofselected);
1245 $contracttmp->date_contrat = $obj->date_contrat;
1246 print $contracttmp->getKanbanView(
'', $arraydata);
1247 if ($i == ($imaxinloop - 1)) {
1253 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1255 if (
$conf->main_checkbox_left_column) {
1256 print
'<td class="nowrap center">';
1257 if ($massactionbutton || $massaction) {
1259 if (in_array($obj->rowid, $arrayofselected)) {
1262 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1270 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1271 print
'<td class="nowraponall">';
1272 print $contracttmp->getNomUrl(1);
1273 if ($obj->nb_late) {
1276 if (!empty($obj->note_private) || !empty($obj->note_public)) {
1277 print
' <span class="note">';
1278 print
'<a href="'.DOL_URL_ROOT.
'/contrat/note.php?id='.$obj->rowid.
'&save_lastsearch_values=1">'.
img_picto($langs->trans(
"ViewPrivateNote"),
'note').
'</a>';
1284 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1285 print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
1295 if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1296 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).
'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).
'</td>';
1301 if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1302 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>';
1304 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1305 print
'<td class="tdoverflowmax150">';
1306 if ($obj->socid > 0) {
1308 print $socstatic->getNomUrl(1,
'');
1313 if (!empty($arrayfields[
's.town'][
'checked'])) {
1314 print
'<td class="nocellnopadd">';
1322 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1323 print
'<td class="center nocellnopadd">';
1331 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1332 print
"<td>".$obj->state_name.
"</td>\n";
1338 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1339 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($socstatic->country).
'">';
1347 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1348 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute((empty($socstatic->country_code) ?
'' : $socstatic->country_code.
': ').$obj->phone).
'">'.
dol_print_phone($obj->phone, $socstatic->country_code, 0, $socstatic->id).
'</td>';
1351 if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1352 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute((empty($socstatic->country_code) ?
'' : $socstatic->country_code.
': ').$obj->phone_mobile).
'">'.
dol_print_phone($obj->phone_mobile, $socstatic->country_code, 0, $socstatic->id).
'</td>';
1355 if (!empty($arrayfields[
's.email'][
'checked'])) {
1356 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute($obj->email).
'">'.
dol_print_email($obj->email, 0, $obj->socid, 1, 0, 1, 1).
'</td>';
1359 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1360 print
'<td class="center">';
1361 if (count($typenArray) == 0) {
1362 $typenArray = $formcompany->typent_array(1);
1364 print $typenArray[$obj->typent_code];
1370 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1373 if ($obj->socid > 0) {
1374 $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
1375 if ($listsalesrepresentatives < 0) {
1378 $nbofsalesrepresentative = count($listsalesrepresentatives);
1379 if ($nbofsalesrepresentative > 6) {
1381 print $nbofsalesrepresentative;
1382 } elseif ($nbofsalesrepresentative > 0) {
1385 foreach ($listsalesrepresentatives as $val) {
1386 $userstatic->id = $val[
'id'];
1387 $userstatic->lastname = $val[
'lastname'];
1388 $userstatic->firstname = $val[
'firstname'];
1389 $userstatic->email = $val[
'email'];
1390 $userstatic->status = $val[
'statut'];
1391 $userstatic->entity = $val[
'entity'];
1392 $userstatic->photo = $val[
'photo'];
1393 $userstatic->login = $val[
'login'];
1394 $userstatic->phone = $val[
'phone'];
1395 $userstatic->job = $val[
'job'];
1396 $userstatic->gender = $val[
'gender'];
1399 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1401 if ($j < $nbofsalesrepresentative) {
1414 if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1415 print
'<td class="center">'.dol_print_date(
$db->jdate($obj->date_contrat),
'day',
'tzserver').
'</td>';
1418 if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1419 print
'<td class="center">'.$contracttmp->getLibSignedStatus(5).
'</td>';
1425 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1426 print
'<td class="center">'.$obj->note_public.
'</td>';
1432 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1433 print
'<td class="center">'.$obj->note_private.
'</td>';
1439 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1441 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
1442 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1443 print $hookmanager->resPrint;
1445 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1446 print
'<td class="center nowrap">';
1454 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1455 print
'<td class="center nowrap">';
1463 if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1464 print
'<td class="center nowrapforall">';
1465 print
dol_print_date(
$db->jdate($obj->lower_planned_end_date),
'day',
'tzuser');
1472 if (!empty($arrayfields[
'status'][
'checked'])) {
1473 print
'<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial :
'').
'</td>';
1474 print
'<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running :
'').
'</td>';
1475 print
'<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired :
'').
'</td>';
1476 print
'<td class="center">'.($obj->nb_closed > 0 ? $obj->nb_closed :
'').
'</td>';
1485 if (!
$conf->main_checkbox_left_column) {
1486 print
'<td class="nowrap center">';
1487 if ($massactionbutton || $massaction) {
1489 if (in_array($obj->rowid, $arrayofselected)) {
1492 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1508 foreach ($arrayfields as $key => $val) {
1509 if (!empty($val[
'checked'])) {
1513 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1518$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1519$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1520print $hookmanager->resPrint;
1522print
'</table>'.
"\n";
1525print
'</form>'.
"\n";
1527$hidegeneratedfilelistifempty = 1;
1528if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1529 $hidegeneratedfilelistifempty = 0;
1533$urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1534$urlsource .= str_replace(
'&',
'&', $param);
1536$filedir = $diroutputmassaction;
1537$genallowed = $permissiontoread;
1538$delallowed = $permissiontoadd;
1540print $formfile->showdocuments(
'massfilesarea_contract',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage lines of contracts.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_print_phone($phone, $countrycode='', $contactid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.