Complete work on new list v5
This commit is contained in:
parent
209990fd15
commit
5c6ecf9aeb
@ -33,17 +33,18 @@ $langs->load("products");
|
|||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$mode = GETPOST("mode");
|
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
if ($page == -1) { $page = 0; }
|
if ($page == -1) { $page = 0; }
|
||||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
if (! $sortfield) $sortfield="c.rowid";
|
if (! $sortfield) $sortfield="c.rowid";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
|
||||||
|
$mode = GETPOST("mode");
|
||||||
$filter=GETPOST("filter");
|
$filter=GETPOST("filter");
|
||||||
$search_name=GETPOST("search_name");
|
$search_name=GETPOST("search_name");
|
||||||
$search_contract=GETPOST("search_contract");
|
$search_contract=GETPOST("search_contract");
|
||||||
@ -73,6 +74,17 @@ $opclotureday=GETPOST('opclotureday');
|
|||||||
$opclotureyear=GETPOST('opclotureyear');
|
$opclotureyear=GETPOST('opclotureyear');
|
||||||
$filter_opcloture=GETPOST('filter_opcloture');
|
$filter_opcloture=GETPOST('filter_opcloture');
|
||||||
|
|
||||||
|
// Initialize context for list
|
||||||
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'servicelist'.$mode;
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
|
$hookmanager->initHooks(array($contextpage));
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
$extralabels = $extrafields->fetch_name_optionals_label('contratdet');
|
||||||
|
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$contratid = GETPOST('id','int');
|
$contratid = GETPOST('id','int');
|
||||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
@ -100,13 +112,46 @@ $staticcontrat=new Contrat($db);
|
|||||||
$staticcontratligne=new ContratLigne($db);
|
$staticcontratligne=new ContratLigne($db);
|
||||||
$companystatic=new Societe($db);
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
$arrayfields=array();
|
$arrayfields=array(
|
||||||
|
'c.ref'=>array('label'=>$langs->trans("Contract"), 'checked'=>1, 'position'=>80),
|
||||||
|
'p.description'=>array('label'=>$langs->trans("Service"), 'checked'=>1, 'position'=>80),
|
||||||
|
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>100),
|
||||||
|
'cd.date_ouverture_prevue'=>array('label'=>$langs->trans("DateStartPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode == "0")),
|
||||||
|
'cd.date_ouverture'=>array('label'=>$langs->trans("DateStartRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode > 0)),
|
||||||
|
'cd.date_fin_validite'=>array('label'=>$langs->trans("DateEndPlannedShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode < 5)),
|
||||||
|
'cd.date_cloture'=>array('label'=>$langs->trans("DateEndRealShort"), 'checked'=>(($mode == "" || $mode == -1) || $mode >= 5)),
|
||||||
|
'status'=>array('label'=>$langs->trans("Status"), 'checked'=>1),
|
||||||
|
//'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||||
|
'cd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
||||||
|
);
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_name="";
|
$search_name="";
|
||||||
@ -132,6 +177,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$mode='';
|
$mode='';
|
||||||
$filter='';
|
$filter='';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -141,8 +188,6 @@ $now=dol_now();
|
|||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
|
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
|
||||||
$sql.= " s.rowid as socid, s.nom as name,";
|
$sql.= " s.rowid as socid, s.nom as name,";
|
||||||
$sql.= " cd.rowid, cd.description, cd.statut,";
|
$sql.= " cd.rowid, cd.description, cd.statut,";
|
||||||
@ -151,11 +196,20 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk
|
|||||||
$sql.= " cd.date_ouverture_prevue,";
|
$sql.= " cd.date_ouverture_prevue,";
|
||||||
$sql.= " cd.date_ouverture,";
|
$sql.= " cd.date_ouverture,";
|
||||||
$sql.= " cd.date_fin_validite,";
|
$sql.= " cd.date_fin_validite,";
|
||||||
$sql.= " cd.date_cloture";
|
$sql.= " cd.date_cloture,";
|
||||||
|
//$sql.= " cd.date_c as date_creation,";
|
||||||
|
$sql.= " cd.tms as date_update";
|
||||||
|
// Add fields from extrafields
|
||||||
|
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||||
|
// Add fields from hooks
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."contratdet as cd";
|
$sql.= " ".MAIN_DB_PREFIX."contratdet as cd";
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet_extrafields as ef on (cd.rowid = ef.fk_object)";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||||
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product';
|
||||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||||
@ -180,29 +234,47 @@ if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $fi
|
|||||||
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
|
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
|
||||||
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
|
||||||
if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'";
|
if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'";
|
||||||
$totalnboflines=0;
|
|
||||||
$result=$db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$totalnboflines = $db->num_rows($result);
|
|
||||||
}
|
|
||||||
$sql .= $db->order($sortfield,$sortorder);
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
|
|
||||||
|
$nbtotalofrecords = -1;
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
dol_syslog("contrat/services.php", LOG_DEBUG);
|
dol_syslog("contrat/services.php", LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
/*
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->id;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||||
|
exit;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
llxHeader(null, $langs->trans("Services"));
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
if ($search_contract) $param.='&search_contract='.urlencode($search_contract);
|
if ($search_contract) $param.='&search_contract='.urlencode($search_contract);
|
||||||
if ($search_name) $param.='&search_name='.urlencode($search_name);
|
if ($search_name) $param.='&search_name='.urlencode($search_name);
|
||||||
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
||||||
if ($mode) $param.='&mode='.$mode;
|
if ($mode) $param.='&mode='.urlencode($mode);
|
||||||
if ($filter) $param.='&filter='.$filter;
|
if ($filter) $param.='&filter='.urlencode($filter);
|
||||||
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1) $param.='&filter_opouvertureprevue='.urlencode($filter_opouvertureprevue);
|
||||||
if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1);
|
if (! empty($filter_op1) && $filter_op1 != -1) $param.='&filter_op1='.urlencode($filter_op1);
|
||||||
if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2);
|
if (! empty($filter_op2) && $filter_op2 != -1) $param.='&filter_op2='.urlencode($filter_op2);
|
||||||
@ -211,6 +283,14 @@ if ($resql)
|
|||||||
if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
if ($filter_date1 != '') $param.='&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year;
|
||||||
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
if ($filter_date2 != '') $param.='&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year;
|
||||||
if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
if ($filter_datecloture != '') $param.='&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year;
|
||||||
|
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||||
|
// Add $param from extra fields
|
||||||
|
foreach ($search_array_options as $key => $val)
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||||
|
}
|
||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array(
|
$arrayofmassactions = array(
|
||||||
@ -234,7 +314,7 @@ if ($resql)
|
|||||||
if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices");
|
if ($mode == "4" && $filter != "expired") $title=$langs->trans("ListOfRunningServices");
|
||||||
if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices");
|
if ($mode == "4" && $filter == "expired") $title=$langs->trans("ListOfExpiredServices");
|
||||||
if ($mode == "5") $title=$langs->trans("ListOfClosedServices");
|
if ($mode == "5") $title=$langs->trans("ListOfClosedServices");
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
|
||||||
|
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
@ -271,38 +351,64 @@ if ($resql)
|
|||||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Contract"),$_SERVER["PHP_SELF"], "c.rowid",$param,"","",$sortfield,$sortorder);
|
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],"c.ref","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Service"),$_SERVER["PHP_SELF"], "p.description",$param,"","",$sortfield,$sortorder);
|
if (! empty($arrayfields['p.description']['checked'])) print_liste_field_titre($arrayfields['p.description']['label'],$_SERVER["PHP_SELF"],"p.description","",$param,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"], "s.nom",$param,"","",$sortfield,$sortorder);
|
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
|
||||||
// Date debut
|
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture_prevue']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture_prevue","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (($mode == "" || $mode == -1) || $mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['cd.date_ouverture']['checked'])) print_liste_field_titre($arrayfields['cd.date_ouverture']['label'],$_SERVER["PHP_SELF"],"cd.date_ouverture","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (($mode == "" || $mode == -1) || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),$_SERVER["PHP_SELF"], "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
if (! empty($arrayfields['cd.date_fin_validite']['checked'])) print_liste_field_titre($arrayfields['cd.date_fin_validite']['label'],$_SERVER["PHP_SELF"],"cd.date_fin_validite","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
// Date fin
|
if (! empty($arrayfields['cd.date_cloture']['checked'])) print_liste_field_titre($arrayfields['cd.date_cloture']['label'],$_SERVER["PHP_SELF"],"cd.date_cloture","",$param,'align="center"',$sortfield,$sortorder);
|
||||||
if (($mode == "" || $mode == -1) || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),$_SERVER["PHP_SELF"], "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder);
|
// Extra fields
|
||||||
if (($mode == "" || $mode == -1) || $mode >= 5) print_liste_field_titre($langs->trans("DateEndRealShort"),$_SERVER["PHP_SELF"], "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder);
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder);
|
{
|
||||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Hook fields
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'],$_SERVER["PHP_SELF"],"cd.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'],$_SERVER["PHP_SELF"],"cd.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||||
|
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER["PHP_SELF"],"cd.statut,c.statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
if (! empty($arrayfields['c.ref']['checked']))
|
||||||
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
// Service label
|
// Service label
|
||||||
|
if (! empty($arrayfields['p.description']['checked']))
|
||||||
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" size="12" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
print '<input type="text" class="flat maxwidth100" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
// Third party
|
// Third party
|
||||||
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
|
{
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
print '<input type="text" class="flat maxwidth100" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (($mode == "" || $mode == -1) || $mode == "0")
|
}
|
||||||
|
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
@ -312,7 +418,7 @@ if ($resql)
|
|||||||
print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1);
|
print $form->select_date($filter_dateouvertureprevue,'opouvertureprevue',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (($mode == "" || $mode == -1) || $mode > 0)
|
if (! empty($arrayfields['cd.date_ouverture']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
@ -322,7 +428,7 @@ if ($resql)
|
|||||||
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
print $form->select_date($filter_date1,'op1',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (($mode == "" || $mode == -1) || $mode < 5)
|
if (! empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
@ -332,7 +438,7 @@ if ($resql)
|
|||||||
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
print $form->select_date($filter_date2,'op2',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (($mode == "" || $mode == -1) || $mode >= 5)
|
if (! empty($arrayfields['cd.date_cloture']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="center">';
|
print '<td class="liste_titre" align="center">';
|
||||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||||
@ -342,7 +448,49 @@ if ($resql)
|
|||||||
print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1);
|
print $form->select_date($filter_date_cloture,'opcloture',0,0,1,'',1,0,1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '<td align="right">';
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||||
|
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||||
|
{
|
||||||
|
$crit=$val;
|
||||||
|
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||||
|
$searchclass='';
|
||||||
|
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||||
|
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||||
|
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
if (! empty($arrayfields['cd.datec']['checked']))
|
||||||
|
{
|
||||||
|
// Date creation
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['cd.tms']['checked']))
|
||||||
|
{
|
||||||
|
// Date modification
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
if (! empty($arrayfields['status']['checked']))
|
||||||
|
{
|
||||||
|
// Status
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
$arrayofstatus=array(
|
$arrayofstatus=array(
|
||||||
'0'=>$langs->trans("ServiceStatusInitial"),
|
'0'=>$langs->trans("ServiceStatusInitial"),
|
||||||
'4'=>$langs->trans("ServiceStatusRunning"),
|
'4'=>$langs->trans("ServiceStatusRunning"),
|
||||||
@ -350,8 +498,10 @@ if ($resql)
|
|||||||
'4&filter=expired'=>$langs->trans("ServiceStatusLate"),
|
'4&filter=expired'=>$langs->trans("ServiceStatusLate"),
|
||||||
'5'=>$langs->trans("ServiceStatusClosed")
|
'5'=>$langs->trans("ServiceStatusClosed")
|
||||||
);
|
);
|
||||||
print $form->selectarray('search_status',$arrayofstatus,(strstr($search_status, ',')?-1:$search_status),1);
|
print $form->selectarray('search_status', $arrayofstatus, (strstr($search_status, ',')?-1:$search_status), 1, 0, '', 0, 0, 0, '', 'maxwidth100onsmartphone');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
// Action column
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
@ -361,7 +511,7 @@ if ($resql)
|
|||||||
$contractstatic=new Contrat($db);
|
$contractstatic=new Contrat($db);
|
||||||
$productstatic=new Product($db);
|
$productstatic=new Product($db);
|
||||||
|
|
||||||
$var=True;
|
$var=True; $i=0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -374,11 +524,15 @@ if ($resql)
|
|||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
|
if (! empty($arrayfields['c.ref']['checked']))
|
||||||
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $contractstatic->getNomUrl(1,16);
|
print $contractstatic->getNomUrl(1,16);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
// Service
|
// Service
|
||||||
|
if (! empty($arrayfields['p.description']['checked']))
|
||||||
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->pid)
|
if ($obj->pid)
|
||||||
{
|
{
|
||||||
@ -396,17 +550,21 @@ if ($resql)
|
|||||||
if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24);
|
if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
|
if (! empty($arrayfields['s.nom']['checked']))
|
||||||
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$companystatic->id=$obj->socid;
|
$companystatic->id=$obj->socid;
|
||||||
$companystatic->name=$obj->name;
|
$companystatic->name=$obj->name;
|
||||||
$companystatic->client=1;
|
$companystatic->client=1;
|
||||||
print $companystatic->getNomUrl(1,'customer',28);
|
print $companystatic->getNomUrl(1,'customer',28);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Start date
|
// Start date
|
||||||
if (($mode == "" || $mode == -1) || $mode == "0")
|
if (! empty($arrayfields['cd.date_ouverture_prevue']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' ');
|
||||||
@ -415,12 +573,12 @@ if ($resql)
|
|||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (($mode == "" || $mode == -1) || $mode > 0)
|
if (! empty($arrayfields['cd.date_ouverture']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').'</td>';
|
print '<td align="center">'.($obj->date_ouverture?dol_print_date($db->jdate($obj->date_ouverture)):' ').'</td>';
|
||||||
}
|
}
|
||||||
// End date
|
// End date
|
||||||
if (($mode == "" || $mode == -1) || $mode < 5)
|
if (! empty($arrayfields['cd.date_fin_validite']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
print '<td align="center">'.($obj->date_fin_validite?dol_print_date($db->jdate($obj->date_fin_validite)):' ');
|
||||||
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
if ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5)
|
||||||
@ -430,11 +588,55 @@ if ($resql)
|
|||||||
print img_warning($textlate);
|
print img_warning($textlate);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
}
|
|
||||||
if (($mode == "" || $mode == -1) || $mode >= 5) print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture));
|
|
||||||
// Icone warning
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="nowrap">';
|
}
|
||||||
|
if (! empty($arrayfields['cd.date_cloture']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">'.dol_print_date($db->jdate($obj->date_cloture)).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extra fields
|
||||||
|
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||||
|
{
|
||||||
|
foreach($extrafields->attribute_label as $key => $val)
|
||||||
|
{
|
||||||
|
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td';
|
||||||
|
$align=$extrafields->getAlignFlag($key);
|
||||||
|
if ($align) print ' align="'.$align.'"';
|
||||||
|
print '>';
|
||||||
|
$tmpkey='options_'.$key;
|
||||||
|
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fields from hook
|
||||||
|
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
// Date creation
|
||||||
|
if (! empty($arrayfields['cd.datec']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
// Date modification
|
||||||
|
if (! empty($arrayfields['cd.tms']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
// Status
|
||||||
|
if (! empty($arrayfields['status']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
|
||||||
{
|
{
|
||||||
print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now));
|
print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now));
|
||||||
@ -444,22 +646,32 @@ if ($resql)
|
|||||||
print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0);
|
print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now)?1:0);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td></td>';
|
}
|
||||||
|
// Action column
|
||||||
|
print '<td class="nowrap" align="center">';
|
||||||
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
|
{
|
||||||
|
$selected=0;
|
||||||
|
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||||
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
if (! $i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
|
$parameters=array('sql' => $sql);
|
||||||
|
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -567,7 +567,7 @@ print '<td class="liste_titre" align="right">';
|
|||||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpitco;
|
print $searchpitco;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
$plannedworkloadoutputformat='allhourmin';
|
$plannedworkloadoutputformat='allhourmin';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user