38require
'../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/phone.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
55 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
59$langs->loadLangs(array(
'contracts',
'products',
'companies',
'compta'));
61$action =
GETPOST(
'action',
'aZ09');
62$massaction =
GETPOST(
'massaction',
'alpha');
64$confirm =
GETPOST(
'confirm',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array:int');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'contractlist';
67$optioncss =
GETPOST(
'optioncss',
'alpha');
68$mode =
GETPOST(
'mode',
'alpha');
72$search_name =
GETPOST(
'search_name',
'alpha');
73$search_alias =
GETPOST(
'search_alias',
'alpha');
74$search_phone =
GETPOST(
'search_phone',
'alpha');
75$search_phone_mobile =
GETPOST(
'search_phone_mobile',
'alpha');
76$search_email =
GETPOST(
'search_email',
'alpha');
77$search_town =
GETPOST(
'search_town',
'alpha');
78$search_zip =
GETPOST(
'search_zip',
'alpha');
79$search_state =
GETPOST(
"search_state",
'alpha');
80$search_country =
GETPOST(
"search_country",
'aZ09');
81$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
82$search_contract =
GETPOST(
'search_contract',
'alpha');
83$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
84$search_ref_supplier =
GETPOST(
'search_ref_supplier',
'alpha');
86$search_all =
GETPOST(
'search_all',
'alphanohtml');
87$search_status =
GETPOST(
'search_status',
'alpha');
88$search_signed_status =
GETPOST(
'search_signed_status',
'alpha');
89$search_note_public =
GETPOST(
'search_note_public',
'alpha');
90$search_note_private =
GETPOST(
'search_note_private',
'alpha');
92$search_user =
GETPOST(
'search_user',
'intcomma');
93$search_sale =
GETPOST(
'search_sale',
'intcomma');
94$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
97$search_op2df =
GETPOST(
'search_op2df',
'alpha');
98$search_date_startday =
GETPOSTINT(
'search_date_startday');
99$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
100$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
101$search_date_endday =
GETPOSTINT(
'search_date_endday');
102$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
103$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
104$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
105$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
106$searchCategoryCustomerOperator = 0;
108 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
110 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
112$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
114$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
115$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
116$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
117$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
118$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
119$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
120$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
121$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
123$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
124$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
125$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
126$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
127$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
128$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
129$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
130$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
134$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
135$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
137if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
141$offset = $limit * $page;
142$pageprev = $page - 1;
143$pagenext = $page + 1;
145 $sortfield =
'c.ref';
153if ($user->socid > 0) {
154 $socid = $user->socid;
157$hookmanager->initHooks(array(
'contractlist'));
161$diroutputmassaction =
$conf->contract->dir_output.
'/temp/massgeneration/'.$user->id;
163if ($search_status ==
'') {
172$extrafields->fetch_name_optionals_label(
$object->table_element);
174$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
176$fieldstosearchall = array();
177foreach (
$object->fields as $key => $val) {
178 if (!empty($val[
'searchall'])) {
179 $fieldstosearchall[
'c.'.$key] = $val[
'label'];
182$fieldstosearchall[
"s.nom"] =
"ThirdParty";
183if (empty($user->socid)) {
184 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
186$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
187$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
189 $fieldstosearchall = $hookmanager->resArray[
'fieldstosearchall'];
190} elseif ($reshook == 0) {
191 if (!empty($hookmanager->resArray[
'fieldstosearchall'])) {
192 $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray[
'fieldstosearchall']);
197 'c.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1',
'position' => 10),
198 'c.ref_customer' => array(
'label' => $langs->trans(
"RefCustomer"),
'checked' =>
'1',
'position' => 12),
199 'c.ref_supplier' => array(
'label' => $langs->trans(
"RefSupplier"),
'checked' =>
'1',
'position' => 14),
200 'c.fk_contract_type' => array(
'label' => $langs->trans(
"ContractType"),
'checked' =>
'1',
'position' => 16),
201 's.nom' => array(
'label' => $langs->trans(
"ThirdParty"),
'checked' =>
'1',
'position' => 30),
202 's.name_alias' => array(
'label' => $langs->trans(
"AliasNameShort"),
'checked' =>
'0',
'position' => 30),
203 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' =>
'0',
'position' => 31),
204 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' =>
'1',
'position' => 32),
205 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' =>
'0',
'position' => 33),
206 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' =>
'0',
'position' => 34),
207 's.phone' => array(
'label' => $langs->trans(
"Phone"),
'checked' =>
'1',
'position' => 100),
208 's.phone_mobile' => array(
'label' => $langs->trans(
"PhoneMobile"),
'checked' =>
'1',
'position' => 102),
209 's.email' => array(
'label' => $langs->trans(
"ThirdPartyEmail"),
'checked' =>
'0',
'position' => 115),
210 'sale_representative' => array(
'label' => $langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked' =>
'-1',
'position' => 130),
211 'c.date_contrat' => array(
'label' => $langs->trans(
"DateContract"),
'checked' =>
'1',
'position' => 140),
212 'c.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
213 'c.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 500),
214 'c.note_public' => array(
'label' => $langs->trans(
"NotePublic"),
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
215 'c.note_private' => array(
'label' => $langs->trans(
"NotePrivate"),
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
216 'lower_planned_end_date' => array(
'label' => $langs->trans(
"LowerDateEndPlannedShort"),
'checked' =>
'1',
'position' => 900,
'help' => $langs->trans(
"LowerDateEndPlannedShort")),
217 'status' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
218 'c.signed_status' => array(
'label' => $langs->trans(
'SignedStatus'),
'checked' =>
'0',
'position' => 1001),
221include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
223$parameters = array(
'arrayfields' => &$arrayfields);
224$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
229if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
230 $search_sale = $user->id;
233$permissiontoread = $user->hasRight(
'contrat',
'lire');
234$permissiontoadd = $user->hasRight(
'contrat',
'creer');
235$permissiontodelete = $user->hasRight(
'contrat',
'supprimer');
245if (
GETPOST(
'cancel',
'alpha')) {
249if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
253$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
254$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
256 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
259include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
261if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
262 $search_dfmonth =
'';
270 $search_country =
'';
272 $search_phone_mobile =
"";
274 $search_type_thirdparty =
'';
275 $search_contract =
"";
276 $search_ref_customer =
"";
277 $search_ref_supplier =
"";
281 $search_product_category =
'';
282 $search_date_startday =
'';
283 $search_date_startmonth =
'';
284 $search_date_startyear =
'';
285 $search_date_endday =
'';
286 $search_date_endmonth =
'';
287 $search_date_endyear =
'';
288 $search_date_start =
'';
289 $search_date_end =
'';
291 $search_date_creation_startmonth =
"";
292 $search_date_creation_startyear =
"";
293 $search_date_creation_startday =
"";
294 $search_date_creation_start =
"";
295 $search_date_creation_endmonth =
"";
296 $search_date_creation_endyear =
"";
297 $search_date_creation_endday =
"";
298 $search_date_creation_end =
"";
299 $search_date_modif_startmonth =
"";
300 $search_date_modif_startyear =
"";
301 $search_date_modif_startday =
"";
302 $search_date_modif_start =
"";
303 $search_date_modif_endmonth =
"";
304 $search_date_modif_endyear =
"";
305 $search_date_modif_endday =
"";
306 $search_date_modif_end =
"";
308 $search_signed_status =
'';
309 $search_note_public =
"";
310 $search_note_private =
"";
312 $searchCategoryCustomerList = array();
313 $search_array_options = array();
316if (empty($reshook)) {
317 $objectclass =
'Contrat';
318 $objectlabel =
'Contracts';
319 $uploaddir =
$conf->contract->dir_output;
320 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
328$form =
new Form($db);
333$contracttmp =
new Contrat($db);
340$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.fk_contract_type, c.note_private, c.note_public, c.entity, c.signed_status,";
341$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,';
342$sql .=
" typent.code as typent_code, c.note_public, c.note_private,";
343$sql .=
" state.code_departement as state_code, state.nom as state_name,";
345if ($arrayfields[
'lower_planned_end_date'][
'checked'] || ($search_dfyear > 0 && $search_op2df)) {
346 $sql .=
" (SELECT MIN(".$db->ifsql(
"cd.statut=4",
"cd.date_fin_validite",
"null").
") FROM ".MAIN_DB_PREFIX.
"contratdet as cd WHERE cd.fk_contrat = c.rowid) as lower_planned_end_date,";
348$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=0",
'1',
'0').
') FROM '.MAIN_DB_PREFIX.
'contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_initial,';
349$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 '.MAIN_DB_PREFIX.
'contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_running,';
350$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 '.MAIN_DB_PREFIX.
'contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_expired,';
351$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 '.MAIN_DB_PREFIX.
'contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_late,';
352$sql .=
" (SELECT SUM(".$db->ifsql(
"cd.statut=5",
'1',
'0').
') FROM '.MAIN_DB_PREFIX.
'contratdet as cd WHERE cd.fk_contrat = c.rowid) as nb_closed';
354if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
355 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
356 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
360$parameters = array();
361$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
362$sql .= $hookmanager->resPrint;
363$sql = preg_replace(
'/,\s*$/',
'', $sql);
367$sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c";
368$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON (c.fk_soc = s.rowid)";
369$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
370$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
371$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
372if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
373 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (c.rowid = ef.fk_object)";
375if ($search_user > 0) {
376 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
377 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
380$parameters = array();
381$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
382$sql .= $hookmanager->resPrint;
383$sql .=
" WHERE c.entity IN (".getEntity(
'contract').
")";
384if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
385 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
388 $sql .=
" AND s.rowid = ".((int) $socid);
390if ($search_date_start) {
391 $sql .=
" AND c.date_contrat >= '".$db->idate($search_date_start).
"'";
393if ($search_date_end) {
394 $sql .=
" AND c.date_contrat <= '".$db->idate($search_date_end).
"'";
408if ($search_phone_mobile) {
411if ($search_contract) {
412 $sql .=
natural_search(array(
'c.rowid',
'c.ref'), $search_contract);
414if (!empty($search_ref_customer)) {
415 $sql .=
natural_search(array(
'c.ref_customer'), $search_ref_customer);
417if (!empty($search_ref_supplier)) {
418 $sql .=
natural_search(array(
'c.ref_supplier'), $search_ref_supplier);
420if ($search_type >= 0) {
421 $sql .=
" AND c.fk_contract_type = ".((int) $search_type);
432if ($search_country && $search_country !=
'-1') {
433 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
435if (!empty($search_note_private)) {
436 $sql .=
natural_search(array(
'c.note_private'), $search_note_private);
438if (!empty($search_note_public)) {
439 $sql .=
natural_search(array(
'c.note_public'), $search_note_public);
446 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
448if ($search_user > 0) {
449 $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);
452if ($search_sale && $search_sale !=
'-1') {
453 if ($search_sale == -2) {
454 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', 0, 1);
455 } elseif ($search_sale > 0) {
456 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', (
int) $search_sale);
460$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
461$searchCategoryProductList = array($search_product_category);
462if (!empty($searchCategoryProductList)) {
463 $searchCategoryProductSqlList = array();
464 $listofcategoryid =
'';
465 foreach ($searchCategoryProductList as $searchCategoryProduct) {
466 if (intval($searchCategoryProduct) == -2) {
467 $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)";
468 } elseif (intval($searchCategoryProduct) > 0) {
469 if ($searchCategoryProductOperator == 0) {
470 $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).
")";
472 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
476 if ($listofcategoryid) {
477 $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).
"))";
479 if ($searchCategoryProductOperator == 1) {
480 if (!empty($searchCategoryProductSqlList)) {
481 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
484 if (!empty($searchCategoryProductSqlList)) {
485 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
489$searchCategoryCustomerSqlList = array();
490if ($searchCategoryCustomerOperator == 1) {
491 $existsCategoryCustomerList = array();
492 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
493 if (intval($searchCategoryCustomer) == -2) {
494 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
495 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
496 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
497 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
498 $sqlCategoryCustomerNotExists .=
" )";
499 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
500 } elseif (intval($searchCategoryCustomer) > 0) {
501 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
504 if (!empty($existsCategoryCustomerList)) {
505 $sqlCategoryCustomerExists =
" EXISTS (";
506 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
507 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
508 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = s.rowid";
509 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
510 $sqlCategoryCustomerExists .=
" )";
511 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
513 if (!empty($searchCategoryCustomerSqlList)) {
514 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
517 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
518 if (intval($searchCategoryCustomer) == -2) {
519 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
520 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
521 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
522 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
523 $sqlCategoryCustomerNotExists .=
" )";
524 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
525 } elseif (intval($searchCategoryCustomer) > 0) {
526 $searchCategoryCustomerSqlList[] =
"s.rowid IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
529 if (!empty($searchCategoryCustomerSqlList)) {
530 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
534if ($search_date_creation_start) {
535 $sql .=
" AND c.datec >= '".$db->idate($search_date_creation_start).
"'";
537if ($search_date_creation_end) {
538 $sql .=
" AND c.datec <= '".$db->idate($search_date_creation_end).
"'";
541if ($search_date_modif_start) {
542 $sql .=
" AND c.tms >= '".$db->idate($search_date_modif_start).
"'";
544if ($search_date_modif_end) {
545 $sql .=
" AND c.tms <= '".$db->idate($search_date_modif_end).
"'";
547if ($search_signed_status !=
'' && $search_signed_status >= 0) {
548 $sql .=
" AND c.signed_status = ".((int) $search_signed_status);
552include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
554$parameters = array();
555$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
556$sql .= $hookmanager->resPrint;
558$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
559$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
560$sql .= $hookmanager->resPrint;
562$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
563$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
564if (empty($reshook)) {
565 if ($search_dfyear > 0 && $search_op2df) {
566 if ($search_op2df ==
'<=') {
568 $sql .=
" HAVING lower_planned_end_date <= '".$db->idate(
dol_get_last_day($search_dfyear, $search_dfmonth,
false)).
"'";
569 } elseif ($search_op2df ==
'>=') {
571 $sql .=
" HAVING lower_planned_end_date >= '".$db->idate(
dol_get_first_day($search_dfyear, $search_dfmonth,
false)).
"'";
574 $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)).
"'";
576 $sql .= empty($hookmanager->resPrint) ?
"" :
" AND ".$hookmanager->resPrint;
578 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
581 $sql = $hookmanager->resPrint;
585$nbtotalofrecords =
'';
590 if ($search_dfyear > 0 && $search_op2df) {
591 $resql = $db->query($sql, 0,
'auto', 1);
593 while ($db->fetch_object($resql)) {
594 if (empty($nbtotalofrecords)) {
595 $nbtotalofrecords = 1;
601 dol_print_error($db);
605 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
607 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as country on (country.rowid = s.fk_pays)',
'', $sqlforcount);
608 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as typent on (typent.id = s.fk_typent)',
'', $sqlforcount);
609 if (!$search_state) {
610 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as state on (state.rowid = s.fk_departement)',
'', $sqlforcount);
612 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'contratdet as cd ON c.rowid = cd.fk_contrat',
'', $sqlforcount);
614 $sqlforcount = preg_replace(
'/GROUP BY.*$/',
'', $sqlforcount);
616 $resql = $db->query($sqlforcount);
618 $objforcount = $db->fetch_object($resql);
619 $nbtotalofrecords = $objforcount->nbtotalofrecords;
621 dol_print_error($db);
625 if (($page * $limit) > (
int) $nbtotalofrecords) {
633$sql .= $db->order($sortfield, $sortorder);
635 $sql .= $db->plimit($limit + 1, $offset);
638$resql = $db->query($sql);
640 dol_print_error($db);
644$num = $db->num_rows($resql);
647if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
648 $obj = $db->fetch_object($resql);
650 header(
"Location: ".DOL_URL_ROOT.
'/contrat/card.php?id='.
$id);
657$title = $langs->trans(
"Contracts");
658$help_url =
'EN:Module_Contracts|FR:Module_Contrat|ES:Contratos_de_servicio';
660llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-contrat page-list bodyforlist');
664$arrayofselected = is_array($toselect) ? $toselect : array();
669 if (empty($search_name)) {
670 $search_name = $soc->name;
676 $param .=
'&mode='.urlencode($mode);
678if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
679 $param .=
'&contextpage='.urlencode($contextpage);
681if ($limit > 0 && $limit !=
$conf->liste_limit) {
682 $param .=
'&limit='.((int) $limit);
685 $param .=
'&socid='.((int) $socid);
687if ($search_all !=
'') {
688 $param .=
'&search_all='.urlencode($search_all);
690if ($search_contract !=
'') {
691 $param .=
'&search_contract='.urlencode($search_contract);
693if ($search_name !=
'') {
694 $param .=
'&search_name='.urlencode($search_name);
696if ($search_alias !=
'') {
697 $param .=
'&search_alias='.urlencode($search_alias);
699if ($search_phone !=
'') {
700 $param .=
'&search_phone='.urlencode($search_phone);
702if ($search_phone_mobile !=
'') {
703 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
705if ($search_email !=
'') {
706 $param .=
'&search_email='.urlencode($search_email);
708if ($search_ref_customer !=
'') {
709 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
711if ($search_ref_supplier !=
'') {
712 $param .=
'&search_ref_supplier='.urlencode($search_ref_supplier);
714if ($search_type >= 0) {
715 $param .=
'&search_type='.$search_type;
717if ($search_note_private !=
'') {
718 $param .=
'&search_note_private='.urlencode($search_note_private);
720if ($search_note_public !=
'') {
721 $param .=
'&search_note_public='.urlencode($search_note_public);
723if ($search_op2df !=
'') {
724 $param .=
'&search_op2df='.urlencode($search_op2df);
726if ($search_date_creation_startmonth) {
727 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
729if ($search_date_creation_startyear) {
730 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
732if ($search_date_creation_startday) {
733 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
735if ($search_date_creation_start) {
736 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
738if ($search_date_creation_endmonth) {
739 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
741if ($search_date_creation_endyear) {
742 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
744if ($search_date_creation_endday) {
745 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
747if ($search_date_creation_end) {
748 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
750if ($search_date_modif_startmonth) {
751 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
753if ($search_date_modif_startyear) {
754 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
756if ($search_date_modif_startday) {
757 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
759if ($search_date_modif_start) {
760 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
762if ($search_date_modif_endmonth) {
763 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
765if ($search_date_modif_endyear) {
766 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
768if ($search_date_modif_endday) {
769 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
771if ($search_date_modif_end) {
772 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
774if ($search_date_startday > 0) {
775 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
777if ($search_date_startmonth > 0) {
778 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
780if ($search_date_startyear > 0) {
781 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
783if ($search_date_endday > 0) {
784 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
786if ($search_date_endmonth > 0) {
787 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
789if ($search_date_endyear > 0) {
790 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
792if ($search_dfyear > 0) {
793 $param .=
'&search_dfyear='.urlencode((
string) ($search_dfyear));
795if ($search_dfmonth > 0) {
796 $param .=
'&search_dfmonth='.urlencode((
string) ($search_dfmonth));
798if ($search_signed_status !=
'' && $search_signed_status >= 0) {
799 $param .=
'&search_signed_status='.urlencode($search_signed_status);
801if ($search_sale > 0) {
802 $param .=
'&search_sale='.urlencode($search_sale);
804if ($search_user > 0) {
805 $param .=
'&search_user='.urlencode((
string) ($search_user));
807if ($search_type_thirdparty > 0) {
808 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
810if ($search_town !=
'') {
811 $param .=
'&search_town='.urlencode($search_town);
813if ($search_zip !=
'') {
814 $param .=
'&search_zip='.urlencode($search_zip);
816if ($search_state !=
'') {
817 $param .=
'&search_state='.urlencode($search_state);
819if ($search_country !=
'') {
820 $param .=
"&search_country=".urlencode($search_country);
822if ($search_product_category > 0) {
823 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
826 $param .=
'&show_files='.urlencode((
string) ($show_files));
828if ($optioncss !=
'') {
829 $param .=
'&optioncss='.urlencode($optioncss);
831foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
832 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
835include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
837$parameters = array();
838$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
839$param .= $hookmanager->resPrint;
842$arrayofmassactions = array(
843 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
844 'builddoc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
845 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
847if (!empty($permissiontodelete)) {
848 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
850if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
851 $arrayofmassactions = array();
853$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
855$url = DOL_URL_ROOT.
'/contrat/card.php?action=create';
857 $url .=
'&socid='.((int) $socid);
860$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'));
861$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'));
862$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'));
864$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContractSubscription'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'contrat',
'creer'));
866print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
'PHP_SELF'].
'">'.
"\n";
867if ($optioncss !=
'') {
868 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
870print
'<input type="hidden" name="token" value="'.newToken().
'">';
871print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
872print
'<input type="hidden" name="action" value="list">';
873print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
874print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
875print
'<input type="hidden" name="page" value="'.$page.
'">';
876print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
877print
'<input type="hidden" name="page_y" value="">';
878print
'<input type="hidden" name="mode" value="'.$mode.
'">';
881print_barre_liste($langs->trans(
"Contracts"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contract', 0, $newcardbutton,
'', $limit, 0, 0, 1);
883$topicmail =
"SendContractRef";
884$modelmail =
"contract";
886$trackid =
'con'.$object->id;
887include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
891 foreach ($fieldstosearchall as $key => $val) {
892 $fieldstosearchall[$key] = $langs->trans($val);
893 $setupstring .= $key.
"=".$val.
";";
895 print
'<!-- Search done like if CONTRACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
896 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
902if ($user->hasRight(
'user',
'user',
'lire')) {
903 $langs->load(
"commercial");
904 $moreforfilter .=
'<div class="divsearchfield">';
905 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
906 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'widthcentpercentminusx maxwidth300');
907 $moreforfilter .=
'</div>';
910if ($user->hasRight(
'user',
'user',
'lire')) {
911 $moreforfilter .=
'<div class="divsearchfield">';
912 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
913 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
914 $moreforfilter .=
'</div>';
917if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
918 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
919 $moreforfilter .=
'<div class="divsearchfield">';
920 $tmptitle = $langs->trans(
'IncludingProductWithTag');
921 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 64, 0, 2);
922 $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);
923 $moreforfilter .=
'</div>';
927 $moreforfilter .=
'<div class="divsearchfield">';
928 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
929 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
930 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 2);
931 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
932 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
933 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
934 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
935 $moreforfilter .=
'</div>';
938$parameters = array();
939$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
940if (empty($reshook)) {
941 $moreforfilter .= $hookmanager->resPrint;
943 $moreforfilter = $hookmanager->resPrint;
946if (!empty($moreforfilter)) {
947 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
948 print $moreforfilter;
952$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
953$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
954if ($massactionbutton) {
955 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
958print
'<div class="div-table-responsive">';
959print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
963print
'<tr class="liste_titre_filter">';
965if (
$conf->main_checkbox_left_column) {
966 print
'<td class="liste_titre maxwidthsearch center">';
967 $searchpicto = $form->showFilterButtons(
'left');
971if (!empty($arrayfields[
'c.ref'][
'checked'])) {
972 print
'<td class="liste_titre">';
973 print
'<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).
'">';
976if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
977 print
'<td class="liste_titre">';
978 print
'<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
981if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
982 print
'<td class="liste_titre">';
983 print
'<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
986if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
987 print
'<td class="liste_titre">';
988 print $form->selectarray(
'search_type', array(
'-1' =>
'',
'0' => $langs->trans(
'CustomerContract'),
'1' => $langs->trans(
'SupplierContract')), $search_type, 0, 0, 0,
'', 0, 0, 0,
'',
'flat maxwidth100');
991if (!empty($arrayfields[
's.nom'][
'checked'])) {
992 print
'<td class="liste_titre">';
993 print
'<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).
'"'.($user->socid > 0 ?
" disabled" :
"").
'>';
997if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
998 print
'<td class="liste_titre">';
999 print
'<input type="text" class="flat maxwidth75" name="search_alias" value="'.dolPrintHTMLForAttribute($search_alias).
'">';
1003if (!empty($arrayfields[
's.town'][
'checked'])) {
1004 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1007if (!empty($arrayfields[
's.zip'][
'checked'])) {
1008 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1011if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1012 print
'<td class="liste_titre">';
1013 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1017if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1018 print
'<td class="liste_titre center">';
1019 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1023if (!empty($arrayfields[
's.phone'][
'checked'])) {
1024 print
'<td class="liste_titre">';
1025 print
'<input type="text" class="flat width50" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1029if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1030 print
'<td class="liste_titre">';
1031 print
'<input type="text" class="flat width50" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1035if (!empty($arrayfields[
's.email'][
'checked'])) {
1036 print
'<td class="liste_titre">';
1037 print
'<input type="text" class="flat width75" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1041if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1042 print
'<td class="liste_titre maxwidthonsmartphone center">';
1043 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);
1046if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1047 print
'<td class="liste_titre"></td>';
1049if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1050 print
'<td class="liste_titre center">';
1051 print
'<div class="nowrapfordate">';
1052 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1054 print
'<div class="nowrapfordate">';
1055 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1060if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1061 print
'<td class="liste_titre center">';
1062 $list_signed_status =
$object->getSignedStatusLocalisedArray();
1063 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
1067if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1068 print
'<td class="liste_titre center">';
1069 print
'<input class="flat" size="10" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1073if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1074 print
'<td class="liste_titre center">';
1075 print
'<input class="flat" size="10" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1079include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1082$parameters = array(
'arrayfields' => $arrayfields);
1083$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1084print $hookmanager->resPrint;
1086if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1087 print
'<td class="liste_titre center nowraponall">';
1088 print
'<div class="nowrapfordate">';
1089 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'));
1091 print
'<div class="nowrapfordate">';
1092 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'));
1097if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1098 print
'<td class="liste_titre center nowraponall">';
1099 print
'<div class="nowrapfordate">';
1100 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'));
1102 print
'<div class="nowrapfordate">';
1103 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'));
1108if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1109 print
'<td class="liste_titre nowraponall center">';
1110 $arrayofoperators = array(
'0' =>
'',
'=' =>
'=',
'<=' =>
'<=',
'>=' =>
'>=');
1111 print $form->selectarray(
'search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth50imp');
1113 print $formother->select_month($search_dfmonth,
'search_dfmonth', 1, 0);
1115 print $formother->selectyear($search_dfyear,
'search_dfyear', 1, 20, 5, 0, 0,
'');
1119if (!empty($arrayfields[
'status'][
'checked'])) {
1120 print
'<td class="liste_titre right" colspan="4"></td>';
1124if (!
$conf->main_checkbox_left_column) {
1125 print
'<td class="liste_titre center">';
1126 $searchpicto = $form->showFilterButtons();
1132$totalarray = array();
1133$totalarray[
'nbfield'] = 0;
1137print
'<tr class="liste_titre">';
1138if (
$conf->main_checkbox_left_column) {
1139 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1140 $totalarray[
'nbfield']++;
1142if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1144 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
1145 $totalarray[
'nbfield']++;
1147if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1148 print_liste_field_titre($arrayfields[
'c.ref_customer'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_customer",
"", $param,
'', $sortfield, $sortorder);
1149 $totalarray[
'nbfield']++;
1151if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1152 print_liste_field_titre($arrayfields[
'c.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
1153 $totalarray[
'nbfield']++;
1155if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
1156 print_liste_field_titre($arrayfields[
'c.fk_contract_type'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_contract_type",
"", $param,
'', $sortfield, $sortorder);
1157 $totalarray[
'nbfield']++;
1159if (!empty($arrayfields[
's.nom'][
'checked'])) {
1160 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1161 $totalarray[
'nbfield']++;
1163if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1164 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
"s.name_alias",
"", $param,
'', $sortfield, $sortorder);
1165 $totalarray[
'nbfield']++;
1167if (!empty($arrayfields[
's.town'][
'checked'])) {
1168 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1169 $totalarray[
'nbfield']++;
1171if (!empty($arrayfields[
's.zip'][
'checked'])) {
1172 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1173 $totalarray[
'nbfield']++;
1175if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1176 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1177 $totalarray[
'nbfield']++;
1179if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1180 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1181 $totalarray[
'nbfield']++;
1183if (!empty($arrayfields[
's.phone'][
'checked'])) {
1184 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1185 $totalarray[
'nbfield']++;
1187if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1188 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1189 $totalarray[
'nbfield']++;
1191if (!empty($arrayfields[
's.email'][
'checked'])) {
1192 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1193 $totalarray[
'nbfield']++;
1195if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1196 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1197 $totalarray[
'nbfield']++;
1199if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1200 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder);
1201 $totalarray[
'nbfield']++;
1203if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1204 print_liste_field_titre($arrayfields[
'c.date_contrat'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_contrat",
"", $param,
'', $sortfield, $sortorder,
'center ');
1205 $totalarray[
'nbfield']++;
1207if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1208 print_liste_field_titre($arrayfields[
'c.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"c.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1209 $totalarray[
'nbfield']++;
1211if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1212 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1213 $totalarray[
'nbfield']++;
1215if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1216 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1217 $totalarray[
'nbfield']++;
1220include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1222$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1223$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1224print $hookmanager->resPrint;
1225if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1226 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1227 $totalarray[
'nbfield']++;
1229if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1230 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1231 $totalarray[
'nbfield']++;
1233if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1234 print_liste_field_titre($arrayfields[
'lower_planned_end_date'][
'label'], $_SERVER[
"PHP_SELF"],
"lower_planned_end_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1235 $totalarray[
'nbfield']++;
1237if (!empty($arrayfields[
'status'][
'checked'])) {
1238 print_liste_field_titre($staticcontratligne->LibStatut(0, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1239 $totalarray[
'nbfield']++;
1240 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1241 $totalarray[
'nbfield']++;
1242 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1243 $totalarray[
'nbfield']++;
1244 print_liste_field_titre($staticcontratligne->LibStatut(5, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1245 $totalarray[
'nbfield']++;
1247if (!
$conf->main_checkbox_left_column) {
1248 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1249 $totalarray[
'nbfield']++;
1256$savnbfield = $totalarray[
'nbfield'];
1257$totalarray = array();
1258$totalarray[
'nbfield'] = 0;
1259$typenArray = array();
1260$cacheCountryIDCode = array();
1261$imaxinloop = ($limit ? min($num, $limit) : $num);
1262$showinvalidemail =
getDolGlobalInt(
'MAIN_SHOW_INVALID_EMAIL_IN_LIST', 1);
1263while ($i < $imaxinloop) {
1264 $obj = $db->fetch_object($resql);
1269 $contracttmp->ref = $obj->ref;
1270 $contracttmp->id = $obj->rowid;
1271 $contracttmp->ref_customer = $obj->ref_customer;
1272 $contracttmp->ref_supplier = $obj->ref_supplier;
1274 $contracttmp->nbofserviceswait = $obj->nb_initial;
1275 $contracttmp->nbofservicesopened = $obj->nb_running;
1276 $contracttmp->nbofservicesexpired = $obj->nb_expired;
1277 $contracttmp->nbofservicesclosed = $obj->nb_closed;
1278 $contracttmp->signed_status = $obj->signed_status;
1280 $socstatic->id = $obj->socid;
1281 $socstatic->name = $obj->name;
1282 $socstatic->name_alias = $obj->name_alias;
1283 $socstatic->email = $obj->email;
1284 $socstatic->status = $obj->company_status;
1285 $socstatic->logo = $obj->company_logo;
1286 $socstatic->country_id = $obj->country_id;
1287 $socstatic->country_code =
'';
1288 $socstatic->country =
'';
1290 if ($obj->country_id > 0) {
1291 if (!isset($cacheCountryIDCode[$obj->country_id][
'code'])) {
1292 $tmparray =
getCountry($obj->country_id,
'all');
1293 $cacheCountryIDCode[$obj->country_id] = array(
'code' => empty($tmparray[
'code']) ?
'' : $tmparray[
'code'],
'label' => empty($tmparray[
'label']) ?
'' : $tmparray[
'label']);
1295 $socstatic->country_code = $cacheCountryIDCode[$obj->country_id][
'code'];
1296 $socstatic->country = $cacheCountryIDCode[$obj->country_id][
'label'];
1299 if ($mode ==
'kanban') {
1301 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1302 print
'<div class="box-flex-container kanban">';
1305 $arraydata = array();
1306 $arraydata[
'thirdparty'] = $socstatic;
1307 $arraydata[
'selected'] = in_array($obj->rowid, $arrayofselected);
1308 $contracttmp->date_contrat = $obj->date_contrat;
1309 print $contracttmp->getKanbanView(
'', $arraydata);
1310 if ($i == ($imaxinloop - 1)) {
1316 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1318 if (
$conf->main_checkbox_left_column) {
1319 print
'<td class="nowrap center">';
1320 if ($massactionbutton || $massaction) {
1322 if (in_array($obj->rowid, $arrayofselected)) {
1325 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1329 $totalarray[
'nbfield']++;
1333 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1334 print
'<td class="nowraponall">';
1335 print $contracttmp->getNomUrl(1);
1336 if ($obj->nb_late) {
1337 print img_warning($langs->trans(
"Late"));
1339 if (!empty($obj->note_private) || !empty($obj->note_public)) {
1340 print
' <span class="note">';
1341 print
'<a href="'.DOL_URL_ROOT.
'/contrat/note.php?id='.$obj->rowid.
'&save_lastsearch_values=1">'.img_picto($langs->trans(
"ViewPrivateNote"),
'note').
'</a>';
1347 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1348 print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
1353 $totalarray[
'nbfield']++;
1358 if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1359 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).
'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).
'</td>';
1361 $totalarray[
'nbfield']++;
1364 if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1365 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>';
1367 if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
1368 $contractTypeLabels = array(0 => $langs->trans(
'CustomerContract'), 1 => $langs->trans(
'SupplierContract'));
1369 print
'<td>'.dol_escape_htmltag($contractTypeLabels[(
int) $obj->fk_contract_type] ??
'').
'</td>';
1371 $totalarray[
'nbfield']++;
1374 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1375 print
'<td class="tdoverflowmax150">';
1376 if ($obj->socid > 0) {
1378 print $socstatic->getNomUrl(1,
'');
1383 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1384 print
'<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($obj->name_alias).
'">';
1385 print
'<span class="spantitle">'.dolPrintHTML($obj->name_alias).
'</span>';
1389 if (!empty($arrayfields[
's.town'][
'checked'])) {
1390 print
'<td class="nocellnopadd">';
1394 $totalarray[
'nbfield']++;
1398 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1399 print
'<td class="center nocellnopadd">';
1403 $totalarray[
'nbfield']++;
1407 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1408 print
"<td>".$obj->state_name.
"</td>\n";
1410 $totalarray[
'nbfield']++;
1414 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1415 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($socstatic->country).
'">';
1419 $totalarray[
'nbfield']++;
1423 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1424 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>';
1427 if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1428 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>';
1431 if (!empty($arrayfields[
's.email'][
'checked'])) {
1432 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute((
string) $obj->email).
'">'.
dol_print_email((
string) $obj->email, 0, $obj->socid, 1, 0, $showinvalidemail, 1).
'</td>';
1436 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1437 print
'<td class="center">';
1438 if (count($typenArray) == 0) {
1439 $typenArray = $formcompany->typent_array(1);
1441 print $typenArray[$obj->typent_code];
1444 $totalarray[
'nbfield']++;
1447 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1450 if ($obj->socid > 0) {
1451 $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
1452 if ($listsalesrepresentatives < 0) {
1453 dol_print_error($db);
1455 $nbofsalesrepresentative = count($listsalesrepresentatives);
1456 if ($nbofsalesrepresentative > 6) {
1458 print $nbofsalesrepresentative;
1459 } elseif ($nbofsalesrepresentative > 0) {
1460 $userstatic =
new User($db);
1462 foreach ($listsalesrepresentatives as $val) {
1463 $userstatic->id = $val[
'id'];
1464 $userstatic->lastname = $val[
'lastname'];
1465 $userstatic->firstname = $val[
'firstname'];
1466 $userstatic->email = $val[
'email'];
1467 $userstatic->status = $val[
'statut'];
1468 $userstatic->entity = $val[
'entity'];
1469 $userstatic->photo = $val[
'photo'];
1470 $userstatic->login = $val[
'login'];
1471 $userstatic->phone = $val[
'phone'];
1472 $userstatic->job = $val[
'job'];
1473 $userstatic->gender = $val[
'gender'];
1476 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1478 if ($j < $nbofsalesrepresentative) {
1491 if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1492 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_contrat),
'day',
'tzserver').
'</td>';
1495 if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1496 print
'<td class="center">'.$contracttmp->getLibSignedStatus(5).
'</td>';
1498 $totalarray[
'nbfield']++;
1502 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1503 print
'<td class="center">'.$obj->note_public.
'</td>';
1505 $totalarray[
'nbfield']++;
1509 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1510 print
'<td class="center">'.$obj->note_private.
'</td>';
1512 $totalarray[
'nbfield']++;
1516 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1518 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1519 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1520 print $hookmanager->resPrint;
1522 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1523 print
'<td class="center nowrap">';
1524 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1527 $totalarray[
'nbfield']++;
1531 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1532 print
'<td class="center nowrap">';
1533 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1536 $totalarray[
'nbfield']++;
1540 if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1541 print
'<td class="center nowrapforall">';
1542 print
dol_print_date($db->jdate($obj->lower_planned_end_date),
'day',
'tzuser');
1545 $totalarray[
'nbfield']++;
1549 if (!empty($arrayfields[
'status'][
'checked'])) {
1550 print
'<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial :
'').
'</td>';
1551 print
'<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running :
'').
'</td>';
1552 print
'<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired :
'').
'</td>';
1553 print
'<td class="center">'.($obj->nb_closed > 0 ? $obj->nb_closed :
'').
'</td>';
1555 $totalarray[
'nbfield']++;
1556 $totalarray[
'nbfield']++;
1557 $totalarray[
'nbfield']++;
1558 $totalarray[
'nbfield']++;
1562 if (!
$conf->main_checkbox_left_column) {
1563 print
'<td class="nowrap center">';
1564 if ($massactionbutton || $massaction) {
1566 if (in_array($obj->rowid, $arrayofselected)) {
1569 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1573 $totalarray[
'nbfield']++;
1585 foreach ($arrayfields as $key => $val) {
1586 if (!empty($val[
'checked'])) {
1590 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1595$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1596$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1597print $hookmanager->resPrint;
1599print
'</table>'.
"\n";
1602print
'</form>'.
"\n";
1604$hidegeneratedfilelistifempty = 1;
1605if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1606 $hidegeneratedfilelistifempty = 0;
1610$urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1611$urlsource .= str_replace(
'&',
'&', $param);
1613$filedir = $diroutputmassaction;
1614$genallowed = $permissiontoread;
1615$delallowed = $permissiontoadd;
1617print $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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
dol_print_phone($phone, $countrycode='', $contactid=0, $socid=0, $addlink='', $separ=" ", $withpicto='', $titlealt='', $adddivfloat=0, $morecss='paddingright')
Format phone numbers according to country.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
dol_natural_search_phone($db, $fields, $value, $nofirstand=0)
Build a natural_search() SQL fragment for a phone/fax field, tolerant of the international storage fo...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.