|
@@ -30,11 +30,11 @@
|
|
|
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
|
|
|
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
|
|
|
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
|
|
|
-//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
|
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
|
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
|
|
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
|
|
|
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
|
|
|
+//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
|
|
|
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
|
|
|
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
|
|
|
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', '1'); // The main.inc.php does not make a redirect if not logged, instead show simple error message
|
|
@@ -129,11 +129,11 @@ $arrayfields = array();
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
// If $val['visible']==0, then we never show the field
|
|
|
if (!empty($val['visible'])) {
|
|
|
- $visible = (int) dol_eval($val['visible'], 1, 1, '1');
|
|
|
+ $visible = (int) dol_eval($val['visible'], 1);
|
|
|
$arrayfields['t.'.$key] = array(
|
|
|
'label'=>$val['label'],
|
|
|
'checked'=>(($visible < 0) ? 0 : 1),
|
|
|
- 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
|
|
+ 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
|
|
'position'=>$val['position'],
|
|
|
'help'=> isset($val['help']) ? $val['help'] : ''
|
|
|
);
|
|
@@ -318,7 +318,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
}
|
|
|
// Add where from hooks
|
|
|
$parameters=array();
|
|
|
-$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
+$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
$sql .= $hookmanager->resPrint;
|
|
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
|
|
*/
|
|
@@ -326,8 +326,15 @@ $sql = preg_replace('/,\s*$/', '', $sql);
|
|
|
// Count total nb of records
|
|
|
$nbtotalofrecords = '';
|
|
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
|
- $resql = $db->query($sql);
|
|
|
- $nbtotalofrecords = $db->num_rows($resql);
|
|
|
+ /* The fast and low memory method to get and count full list converts the sql into a sql count */
|
|
|
+ $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
|
|
+ $resql = $db->query($sqlforcount);
|
|
|
+ if ($resql) {
|
|
|
+ $objforcount = $db->fetch_object($resql);
|
|
|
+ $nbtotalofrecords = $objforcount->nbtotalofrecords;
|
|
|
+ } else {
|
|
|
+ dol_print_error($db);
|
|
|
+ }
|
|
|
|
|
|
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
|
|
$page = 0;
|
|
@@ -543,7 +550,7 @@ $arrayofmassactions = array(
|
|
|
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
|
|
|
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
|
|
);
|
|
|
-if ($permissiontodelete) {
|
|
|
+if (!empty($permissiontodelete)) {
|
|
|
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
|
|
}
|
|
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
|
@@ -560,12 +567,17 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
|
|
print '<input type="hidden" name="action" value="list">';
|
|
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
-//print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
+print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
|
|
|
|
-$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
|
|
|
+
|
|
|
+$newcardbutton = '';
|
|
|
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
|
|
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
|
|
+$newcardbutton .= dolGetButtonTitleSeparator();
|
|
|
+$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.((int) $id)), '', $permissiontoadd);
|
|
|
|
|
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
|
|
|
|
@@ -577,10 +589,13 @@ $trackid = 'recruitmentapplication'.$object->id;
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|
|
|
|
|
if ($search_all) {
|
|
|
+ $setupstring = '';
|
|
|
foreach ($fieldstosearchall as $key => $val) {
|
|
|
$fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ $setupstring .= $key."=".$val.";";
|
|
|
}
|
|
|
- print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
|
|
+ print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
|
|
|
+ print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
|
|
|
}
|
|
|
|
|
|
$moreforfilter = '';
|
|
@@ -603,7 +618,7 @@ if (!empty($moreforfilter)) {
|
|
|
}
|
|
|
|
|
|
$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, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
|
|
|
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
|
|
|
|
|
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
|
@@ -613,8 +628,16 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
|
|
// Fields title search
|
|
|
// --------------------------------------------------------------------
|
|
|
print '<tr class="liste_titre">';
|
|
|
+// Action column
|
|
|
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
|
|
+ print '<td class="liste_titre maxwidthsearch">';
|
|
|
+ $searchpicto = $form->showFilterButtons('left');
|
|
|
+ print $searchpicto;
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
- $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
|
|
+ $searchkey = empty($search[$key]) ? '' : $search[$key];
|
|
|
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
if ($key == 'status') {
|
|
|
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
|
@@ -655,10 +678,12 @@ $parameters = array('arrayfields'=>$arrayfields);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Action column
|
|
|
-print '<td class="liste_titre maxwidthsearch">';
|
|
|
-$searchpicto = $form->showFilterButtons();
|
|
|
-print $searchpicto;
|
|
|
-print '</td>';
|
|
|
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
|
|
+ print '<td class="liste_titre maxwidthsearch">';
|
|
|
+ $searchpicto = $form->showFilterButtons();
|
|
|
+ print $searchpicto;
|
|
|
+ print '</td>';
|
|
|
+}
|
|
|
print '</tr>'."\n";
|
|
|
|
|
|
$totalarray = array();
|
|
@@ -667,6 +692,9 @@ $totalarray['nbfield'] = 0;
|
|
|
// Fields title label
|
|
|
// --------------------------------------------------------------------
|
|
|
print '<tr class="liste_titre">';
|
|
|
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
|
|
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
|
|
+}
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
|
|
if ($key == 'status') {
|
|
@@ -675,21 +703,25 @@ foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
} elseif (in_array($val['type'], array('timestamp'))) {
|
|
|
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
|
|
+ } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
|
|
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
}
|
|
|
+ $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
|
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
|
|
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
|
|
+ $totalarray['nbfield']++;
|
|
|
}
|
|
|
}
|
|
|
// 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);
|
|
|
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Action column
|
|
|
-print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
|
|
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
|
|
|
+ print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
|
|
+}
|
|
|
$totalarray['nbfield']++;
|
|
|
print '</tr>'."\n";
|
|
|
|
|
@@ -735,7 +767,19 @@ while ($i < $imaxinloop) {
|
|
|
} else {
|
|
|
// Show here line of result
|
|
|
$j = 0;
|
|
|
- print '<tr class="oddeven">';
|
|
|
+ print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
|
|
+ // Action column
|
|
|
+ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_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
|
|
|
+ $selected = 0;
|
|
|
+ if (in_array($object->id, $arrayofselected)) {
|
|
|
+ $selected = 1;
|
|
|
+ }
|
|
|
+ print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
+ }
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
|
|
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
|
@@ -756,7 +800,11 @@ while ($i < $imaxinloop) {
|
|
|
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
|
|
|
|
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
|
|
- print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
|
|
+ print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
|
|
|
+ if (preg_match('/tdoverflow/', $cssforfield)) {
|
|
|
+ print ' title="'.dol_escape_htmltag($object->$key).'"';
|
|
|
+ }
|
|
|
+ print '>';
|
|
|
if ($key == 'status') {
|
|
|
print $object->getLibStatut(5);
|
|
|
} elseif ($key == 'rowid') {
|
|
@@ -789,15 +837,17 @@ while ($i < $imaxinloop) {
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// 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
|
|
|
- $selected = 0;
|
|
|
- if (in_array($object->id, $arrayofselected)) {
|
|
|
- $selected = 1;
|
|
|
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_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
|
|
|
+ $selected = 0;
|
|
|
+ if (in_array($object->id, $arrayofselected)) {
|
|
|
+ $selected = 1;
|
|
|
+ }
|
|
|
+ print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
}
|
|
|
- print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
+ print '</td>';
|
|
|
}
|
|
|
- print '</td>';
|
|
|
if (!$i) {
|
|
|
$totalarray['nbfield']++;
|
|
|
}
|
|
@@ -826,7 +876,7 @@ if ($num == 0) {
|
|
|
$db->free($resql);
|
|
|
|
|
|
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
|
|
-$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
|
|
|
print '</table>'."\n";
|