33require
"../main.inc.php";
42require_once DOL_DOCUMENT_ROOT.
"/contrat/class/contrat.class.php";
43require_once DOL_DOCUMENT_ROOT.
"/product/class/product.class.php";
44require_once DOL_DOCUMENT_ROOT.
"/societe/class/societe.class.php";
47$langs->loadLangs(array(
'products',
'contracts',
'companies'));
51$massaction =
GETPOST(
'massaction',
'alpha');
52$toselect =
GETPOST(
'toselect',
'array:int');
53$optioncss =
GETPOST(
'optioncss',
'aZ');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php')).$mode;
59$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
62if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
66$offset = $limit * $page;
70 $sortfield =
"c.rowid";
76$search_id = trim(
GETPOST(
"search_id",
"int"));
77$search_contract_id = trim(
GETPOST(
"search_contract_id",
"int"));
78$search_name =
GETPOST(
"search_name",
'alpha');
79$search_subprice =
GETPOST(
"search_subprice",
'alpha');
80$search_qty =
GETPOST(
"search_qty",
'alpha');
81$search_total_ht =
GETPOST(
"search_total_ht",
'alpha');
82$search_total_tva =
GETPOST(
"search_total_tva",
'alpha');
83$search_total_ttc =
GETPOST(
"search_total_ttc",
'alpha');
84$search_contract =
GETPOST(
"search_contract",
'alpha');
85$search_service =
GETPOST(
"search_service",
'alpha');
87$search_status =
GETPOST(
"search_status",
'alpha');
88$search_option =
GETPOST(
'search_option',
'alpha');
89$search_product_category =
GETPOSTINT(
'search_product_category');
93if ($search_status ==
'4&filter=notexpired') {
95 $filter =
'notexpired';
97if ($search_status ==
'4&filter=expired') {
104$opouvertureprevuemonth =
GETPOST(
'opouvertureprevuemonth');
105$opouvertureprevueday =
GETPOST(
'opouvertureprevueday');
106$opouvertureprevueyear =
GETPOST(
'opouvertureprevueyear');
107$sqlfilter_opouvertureprevue =
GETPOST(
'filter_opouvertureprevue',
'alphawithlgt');
112$sqlfilter_op1 =
GETPOST(
'filter_op1',
'alphawithlgt');
117$sqlfilter_op2 =
GETPOST(
'filter_op2',
'alphawithlgt');
119$opcloturemonth =
GETPOSTINT(
'opcloturemonth');
122$sqlfilter_opcloture =
GETPOST(
'filter_opcloture',
'alphawithlgt');
127$hookmanager->initHooks(array(
'contractservicelist'));
130$extrafields->fetch_name_optionals_label(
$object->table_element);
132$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
134$search_all =
GETPOST(
'search_all',
'alphanohtml');
136$fieldstosearchall = [
137 'p.label' =>
'Product',
138 's.nom' =>
'ThirdParty',
140$parameters = [
'fieldstosearchall' => $fieldstosearchall];
141$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
143 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
145$fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray);
149if (!empty($user->socid)) {
150 $socid = $user->socid;
154$staticcontrat =
new Contrat($db);
156$companystatic =
new Societe($db);
159 'cd.rowid' => array(
'label' =>
"TechnicalID",
'checked' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'enabled' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
160 'c.rowid' => array(
'label' =>
"ContractID",
'checked' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'enabled' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 2),
161 'c.ref' => array(
'label' =>
"Contract",
'checked' =>
'1',
'position' => 80),
162 'c.fk_contract_type' => array(
'label' =>
"ContractType",
'checked' =>
'1',
'position' => 82),
163 'p.description' => array(
'label' =>
"Service",
'checked' =>
'1',
'position' => 85),
164 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 90),
165 'cd.tva_tx' => array(
'label' =>
"VATRate",
'checked' =>
'-1',
'position' => 100),
166 'cd.subprice' => array(
'label' =>
"PriceUHT",
'checked' =>
'-1',
'position' => 105),
167 'cd.qty' => array(
'label' =>
"Qty",
'checked' =>
'1',
'position' => 108),
168 'cd.total_ht' => array(
'label' =>
"TotalHT",
'checked' =>
'-1',
'position' => 109,
'isameasure' => 1),
169 'cd.total_tva' => array(
'label' =>
"TotalVAT",
'checked' =>
'-1',
'position' => 110),
170 'cd.date_ouverture_prevue' => array(
'label' =>
"DateStartPlannedShort",
'checked' =>
'1',
'position' => 150),
171 'cd.date_ouverture' => array(
'label' =>
"DateStartRealShort",
'checked' =>
'1',
'position' => 160),
172 'cd.date_fin_validite' => array(
'label' =>
"DateEndPlannedShort",
'checked' =>
'1',
'position' => 170),
173 'cd.date_cloture' => array(
'label' =>
"DateEndRealShort",
'checked' =>
'1',
'position' => 180),
175 'cd.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 500),
176 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000)
179include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
181$parameters = array(
'arrayfields' => &$arrayfields);
182$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
187$permissiontoread = $user->hasRight(
'contrat',
'lire');
188$permissiontoadd = $user->hasRight(
'contrat',
'creer');
189$permissiontodelete = $user->hasRight(
'contrat',
'supprimer');
198if (
GETPOST(
'cancel',
'alpha')) {
202if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
206$parameters = array(
'socid' => $socid);
207$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
209 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
212if (empty($reshook)) {
214 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
216 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
218 $search_contract_id =
"";
219 $search_product_category = 0;
221 $search_subprice =
"";
223 $search_total_ht =
"";
224 $search_total_tva =
"";
225 $search_total_ttc =
"";
226 $search_contract =
"";
227 $search_service =
"";
231 $opouvertureprevuemonth =
"";
232 $opouvertureprevueday =
"";
233 $opouvertureprevueyear =
"";
234 $sqlfilter_opouvertureprevue =
"";
243 $opcloturemonth =
"";
246 $sqlfilter_opcloture =
"";
249 $search_array_options = array();
258$form =
new Form($db);
262$title = $langs->trans(
"ListOfServices");
263if ($search_status ==
"0") {
264 $title = $langs->trans(
"ListOfInactiveServices");
266if ($search_status ==
"4" && $filter !=
"expired") {
267 $title = $langs->trans(
"ListOfRunningServices");
269if ($search_status ==
"4" && $filter ==
"expired") {
270 $title = $langs->trans(
"ListOfExpiredServices");
272if ($search_status ==
"5") {
273 $title = $langs->trans(
"ListOfClosedServices");
275$help_url =
'EN:Module_Contracts|FR:Module_Contrat|ES:Contratos_de_servicio';
279$sql =
"SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier, c.fk_contract_type,";
280$sql .=
" s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
281$sql .=
" cd.rowid, cd.description, cd.statut, cd.product_type as type,";
282$sql .=
" p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.tobuy, p.tosell, p.barcode, p.entity as pentity,";
283if (!$user->hasRight(
'societe',
'client',
'voir')) {
284 $sql .=
" sc.fk_soc, sc.fk_user,";
286$sql .=
" cd.date_ouverture_prevue,";
287$sql .=
" cd.date_ouverture,";
288$sql .=
" cd.date_fin_validite,";
289$sql .=
" cd.date_cloture,";
291$sql .=
" cd.total_ht,";
292$sql .=
" cd.total_tva,";
293$sql .=
" cd.tva_tx,";
294$sql .=
" cd.subprice,";
296$sql .=
" cd.tms as date_modification";
298if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
299 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
300 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
304$parameters = array();
305$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
306$sql .= $hookmanager->resPrint;
307$sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c,";
308$sql .=
" ".MAIN_DB_PREFIX.
"societe as s,";
309if (!$user->hasRight(
'societe',
'client',
'voir')) {
310 $sql .=
" ".MAIN_DB_PREFIX.
"societe_commerciaux as sc,";
312$sql .=
" ".MAIN_DB_PREFIX.
"contratdet as cd";
313if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
314 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cd.rowid = ef.fk_object)";
319$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
320$sql .= $hookmanager->resPrint;
322$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
323if ($search_product_category > 0) {
324 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=cd.fk_product';
326$sql .=
" WHERE c.entity IN (".getEntity(
$object->element).
")";
327$sql .=
" AND c.rowid = cd.fk_contrat";
328if ($search_product_category > 0) {
329 $sql .=
" AND cp.fk_categorie = ".((int) $search_product_category);
331$sql .=
" AND c.fk_soc = s.rowid";
332if (!$user->hasRight(
'societe',
'client',
'voir')) {
333 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
335if ($search_status ==
"0") {
336 $sql .=
" AND cd.statut = 0";
338if ($search_status ==
"4") {
339 $sql .=
" AND cd.statut = 4";
341if ($search_status ==
"4&filter=expired" || ($search_status ==
'4' && $filter ==
'expired')) {
342 $sql .=
" AND cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now).
"'";
344if ($search_status ==
"4&filter=notexpired" || ($search_status ==
'4' && $filter ==
'notexpired')) {
345 $sql .=
" AND cd.statut = 4 AND cd.date_fin_validite >= '".$db->idate($now).
"'";
347if ($search_status ==
"5") {
348 $sql .=
" AND cd.statut = 5";
353if ($search_contract_id > 0) {
356if ($search_option ==
'late' && $search_status !=
'0') {
357 $warning_date = $db->idate(
dol_now() - (
int)
$conf->contract->services->expires->warning_delay);
358 $sql .=
" AND cd.date_fin_validite < '".$db->escape($warning_date).
"'";
360if ($search_option ==
'late' && $search_status ==
'0') {
361 $warning_date = $db->idate(
dol_now() - (
int)
$conf->contract->services->expires->warning_delay);
362 $sql .=
" AND (cd.date_ouverture_prevue < '".$db->escape($warning_date).
"' OR cd.date_fin_validite < '".$db->escape($warning_date).
"')";
364if ($search_subprice) {
370if ($search_total_ht) {
373if ($search_total_tva) {
376if ($search_total_ttc) {
382if ($search_contract) {
385if ($search_type >= 0) {
386 $sql .=
" AND c.fk_contract_type = ".((int) $search_type);
388if ($search_service) {
389 $sql .=
natural_search(array(
"p.ref",
"p.description",
"cd.description"), $search_service);
392 $sql .=
" AND s.rowid = ".((int) $socid);
395$filter_dateouvertureprevue =
'';
398$filter_date_cloture =
'';
400$filter_dateouvertureprevue_start =
dol_mktime(0, 0, 0, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
401$filter_dateouvertureprevue_end =
dol_mktime(23, 59, 59, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
402if ($filter_dateouvertureprevue_start !=
'' && $sqlfilter_opouvertureprevue == -1) {
403 $sqlfilter_opouvertureprevue =
' BETWEEN ';
406$filter_date1_start =
dol_mktime(0, 0, 0, (
int) $op1month, (
int) $op1day, (
int) $op1year);
407$filter_date1_end =
dol_mktime(23, 59, 59, (
int) $op1month, (
int) $op1day, (
int) $op1year);
408if ($filter_date1_start !=
'' && $sqlfilter_op1 == -1) {
409 $sqlfilter_op1 =
' BETWEEN ';
412$filter_date2_start =
dol_mktime(0, 0, 0, (
int) $op2month, (
int) $op2day, (
int) $op2year);
413$filter_date2_end =
dol_mktime(23, 59, 59, (
int) $op2month, (
int) $op2day, (
int) $op2year);
414if ($filter_date2_start !=
'' && $sqlfilter_op2 == -1) {
415 $sqlfilter_op2 =
' BETWEEN ';
418$filter_datecloture_start =
dol_mktime(0, 0, 0, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
419$filter_datecloture_end =
dol_mktime(23, 59, 59, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
420if ($filter_datecloture_start !=
'' && $sqlfilter_opcloture == -1) {
421 $sqlfilter_opcloture =
' BETWEEN ';
424if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue != -1 && $sqlfilter_opouvertureprevue !=
' BETWEEN ' && $filter_dateouvertureprevue_start !=
'') {
425 $sql .=
" AND cd.date_ouverture_prevue ".preg_replace(
'/[^<>]/',
'', $sqlfilter_opouvertureprevue).
" '".$db->idate($filter_dateouvertureprevue_start).
"'";
427if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue ==
' BETWEEN ') {
428 $sql .=
" AND cd.date_ouverture_prevue ".$db->sanitize($sqlfilter_opouvertureprevue).
" '".$db->idate($filter_dateouvertureprevue_start).
"' AND '".$db->idate($filter_dateouvertureprevue_end).
"'";
430if (!empty($sqlfilter_op1) && $sqlfilter_op1 != -1 && $sqlfilter_op1 !=
' BETWEEN ' && $filter_date1_start !=
'') {
431 $sql .=
" AND cd.date_ouverture ".preg_replace(
'/[^<>]/',
'', $sqlfilter_op1).
" '".$db->idate($filter_date1_start).
"'";
433if (!empty($sqlfilter_op1) && $sqlfilter_op1 ==
' BETWEEN ') {
434 $sql .=
" AND cd.date_ouverture ".$db->sanitize($sqlfilter_op1).
" '".$db->idate($filter_date1_start).
"' AND '".$db->idate($filter_date1_end).
"'";
436if (!empty($sqlfilter_op2) && $sqlfilter_op2 != -1 && $sqlfilter_op2 !=
' BETWEEN ' && $filter_date2_start !=
'') {
437 $sql .=
" AND cd.date_fin_validite ".preg_replace(
'/[^<>]/',
'', $sqlfilter_op2).
" '".$db->idate($filter_date2_start).
"'";
439if (!empty($sqlfilter_op2) && $sqlfilter_op2 ==
' BETWEEN ') {
440 $sql .=
" AND cd.date_fin_validite ".$db->sanitize($sqlfilter_op2).
" '".$db->idate($filter_date2_start).
"' AND '".$db->idate($filter_date2_end).
"'";
442if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture !=
' BETWEEN ' && $sqlfilter_opcloture != -1 && $filter_datecloture_start !=
'') {
443 $sql .=
" AND cd.date_cloture ".preg_replace(
'/[^<>]/',
'', $sqlfilter_opcloture).
" '".$db->idate($filter_datecloture_start).
"'";
445if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture ==
' BETWEEN ') {
446 $sql .=
" AND cd.date_cloture ".$db->sanitize($sqlfilter_opcloture).
" '".$db->idate($filter_datecloture_start).
"' AND '".$db->idate($filter_datecloture_end).
"'";
449 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
452include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
455$parameters = array();
456$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
457$sql .= $hookmanager->resPrint;
460$nbtotalofrecords =
'';
462 $result = $db->query($sql);
463 $nbtotalofrecords = $db->num_rows($result);
464 if (($page * $limit) > (
int) $nbtotalofrecords) {
471$sql .= $db->order($sortfield, $sortorder);
473 $sql .= $db->plimit($limit + 1, $offset);
477dol_syslog(
"contrat/services_list.php", LOG_DEBUG);
478$resql = $db->query($sql);
480 dol_print_error($db);
484$num = $db->num_rows($resql);
499llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-contrat page-list_services bodyforlist');
501$arrayofselected = is_array($toselect) ? $toselect : array();
505 $param .=
'&mode='.urlencode($mode);
507if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
508 $param .=
'&contextpage='.urlencode($contextpage);
510if ($limit > 0 && $limit !=
$conf->liste_limit) {
511 $param .=
'&limit='.((int) $limit);
513if ($search_all !=
'') {
514 $param .=
'&sall='.urlencode($search_all);
516if ($optioncss !=
'') {
517 $param .=
'&optioncss='.urlencode($optioncss);
520 $param .=
'&search_id='.urlencode($search_id);
522if ($search_contract_id > 0) {
523 $param .=
'&search_contract_id='.urlencode($search_contract_id);
525if ($search_contract) {
526 $param .=
'&search_contract='.urlencode($search_contract);
528if ($search_type >= 0) {
529 $param .=
'&search_type='.$search_type;
532 $param .=
'&search_name='.urlencode($search_name);
534if ($search_subprice) {
535 $param .=
'&search_subprice='.urlencode($search_subprice);
538 $param .=
'&search_qty='.urlencode($search_qty);
540if ($search_total_ht) {
541 $param .=
'&search_total_ht='.urlencode($search_total_ht);
543if ($search_total_tva) {
544 $param .=
'&search_total_tva='.urlencode($search_total_tva);
546if ($search_total_ttc) {
547 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
549if ($search_service) {
550 $param .=
'&search_service='.urlencode($search_service);
552if ($search_status !=
'') {
553 if ($filter ==
'expired' || $filter ==
'notexpired') {
554 $param .=
'&search_status='.urlencode($search_status.
'&filter='.$filter);
556 $param .=
'&search_status='.urlencode($search_status);
560 $param .=
"&search_option=".urlencode($search_option);
562if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue != -1) {
563 $param .=
'&filter_opouvertureprevue='.urlencode($sqlfilter_opouvertureprevue);
565if (!empty($sqlfilter_op1) && $sqlfilter_op1 != -1) {
566 $param .=
'&filter_op1='.urlencode($sqlfilter_op1);
568if (!empty($sqlfilter_op2) && $sqlfilter_op2 != -1) {
569 $param .=
'&filter_op2='.urlencode($sqlfilter_op2);
571if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture != -1) {
572 $param .=
'&filter_opcloture='.urlencode($sqlfilter_opcloture);
574if ($filter_dateouvertureprevue_start !=
'') {
575 $param .=
'&opouvertureprevueday='.((int) $opouvertureprevueday).
'&opouvertureprevuemonth='.((int) $opouvertureprevuemonth).
'&opouvertureprevueyear='.((int) $opouvertureprevueyear);
577if ($filter_date1_start !=
'') {
578 $param .=
'&op1day='.((int) $op1day).
'&op1month='.((int) $op1month).
'&op1year='.((int) $op1year);
580if ($filter_date2_start !=
'') {
581 $param .=
'&op2day='.((int) $op2day).
'&op2month='.((int) $op2month).
'&op2year='.((int) $op2year);
583if ($filter_datecloture_start !=
'') {
584 $param .=
'&opclotureday='.((int) $op2day).
'&opcloturemonth='.((int) $op2month).
'&opclotureyear='.((int) $op2year);
587include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
589$parameters = array();
590$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
591$param .= $hookmanager->resPrint;
594$arrayofmassactions = array(
600$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
602print
'<form method="POST" id="searchFormList" spellcheck="false" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
603if ($optioncss !=
'') {
604 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
606print
'<input type="hidden" name="token" value="'.newToken().
'">';
607print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
608print
'<input type="hidden" name="action" value="list">';
609print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
610print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
611print
'<input type="hidden" name="page" value="'.$page.
'">';
612print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
613print
'<input type="hidden" name="page_y" value="">';
614print
'<input type="hidden" name="mode" value="'.$mode.
'">';
619print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contract', 0,
'',
'', $limit);
621if (!empty($search_all)) {
622 $fieldstosearchall = array();
623 foreach ($fieldstosearchall as $key => $val) {
624 $fieldstosearchall[$key] = $langs->trans($val);
626 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
633if (
isModEnabled(
'category') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
634 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
635 $moreforfilter .=
'<div class="divsearchfield">';
636 $tmptitle = $langs->trans(
'IncludingProductWithTag');
637 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
638 $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);
639 $moreforfilter .=
'</div>';
642$moreforfilter .=
'<div class="divsearchfield">';
643$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
'</label> <input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
644$moreforfilter .=
'</div>';
646$parameters = array();
647$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
648if (empty($reshook)) {
649 $moreforfilter .= $hookmanager->resPrint;
651 $moreforfilter = $hookmanager->resPrint;
655if (!empty($moreforfilter)) {
656 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
657 print $moreforfilter;
661$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
662$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
663$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
664$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
667print
'<div class="div-table-responsive">';
668print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
672print
'<tr class="liste_titre_filter">';
674if (
$conf->main_checkbox_left_column) {
675 print
'<td class="liste_titre center maxwidthsearch">';
676 $searchpicto = $form->showFilterButtons(
'left');
680if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
681 print
'<td class="liste_titre">';
682 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
685if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
686 print
'<td class="liste_titre">';
687 print
'<input class="flat searchstring" type="text" name="search_contract_id" size="1" value="'.dol_escape_htmltag($search_contract_id).
'">';
690if (!empty($arrayfields[
'c.ref'][
'checked'])) {
691 print
'<td class="liste_titre">';
692 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
693 print
'<input type="text" class="flat maxwidth75" name="search_contract" value="'.dol_escape_htmltag($search_contract).
'">';
696if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
697 print
'<td class="liste_titre">';
698 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');
702if (!empty($arrayfields[
'p.description'][
'checked'])) {
703 print
'<td class="liste_titre">';
704 print
'<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).
'">';
708if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
709 print
'<td class="liste_titre">';
712if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
713 print
'<td class="liste_titre right">';
714 print
'<input type="text" class="flat maxwidth50 right" name="search_subprice" value="'.dol_escape_htmltag($search_subprice).
'">';
717if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
718 print
'<td class="liste_titre right">';
719 print
'<input type="text" class="flat maxwidth50 right" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
722if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
723 print
'<td class="liste_titre right">';
724 print
'<input type="text" class="flat maxwidth50" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
727if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
728 print
'<td class="liste_titre right">';
729 print
'<input type="text" class="flat maxwidth50" name="search_total_tva" value="'.dol_escape_htmltag($search_total_tva).
'">';
733if (!empty($arrayfields[
's.nom'][
'checked'])) {
734 print
'<td class="liste_titre">';
735 print
'<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).
'">';
739if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
740 print
'<td class="liste_titre center">';
741 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
742 print $form->selectarray(
'filter_opouvertureprevue', $arrayofoperators, $sqlfilter_opouvertureprevue, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
744 $filter_dateouvertureprevue =
dol_mktime(0, 0, 0, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
745 print $form->selectDate($filter_dateouvertureprevue,
'opouvertureprevue', 0, 0, 1,
'', 1, 0);
748if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
749 print
'<td class="liste_titre center">';
750 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
751 print $form->selectarray(
'filter_op1', $arrayofoperators, $sqlfilter_op1, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
753 $filter_date1 =
dol_mktime(0, 0, 0, (
int) $op1month, (
int) $op1day, (
int) $op1year);
754 print $form->selectDate($filter_date1,
'op1', 0, 0, 1,
'', 1, 0);
757if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
758 print
'<td class="liste_titre center">';
759 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
760 print $form->selectarray(
'filter_op2', $arrayofoperators, $sqlfilter_op2, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
762 $filter_date2 =
dol_mktime(0, 0, 0, (
int) $op2month, (
int) $op2day, (
int) $op2year);
763 print $form->selectDate($filter_date2,
'op2', 0, 0, 1,
'', 1, 0);
766if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
767 print
'<td class="liste_titre center">';
768 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
769 print $form->selectarray(
'filter_opcloture', $arrayofoperators, $sqlfilter_opcloture, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
771 $filter_date_cloture =
dol_mktime(0, 0, 0, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
772 print $form->selectDate($filter_date_cloture,
'opcloture', 0, 0, 1,
'', 1, 0);
776include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
779$parameters = array(
'arrayfields' => $arrayfields);
780$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
781print $hookmanager->resPrint;
782if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
784 print
'<td class="liste_titre">';
787if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
789 print
'<td class="liste_titre">';
792if (!empty($arrayfields[
'status'][
'checked'])) {
794 print
'<td class="liste_titre right parentonrightofpage">';
795 $arrayofstatus = array(
796 '0' => $langs->trans(
"ServiceStatusInitial"),
797 '4' => $langs->trans(
"ServiceStatusRunning"),
798 '4&filter=notexpired' => $langs->trans(
"ServiceStatusNotLate"),
799 '4&filter=expired' => $langs->trans(
"ServiceStatusLate"),
800 '5' => $langs->trans(
"ServiceStatusClosed")
802 $search_status_new =
GETPOST(
'search_status',
'alpha');
803 if ($filter ==
'expired' && !preg_match(
'/expired/', $search_status_new)) {
804 $search_status_new .=
'&filter=expired';
806 print $form->selectarray(
'search_status', $arrayofstatus, (strstr($search_status_new,
',') ? -1 : $search_status_new), 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
810if (!
$conf->main_checkbox_left_column) {
811 print
'<td class="liste_titre center maxwidthsearch">';
812 $searchpicto = $form->showFilterButtons();
818$totalarray = array();
819$totalarray[
'nbfield'] = 0;
823print
'<tr class="liste_titre">';
825if (
$conf->main_checkbox_left_column) {
826 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
827 $totalarray[
'nbfield']++;
829if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
830 print_liste_field_titre($arrayfields[
'cd.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.rowid",
"", $param,
"", $sortfield, $sortorder);
832if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
833 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"c.rowid",
"", $param,
"", $sortfield, $sortorder);
835if (!empty($arrayfields[
'c.ref'][
'checked'])) {
837 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
"", $sortfield, $sortorder);
839if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
840 print_liste_field_titre($arrayfields[
'c.fk_contract_type'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_contract_type",
"", $param,
"", $sortfield, $sortorder);
842if (!empty($arrayfields[
'p.description'][
'checked'])) {
843 print_liste_field_titre($arrayfields[
'p.description'][
'label'], $_SERVER[
"PHP_SELF"],
"p.description",
"", $param,
"", $sortfield, $sortorder);
845if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
846 print_liste_field_titre($arrayfields[
'cd.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.tva_tx",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
848if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
849 print_liste_field_titre($arrayfields[
'cd.subprice'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.subprice",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
851if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
852 print_liste_field_titre($arrayfields[
'cd.qty'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.qty",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
854if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
855 print_liste_field_titre($arrayfields[
'cd.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
857if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
858 print_liste_field_titre($arrayfields[
'cd.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
860if (!empty($arrayfields[
's.nom'][
'checked'])) {
861 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
863if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
864 print_liste_field_titre($arrayfields[
'cd.date_ouverture_prevue'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_ouverture_prevue",
"", $param,
'', $sortfield, $sortorder,
'center ');
866if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
867 print_liste_field_titre($arrayfields[
'cd.date_ouverture'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_ouverture",
"", $param,
'', $sortfield, $sortorder,
'center ');
869if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
870 print_liste_field_titre($arrayfields[
'cd.date_fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_fin_validite",
"", $param,
'', $sortfield, $sortorder,
'center ');
872if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
873 print_liste_field_titre($arrayfields[
'cd.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center ');
876include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
878$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
879$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
880print $hookmanager->resPrint;
881if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
882 print_liste_field_titre($arrayfields[
'cd.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
884if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
885 print_liste_field_titre($arrayfields[
'cd.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
887if (!empty($arrayfields[
'status'][
'checked'])) {
888 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.statut,c.statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
891if (!
$conf->main_checkbox_left_column) {
892 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
893 $totalarray[
'nbfield']++;
901$contractstatic =
new Contrat($db);
902$productstatic =
new Product($db);
905$savnbfield = $totalarray[
'nbfield'];
906$totalarray = array(
'nbfield' => 0,
'val' => array(
'cd.qty' => 0,
'cd.total_ht' => 0,
'cd.total_tva' => 0));
907$imaxinloop = ($limit ? min($num, $limit) : $num);
908while ($i < $imaxinloop) {
909 $obj = $db->fetch_object($resql);
914 $contractstatic->id = $obj->cid;
915 $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
916 $contractstatic->ref_customer = $obj->ref_customer;
917 $contractstatic->ref_supplier = $obj->ref_supplier;
919 $companystatic->id = $obj->socid;
920 $companystatic->name = $obj->name;
921 $companystatic->email = $obj->email;
922 $companystatic->client = $obj->client;
923 $companystatic->fournisseur = $obj->fournisseur;
925 $productstatic->id = $obj->pid;
926 $productstatic->type = $obj->ptype;
927 $productstatic->ref = $obj->pref;
928 $productstatic->entity = $obj->pentity;
929 $productstatic->status = $obj->tosell;
930 $productstatic->status_buy = $obj->tobuy;
931 $productstatic->label = $obj->label;
932 $productstatic->description = $obj->description;
933 $productstatic->barcode = $obj->barcode;
935 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
938 if (
$conf->main_checkbox_left_column) {
939 print
'<td class="nowrap center">';
940 if ($massactionbutton || $massaction) {
942 if (in_array($obj->rowid, $arrayofselected)) {
945 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
949 $totalarray[
'nbfield']++;
954 if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
955 print
'<td class="tdoverflowmax50" data-key="id">';
959 $totalarray[
'nbfield']++;
964 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
965 print
'<td class="nowraponall">';
969 $totalarray[
'nbfield']++;
974 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
975 print
'<td class="nowraponall">';
976 print $contractstatic->getNomUrl(1, 16);
979 $totalarray[
'nbfield']++;
982 if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
983 $contractTypeLabels = array(0 => $langs->trans(
'CustomerContract'), 1 => $langs->trans(
'SupplierContract'));
984 print
'<td>'.dol_escape_htmltag($contractTypeLabels[(
int) $obj->fk_contract_type] ??
'').
'</td>';
986 $totalarray[
'nbfield']++;
990 if (!empty($arrayfields[
'p.description'][
'checked'])) {
991 print
'<td class="tdoverflowmax300">';
993 print $productstatic->getNomUrl(1,
'', 24);
994 print $obj->label ?
' - '.dol_trunc($obj->label, 16) :
'';
996 print
'<br><div class="small lineheightsmall">'.dol_nl2br($obj->description).
'</div>';
999 if ($obj->type == 0) {
1000 print img_object($obj->description,
'product').
' '.
dol_trunc($obj->description, 24);
1002 if ($obj->type == 1) {
1003 print img_object($obj->description,
'service').
' '.
dol_trunc($obj->description, 24);
1008 $totalarray[
'nbfield']++;
1012 if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
1013 print
'<td class="right nowraponall">';
1017 $totalarray[
'nbfield']++;
1020 if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
1021 print
'<td class="right nowraponall">';
1022 print
price($obj->subprice);
1025 $totalarray[
'nbfield']++;
1028 if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
1029 print
'<td class="right nowraponall">';
1033 $totalarray[
'nbfield']++;
1036 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.qty';
1038 $totalarray[
'val'][
'cd.qty'] += $obj->qty;
1040 if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
1041 print
'<td class="right nowraponall">';
1042 print
'<span class="amount">'.price($obj->total_ht).
'</span>';
1045 $totalarray[
'nbfield']++;
1048 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.total_ht';
1050 $totalarray[
'val'][
'cd.total_ht'] += $obj->total_ht;
1052 if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
1053 print
'<td class="right nowraponall">';
1054 print
'<span class="amount">'.price($obj->total_tva).
'</span>';
1057 $totalarray[
'nbfield']++;
1060 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.total_tva';
1062 $totalarray[
'val'][
'cd.total_tva'] += $obj->total_tva;
1066 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1067 print
'<td class="tdoverflowmax100">';
1068 print $companystatic->getNomUrl(1,
'customer', 28);
1071 $totalarray[
'nbfield']++;
1076 if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
1077 print
'<td class="center nowraponall">';
1078 print($obj->date_ouverture_prevue ?
dol_print_date($db->jdate($obj->date_ouverture_prevue),
'dayhour') :
' ');
1079 if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now -
$conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
1080 print
' '.img_picto($langs->trans(
"Late"),
"warning");
1082 print
' ';
1086 $totalarray[
'nbfield']++;
1089 if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
1090 print
'<td class="center nowraponall">'.($obj->date_ouverture ?
dol_print_date($db->jdate($obj->date_ouverture),
'dayhour') :
' ').
'</td>';
1092 $totalarray[
'nbfield']++;
1096 if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
1097 print
'<td class="center nowraponall">'.($obj->date_fin_validite ?
dol_print_date($db->jdate($obj->date_fin_validite),
'dayhour') :
' ');
1098 if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now -
$conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
1099 $warning_delay =
$conf->contrat->services->expires->warning_delay / 3600 / 24;
1100 $textlate = $langs->trans(
"Late").
' = '.$langs->trans(
"DateReference").
' > '.$langs->trans(
"DateToday").
' '.(ceil($warning_delay) >= 0 ?
'+' :
'').ceil($warning_delay).
' '.$langs->trans(
"days");
1101 print img_warning($textlate);
1103 print
' ';
1107 $totalarray[
'nbfield']++;
1111 if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
1112 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture),
'dayhour').
'</td>';
1114 $totalarray[
'nbfield']++;
1119 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1121 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1122 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1123 print $hookmanager->resPrint;
1125 if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
1126 print
'<td class="center">';
1127 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1130 $totalarray[
'nbfield']++;
1134 if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
1135 print
'<td class="center nowraponall">';
1136 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1139 $totalarray[
'nbfield']++;
1143 if (!empty($arrayfields[
'status'][
'checked'])) {
1144 print
'<td class="right">';
1145 if ($obj->cstatut == 0) {
1148 print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0,
'',
' - '.$langs->trans(
"Draft"));
1150 print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
1154 $totalarray[
'nbfield']++;
1158 if (!
$conf->main_checkbox_left_column) {
1159 print
'<td class="nowrap center">';
1160 if ($massactionbutton || $massaction) {
1162 if (in_array($obj->rowid, $arrayofselected)) {
1165 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1169 $totalarray[
'nbfield']++;
1178include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1183 foreach ($arrayfields as $key => $val) {
1184 if (!empty($val[
'checked'])) {
1188 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1193$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1194$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1195print $hookmanager->resPrint;
1197print
'</table>'.
"\n";
1200print
'</form>'.
"\n";
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 products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
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...
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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).
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
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.