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'));
50$massaction =
GETPOST(
'massaction',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array:int');
52$optioncss =
GETPOST(
'optioncss',
'aZ');
54$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php')).$mode;
58$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
61if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
65$offset = $limit * $page;
69 $sortfield =
"c.rowid";
75$search_id = trim(
GETPOST(
"search_id",
"int"));
76$search_contract_id = trim(
GETPOST(
"search_contract_id",
"int"));
77$search_name =
GETPOST(
"search_name",
'alpha');
78$search_subprice =
GETPOST(
"search_subprice",
'alpha');
79$search_qty =
GETPOST(
"search_qty",
'alpha');
80$search_total_ht =
GETPOST(
"search_total_ht",
'alpha');
81$search_total_tva =
GETPOST(
"search_total_tva",
'alpha');
82$search_total_ttc =
GETPOST(
"search_total_ttc",
'alpha');
83$search_contract =
GETPOST(
"search_contract",
'alpha');
84$search_service =
GETPOST(
"search_service",
'alpha');
86$search_status =
GETPOST(
"search_status",
'alpha');
87$search_option =
GETPOST(
'search_option',
'alpha');
88$search_product_category =
GETPOSTINT(
'search_product_category');
92if ($search_status ==
'4&filter=notexpired') {
94 $filter =
'notexpired';
96if ($search_status ==
'4&filter=expired') {
103$opouvertureprevuemonth =
GETPOST(
'opouvertureprevuemonth');
104$opouvertureprevueday =
GETPOST(
'opouvertureprevueday');
105$opouvertureprevueyear =
GETPOST(
'opouvertureprevueyear');
106$sqlfilter_opouvertureprevue =
GETPOST(
'filter_opouvertureprevue',
'alphawithlgt');
111$sqlfilter_op1 =
GETPOST(
'filter_op1',
'alphawithlgt');
116$sqlfilter_op2 =
GETPOST(
'filter_op2',
'alphawithlgt');
118$opcloturemonth =
GETPOSTINT(
'opcloturemonth');
121$sqlfilter_opcloture =
GETPOST(
'filter_opcloture',
'alphawithlgt');
126$hookmanager->initHooks(array(
'contractservicelist'));
129$extrafields->fetch_name_optionals_label(
$object->table_element);
131$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
133$search_all =
GETPOST(
'search_all',
'alphanohtml');
135$fieldstosearchall = [
136 'p.label' =>
'Product',
137 's.nom' =>
'ThirdParty',
139$parameters = [
'fieldstosearchall' => $fieldstosearchall];
140$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
142 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
144$fieldstosearchall = array_merge($fieldstosearchall, $hookmanager->resArray);
148if (!empty($user->socid)) {
149 $socid = $user->socid;
153$staticcontrat =
new Contrat($db);
155$companystatic =
new Societe($db);
158 'cd.rowid' => array(
'label' =>
"TechnicalID",
'checked' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'enabled' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
159 'c.rowid' => array(
'label' =>
"ContractID",
'checked' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'enabled' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 2),
160 'c.ref' => array(
'label' =>
"Contract",
'checked' =>
'1',
'position' => 80),
161 'c.fk_contract_type' => array(
'label' =>
"ContractType",
'checked' =>
'1',
'position' => 82),
162 'p.description' => array(
'label' =>
"Service",
'checked' =>
'1',
'position' => 85),
163 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 90),
164 'cd.tva_tx' => array(
'label' =>
"VATRate",
'checked' =>
'-1',
'position' => 100),
165 'cd.subprice' => array(
'label' =>
"PriceUHT",
'checked' =>
'-1',
'position' => 105),
166 'cd.qty' => array(
'label' =>
"Qty",
'checked' =>
'1',
'position' => 108),
167 'cd.total_ht' => array(
'label' =>
"TotalHT",
'checked' =>
'-1',
'position' => 109,
'isameasure' => 1),
168 'cd.total_tva' => array(
'label' =>
"TotalVAT",
'checked' =>
'-1',
'position' => 110),
169 'cd.date_ouverture_prevue' => array(
'label' =>
"DateStartPlannedShort",
'checked' =>
'1',
'position' => 150),
170 'cd.date_ouverture' => array(
'label' =>
"DateStartRealShort",
'checked' =>
'1',
'position' => 160),
171 'cd.date_fin_validite' => array(
'label' =>
"DateEndPlannedShort",
'checked' =>
'1',
'position' => 170),
172 'cd.date_cloture' => array(
'label' =>
"DateEndRealShort",
'checked' =>
'1',
'position' => 180),
174 'cd.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 500),
175 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000)
178include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
180$parameters = array(
'arrayfields' => &$arrayfields);
181$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
186$permissiontoread = $user->hasRight(
'contrat',
'lire');
187$permissiontoadd = $user->hasRight(
'contrat',
'creer');
188$permissiontodelete = $user->hasRight(
'contrat',
'supprimer');
197if (
GETPOST(
'cancel',
'alpha')) {
201if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
205$parameters = array(
'socid' => $socid);
206$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
208 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
211if (empty($reshook)) {
213 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
215 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
217 $search_contract_id =
"";
218 $search_product_category = 0;
220 $search_subprice =
"";
222 $search_total_ht =
"";
223 $search_total_tva =
"";
224 $search_total_ttc =
"";
225 $search_contract =
"";
226 $search_service =
"";
230 $opouvertureprevuemonth =
"";
231 $opouvertureprevueday =
"";
232 $opouvertureprevueyear =
"";
233 $sqlfilter_opouvertureprevue =
"";
242 $opcloturemonth =
"";
245 $sqlfilter_opcloture =
"";
248 $search_array_options = array();
257$form =
new Form($db);
261$title = $langs->trans(
"ListOfServices");
262if ($search_status ==
"0") {
263 $title = $langs->trans(
"ListOfInactiveServices");
265if ($search_status ==
"4" && $filter !=
"expired") {
266 $title = $langs->trans(
"ListOfRunningServices");
268if ($search_status ==
"4" && $filter ==
"expired") {
269 $title = $langs->trans(
"ListOfExpiredServices");
271if ($search_status ==
"5") {
272 $title = $langs->trans(
"ListOfClosedServices");
274$help_url =
'EN:Module_Contracts|FR:Module_Contrat|ES:Contratos_de_servicio';
278$sql =
"SELECT c.rowid as cid, c.ref, c.statut as cstatut, c.ref_customer, c.ref_supplier, c.fk_contract_type,";
279$sql .=
" s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
280$sql .=
" cd.rowid, cd.description, cd.statut, cd.product_type as type,";
281$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,";
282if (!$user->hasRight(
'societe',
'client',
'voir')) {
283 $sql .=
" sc.fk_soc, sc.fk_user,";
285$sql .=
" cd.date_ouverture_prevue,";
286$sql .=
" cd.date_ouverture,";
287$sql .=
" cd.date_fin_validite,";
288$sql .=
" cd.date_cloture,";
290$sql .=
" cd.total_ht,";
291$sql .=
" cd.total_tva,";
292$sql .=
" cd.tva_tx,";
293$sql .=
" cd.subprice,";
295$sql .=
" cd.tms as date_modification";
297if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
298 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
299 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
303$parameters = array();
304$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
305$sql .= $hookmanager->resPrint;
306$sql .=
" FROM ".MAIN_DB_PREFIX.
"contrat as c,";
307$sql .=
" ".MAIN_DB_PREFIX.
"societe as s,";
308if (!$user->hasRight(
'societe',
'client',
'voir')) {
309 $sql .=
" ".MAIN_DB_PREFIX.
"societe_commerciaux as sc,";
311$sql .=
" ".MAIN_DB_PREFIX.
"contratdet as cd";
312if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
313 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (cd.rowid = ef.fk_object)";
318$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
319$sql .= $hookmanager->resPrint;
321$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
322if ($search_product_category > 0) {
323 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=cd.fk_product';
325$sql .=
" WHERE c.entity IN (".getEntity(
$object->element).
")";
326$sql .=
" AND c.rowid = cd.fk_contrat";
327if ($search_product_category > 0) {
328 $sql .=
" AND cp.fk_categorie = ".((int) $search_product_category);
330$sql .=
" AND c.fk_soc = s.rowid";
331if (!$user->hasRight(
'societe',
'client',
'voir')) {
332 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
334if ($search_status ==
"0") {
335 $sql .=
" AND cd.statut = 0";
337if ($search_status ==
"4") {
338 $sql .=
" AND cd.statut = 4";
340if ($search_status ==
"4&filter=expired" || ($search_status ==
'4' && $filter ==
'expired')) {
341 $sql .=
" AND cd.statut = 4 AND cd.date_fin_validite < '".$db->idate($now).
"'";
343if ($search_status ==
"4&filter=notexpired" || ($search_status ==
'4' && $filter ==
'notexpired')) {
344 $sql .=
" AND cd.statut = 4 AND cd.date_fin_validite >= '".$db->idate($now).
"'";
346if ($search_status ==
"5") {
347 $sql .=
" AND cd.statut = 5";
352if ($search_contract_id > 0) {
355if ($search_option ==
'late' && $search_status !=
'0') {
356 $warning_date = $db->idate(
dol_now() - (
int)
$conf->contract->services->expires->warning_delay);
357 $sql .=
" AND cd.date_fin_validite < '".$db->escape($warning_date).
"'";
359if ($search_option ==
'late' && $search_status ==
'0') {
360 $warning_date = $db->idate(
dol_now() - (
int)
$conf->contract->services->expires->warning_delay);
361 $sql .=
" AND (cd.date_ouverture_prevue < '".$db->escape($warning_date).
"' OR cd.date_fin_validite < '".$db->escape($warning_date).
"')";
363if ($search_subprice) {
369if ($search_total_ht) {
372if ($search_total_tva) {
375if ($search_total_ttc) {
381if ($search_contract) {
384if ($search_type >= 0) {
385 $sql .=
" AND c.fk_contract_type = ".((int) $search_type);
387if ($search_service) {
388 $sql .=
natural_search(array(
"p.ref",
"p.description",
"cd.description"), $search_service);
391 $sql .=
" AND s.rowid = ".((int) $socid);
394$filter_dateouvertureprevue =
'';
397$filter_date_cloture =
'';
399$filter_dateouvertureprevue_start =
dol_mktime(0, 0, 0, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
400$filter_dateouvertureprevue_end =
dol_mktime(23, 59, 59, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
401if ($filter_dateouvertureprevue_start !=
'' && $sqlfilter_opouvertureprevue == -1) {
402 $sqlfilter_opouvertureprevue =
' BETWEEN ';
405$filter_date1_start =
dol_mktime(0, 0, 0, (
int) $op1month, (
int) $op1day, (
int) $op1year);
406$filter_date1_end =
dol_mktime(23, 59, 59, (
int) $op1month, (
int) $op1day, (
int) $op1year);
407if ($filter_date1_start !=
'' && $sqlfilter_op1 == -1) {
408 $sqlfilter_op1 =
' BETWEEN ';
411$filter_date2_start =
dol_mktime(0, 0, 0, (
int) $op2month, (
int) $op2day, (
int) $op2year);
412$filter_date2_end =
dol_mktime(23, 59, 59, (
int) $op2month, (
int) $op2day, (
int) $op2year);
413if ($filter_date2_start !=
'' && $sqlfilter_op2 == -1) {
414 $sqlfilter_op2 =
' BETWEEN ';
417$filter_datecloture_start =
dol_mktime(0, 0, 0, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
418$filter_datecloture_end =
dol_mktime(23, 59, 59, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
419if ($filter_datecloture_start !=
'' && $sqlfilter_opcloture == -1) {
420 $sqlfilter_opcloture =
' BETWEEN ';
423if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue != -1 && $sqlfilter_opouvertureprevue !=
' BETWEEN ' && $filter_dateouvertureprevue_start !=
'') {
424 $sql .=
" AND cd.date_ouverture_prevue ".preg_replace(
'/[^<>]/',
'', $sqlfilter_opouvertureprevue).
" '".$db->idate($filter_dateouvertureprevue_start).
"'";
426if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue ==
' BETWEEN ') {
427 $sql .=
" AND cd.date_ouverture_prevue ".$db->sanitize($sqlfilter_opouvertureprevue).
" '".$db->idate($filter_dateouvertureprevue_start).
"' AND '".$db->idate($filter_dateouvertureprevue_end).
"'";
429if (!empty($sqlfilter_op1) && $sqlfilter_op1 != -1 && $sqlfilter_op1 !=
' BETWEEN ' && $filter_date1_start !=
'') {
430 $sql .=
" AND cd.date_ouverture ".preg_replace(
'/[^<>]/',
'', $sqlfilter_op1).
" '".$db->idate($filter_date1_start).
"'";
432if (!empty($sqlfilter_op1) && $sqlfilter_op1 ==
' BETWEEN ') {
433 $sql .=
" AND cd.date_ouverture ".$db->sanitize($sqlfilter_op1).
" '".$db->idate($filter_date1_start).
"' AND '".$db->idate($filter_date1_end).
"'";
435if (!empty($sqlfilter_op2) && $sqlfilter_op2 != -1 && $sqlfilter_op2 !=
' BETWEEN ' && $filter_date2_start !=
'') {
436 $sql .=
" AND cd.date_fin_validite ".preg_replace(
'/[^<>]/',
'', $sqlfilter_op2).
" '".$db->idate($filter_date2_start).
"'";
438if (!empty($sqlfilter_op2) && $sqlfilter_op2 ==
' BETWEEN ') {
439 $sql .=
" AND cd.date_fin_validite ".$db->sanitize($sqlfilter_op2).
" '".$db->idate($filter_date2_start).
"' AND '".$db->idate($filter_date2_end).
"'";
441if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture !=
' BETWEEN ' && $sqlfilter_opcloture != -1 && $filter_datecloture_start !=
'') {
442 $sql .=
" AND cd.date_cloture ".preg_replace(
'/[^<>]/',
'', $sqlfilter_opcloture).
" '".$db->idate($filter_datecloture_start).
"'";
444if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture ==
' BETWEEN ') {
445 $sql .=
" AND cd.date_cloture ".$db->sanitize($sqlfilter_opcloture).
" '".$db->idate($filter_datecloture_start).
"' AND '".$db->idate($filter_datecloture_end).
"'";
448 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
451include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
454$parameters = array();
455$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
456$sql .= $hookmanager->resPrint;
459$nbtotalofrecords =
'';
461 $result = $db->query($sql);
462 $nbtotalofrecords = $db->num_rows($result);
463 if (($page * $limit) > (
int) $nbtotalofrecords) {
470$sql .= $db->order($sortfield, $sortorder);
472 $sql .= $db->plimit($limit + 1, $offset);
476dol_syslog(
"contrat/services_list.php", LOG_DEBUG);
477$resql = $db->query($sql);
479 dol_print_error($db);
483$num = $db->num_rows($resql);
498llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-contrat page-list_services bodyforlist');
500$arrayofselected = is_array($toselect) ? $toselect : array();
504 $param .=
'&mode='.urlencode($mode);
506if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
507 $param .=
'&contextpage='.urlencode($contextpage);
509if ($limit > 0 && $limit !=
$conf->liste_limit) {
510 $param .=
'&limit='.((int) $limit);
512if ($search_all !=
'') {
513 $param .=
'&sall='.urlencode($search_all);
515if ($optioncss !=
'') {
516 $param .=
'&optioncss='.urlencode($optioncss);
519 $param .=
'&search_id='.urlencode($search_id);
521if ($search_contract_id > 0) {
522 $param .=
'&search_contract_id='.urlencode($search_contract_id);
524if ($search_contract) {
525 $param .=
'&search_contract='.urlencode($search_contract);
527if ($search_type >= 0) {
528 $param .=
'&search_type='.$search_type;
531 $param .=
'&search_name='.urlencode($search_name);
533if ($search_subprice) {
534 $param .=
'&search_subprice='.urlencode($search_subprice);
537 $param .=
'&search_qty='.urlencode($search_qty);
539if ($search_total_ht) {
540 $param .=
'&search_total_ht='.urlencode($search_total_ht);
542if ($search_total_tva) {
543 $param .=
'&search_total_tva='.urlencode($search_total_tva);
545if ($search_total_ttc) {
546 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
548if ($search_service) {
549 $param .=
'&search_service='.urlencode($search_service);
551if ($search_status !=
'') {
552 if ($filter ==
'expired' || $filter ==
'notexpired') {
553 $param .=
'&search_status='.urlencode($search_status.
'&filter='.$filter);
555 $param .=
'&search_status='.urlencode($search_status);
559 $param .=
"&search_option=".urlencode($search_option);
561if (!empty($sqlfilter_opouvertureprevue) && $sqlfilter_opouvertureprevue != -1) {
562 $param .=
'&filter_opouvertureprevue='.urlencode($sqlfilter_opouvertureprevue);
564if (!empty($sqlfilter_op1) && $sqlfilter_op1 != -1) {
565 $param .=
'&filter_op1='.urlencode($sqlfilter_op1);
567if (!empty($sqlfilter_op2) && $sqlfilter_op2 != -1) {
568 $param .=
'&filter_op2='.urlencode($sqlfilter_op2);
570if (!empty($sqlfilter_opcloture) && $sqlfilter_opcloture != -1) {
571 $param .=
'&filter_opcloture='.urlencode($sqlfilter_opcloture);
573if ($filter_dateouvertureprevue_start !=
'') {
574 $param .=
'&opouvertureprevueday='.((int) $opouvertureprevueday).
'&opouvertureprevuemonth='.((int) $opouvertureprevuemonth).
'&opouvertureprevueyear='.((int) $opouvertureprevueyear);
576if ($filter_date1_start !=
'') {
577 $param .=
'&op1day='.((int) $op1day).
'&op1month='.((int) $op1month).
'&op1year='.((int) $op1year);
579if ($filter_date2_start !=
'') {
580 $param .=
'&op2day='.((int) $op2day).
'&op2month='.((int) $op2month).
'&op2year='.((int) $op2year);
582if ($filter_datecloture_start !=
'') {
583 $param .=
'&opclotureday='.((int) $op2day).
'&opcloturemonth='.((int) $op2month).
'&opclotureyear='.((int) $op2year);
586include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
588$parameters = array();
589$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
590$param .= $hookmanager->resPrint;
593$arrayofmassactions = array(
599$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
601print
'<form method="POST" id="searchFormList" spellcheck="false" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
602if ($optioncss !=
'') {
603 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
605print
'<input type="hidden" name="token" value="'.newToken().
'">';
606print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
607print
'<input type="hidden" name="action" value="list">';
608print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
609print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
610print
'<input type="hidden" name="page" value="'.$page.
'">';
611print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
612print
'<input type="hidden" name="page_y" value="">';
613print
'<input type="hidden" name="mode" value="'.$mode.
'">';
618print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'contract', 0,
'',
'', $limit);
620if (!empty($search_all)) {
621 $fieldstosearchall = array();
622 foreach ($fieldstosearchall as $key => $val) {
623 $fieldstosearchall[$key] = $langs->trans($val);
625 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
632if (
isModEnabled(
'category') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
633 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
634 $moreforfilter .=
'<div class="divsearchfield">';
635 $tmptitle = $langs->trans(
'IncludingProductWithTag');
636 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, 0, 1);
637 $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);
638 $moreforfilter .=
'</div>';
641$moreforfilter .=
'<div class="divsearchfield">';
642$moreforfilter .=
'<label for="search_option">'.$langs->trans(
'Alert').
'</label> <input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option ==
'late' ?
' checked' :
'').
'>';
643$moreforfilter .=
'</div>';
645$parameters = array();
646$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
647if (empty($reshook)) {
648 $moreforfilter .= $hookmanager->resPrint;
650 $moreforfilter = $hookmanager->resPrint;
654if (!empty($moreforfilter)) {
655 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
656 print $moreforfilter;
660$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
661$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
662$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
663$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
666print
'<div class="div-table-responsive">';
667print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
671print
'<tr class="liste_titre_filter">';
673if (
$conf->main_checkbox_left_column) {
674 print
'<td class="liste_titre center maxwidthsearch">';
675 $searchpicto = $form->showFilterButtons(
'left');
679if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
680 print
'<td class="liste_titre">';
681 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
684if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
685 print
'<td class="liste_titre">';
686 print
'<input class="flat searchstring" type="text" name="search_contract_id" size="1" value="'.dol_escape_htmltag($search_contract_id).
'">';
689if (!empty($arrayfields[
'c.ref'][
'checked'])) {
690 print
'<td class="liste_titre">';
691 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
692 print
'<input type="text" class="flat maxwidth75" name="search_contract" value="'.dol_escape_htmltag($search_contract).
'">';
695if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
696 print
'<td class="liste_titre">';
697 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');
701if (!empty($arrayfields[
'p.description'][
'checked'])) {
702 print
'<td class="liste_titre">';
703 print
'<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).
'">';
707if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
708 print
'<td class="liste_titre">';
711if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
712 print
'<td class="liste_titre right">';
713 print
'<input type="text" class="flat maxwidth50 right" name="search_subprice" value="'.dol_escape_htmltag($search_subprice).
'">';
716if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
717 print
'<td class="liste_titre right">';
718 print
'<input type="text" class="flat maxwidth50 right" name="search_qty" value="'.dol_escape_htmltag($search_qty).
'">';
721if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
722 print
'<td class="liste_titre right">';
723 print
'<input type="text" class="flat maxwidth50" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
726if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
727 print
'<td class="liste_titre right">';
728 print
'<input type="text" class="flat maxwidth50" name="search_total_tva" value="'.dol_escape_htmltag($search_total_tva).
'">';
732if (!empty($arrayfields[
's.nom'][
'checked'])) {
733 print
'<td class="liste_titre">';
734 print
'<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).
'">';
738if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
739 print
'<td class="liste_titre center">';
740 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
741 print $form->selectarray(
'filter_opouvertureprevue', $arrayofoperators, $sqlfilter_opouvertureprevue, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
743 $filter_dateouvertureprevue =
dol_mktime(0, 0, 0, (
int) $opouvertureprevuemonth, (
int) $opouvertureprevueday, (
int) $opouvertureprevueyear);
744 print $form->selectDate($filter_dateouvertureprevue,
'opouvertureprevue', 0, 0, 1,
'', 1, 0);
747if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
748 print
'<td class="liste_titre center">';
749 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
750 print $form->selectarray(
'filter_op1', $arrayofoperators, $sqlfilter_op1, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
752 $filter_date1 =
dol_mktime(0, 0, 0, (
int) $op1month, (
int) $op1day, (
int) $op1year);
753 print $form->selectDate($filter_date1,
'op1', 0, 0, 1,
'', 1, 0);
756if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
757 print
'<td class="liste_titre center">';
758 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
759 print $form->selectarray(
'filter_op2', $arrayofoperators, $sqlfilter_op2, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
761 $filter_date2 =
dol_mktime(0, 0, 0, (
int) $op2month, (
int) $op2day, (
int) $op2year);
762 print $form->selectDate($filter_date2,
'op2', 0, 0, 1,
'', 1, 0);
765if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
766 print
'<td class="liste_titre center">';
767 $arrayofoperators = array(
'<' =>
'<',
'>' =>
'>');
768 print $form->selectarray(
'filter_opcloture', $arrayofoperators, $sqlfilter_opcloture, 1, 0, 0,
'', 0, 0, 0,
'',
'width50');
770 $filter_date_cloture =
dol_mktime(0, 0, 0, (
int) $opcloturemonth, (
int) $opclotureday, (
int) $opclotureyear);
771 print $form->selectDate($filter_date_cloture,
'opcloture', 0, 0, 1,
'', 1, 0);
775include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
778$parameters = array(
'arrayfields' => $arrayfields);
779$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
780print $hookmanager->resPrint;
781if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
783 print
'<td class="liste_titre">';
786if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
788 print
'<td class="liste_titre">';
791if (!empty($arrayfields[
'status'][
'checked'])) {
793 print
'<td class="liste_titre right parentonrightofpage">';
794 $arrayofstatus = array(
795 '0' => $langs->trans(
"ServiceStatusInitial"),
796 '4' => $langs->trans(
"ServiceStatusRunning"),
797 '4&filter=notexpired' => $langs->trans(
"ServiceStatusNotLate"),
798 '4&filter=expired' => $langs->trans(
"ServiceStatusLate"),
799 '5' => $langs->trans(
"ServiceStatusClosed")
801 $search_status_new =
GETPOST(
'search_status',
'alpha');
802 if ($filter ==
'expired' && !preg_match(
'/expired/', $search_status_new)) {
803 $search_status_new .=
'&filter=expired';
805 print $form->selectarray(
'search_status', $arrayofstatus, (strstr($search_status_new,
',') ? -1 : $search_status_new), 1, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
809if (!
$conf->main_checkbox_left_column) {
810 print
'<td class="liste_titre center maxwidthsearch">';
811 $searchpicto = $form->showFilterButtons();
817$totalarray = array();
818$totalarray[
'nbfield'] = 0;
822print
'<tr class="liste_titre">';
824if (
$conf->main_checkbox_left_column) {
825 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
826 $totalarray[
'nbfield']++;
828if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
829 print_liste_field_titre($arrayfields[
'cd.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.rowid",
"", $param,
"", $sortfield, $sortorder);
831if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
832 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
"c.rowid",
"", $param,
"", $sortfield, $sortorder);
834if (!empty($arrayfields[
'c.ref'][
'checked'])) {
836 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"c.ref",
"", $param,
"", $sortfield, $sortorder);
838if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
839 print_liste_field_titre($arrayfields[
'c.fk_contract_type'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_contract_type",
"", $param,
"", $sortfield, $sortorder);
841if (!empty($arrayfields[
'p.description'][
'checked'])) {
842 print_liste_field_titre($arrayfields[
'p.description'][
'label'], $_SERVER[
"PHP_SELF"],
"p.description",
"", $param,
"", $sortfield, $sortorder);
844if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
845 print_liste_field_titre($arrayfields[
'cd.tva_tx'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.tva_tx",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
847if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
848 print_liste_field_titre($arrayfields[
'cd.subprice'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.subprice",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
850if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
851 print_liste_field_titre($arrayfields[
'cd.qty'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.qty",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
853if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
854 print_liste_field_titre($arrayfields[
'cd.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
856if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
857 print_liste_field_titre($arrayfields[
'cd.total_tva'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right nowrap ');
859if (!empty($arrayfields[
's.nom'][
'checked'])) {
860 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
862if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
863 print_liste_field_titre($arrayfields[
'cd.date_ouverture_prevue'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_ouverture_prevue",
"", $param,
'', $sortfield, $sortorder,
'center ');
865if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
866 print_liste_field_titre($arrayfields[
'cd.date_ouverture'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_ouverture",
"", $param,
'', $sortfield, $sortorder,
'center ');
868if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
869 print_liste_field_titre($arrayfields[
'cd.date_fin_validite'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_fin_validite",
"", $param,
'', $sortfield, $sortorder,
'center ');
871if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
872 print_liste_field_titre($arrayfields[
'cd.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center ');
875include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
877$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder);
878$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
879print $hookmanager->resPrint;
880if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
881 print_liste_field_titre($arrayfields[
'cd.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
883if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
884 print_liste_field_titre($arrayfields[
'cd.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
886if (!empty($arrayfields[
'status'][
'checked'])) {
887 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
"PHP_SELF"],
"cd.statut,c.statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
890if (!
$conf->main_checkbox_left_column) {
891 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
892 $totalarray[
'nbfield']++;
900$contractstatic =
new Contrat($db);
901$productstatic =
new Product($db);
904$savnbfield = $totalarray[
'nbfield'];
905$totalarray = array(
'nbfield' => 0,
'val' => array(
'cd.qty' => 0,
'cd.total_ht' => 0,
'cd.total_tva' => 0));
906$imaxinloop = ($limit ? min($num, $limit) : $num);
907while ($i < $imaxinloop) {
908 $obj = $db->fetch_object($resql);
913 $contractstatic->id = $obj->cid;
914 $contractstatic->ref = $obj->ref ? $obj->ref : $obj->cid;
915 $contractstatic->ref_customer = $obj->ref_customer;
916 $contractstatic->ref_supplier = $obj->ref_supplier;
918 $companystatic->id = $obj->socid;
919 $companystatic->name = $obj->name;
920 $companystatic->email = $obj->email;
921 $companystatic->client = $obj->client;
922 $companystatic->fournisseur = $obj->fournisseur;
924 $productstatic->id = $obj->pid;
925 $productstatic->type = $obj->ptype;
926 $productstatic->ref = $obj->pref;
927 $productstatic->entity = $obj->pentity;
928 $productstatic->status = $obj->tosell;
929 $productstatic->status_buy = $obj->tobuy;
930 $productstatic->label = $obj->label;
931 $productstatic->description = $obj->description;
932 $productstatic->barcode = $obj->barcode;
934 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
937 if (
$conf->main_checkbox_left_column) {
938 print
'<td class="nowrap center">';
939 if ($massactionbutton || $massaction) {
941 if (in_array($obj->rowid, $arrayofselected)) {
944 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
948 $totalarray[
'nbfield']++;
953 if (!empty($arrayfields[
'cd.rowid'][
'checked'])) {
954 print
'<td class="tdoverflowmax50" data-key="id">';
958 $totalarray[
'nbfield']++;
963 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
964 print
'<td class="nowraponall">';
968 $totalarray[
'nbfield']++;
973 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
974 print
'<td class="nowraponall">';
975 print $contractstatic->getNomUrl(1, 16);
978 $totalarray[
'nbfield']++;
981 if (!empty($arrayfields[
'c.fk_contract_type'][
'checked'])) {
982 $contractTypeLabels = array(0 => $langs->trans(
'CustomerContract'), 1 => $langs->trans(
'SupplierContract'));
983 print
'<td>'.dol_escape_htmltag($contractTypeLabels[(
int) $obj->fk_contract_type] ??
'').
'</td>';
985 $totalarray[
'nbfield']++;
989 if (!empty($arrayfields[
'p.description'][
'checked'])) {
990 print
'<td class="tdoverflowmax300">';
992 print $productstatic->getNomUrl(1,
'', 24);
993 print $obj->label ?
' - '.dol_trunc($obj->label, 16) :
'';
995 print
'<br><div class="small lineheightsmall">'.dol_nl2br($obj->description).
'</div>';
998 if ($obj->type == 0) {
999 print img_object($obj->description,
'product').
' '.
dol_trunc($obj->description, 24);
1001 if ($obj->type == 1) {
1002 print img_object($obj->description,
'service').
' '.
dol_trunc($obj->description, 24);
1007 $totalarray[
'nbfield']++;
1011 if (!empty($arrayfields[
'cd.tva_tx'][
'checked'])) {
1012 print
'<td class="right nowraponall">';
1016 $totalarray[
'nbfield']++;
1019 if (!empty($arrayfields[
'cd.subprice'][
'checked'])) {
1020 print
'<td class="right nowraponall">';
1021 print
price($obj->subprice);
1024 $totalarray[
'nbfield']++;
1027 if (!empty($arrayfields[
'cd.qty'][
'checked'])) {
1028 print
'<td class="right nowraponall">';
1032 $totalarray[
'nbfield']++;
1035 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.qty';
1037 $totalarray[
'val'][
'cd.qty'] += $obj->qty;
1039 if (!empty($arrayfields[
'cd.total_ht'][
'checked'])) {
1040 print
'<td class="right nowraponall">';
1041 print
'<span class="amount">'.price($obj->total_ht).
'</span>';
1044 $totalarray[
'nbfield']++;
1047 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.total_ht';
1049 $totalarray[
'val'][
'cd.total_ht'] += $obj->total_ht;
1051 if (!empty($arrayfields[
'cd.total_tva'][
'checked'])) {
1052 print
'<td class="right nowraponall">';
1053 print
'<span class="amount">'.price($obj->total_tva).
'</span>';
1056 $totalarray[
'nbfield']++;
1059 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cd.total_tva';
1061 $totalarray[
'val'][
'cd.total_tva'] += $obj->total_tva;
1065 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1066 print
'<td class="tdoverflowmax100">';
1067 print $companystatic->getNomUrl(1,
'customer', 28);
1070 $totalarray[
'nbfield']++;
1075 if (!empty($arrayfields[
'cd.date_ouverture_prevue'][
'checked'])) {
1076 print
'<td class="center nowraponall">';
1077 print($obj->date_ouverture_prevue ?
dol_print_date($db->jdate($obj->date_ouverture_prevue),
'dayhour') :
' ');
1078 if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now -
$conf->contrat->services->inactifs->warning_delay)) && $obj->statut == 0) {
1079 print
' '.img_picto($langs->trans(
"Late"),
"warning");
1081 print
' ';
1085 $totalarray[
'nbfield']++;
1088 if (!empty($arrayfields[
'cd.date_ouverture'][
'checked'])) {
1089 print
'<td class="center nowraponall">'.($obj->date_ouverture ?
dol_print_date($db->jdate($obj->date_ouverture),
'dayhour') :
' ').
'</td>';
1091 $totalarray[
'nbfield']++;
1095 if (!empty($arrayfields[
'cd.date_fin_validite'][
'checked'])) {
1096 print
'<td class="center nowraponall">'.($obj->date_fin_validite ?
dol_print_date($db->jdate($obj->date_fin_validite),
'dayhour') :
' ');
1097 if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now -
$conf->contrat->services->expires->warning_delay) && $obj->statut < 5) {
1098 $warning_delay =
$conf->contrat->services->expires->warning_delay / 3600 / 24;
1099 $textlate = $langs->trans(
"Late").
' = '.$langs->trans(
"DateReference").
' > '.$langs->trans(
"DateToday").
' '.(ceil($warning_delay) >= 0 ?
'+' :
'').ceil($warning_delay).
' '.$langs->trans(
"days");
1100 print img_warning($textlate);
1102 print
' ';
1106 $totalarray[
'nbfield']++;
1110 if (!empty($arrayfields[
'cd.date_cloture'][
'checked'])) {
1111 print
'<td class="center nowraponall">'.dol_print_date($db->jdate($obj->date_cloture),
'dayhour').
'</td>';
1113 $totalarray[
'nbfield']++;
1118 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1120 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1121 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1122 print $hookmanager->resPrint;
1124 if (!empty($arrayfields[
'cd.datec'][
'checked'])) {
1125 print
'<td class="center">';
1126 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1129 $totalarray[
'nbfield']++;
1133 if (!empty($arrayfields[
'cd.tms'][
'checked'])) {
1134 print
'<td class="center nowraponall">';
1135 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1138 $totalarray[
'nbfield']++;
1142 if (!empty($arrayfields[
'status'][
'checked'])) {
1143 print
'<td class="right">';
1144 if ($obj->cstatut == 0) {
1147 print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0,
'',
' - '.$langs->trans(
"Draft"));
1149 print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0);
1153 $totalarray[
'nbfield']++;
1157 if (!
$conf->main_checkbox_left_column) {
1158 print
'<td class="nowrap center">';
1159 if ($massactionbutton || $massaction) {
1161 if (in_array($obj->rowid, $arrayofselected)) {
1164 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1168 $totalarray[
'nbfield']++;
1177include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1182 foreach ($arrayfields as $key => $val) {
1183 if (!empty($val[
'checked'])) {
1187 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1192$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1193$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1194print $hookmanager->resPrint;
1196print
'</table>'.
"\n";
1199print
'</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.
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)
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.