diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 39e7d4f67c8..98bb4d72361 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -555,7 +555,14 @@ while ($i < $imaxinloop) {
print '
';
}
// Output Kanban
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php
index 2826ed9b703..5cb2c0a11fe 100644
--- a/htdocs/bom/bom_list.php
+++ b/htdocs/bom/bom_list.php
@@ -697,8 +697,15 @@ while ($i < $imaxinloop) {
$prod = null;
}
- // Output kanban
- print $object->getKanbanView('', array('prod'=>$prod, 'selected' => in_array($object->id, $arrayofselected)));
+ // Output Kanban
+ $selected = -1;
+ 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 $object->getKanbanView('', array('prod'=>$prod, 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '';
print '';
diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php
index cf79f93e96e..5adc58a5c16 100644
--- a/htdocs/bookcal/availabilities_list.php
+++ b/htdocs/bookcal/availabilities_list.php
@@ -641,7 +641,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index 3e4ae193a94..1ff8d4bd42a 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -358,7 +358,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php
index 7bc7d80aa26..e1797c76ec3 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_list.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_list.php
@@ -585,7 +585,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->year_close = $obj->year_close;
$object->cheque = $obj->cheque;
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ // Output Kanban
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == (min($num, $limit) - 1)) {
print '';
print '';
diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php
index 0e3daaf496b..b9f300ddfc1 100644
--- a/htdocs/compta/prelevement/list.php
+++ b/htdocs/compta/prelevement/list.php
@@ -379,13 +379,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
+ $selected = -1;
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 $object->getKanbanView('', array('selected' => in_array($bon->id, $arrayofselected)));
+ print $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php
index 9e5a28b6905..49031f482c9 100644
--- a/htdocs/compta/tva/list.php
+++ b/htdocs/compta/tva/list.php
@@ -593,13 +593,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
+ $selected = -1;
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 $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ print $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php
index dcfb1809936..38f7f5de305 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_list.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_list.php
@@ -944,13 +944,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
+ $selected = -1;
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 $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ print $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 119b6ad9b8e..e0b69daf63c 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -908,7 +908,16 @@ while ($i < min($num, $limit)) {
}
$object->date_delivery = $obj->delivery_date;
$object->town = $obj->town;
- print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => in_array($obj->id, $arrayofselected)));
+
+ // Output Kanban
+ $selected = -1;
+ 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 $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
if ($i == min($num, $limit) - 1) {
print '';
print '';
diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php
index 4b7e343be7e..b5e08794593 100644
--- a/htdocs/hrm/evaluation_list.php
+++ b/htdocs/hrm/evaluation_list.php
@@ -643,6 +643,7 @@ while ($i < $imaxinloop) {
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user);
+ $selected = -1;
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)) {
diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php
index 369796130e8..f2c52a876e4 100644
--- a/htdocs/hrm/job_list.php
+++ b/htdocs/hrm/job_list.php
@@ -609,7 +609,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php
index dad14763a7d..449a51955d6 100644
--- a/htdocs/hrm/position_list.php
+++ b/htdocs/hrm/position_list.php
@@ -636,14 +636,15 @@ while ($i < $imaxinloop) {
$userstatic->login = $obj->login;
$userstatic->photo = $obj->photo;
- // output kanban
+ // Output kanban
+ $selected = -1;
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 $object->getKanbanView('', array('user' => $userstatic->getNomUrl(-1), 'job'=> $jobstatic->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
}
+ print $object->getKanbanView('', array('user' => $userstatic->getNomUrl(-1), 'job'=> $jobstatic->getNomUrl(1), 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '';
print '';
diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php
index b6eaef680ba..059bfb1d038 100644
--- a/htdocs/hrm/skill_list.php
+++ b/htdocs/hrm/skill_list.php
@@ -626,13 +626,15 @@ while ($i < $imaxinloop) {
$object->skill_type = $obj->skill_type;
$object->description = $obj->description;
+ // Output Kanban
+ $selected = -1;
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 $object->getKanbanView('', array('selected' => in_array($obj->id, $arrayofselected)));
+ print $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '';
print '';
diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php
index 772c2e6a6eb..84fbf128162 100644
--- a/htdocs/intracommreport/list.php
+++ b/htdocs/intracommreport/list.php
@@ -578,13 +578,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
+ $selected = -1;
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 $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ print $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index 25f41a0c719..4ac4376b32a 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -667,7 +667,14 @@ while ($i < $imaxinloop) {
print '';
}
// Output Kanban
- print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
+ $selected = -1;
+ 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 $object->getKanbanView('', array('selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '
';
print '';
diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php
index 7542932b022..ac524a79a4c 100644
--- a/htdocs/loan/list.php
+++ b/htdocs/loan/list.php
@@ -31,14 +31,16 @@ require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills", "compta", "loan"));
+$massaction = GETPOST('massaction', 'alpha');
+
$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');
-$massaction = GETPOST('massaction', 'alpha');
-if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) {
+if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
+ // If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
-} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
+}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -72,12 +74,14 @@ if ($user->socid) {
}
$result = restrictedArea($user, 'loan', '', '', '');
+
/*
* Actions
*/
if (GETPOST('cancel', 'alpha')) {
- $action = 'list'; $massaction = '';
+ $action = 'list';
+ $massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = '';
@@ -113,6 +117,8 @@ llxHeader('', $title, $help_url);
$arrayofselected = is_array($toselect) ? $toselect : array();
+// Build and execute select
+// --------------------------------------------------------------------
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.paid,";
$sql .= " SUM(pl.amount_capital) as alreadypaid";
@@ -139,7 +145,6 @@ $nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
- $sqlforcount = preg_replace('/'.preg_quote($linktopl, '/').'/', '', $sqlforcount);
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
@@ -149,7 +154,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
dol_print_error($db);
}
- 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 than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
@@ -171,6 +176,17 @@ if (!$resql) {
$num = $db->num_rows($resql);
+
+
+// Direct jump if only one record found
+if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
+ $obj = $db->fetch_object($resql);
+ $id = $obj->rowid;
+ header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.((int) $id));
+ exit;
+}
+
+
// Output page
// --------------------------------------------------------------------
if ($resql) {
@@ -209,6 +225,8 @@ if ($resql) {
$newcardbutton .= dolGetButtonTitleSeparator();
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLoan'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
+ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
+
print '