|
@@ -32,13 +32,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|
|
-if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
|
-if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
|
|
+if (!empty($conf->projet->enabled)) {
|
|
|
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|
|
+}
|
|
|
+if (!empty($conf->contrat->enabled)) {
|
|
|
+ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
|
|
+}
|
|
|
|
|
|
// Load translation files required by the page
|
|
|
$langs->loadLangs(array('companies', 'bills', 'interventions'));
|
|
|
-if (!empty($conf->projet->enabled)) $langs->load("projects");
|
|
|
-if (!empty($conf->contrat->enabled)) $langs->load("contracts");
|
|
|
+if (!empty($conf->projet->enabled)) {
|
|
|
+ $langs->load("projects");
|
|
|
+}
|
|
|
+if (!empty($conf->contrat->enabled)) {
|
|
|
+ $langs->load("contracts");
|
|
|
+}
|
|
|
|
|
|
$action = GETPOST('action', 'aZ09');
|
|
|
$massaction = GETPOST('massaction', 'alpha');
|
|
@@ -59,7 +67,9 @@ $socid = GETPOST('socid', 'int');
|
|
|
|
|
|
// Security check
|
|
|
$id = GETPOST('id', 'int');
|
|
|
-if ($user->socid) $socid = $user->socid;
|
|
|
+if ($user->socid) {
|
|
|
+ $socid = $user->socid;
|
|
|
+}
|
|
|
$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
|
|
|
|
|
|
$diroutputmassaction = $conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id;
|
|
@@ -68,14 +78,17 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
|
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
|
|
+if (empty($page) || $page == -1) {
|
|
|
+ $page = 0;
|
|
|
+} // If $page is not defined, or '' or -1
|
|
|
$offset = $limit * $page;
|
|
|
$pageprev = $page - 1;
|
|
|
$pagenext = $page + 1;
|
|
|
-if (!$sortorder) $sortorder = "DESC";
|
|
|
-if (!$sortfield)
|
|
|
-{
|
|
|
- $sortfield = "f.ref";
|
|
|
+if (!$sortorder) {
|
|
|
+ $sortorder = "DESC";
|
|
|
+}
|
|
|
+if (!$sortfield) {
|
|
|
+ $sortfield = "f.ref";
|
|
|
}
|
|
|
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
@@ -97,8 +110,12 @@ $fieldstosearchall = array(
|
|
|
'f.note_public'=>'NotePublic',
|
|
|
'fd.description'=>'DescriptionOfLine',
|
|
|
);
|
|
|
-if (empty($user->socid)) $fieldstosearchall["f.note_private"] = "NotePrivate";
|
|
|
-if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['fd.description']);
|
|
|
+if (empty($user->socid)) {
|
|
|
+ $fieldstosearchall["f.note_private"] = "NotePrivate";
|
|
|
+}
|
|
|
+if (!empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
|
|
+ unset($fieldstosearchall['fd.description']);
|
|
|
+}
|
|
|
|
|
|
// Definition of fields for list
|
|
|
$arrayfields = array(
|
|
@@ -127,21 +144,25 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|
|
* Actions
|
|
|
*/
|
|
|
|
|
|
-if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
|
|
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; }
|
|
|
+if (GETPOST('cancel', 'alpha')) {
|
|
|
+ $action = 'list'; $massaction = '';
|
|
|
+}
|
|
|
+if (!GETPOST('confirmmassaction', 'alpha') && $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 ($reshook < 0) {
|
|
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
+}
|
|
|
|
|
|
-if (empty($reshook))
|
|
|
-{
|
|
|
+if (empty($reshook)) {
|
|
|
// Selection of new fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
|
|
|
// Purge search criteria
|
|
|
- if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
|
|
- {
|
|
|
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
|
|
$search_ref = "";
|
|
|
$search_company = "";
|
|
|
$search_projet_ref = "";
|
|
@@ -187,10 +208,8 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
|
|
|
$atleastonefieldinlines = 0;
|
|
|
-foreach ($arrayfields as $tmpkey => $tmpval)
|
|
|
-{
|
|
|
- if (preg_match('/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey]['checked']))
|
|
|
- {
|
|
|
+foreach ($arrayfields as $tmpkey => $tmpval) {
|
|
|
+ if (preg_match('/^fd\./', $tmpkey) && !empty($arrayfields[$tmpkey]['checked'])) {
|
|
|
$atleastonefieldinlines++;
|
|
|
break;
|
|
|
}
|
|
@@ -198,7 +217,9 @@ foreach ($arrayfields as $tmpkey => $tmpval)
|
|
|
|
|
|
$sql = "SELECT";
|
|
|
$sql .= " f.ref, f.rowid, f.fk_statut as status, f.description, f.datec as date_creation, f.tms as date_update, f.note_public, f.note_private,";
|
|
|
-if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
|
|
|
+if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
|
|
|
+ $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
|
|
|
+}
|
|
|
$sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus";
|
|
|
if (!empty($conf->projet->enabled)) {
|
|
|
$sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
|
|
@@ -208,7 +229,9 @@ if (!empty($conf->contrat->enabled)) {
|
|
|
}
|
|
|
// Add fields from extrafields
|
|
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
|
|
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
|
|
+ $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
|
|
+ }
|
|
|
}
|
|
|
// Add fields from hooks
|
|
|
$parameters = array();
|
|
@@ -221,9 +244,15 @@ if (!empty($conf->projet->enabled)) {
|
|
|
if (!empty($conf->contrat->enabled)) {
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid";
|
|
|
}
|
|
|
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
|
|
|
-if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
|
|
-if (!$user->rights->societe->client->voir && empty($socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
|
|
|
+}
|
|
|
+if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
|
|
|
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
|
|
|
+}
|
|
|
+if (!$user->rights->societe->client->voir && empty($socid)) {
|
|
|
+ $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
+}
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
@@ -240,16 +269,21 @@ if ($search_contrat_ref) {
|
|
|
$sql .= natural_search('c.ref', $search_contrat_ref);
|
|
|
}
|
|
|
if ($search_desc) {
|
|
|
- if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
|
|
|
- else $sql .= natural_search(array('f.description'), $search_desc);
|
|
|
+ if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) {
|
|
|
+ $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
|
|
|
+ } else {
|
|
|
+ $sql .= natural_search(array('f.description'), $search_desc);
|
|
|
+ }
|
|
|
}
|
|
|
if ($search_status != '' && $search_status >= 0) {
|
|
|
$sql .= ' AND f.fk_statut = '.urlencode($search_status);
|
|
|
}
|
|
|
-if (!$user->rights->societe->client->voir && empty($socid))
|
|
|
+if (!$user->rights->societe->client->voir && empty($socid)) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
|
|
-if ($socid)
|
|
|
+}
|
|
|
+if ($socid) {
|
|
|
$sql .= " AND s.rowid = ".$socid;
|
|
|
+}
|
|
|
if ($sall) {
|
|
|
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
|
|
}
|
|
@@ -263,12 +297,10 @@ $sql .= $db->order($sortfield, $sortorder);
|
|
|
|
|
|
// Count total nb of records
|
|
|
$nbtotalofrecords = '';
|
|
|
-if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
-{
|
|
|
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
|
$result = $db->query($sql);
|
|
|
$nbtotalofrecords = $db->num_rows($result);
|
|
|
- if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
|
|
- {
|
|
|
+ if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
|
|
$page = 0;
|
|
|
$offset = 0;
|
|
|
}
|
|
@@ -278,30 +310,50 @@ $sql .= $db->plimit($limit + 1, $offset);
|
|
|
//print $sql;
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
-if ($resql)
|
|
|
-{
|
|
|
+if ($resql) {
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
|
|
- if ($socid > 0)
|
|
|
- {
|
|
|
+ if ($socid > 0) {
|
|
|
$soc = new Societe($db);
|
|
|
$soc->fetch($socid);
|
|
|
- if (empty($search_company)) $search_company = $soc->name;
|
|
|
+ if (empty($search_company)) {
|
|
|
+ $search_company = $soc->name;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$param = '';
|
|
|
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
|
|
- if ($sall) $param .= "&sall=".urlencode($sall);
|
|
|
- if ($socid) $param .= "&socid=".urlencode($socid);
|
|
|
- if ($search_ref) $param .= "&search_ref=".urlencode($search_ref);
|
|
|
- if ($search_company) $param .= "&search_company=".urlencode($search_company);
|
|
|
- if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
|
|
|
- if ($search_status != '' && $search_status > -1) $param .= "&search_status=".urlencode($search_status);
|
|
|
- if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
|
|
- if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
+ $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+ }
|
|
|
+ if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.urlencode($limit);
|
|
|
+ }
|
|
|
+ if ($sall) {
|
|
|
+ $param .= "&sall=".urlencode($sall);
|
|
|
+ }
|
|
|
+ if ($socid) {
|
|
|
+ $param .= "&socid=".urlencode($socid);
|
|
|
+ }
|
|
|
+ if ($search_ref) {
|
|
|
+ $param .= "&search_ref=".urlencode($search_ref);
|
|
|
+ }
|
|
|
+ if ($search_company) {
|
|
|
+ $param .= "&search_company=".urlencode($search_company);
|
|
|
+ }
|
|
|
+ if ($search_desc) {
|
|
|
+ $param .= "&search_desc=".urlencode($search_desc);
|
|
|
+ }
|
|
|
+ if ($search_status != '' && $search_status > -1) {
|
|
|
+ $param .= "&search_status=".urlencode($search_status);
|
|
|
+ }
|
|
|
+ if ($show_files) {
|
|
|
+ $param .= '&show_files='.urlencode($show_files);
|
|
|
+ }
|
|
|
+ if ($optioncss != '') {
|
|
|
+ $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+ }
|
|
|
// Add $param from extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|
|
|
|
@@ -311,19 +363,27 @@ if ($resql)
|
|
|
'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
//'presend'=>$langs->trans("SendByMail"),
|
|
|
);
|
|
|
- if ($user->rights->ficheinter->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
- if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
|
|
+ if ($user->rights->ficheinter->supprimer) {
|
|
|
+ $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
+ }
|
|
|
+ if (in_array($massaction, array('presend', 'predelete'))) {
|
|
|
+ $arrayofmassactions = array();
|
|
|
+ }
|
|
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
|
|
|
|
$newcardbutton = '';
|
|
|
|
|
|
$url = DOL_URL_ROOT.'/fichinter/card.php?action=create';
|
|
|
- if (!empty($socid)) $url .= '&socid='.$socid;
|
|
|
+ if (!empty($socid)) {
|
|
|
+ $url .= '&socid='.$socid;
|
|
|
+ }
|
|
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewIntervention'), '', 'fa fa-plus-circle', $url, '', $user->rights->ficheinter->creer);
|
|
|
|
|
|
// Lines of title fields
|
|
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
- if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+ if ($optioncss != '') {
|
|
|
+ print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+ }
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
print '<input type="hidden" name="action" value="list">';
|
|
@@ -339,9 +399,10 @@ if ($resql)
|
|
|
$trackid = 'int'.$object->id;
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|
|
|
|
|
- if ($sall)
|
|
|
- {
|
|
|
- foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ if ($sall) {
|
|
|
+ foreach ($fieldstosearchall as $key => $val) {
|
|
|
+ $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ }
|
|
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
|
|
|
}
|
|
|
|
|
@@ -349,48 +410,47 @@ if ($resql)
|
|
|
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
- if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|
|
- else $moreforfilter = $hookmanager->resPrint;
|
|
|
+ if (empty($reshook)) {
|
|
|
+ $moreforfilter .= $hookmanager->resPrint;
|
|
|
+ } else {
|
|
|
+ $moreforfilter = $hookmanager->resPrint;
|
|
|
+ }
|
|
|
|
|
|
- if (!empty($moreforfilter))
|
|
|
- {
|
|
|
+ if (!empty($moreforfilter)) {
|
|
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
|
print $moreforfilter;
|
|
|
print '</div>';
|
|
|
}
|
|
|
|
|
|
- if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
+ if ($massactionbutton) {
|
|
|
+ $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
+ }
|
|
|
|
|
|
print '<div class="div-table-responsive">';
|
|
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
|
|
|
|
print '<tr class="liste_titre_filter">';
|
|
|
- if (!empty($arrayfields['f.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.ref']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="8">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['s.nom']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input type="text" class="flat" name="search_company" value="'.$search_company.'" size="10">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['pr.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['pr.ref']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input type="text" class="flat" name="search_projet_ref" value="'.$search_projet_ref.'" size="8">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['c.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['c.ref']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input type="text" class="flat" name="search_contrat_ref" value="'.$search_contrat_ref.'" size="8">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['f.description']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.description']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
|
|
|
print '</td>';
|
|
@@ -402,51 +462,45 @@ if ($resql)
|
|
|
$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['f.datec']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.datec']['checked'])) {
|
|
|
// Date creation
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['f.tms']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.tms']['checked'])) {
|
|
|
// Date modification
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['f.note_public']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.note_public']['checked'])) {
|
|
|
// Note public
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['f.note_private']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.note_private']['checked'])) {
|
|
|
// Note private
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Status
|
|
|
- if (!empty($arrayfields['f.fk_statut']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
|
|
print '<td class="liste_titre right">';
|
|
|
$tmp = $objectstatic->LibStatut(0); // To load $this->statuts_short
|
|
|
$liststatus = $objectstatic->statuts_short;
|
|
|
- if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
|
|
|
+ if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
|
|
|
+ unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
|
|
|
+ }
|
|
|
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Fields of detail line
|
|
|
- if (!empty($arrayfields['fd.description']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.description']['checked'])) {
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['fd.date']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.date']['checked'])) {
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
}
|
|
|
- if (!empty($arrayfields['fd.duree']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.duree']['checked'])) {
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
}
|
|
|
print '<td class="liste_titre maxwidthsearch">';
|
|
@@ -457,33 +511,58 @@ if ($resql)
|
|
|
print "</tr>\n";
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
- if (!empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $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);
|
|
|
- if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $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);
|
|
|
- if (!empty($arrayfields['f.description']['checked'])) print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
|
|
|
+ if (!empty($arrayfields['f.ref']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $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);
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['pr.ref']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], "pr.ref", "", $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);
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['f.description']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
|
|
|
+ }
|
|
|
// Extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|
|
// Hook fields
|
|
|
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
- if (!empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
- if (!empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
- if (!empty($arrayfields['f.note_public']['checked'])) print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
- if (!empty($arrayfields['f.note_private']['checked'])) print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
- if (!empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
- if (!empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
|
|
|
- if (!empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
- if (!empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+ if (!empty($arrayfields['f.datec']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['f.tms']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['f.note_public']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.note_public']['label'], $_SERVER["PHP_SELF"], "f.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['f.note_private']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['fd.description']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['fd.date']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+ }
|
|
|
+ if (!empty($arrayfields['fd.duree']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+ }
|
|
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
|
|
print "</tr>\n";
|
|
|
|
|
|
$total = 0;
|
|
|
$i = 0;
|
|
|
$totalarray = array();
|
|
|
- while ($i < min($num, $limit))
|
|
|
- {
|
|
|
+ while ($i < min($num, $limit)) {
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
|
$objectstatic->id = $obj->rowid;
|
|
@@ -500,8 +579,7 @@ if ($resql)
|
|
|
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
|
- if (!empty($arrayfields['f.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.ref']['checked'])) {
|
|
|
print "<td>";
|
|
|
|
|
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
|
@@ -512,15 +590,13 @@ if ($resql)
|
|
|
// Warning
|
|
|
$warnornote = '';
|
|
|
//if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->fichinter->warning_delay)) $warnornote.=img_warning($langs->trans("Late"));
|
|
|
- if (!empty($obj->note_private))
|
|
|
- {
|
|
|
+ if (!empty($obj->note_private)) {
|
|
|
$warnornote .= ($warnornote ? ' ' : '');
|
|
|
$warnornote .= '<span class="note">';
|
|
|
$warnornote .= '<a href="note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
|
|
|
$warnornote .= '</span>';
|
|
|
}
|
|
|
- if ($warnornote)
|
|
|
- {
|
|
|
+ if ($warnornote) {
|
|
|
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
|
|
print $warnornote;
|
|
|
print '</td>';
|
|
@@ -535,17 +611,19 @@ if ($resql)
|
|
|
print '</td></tr></table>';
|
|
|
|
|
|
print "</td>\n";
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['s.nom']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
print '<td>';
|
|
|
print $companystatic->getNomUrl(1, '', 44);
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['pr.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['pr.ref']['checked'])) {
|
|
|
print '<td>';
|
|
|
$projetstatic->id = $obj->projet_id;
|
|
|
$projetstatic->ref = $obj->projet_ref;
|
|
@@ -554,10 +632,11 @@ if ($resql)
|
|
|
print $projetstatic->getNomUrl(1, '');
|
|
|
}
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['c.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['c.ref']['checked'])) {
|
|
|
print '<td>';
|
|
|
$contratstatic->id = $obj->contrat_id;
|
|
|
$contratstatic->ref = $obj->contrat_ref;
|
|
@@ -567,12 +646,15 @@ if ($resql)
|
|
|
print $contratstatic->getNomUrl(1, '');
|
|
|
print '</td>';
|
|
|
}
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['f.description']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.description']['checked'])) {
|
|
|
print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description), 48).'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Extra fields
|
|
@@ -582,71 +664,84 @@ if ($resql)
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Date creation
|
|
|
- if (!empty($arrayfields['f.datec']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.datec']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Date modification
|
|
|
- if (!empty($arrayfields['f.tms']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.tms']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Note public
|
|
|
- if (!empty($arrayfields['f.note_public']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.note_public']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
print dol_escape_htmltag($obj->note_public);
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Note private
|
|
|
- if (!empty($arrayfields['f.note_private']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.note_private']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
print dol_escape_htmltag($obj->note_private);
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Status
|
|
|
- if (!empty($arrayfields['f.fk_statut']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
|
|
print '<td class="right">'.$objectstatic->getLibStatut(5).'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Fields of detail of line
|
|
|
- if (!empty($arrayfields['fd.description']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.description']['checked'])) {
|
|
|
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['fd.date']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.date']['checked'])) {
|
|
|
print '<td class="center">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
- if (!empty($arrayfields['fd.duree']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['fd.duree']['checked'])) {
|
|
|
print '<td class="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['pos'][$totalarray['nbfield']] = 'fd.duree';
|
|
|
+ }
|
|
|
$totalarray['val']['fd.duree'] += $obj->duree;
|
|
|
}
|
|
|
// Action column
|
|
|
print '<td class="nowrap center">';
|
|
|
- if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
- {
|
|
|
+ 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;
|
|
|
+ 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']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
@@ -669,7 +764,9 @@ if ($resql)
|
|
|
print "</form>\n";
|
|
|
|
|
|
$hidegeneratedfilelistifempty = 1;
|
|
|
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
|
|
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
|
|
+ $hidegeneratedfilelistifempty = 0;
|
|
|
+ }
|
|
|
|
|
|
// Show list of available documents
|
|
|
$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|