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_phone =
GETPOST(
'search_phone',
'alpha');
74$search_phone_mobile =
GETPOST(
'search_phone_mobile',
'alpha');
75$search_email =
GETPOST(
'search_email',
'alpha');
76$search_town =
GETPOST(
'search_town',
'alpha');
77$search_zip =
GETPOST(
'search_zip',
'alpha');
78$search_state =
GETPOST(
"search_state",
'alpha');
79$search_country =
GETPOST(
"search_country",
'aZ09');
80$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
81$search_contract =
GETPOST(
'search_contract',
'alpha');
82$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
83$search_ref_supplier =
GETPOST(
'search_ref_supplier',
'alpha');
85$search_all =
GETPOST(
'search_all',
'alphanohtml');
86$search_status =
GETPOST(
'search_status',
'alpha');
87$search_signed_status =
GETPOST(
'search_signed_status',
'alpha');
88$search_note_public =
GETPOST(
'search_note_public',
'alpha');
89$search_note_private =
GETPOST(
'search_note_private',
'alpha');
91$search_user =
GETPOST(
'search_user',
'intcomma');
92$search_sale =
GETPOST(
'search_sale',
'intcomma');
93$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
96$search_op2df =
GETPOST(
'search_op2df',
'alpha');
97$search_date_startday =
GETPOSTINT(
'search_date_startday');
98$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
99$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
100$search_date_endday =
GETPOSTINT(
'search_date_endday');
101$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
102$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
103$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
104$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
105$searchCategoryCustomerOperator = 0;
107 $searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
109 $searchCategoryCustomerOperator =
getDolGlobalString(
'MAIN_SEARCH_CAT_OR_BY_DEFAULT');
111$searchCategoryCustomerList =
GETPOST(
'search_category_customer_list',
'array');
113$search_date_creation_startmonth =
GETPOSTINT(
'search_date_creation_startmonth');
114$search_date_creation_startyear =
GETPOSTINT(
'search_date_creation_startyear');
115$search_date_creation_startday =
GETPOSTINT(
'search_date_creation_startday');
116$search_date_creation_start =
dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
117$search_date_creation_endmonth =
GETPOSTINT(
'search_date_creation_endmonth');
118$search_date_creation_endyear =
GETPOSTINT(
'search_date_creation_endyear');
119$search_date_creation_endday =
GETPOSTINT(
'search_date_creation_endday');
120$search_date_creation_end =
dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
122$search_date_modif_startmonth =
GETPOSTINT(
'search_date_modif_startmonth');
123$search_date_modif_startyear =
GETPOSTINT(
'search_date_modif_startyear');
124$search_date_modif_startday =
GETPOSTINT(
'search_date_modif_startday');
125$search_date_modif_start =
dol_mktime(0, 0, 0, $search_date_modif_startmonth, $search_date_modif_startday, $search_date_modif_startyear);
126$search_date_modif_endmonth =
GETPOSTINT(
'search_date_modif_endmonth');
127$search_date_modif_endyear =
GETPOSTINT(
'search_date_modif_endyear');
128$search_date_modif_endday =
GETPOSTINT(
'search_date_modif_endday');
129$search_date_modif_end =
dol_mktime(23, 59, 59, $search_date_modif_endmonth, $search_date_modif_endday, $search_date_modif_endyear);
133$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
134$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
136if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
140$offset = $limit * $page;
141$pageprev = $page - 1;
142$pagenext = $page + 1;
144 $sortfield =
'c.ref';
152if ($user->socid > 0) {
153 $socid = $user->socid;
156$hookmanager->initHooks(array(
'contractlist'));
160$diroutputmassaction =
$conf->contract->dir_output.
'/temp/massgeneration/'.$user->id;
162if ($search_status ==
'') {
171$extrafields->fetch_name_optionals_label(
$object->table_element);
173$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
175$fieldstosearchall = array();
176foreach (
$object->fields as $key => $val) {
177 if (!empty($val[
'searchall'])) {
178 $fieldstosearchall[
'c.'.$key] = $val[
'label'];
181$fieldstosearchall[
"s.nom"] =
"ThirdParty";
182if (empty($user->socid)) {
183 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
185$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
186$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
188 $fieldstosearchall = $hookmanager->resArray[
'fieldstosearchall'];
189} elseif ($reshook == 0) {
190 if (!empty($hookmanager->resArray[
'fieldstosearchall'])) {
191 $fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray[
'fieldstosearchall']);
196 'c.ref' => array(
'label' => $langs->trans(
"Ref"),
'checked' =>
'1',
'position' => 10),
197 'c.ref_customer' => array(
'label' => $langs->trans(
"RefCustomer"),
'checked' =>
'1',
'position' => 12),
198 'c.ref_supplier' => array(
'label' => $langs->trans(
"RefSupplier"),
'checked' =>
'1',
'position' => 14),
199 'c.fk_contract_type' => array(
'label' => $langs->trans(
"ContractType"),
'checked' =>
'1',
'position' => 16),
200 's.nom' => array(
'label' => $langs->trans(
"ThirdParty"),
'checked' =>
'1',
'position' => 30),
201 's.town' => array(
'label' => $langs->trans(
"Town"),
'checked' =>
'0',
'position' => 31),
202 's.zip' => array(
'label' => $langs->trans(
"Zip"),
'checked' =>
'1',
'position' => 32),
203 'state.nom' => array(
'label' => $langs->trans(
"StateShort"),
'checked' =>
'0',
'position' => 33),
204 'country.code_iso' => array(
'label' => $langs->trans(
"Country"),
'checked' =>
'0',
'position' => 34),
205 's.phone' => array(
'label' => $langs->trans(
"Phone"),
'checked' =>
'1',
'position' => 100),
206 's.phone_mobile' => array(
'label' => $langs->trans(
"PhoneMobile"),
'checked' =>
'1',
'position' => 102),
207 's.email' => array(
'label' => $langs->trans(
"ThirdPartyEmail"),
'checked' =>
'0',
'position' => 115),
208 'sale_representative' => array(
'label' => $langs->trans(
"SaleRepresentativesOfThirdParty"),
'checked' =>
'-1',
'position' => 130),
209 'c.date_contrat' => array(
'label' => $langs->trans(
"DateContract"),
'checked' =>
'1',
'position' => 140),
210 'c.datec' => array(
'label' => $langs->trans(
"DateCreation"),
'checked' =>
'0',
'position' => 500),
211 'c.tms' => array(
'label' => $langs->trans(
"DateModificationShort"),
'checked' =>
'0',
'position' => 500),
212 'c.note_public' => array(
'label' => $langs->trans(
"NotePublic"),
'checked' =>
'0',
'position' => 520,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES'))),
213 'c.note_private' => array(
'label' => $langs->trans(
"NotePrivate"),
'checked' =>
'0',
'position' => 521,
'enabled' => (
string) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES'))),
214 'lower_planned_end_date' => array(
'label' => $langs->trans(
"LowerDateEndPlannedShort"),
'checked' =>
'1',
'position' => 900,
'help' => $langs->trans(
"LowerDateEndPlannedShort")),
215 'status' => array(
'label' => $langs->trans(
"Status"),
'checked' =>
'1',
'position' => 1000),
216 'c.signed_status' => array(
'label' => $langs->trans(
'SignedStatus'),
'checked' =>
'0',
'position' => 1001),
219include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
221$parameters = array(
'arrayfields' => &$arrayfields);
222$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
227if (empty($user->socid) && !$user->hasRight(
'societe',
'client',
'voir')) {
228 $search_sale = $user->id;
231$permissiontoread = $user->hasRight(
'contrat',
'lire');
232$permissiontoadd = $user->hasRight(
'contrat',
'creer');
233$permissiontodelete = $user->hasRight(
'contrat',
'supprimer');
243if (
GETPOST(
'cancel',
'alpha')) {
247if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
251$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
252$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
254 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
257include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
259if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
260 $search_dfmonth =
'';
267 $search_country =
'';
269 $search_phone_mobile =
"";
271 $search_type_thirdparty =
'';
272 $search_contract =
"";
273 $search_ref_customer =
"";
274 $search_ref_supplier =
"";
278 $search_product_category =
'';
279 $search_date_startday =
'';
280 $search_date_startmonth =
'';
281 $search_date_startyear =
'';
282 $search_date_endday =
'';
283 $search_date_endmonth =
'';
284 $search_date_endyear =
'';
285 $search_date_start =
'';
286 $search_date_end =
'';
288 $search_date_creation_startmonth =
"";
289 $search_date_creation_startyear =
"";
290 $search_date_creation_startday =
"";
291 $search_date_creation_start =
"";
292 $search_date_creation_endmonth =
"";
293 $search_date_creation_endyear =
"";
294 $search_date_creation_endday =
"";
295 $search_date_creation_end =
"";
296 $search_date_modif_startmonth =
"";
297 $search_date_modif_startyear =
"";
298 $search_date_modif_startday =
"";
299 $search_date_modif_start =
"";
300 $search_date_modif_endmonth =
"";
301 $search_date_modif_endyear =
"";
302 $search_date_modif_endday =
"";
303 $search_date_modif_end =
"";
305 $search_signed_status =
'';
306 $search_note_public =
"";
307 $search_note_private =
"";
309 $searchCategoryCustomerList = array();
310 $search_array_options = array();
313if (empty($reshook)) {
314 $objectclass =
'Contrat';
315 $objectlabel =
'Contracts';
316 $uploaddir =
$conf->contract->dir_output;
317 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
325$form =
new Form($db);
330$contracttmp =
new Contrat($db);
337$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,";
338$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,';
339$sql .=
" typent.code as typent_code, c.note_public, c.note_private,";
340$sql .=
" state.code_departement as state_code, state.nom as state_name,";
342if ($arrayfields[
'lower_planned_end_date'][
'checked'] || ($search_dfyear > 0 && $search_op2df)) {
343 $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,";
345$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,';
346$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,';
347$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,';
348$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,';
349$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';
351if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
352 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
353 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
357$parameters = array();
358$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
359$sql .= $hookmanager->resPrint;
360$sql = preg_replace(
'/,\s*$/',
'', $sql);
364$sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c";
365$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON (c.fk_soc = s.rowid)";
366$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
367$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
368$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
369if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
370 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (c.rowid = ef.fk_object)";
372if ($search_user > 0) {
373 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
374 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
377$parameters = array();
378$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
379$sql .= $hookmanager->resPrint;
380$sql .=
" WHERE c.entity IN (".getEntity(
'contract').
")";
381if ($search_type_thirdparty !=
'' && $search_type_thirdparty > 0) {
382 $sql .=
" AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).
')';
385 $sql .=
" AND s.rowid = ".((int) $socid);
387if ($search_date_start) {
388 $sql .=
" AND c.date_contrat >= '".$db->idate($search_date_start).
"'";
390if ($search_date_end) {
391 $sql .=
" AND c.date_contrat <= '".$db->idate($search_date_end).
"'";
402if ($search_phone_mobile) {
405if ($search_contract) {
406 $sql .=
natural_search(array(
'c.rowid',
'c.ref'), $search_contract);
408if (!empty($search_ref_customer)) {
409 $sql .=
natural_search(array(
'c.ref_customer'), $search_ref_customer);
411if (!empty($search_ref_supplier)) {
412 $sql .=
natural_search(array(
'c.ref_supplier'), $search_ref_supplier);
414if ($search_type >= 0) {
415 $sql .=
" AND c.fk_contract_type = ".((int) $search_type);
426if ($search_country && $search_country !=
'-1') {
427 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
429if (!empty($search_note_private)) {
430 $sql .=
natural_search(array(
'c.note_private'), $search_note_private);
432if (!empty($search_note_public)) {
433 $sql .=
natural_search(array(
'c.note_public'), $search_note_public);
440 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
442if ($search_user > 0) {
443 $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);
446if ($search_sale && $search_sale !=
'-1') {
447 if ($search_sale == -2) {
448 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', 0, 1);
449 } elseif ($search_sale > 0) {
450 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', (
int) $search_sale);
454$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
455$searchCategoryProductList = array($search_product_category);
456if (!empty($searchCategoryProductList)) {
457 $searchCategoryProductSqlList = array();
458 $listofcategoryid =
'';
459 foreach ($searchCategoryProductList as $searchCategoryProduct) {
460 if (intval($searchCategoryProduct) == -2) {
461 $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)";
462 } elseif (intval($searchCategoryProduct) > 0) {
463 if ($searchCategoryProductOperator == 0) {
464 $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).
")";
466 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
470 if ($listofcategoryid) {
471 $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).
"))";
473 if ($searchCategoryProductOperator == 1) {
474 if (!empty($searchCategoryProductSqlList)) {
475 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
478 if (!empty($searchCategoryProductSqlList)) {
479 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
483$searchCategoryCustomerSqlList = array();
484if ($searchCategoryCustomerOperator == 1) {
485 $existsCategoryCustomerList = array();
486 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
487 if (intval($searchCategoryCustomer) == -2) {
488 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
489 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
490 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
491 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
492 $sqlCategoryCustomerNotExists .=
" )";
493 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
494 } elseif (intval($searchCategoryCustomer) > 0) {
495 $existsCategoryCustomerList[] = $db->escape($searchCategoryCustomer);
498 if (!empty($existsCategoryCustomerList)) {
499 $sqlCategoryCustomerExists =
" EXISTS (";
500 $sqlCategoryCustomerExists .=
" SELECT cat_cus.fk_soc";
501 $sqlCategoryCustomerExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
502 $sqlCategoryCustomerExists .=
" WHERE cat_cus.fk_soc = s.rowid";
503 $sqlCategoryCustomerExists .=
" AND cat_cus.fk_categorie IN (".$db->sanitize(implode(
',', $existsCategoryCustomerList)).
")";
504 $sqlCategoryCustomerExists .=
" )";
505 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerExists;
507 if (!empty($searchCategoryCustomerSqlList)) {
508 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
511 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
512 if (intval($searchCategoryCustomer) == -2) {
513 $sqlCategoryCustomerNotExists =
" NOT EXISTS (";
514 $sqlCategoryCustomerNotExists .=
" SELECT cat_cus.fk_soc";
515 $sqlCategoryCustomerNotExists .=
" FROM ".$db->prefix().
"categorie_societe AS cat_cus";
516 $sqlCategoryCustomerNotExists .=
" WHERE cat_cus.fk_soc = s.rowid";
517 $sqlCategoryCustomerNotExists .=
" )";
518 $searchCategoryCustomerSqlList[] = $sqlCategoryCustomerNotExists;
519 } elseif (intval($searchCategoryCustomer) > 0) {
520 $searchCategoryCustomerSqlList[] =
"s.rowid IN (SELECT fk_soc FROM ".$db->prefix().
"categorie_societe WHERE fk_categorie = ".((int) $searchCategoryCustomer).
")";
523 if (!empty($searchCategoryCustomerSqlList)) {
524 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
528if ($search_date_creation_start) {
529 $sql .=
" AND c.datec >= '".$db->idate($search_date_creation_start).
"'";
531if ($search_date_creation_end) {
532 $sql .=
" AND c.datec <= '".$db->idate($search_date_creation_end).
"'";
535if ($search_date_modif_start) {
536 $sql .=
" AND c.tms >= '".$db->idate($search_date_modif_start).
"'";
538if ($search_date_modif_end) {
539 $sql .=
" AND c.tms <= '".$db->idate($search_date_modif_end).
"'";
541if ($search_signed_status !=
'' && $search_signed_status >= 0) {
542 $sql .=
" AND c.signed_status = ".((int) $search_signed_status);
546include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
548$parameters = array();
549$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
550$sql .= $hookmanager->resPrint;
552$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
553$reshook = $hookmanager->executeHooks(
'printFieldListGroupBy', $parameters, $object);
554$sql .= $hookmanager->resPrint;
556$parameters = array(
'search_dfyear' => $search_dfyear,
'search_op2df' => $search_op2df);
557$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
558if (empty($reshook)) {
559 if ($search_dfyear > 0 && $search_op2df) {
560 if ($search_op2df ==
'<=') {
562 $sql .=
" HAVING lower_planned_end_date <= '".$db->idate(
dol_get_last_day($search_dfyear, $search_dfmonth,
false)).
"'";
563 } elseif ($search_op2df ==
'>=') {
565 $sql .=
" HAVING lower_planned_end_date >= '".$db->idate(
dol_get_first_day($search_dfyear, $search_dfmonth,
false)).
"'";
568 $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)).
"'";
570 $sql .= empty($hookmanager->resPrint) ?
"" :
" AND ".$hookmanager->resPrint;
572 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
575 $sql = $hookmanager->resPrint;
579$nbtotalofrecords =
'';
584 if ($search_dfyear > 0 && $search_op2df) {
585 $resql = $db->query($sql, 0,
'auto', 1);
587 while ($db->fetch_object($resql)) {
588 if (empty($nbtotalofrecords)) {
589 $nbtotalofrecords = 1;
595 dol_print_error($db);
599 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
601 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as country on (country.rowid = s.fk_pays)',
'', $sqlforcount);
602 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_typent as typent on (typent.id = s.fk_typent)',
'', $sqlforcount);
603 if (!$search_state) {
604 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as state on (state.rowid = s.fk_departement)',
'', $sqlforcount);
606 $sqlforcount = str_replace(
'LEFT JOIN '.MAIN_DB_PREFIX.
'contratdet as cd ON c.rowid = cd.fk_contrat',
'', $sqlforcount);
608 $sqlforcount = preg_replace(
'/GROUP BY.*$/',
'', $sqlforcount);
610 $resql = $db->query($sqlforcount);
612 $objforcount = $db->fetch_object($resql);
613 $nbtotalofrecords = $objforcount->nbtotalofrecords;
615 dol_print_error($db);
619 if (($page * $limit) > (
int) $nbtotalofrecords) {
627$sql .= $db->order($sortfield, $sortorder);
629 $sql .= $db->plimit($limit + 1, $offset);
632$resql = $db->query($sql);
634 dol_print_error($db);
638$num = $db->num_rows($resql);
641if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
642 $obj = $db->fetch_object($resql);
644 header(
"Location: ".DOL_URL_ROOT.
'/contrat/card.php?id='.
$id);
651$title = $langs->trans(
"Contracts");
652$help_url =
'EN:Module_Contracts|FR:Module_Contrat|ES:Contratos_de_servicio';
654llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-contrat page-list bodyforlist');
658$arrayofselected = is_array($toselect) ? $toselect : array();
663 if (empty($search_name)) {
664 $search_name = $soc->name;
670 $param .=
'&mode='.urlencode($mode);
672if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
673 $param .=
'&contextpage='.urlencode($contextpage);
675if ($limit > 0 && $limit !=
$conf->liste_limit) {
676 $param .=
'&limit='.((int) $limit);
678if ($search_all !=
'') {
679 $param .=
'&search_all='.urlencode($search_all);
681if ($search_contract !=
'') {
682 $param .=
'&search_contract='.urlencode($search_contract);
684if ($search_name !=
'') {
685 $param .=
'&search_name='.urlencode($search_name);
687if ($search_phone !=
'') {
688 $param .=
'&search_phone='.urlencode($search_phone);
690if ($search_phone_mobile !=
'') {
691 $param .=
'&search_phone_mobile='.urlencode($search_phone_mobile);
693if ($search_email !=
'') {
694 $param .=
'&search_email='.urlencode($search_email);
696if ($search_ref_customer !=
'') {
697 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
699if ($search_ref_supplier !=
'') {
700 $param .=
'&search_ref_supplier='.urlencode($search_ref_supplier);
702if ($search_type >= 0) {
703 $param .=
'&search_type='.$search_type;
705if ($search_note_private !=
'') {
706 $param .=
'&search_note_private='.urlencode($search_note_private);
708if ($search_note_public !=
'') {
709 $param .=
'&search_note_public='.urlencode($search_note_public);
711if ($search_op2df !=
'') {
712 $param .=
'&search_op2df='.urlencode($search_op2df);
714if ($search_date_creation_startmonth) {
715 $param .=
'&search_date_creation_startmonth='.urlencode((
string) ($search_date_creation_startmonth));
717if ($search_date_creation_startyear) {
718 $param .=
'&search_date_creation_startyear='.urlencode((
string) ($search_date_creation_startyear));
720if ($search_date_creation_startday) {
721 $param .=
'&search_date_creation_startday='.urlencode((
string) ($search_date_creation_startday));
723if ($search_date_creation_start) {
724 $param .=
'&search_date_creation_start='.urlencode((
string) $search_date_creation_start);
726if ($search_date_creation_endmonth) {
727 $param .=
'&search_date_creation_endmonth='.urlencode((
string) ($search_date_creation_endmonth));
729if ($search_date_creation_endyear) {
730 $param .=
'&search_date_creation_endyear='.urlencode((
string) ($search_date_creation_endyear));
732if ($search_date_creation_endday) {
733 $param .=
'&search_date_creation_endday='.urlencode((
string) ($search_date_creation_endday));
735if ($search_date_creation_end) {
736 $param .=
'&search_date_creation_end='.urlencode((
string) $search_date_creation_end);
738if ($search_date_modif_startmonth) {
739 $param .=
'&search_date_modif_startmonth='.urlencode((
string) ($search_date_modif_startmonth));
741if ($search_date_modif_startyear) {
742 $param .=
'&search_date_modif_startyear='.urlencode((
string) ($search_date_modif_startyear));
744if ($search_date_modif_startday) {
745 $param .=
'&search_date_modif_startday='.urlencode((
string) ($search_date_modif_startday));
747if ($search_date_modif_start) {
748 $param .=
'&search_date_modif_start='.urlencode((
string) $search_date_modif_start);
750if ($search_date_modif_endmonth) {
751 $param .=
'&search_date_modif_endmonth='.urlencode((
string) ($search_date_modif_endmonth));
753if ($search_date_modif_endyear) {
754 $param .=
'&search_date_modif_endyear='.urlencode((
string) ($search_date_modif_endyear));
756if ($search_date_modif_endday) {
757 $param .=
'&search_date_modif_endday='.urlencode((
string) ($search_date_modif_endday));
759if ($search_date_modif_end) {
760 $param .=
'&search_date_modif_end=' . urlencode((
string) $search_date_modif_end);
762if ($search_date_startday > 0) {
763 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
765if ($search_date_startmonth > 0) {
766 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
768if ($search_date_startyear > 0) {
769 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
771if ($search_date_endday > 0) {
772 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
774if ($search_date_endmonth > 0) {
775 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
777if ($search_date_endyear > 0) {
778 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
780if ($search_dfyear > 0) {
781 $param .=
'&search_dfyear='.urlencode((
string) ($search_dfyear));
783if ($search_dfmonth > 0) {
784 $param .=
'&search_dfmonth='.urlencode((
string) ($search_dfmonth));
786if ($search_signed_status !=
'' && $search_signed_status >= 0) {
787 $param .=
'&search_signed_status='.urlencode($search_signed_status);
789if ($search_sale > 0) {
790 $param .=
'&search_sale='.urlencode($search_sale);
792if ($search_user > 0) {
793 $param .=
'&search_user='.urlencode((
string) ($search_user));
795if ($search_type_thirdparty > 0) {
796 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
798if ($search_town !=
'') {
799 $param .=
'&search_town='.urlencode($search_town);
801if ($search_zip !=
'') {
802 $param .=
'&search_zip='.urlencode($search_zip);
804if ($search_state !=
'') {
805 $param .=
'&search_state='.urlencode($search_state);
807if ($search_country !=
'') {
808 $param .=
"&search_country=".urlencode($search_country);
810if ($search_product_category > 0) {
811 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
814 $param .=
'&show_files='.urlencode((
string) ($show_files));
816if ($optioncss !=
'') {
817 $param .=
'&optioncss='.urlencode($optioncss);
819foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
820 $param .=
"&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
823include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
826$arrayofmassactions = array(
827 'generate_doc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
828 'builddoc' => img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
829 'presend' => img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
831if (!empty($permissiontodelete)) {
832 $arrayofmassactions[
'predelete'] = img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
834if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete'))) {
835 $arrayofmassactions = array();
837$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
839$url = DOL_URL_ROOT.
'/contrat/card.php?action=create';
841 $url .=
'&socid='.((int) $socid);
844$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'));
845$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'));
846$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'));
848$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewContractSubscription'),
'',
'fa fa-plus-circle', $url,
'', $user->hasRight(
'contrat',
'creer'));
850print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
'PHP_SELF'].
'">'.
"\n";
851if ($optioncss !=
'') {
852 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
854print
'<input type="hidden" name="token" value="'.newToken().
'">';
855print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
856print
'<input type="hidden" name="action" value="list">';
857print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
858print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
859print
'<input type="hidden" name="page" value="'.$page.
'">';
860print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
861print
'<input type="hidden" name="page_y" value="">';
862print
'<input type="hidden" name="mode" value="'.$mode.
'">';
865print_barre_liste($langs->trans(
"Contracts"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contract', 0, $newcardbutton,
'', $limit, 0, 0, 1);
867$topicmail =
"SendContractRef";
868$modelmail =
"contract";
870$trackid =
'con'.$object->id;
871include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
875 foreach ($fieldstosearchall as $key => $val) {
876 $fieldstosearchall[$key] = $langs->trans($val);
877 $setupstring .= $key.
"=".$val.
";";
879 print
'<!-- Search done like if CONTRACT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
880 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
886if ($user->hasRight(
'user',
'user',
'lire')) {
887 $langs->load(
"commercial");
888 $moreforfilter .=
'<div class="divsearchfield">';
889 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
890 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'widthcentpercentminusx maxwidth300');
891 $moreforfilter .=
'</div>';
894if ($user->hasRight(
'user',
'user',
'lire')) {
895 $moreforfilter .=
'<div class="divsearchfield">';
896 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
897 $moreforfilter .= img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
898 $moreforfilter .=
'</div>';
901if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
902 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
903 $moreforfilter .=
'<div class="divsearchfield">';
904 $tmptitle = $langs->trans(
'IncludingProductWithTag');
905 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 64, 0, 2);
906 $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);
907 $moreforfilter .=
'</div>';
911 $moreforfilter .=
'<div class="divsearchfield">';
912 $tmptitle = $langs->transnoentities(
'CustomersProspectsCategoriesShort');
913 $moreforfilter .= img_picto($tmptitle,
'category',
'class="pictofixedwidth"');
914 $categoriesArr = $form->select_all_categories(Categorie::TYPE_CUSTOMER,
'',
'', 64, 0, 2);
915 $categoriesArr[-2] =
'- '.$langs->trans(
'NotCategorized').
' -';
916 $moreforfilter .=
Form::multiselectarray(
'search_category_customer_list', $categoriesArr, $searchCategoryCustomerList, 0, 0,
'minwidth300', 0, 0,
'',
'category', $tmptitle);
917 $moreforfilter .=
' <input type="checkbox" class="valignmiddle" id="search_category_customer_operator" name="search_category_customer_operator" value="1"'.($searchCategoryCustomerOperator == 1 ?
' checked="checked"' :
'').
'/>';
918 $moreforfilter .= $form->textwithpicto(
'', $langs->trans(
'UseOrOperatorForCategories') .
' : ' . $tmptitle, 1,
'help',
'', 0, 2,
'tooltip_cat_cus');
919 $moreforfilter .=
'</div>';
922$parameters = array();
923$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
924if (empty($reshook)) {
925 $moreforfilter .= $hookmanager->resPrint;
927 $moreforfilter = $hookmanager->resPrint;
930if (!empty($moreforfilter)) {
931 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
932 print $moreforfilter;
936$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
937$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
938if ($massactionbutton) {
939 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
942print
'<div class="div-table-responsive">';
943print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
947print
'<tr class="liste_titre_filter">';
949if (
$conf->main_checkbox_left_column) {
950 print
'<td class="liste_titre maxwidthsearch center">';
951 $searchpicto = $form->showFilterButtons(
'left');
955if (!empty($arrayfields[
'c.ref'][
'checked'])) {
956 print
'<td class="liste_titre">';
957 print
'<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).
'">';
960if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
961 print
'<td class="liste_titre">';
962 print
'<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
965if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
966 print
'<td class="liste_titre">';
967 print
'<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).
'">';
970if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
971 print
'<td class="liste_titre">';
972 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');
975if (!empty($arrayfields[
's.nom'][
'checked'])) {
976 print
'<td class="liste_titre">';
977 print
'<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).
'"'.($user->socid > 0 ?
" disabled" :
"").
'>';
981if (!empty($arrayfields[
's.town'][
'checked'])) {
982 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
985if (!empty($arrayfields[
's.zip'][
'checked'])) {
986 print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
989if (!empty($arrayfields[
'state.nom'][
'checked'])) {
990 print
'<td class="liste_titre">';
991 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
995if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
996 print
'<td class="liste_titre center">';
997 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1001if (!empty($arrayfields[
's.phone'][
'checked'])) {
1002 print
'<td class="liste_titre">';
1003 print
'<input type="text" class="flat width50" name="search_phone" value="'.dol_escape_htmltag($search_phone).
'">';
1007if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1008 print
'<td class="liste_titre">';
1009 print
'<input type="text" class="flat width50" name="search_phone_mobile" value="'.dol_escape_htmltag($search_phone_mobile).
'">';
1013if (!empty($arrayfields[
's.email'][
'checked'])) {
1014 print
'<td class="liste_titre">';
1015 print
'<input type="text" class="flat width75" name="search_email" value="'.dol_escape_htmltag($search_email).
'">';
1019if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1020 print
'<td class="liste_titre maxwidthonsmartphone center">';
1021 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);
1024if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1025 print
'<td class="liste_titre"></td>';
1027if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1028 print
'<td class="liste_titre center">';
1029 print
'<div class="nowrapfordate">';
1030 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1032 print
'<div class="nowrapfordate">';
1033 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1038if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1039 print
'<td class="liste_titre center">';
1040 $list_signed_status =
$object->getSignedStatusLocalisedArray();
1041 print $form->selectarray(
'search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0,
'', 1, 0, 0,
'',
'search_status');
1045if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1046 print
'<td class="liste_titre center">';
1047 print
'<input class="flat" size="10" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).
'">';
1051if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1052 print
'<td class="liste_titre center">';
1053 print
'<input class="flat" size="10" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).
'">';
1057include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1060$parameters = array(
'arrayfields' => $arrayfields);
1061$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1062print $hookmanager->resPrint;
1064if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1065 print
'<td class="liste_titre center nowraponall">';
1066 print
'<div class="nowrapfordate">';
1067 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'));
1069 print
'<div class="nowrapfordate">';
1070 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'));
1075if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1076 print
'<td class="liste_titre center nowraponall">';
1077 print
'<div class="nowrapfordate">';
1078 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'));
1080 print
'<div class="nowrapfordate">';
1081 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'));
1086if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1087 print
'<td class="liste_titre nowraponall center">';
1088 $arrayofoperators = array(
'0' =>
'',
'=' =>
'=',
'<=' =>
'<=',
'>=' =>
'>=');
1089 print $form->selectarray(
'search_op2df', $arrayofoperators, $search_op2df, 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth50imp');
1091 print $formother->select_month($search_dfmonth,
'search_dfmonth', 1, 0);
1093 print $formother->selectyear($search_dfyear,
'search_dfyear', 1, 20, 5, 0, 0,
'');
1097if (!empty($arrayfields[
'status'][
'checked'])) {
1098 print
'<td class="liste_titre right" colspan="4"></td>';
1102if (!
$conf->main_checkbox_left_column) {
1103 print
'<td class="liste_titre center">';
1104 $searchpicto = $form->showFilterButtons();
1110$totalarray = array();
1111$totalarray[
'nbfield'] = 0;
1115print
'<tr class="liste_titre">';
1116if (
$conf->main_checkbox_left_column) {
1117 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1118 $totalarray[
'nbfield']++;
1120if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1122 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
'', $sortfield, $sortorder);
1123 $totalarray[
'nbfield']++;
1125if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1126 print_liste_field_titre($arrayfields[
'c.ref_customer'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_customer",
"", $param,
'', $sortfield, $sortorder);
1127 $totalarray[
'nbfield']++;
1129if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1130 print_liste_field_titre($arrayfields[
'c.ref_supplier'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref_supplier",
"", $param,
'', $sortfield, $sortorder);
1131 $totalarray[
'nbfield']++;
1133if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
1134 print_liste_field_titre($arrayfields[
'c.fk_contract_type'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_contract_type",
"", $param,
'', $sortfield, $sortorder);
1135 $totalarray[
'nbfield']++;
1137if (!empty($arrayfields[
's.nom'][
'checked'])) {
1138 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder);
1139 $totalarray[
'nbfield']++;
1141if (!empty($arrayfields[
's.town'][
'checked'])) {
1142 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1143 $totalarray[
'nbfield']++;
1145if (!empty($arrayfields[
's.zip'][
'checked'])) {
1146 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1147 $totalarray[
'nbfield']++;
1149if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1150 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1151 $totalarray[
'nbfield']++;
1153if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1154 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1155 $totalarray[
'nbfield']++;
1157if (!empty($arrayfields[
's.phone'][
'checked'])) {
1158 print_liste_field_titre($arrayfields[
's.phone'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone",
"", $param,
'', $sortfield, $sortorder);
1159 $totalarray[
'nbfield']++;
1161if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1162 print_liste_field_titre($arrayfields[
's.phone_mobile'][
'label'], $_SERVER[
"PHP_SELF"],
"s.phone_mobile",
"", $param,
'', $sortfield, $sortorder);
1163 $totalarray[
'nbfield']++;
1165if (!empty($arrayfields[
's.email'][
'checked'])) {
1166 print_liste_field_titre($arrayfields[
's.email'][
'label'], $_SERVER[
"PHP_SELF"],
"s.email",
"", $param,
'', $sortfield, $sortorder);
1167 $totalarray[
'nbfield']++;
1169if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1170 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1171 $totalarray[
'nbfield']++;
1173if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1174 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"", $param,
'', $sortfield, $sortorder);
1175 $totalarray[
'nbfield']++;
1177if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1178 print_liste_field_titre($arrayfields[
'c.date_contrat'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_contrat",
"", $param,
'', $sortfield, $sortorder,
'center ');
1179 $totalarray[
'nbfield']++;
1181if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1182 print_liste_field_titre($arrayfields[
'c.signed_status'][
'label'], $_SERVER[
"PHP_SELF"],
"c.signed_status",
"", $param,
'', $sortfield, $sortorder,
'center ');
1183 $totalarray[
'nbfield']++;
1185if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1186 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'center ');
1187 $totalarray[
'nbfield']++;
1189if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1190 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'center ');
1191 $totalarray[
'nbfield']++;
1194include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1196$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
1197$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1198print $hookmanager->resPrint;
1199if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1200 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1201 $totalarray[
'nbfield']++;
1203if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1204 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1205 $totalarray[
'nbfield']++;
1207if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1208 print_liste_field_titre($arrayfields[
'lower_planned_end_date'][
'label'], $_SERVER[
"PHP_SELF"],
"lower_planned_end_date",
"", $param,
'', $sortfield, $sortorder,
'center ');
1209 $totalarray[
'nbfield']++;
1211if (!empty($arrayfields[
'status'][
'checked'])) {
1212 print_liste_field_titre($staticcontratligne->LibStatut(0, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1213 $totalarray[
'nbfield']++;
1214 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 0,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1215 $totalarray[
'nbfield']++;
1216 print_liste_field_titre($staticcontratligne->LibStatut(4, 3, 1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1217 $totalarray[
'nbfield']++;
1218 print_liste_field_titre($staticcontratligne->LibStatut(5, 3, -1,
'class="nochangebackground"'),
'',
'',
'',
'',
'width="16"');
1219 $totalarray[
'nbfield']++;
1221if (!
$conf->main_checkbox_left_column) {
1222 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
1223 $totalarray[
'nbfield']++;
1230$savnbfield = $totalarray[
'nbfield'];
1231$totalarray = array();
1232$totalarray[
'nbfield'] = 0;
1233$typenArray = array();
1234$cacheCountryIDCode = array();
1235$imaxinloop = ($limit ? min($num, $limit) : $num);
1236$showinvalidemail =
getDolGlobalInt(
'MAIN_SHOW_INVALID_EMAIL_IN_LIST', 1);
1237while ($i < $imaxinloop) {
1238 $obj = $db->fetch_object($resql);
1243 $contracttmp->ref = $obj->ref;
1244 $contracttmp->id = $obj->rowid;
1245 $contracttmp->ref_customer = $obj->ref_customer;
1246 $contracttmp->ref_supplier = $obj->ref_supplier;
1248 $contracttmp->nbofserviceswait = $obj->nb_initial;
1249 $contracttmp->nbofservicesopened = $obj->nb_running;
1250 $contracttmp->nbofservicesexpired = $obj->nb_expired;
1251 $contracttmp->nbofservicesclosed = $obj->nb_closed;
1252 $contracttmp->signed_status = $obj->signed_status;
1254 $socstatic->id = $obj->socid;
1255 $socstatic->name = $obj->name;
1256 $socstatic->name_alias = $obj->name_alias;
1257 $socstatic->email = $obj->email;
1258 $socstatic->status = $obj->company_status;
1259 $socstatic->logo = $obj->company_logo;
1260 $socstatic->country_id = $obj->country_id;
1261 $socstatic->country_code =
'';
1262 $socstatic->country =
'';
1264 if ($obj->country_id > 0) {
1265 if (!isset($cacheCountryIDCode[$obj->country_id][
'code'])) {
1266 $tmparray =
getCountry($obj->country_id,
'all');
1267 $cacheCountryIDCode[$obj->country_id] = array(
'code' => empty($tmparray[
'code']) ?
'' : $tmparray[
'code'],
'label' => empty($tmparray[
'label']) ?
'' : $tmparray[
'label']);
1269 $socstatic->country_code = $cacheCountryIDCode[$obj->country_id][
'code'];
1270 $socstatic->country = $cacheCountryIDCode[$obj->country_id][
'label'];
1273 if ($mode ==
'kanban') {
1275 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1276 print
'<div class="box-flex-container kanban">';
1279 $arraydata = array();
1280 $arraydata[
'thirdparty'] = $socstatic;
1281 $arraydata[
'selected'] = in_array($obj->rowid, $arrayofselected);
1282 $contracttmp->date_contrat = $obj->date_contrat;
1283 print $contracttmp->getKanbanView(
'', $arraydata);
1284 if ($i == ($imaxinloop - 1)) {
1290 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1292 if (
$conf->main_checkbox_left_column) {
1293 print
'<td class="nowrap center">';
1294 if ($massactionbutton || $massaction) {
1296 if (in_array($obj->rowid, $arrayofselected)) {
1299 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1303 $totalarray[
'nbfield']++;
1307 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1308 print
'<td class="nowraponall">';
1309 print $contracttmp->getNomUrl(1);
1310 if ($obj->nb_late) {
1311 print img_warning($langs->trans(
"Late"));
1313 if (!empty($obj->note_private) || !empty($obj->note_public)) {
1314 print
' <span class="note">';
1315 print
'<a href="'.DOL_URL_ROOT.
'/contrat/note.php?id='.$obj->rowid.
'&save_lastsearch_values=1">'.img_picto($langs->trans(
"ViewPrivateNote"),
'note').
'</a>';
1321 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1322 print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
1327 $totalarray[
'nbfield']++;
1332 if (!empty($arrayfields[
'c.ref_customer'][
'checked'])) {
1333 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag(
dol_string_nohtmltag($contracttmp->getFormatedCustomerRef($obj->ref_customer))).
'">'.$contracttmp->getFormatedCustomerRef($obj->ref_customer).
'</td>';
1335 $totalarray[
'nbfield']++;
1338 if (!empty($arrayfields[
'c.ref_supplier'][
'checked'])) {
1339 print
'<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).
'">'.
dol_escape_htmltag($obj->ref_supplier).
'</td>';
1341 if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
1342 $contractTypeLabels = array(0 => $langs->trans(
'CustomerContract'), 1 => $langs->trans(
'SupplierContract'));
1343 print
'<td>'.dol_escape_htmltag($contractTypeLabels[(
int) $obj->fk_contract_type] ??
'').
'</td>';
1345 $totalarray[
'nbfield']++;
1348 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1349 print
'<td class="tdoverflowmax150">';
1350 if ($obj->socid > 0) {
1352 print $socstatic->getNomUrl(1,
'');
1357 if (!empty($arrayfields[
's.town'][
'checked'])) {
1358 print
'<td class="nocellnopadd">';
1362 $totalarray[
'nbfield']++;
1366 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1367 print
'<td class="center nocellnopadd">';
1371 $totalarray[
'nbfield']++;
1375 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1376 print
"<td>".$obj->state_name.
"</td>\n";
1378 $totalarray[
'nbfield']++;
1382 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1383 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($socstatic->country).
'">';
1387 $totalarray[
'nbfield']++;
1391 if (!empty($arrayfields[
's.phone'][
'checked'])) {
1392 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>';
1395 if (!empty($arrayfields[
's.phone_mobile'][
'checked'])) {
1396 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>';
1399 if (!empty($arrayfields[
's.email'][
'checked'])) {
1400 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute((
string) $obj->email).
'">'.
dol_print_email((
string) $obj->email, 0, $obj->socid, 1, 0, $showinvalidemail, 1).
'</td>';
1404 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1405 print
'<td class="center">';
1406 if (count($typenArray) == 0) {
1407 $typenArray = $formcompany->typent_array(1);
1409 print $typenArray[$obj->typent_code];
1412 $totalarray[
'nbfield']++;
1415 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1418 if ($obj->socid > 0) {
1419 $listsalesrepresentatives = $socstatic->getSalesRepresentatives($user);
1420 if ($listsalesrepresentatives < 0) {
1421 dol_print_error($db);
1423 $nbofsalesrepresentative = count($listsalesrepresentatives);
1424 if ($nbofsalesrepresentative > 6) {
1426 print $nbofsalesrepresentative;
1427 } elseif ($nbofsalesrepresentative > 0) {
1428 $userstatic =
new User($db);
1430 foreach ($listsalesrepresentatives as $val) {
1431 $userstatic->id = $val[
'id'];
1432 $userstatic->lastname = $val[
'lastname'];
1433 $userstatic->firstname = $val[
'firstname'];
1434 $userstatic->email = $val[
'email'];
1435 $userstatic->status = $val[
'statut'];
1436 $userstatic->entity = $val[
'entity'];
1437 $userstatic->photo = $val[
'photo'];
1438 $userstatic->login = $val[
'login'];
1439 $userstatic->phone = $val[
'phone'];
1440 $userstatic->job = $val[
'job'];
1441 $userstatic->gender = $val[
'gender'];
1444 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1446 if ($j < $nbofsalesrepresentative) {
1459 if (!empty($arrayfields[
'c.date_contrat'][
'checked'])) {
1460 print
'<td class="center">'.dol_print_date($db->jdate($obj->date_contrat),
'day',
'tzserver').
'</td>';
1463 if (!empty($arrayfields[
'c.signed_status'][
'checked'])) {
1464 print
'<td class="center">'.$contracttmp->getLibSignedStatus(5).
'</td>';
1466 $totalarray[
'nbfield']++;
1470 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1471 print
'<td class="center">'.$obj->note_public.
'</td>';
1473 $totalarray[
'nbfield']++;
1477 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1478 print
'<td class="center">'.$obj->note_private.
'</td>';
1480 $totalarray[
'nbfield']++;
1484 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1486 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1487 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1488 print $hookmanager->resPrint;
1490 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1491 print
'<td class="center nowrap">';
1492 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1495 $totalarray[
'nbfield']++;
1499 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1500 print
'<td class="center nowrap">';
1501 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1504 $totalarray[
'nbfield']++;
1508 if (!empty($arrayfields[
'lower_planned_end_date'][
'checked'])) {
1509 print
'<td class="center nowrapforall">';
1510 print
dol_print_date($db->jdate($obj->lower_planned_end_date),
'day',
'tzuser');
1513 $totalarray[
'nbfield']++;
1517 if (!empty($arrayfields[
'status'][
'checked'])) {
1518 print
'<td class="center">'.($obj->nb_initial > 0 ? $obj->nb_initial :
'').
'</td>';
1519 print
'<td class="center">'.($obj->nb_running > 0 ? $obj->nb_running :
'').
'</td>';
1520 print
'<td class="center">'.($obj->nb_expired > 0 ? $obj->nb_expired :
'').
'</td>';
1521 print
'<td class="center">'.($obj->nb_closed > 0 ? $obj->nb_closed :
'').
'</td>';
1523 $totalarray[
'nbfield']++;
1524 $totalarray[
'nbfield']++;
1525 $totalarray[
'nbfield']++;
1526 $totalarray[
'nbfield']++;
1530 if (!
$conf->main_checkbox_left_column) {
1531 print
'<td class="nowrap center">';
1532 if ($massactionbutton || $massaction) {
1534 if (in_array($obj->rowid, $arrayofselected)) {
1537 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1541 $totalarray[
'nbfield']++;
1553 foreach ($arrayfields as $key => $val) {
1554 if (!empty($val[
'checked'])) {
1558 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1563$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1564$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1565print $hookmanager->resPrint;
1567print
'</table>'.
"\n";
1570print
'</form>'.
"\n";
1572$hidegeneratedfilelistifempty = 1;
1573if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1574 $hidegeneratedfilelistifempty = 0;
1578$urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1579$urlsource .= str_replace(
'&',
'&', $param);
1581$filedir = $diroutputmassaction;
1582$genallowed = $permissiontoread;
1583$delallowed = $permissiontoadd;
1585print $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...
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.