Skip to content
Snippets Groups Projects
Commit 901f952c authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #4103 from frederic34/patch-3

FIX: Navigation to resource list
parents a6d8f943 e6033369
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,6 @@
*/
// Put here all includes required by your class file
require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php";
......@@ -403,7 +402,13 @@ class Resource extends CommonObject
}
$sql.= " GROUP BY t.rowid";
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
$this->num_all = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $this->db->query($sql);
$this->num_all = $this->db->num_rows($result);
}
if ($limit) $sql.= $this->db->plimit($limit, $offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
$resql=$this->db->query($sql);
......
......@@ -22,15 +22,10 @@
*/
// Change this following line to use the correct relative path (../, ../../, etc)
$res=0;
$res=@include("../main.inc.php"); // For root directory
if (! $res) $res=@include("../../main.inc.php"); // For "custom" directory
if (! $res) die("Include of main fails");
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/resource.class.php';
require 'class/resource.class.php';
// Load traductions files requiredby by page
// Load translations files requiredby by page
$langs->load("resource");
$langs->load("companies");
$langs->load("other");
......@@ -52,7 +47,7 @@ $object = new Resource($db);
$hookmanager->initHooks(array('resource_list'));
if (empty($sortorder)) $sortorder="DESC";
if (empty($sortorder)) $sortorder="ASC";
if (empty($sortfield)) $sortfield="t.rowid";
if (empty($arch)) $arch = 0;
......@@ -89,8 +84,6 @@ llxHeader('',$pagetitle,'');
$form=new Form($db);
print_fiche_titre($pagetitle,'','title_generic');
// Confirmation suppression resource line
if ($action == 'delete_resource')
{
......@@ -102,6 +95,8 @@ $ret = $object->fetch_all($sortorder, $sortfield, $limit, $offset);
if($ret == -1) {
dol_print_error($db,$object->error);
exit;
} else {
print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $ret+1, $object->num_all,'title_generic.png');
}
if(!$ret) {
print '<div class="warning">'.$langs->trans('NoResourceInDatabase').'</div>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment