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

Increase default date range to current month instead of current day

parent 36cad55e
No related branches found
No related tags found
No related merge requests found
<?php <?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com> * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* *
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (! $user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
...@@ -66,6 +67,9 @@ $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday" ...@@ -66,6 +67,9 @@ $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"
// checks:if date_start>date_end then date_end=date_start + 24 hours // checks:if date_start>date_end then date_end=date_start + 24 hours
if ($date_start > $date_end) $date_end=$date_start+86400; if ($date_start > $date_end) $date_end=$date_start+86400;
$now = dol_now();
$nowarray = dol_getdate($now);
$params = "&amp;search_code=$search_code&amp;search_ip=$search_ip&amp;search_user=$search_user&amp;search_desc=$search_desc&amp;search_ua=$search_ua"; $params = "&amp;search_code=$search_code&amp;search_ip=$search_ip&amp;search_user=$search_user&amp;search_desc=$search_desc&amp;search_ua=$search_ua";
$params.= "&amp;date_startmonth=".$_REQUEST["date_startmonth"]; $params.= "&amp;date_startmonth=".$_REQUEST["date_startmonth"];
$params.= "&amp;date_startday=".$_REQUEST["date_startday"]; $params.= "&amp;date_startday=".$_REQUEST["date_startday"];
...@@ -74,10 +78,13 @@ $params.= "&amp;date_endmonth=".$_REQUEST["date_endmonth"]; ...@@ -74,10 +78,13 @@ $params.= "&amp;date_endmonth=".$_REQUEST["date_endmonth"];
$params.= "&amp;date_endday=".$_REQUEST["date_endday"]; $params.= "&amp;date_endday=".$_REQUEST["date_endday"];
$params.= "&amp;date_endyear=".$_REQUEST["date_endyear"]; $params.= "&amp;date_endyear=".$_REQUEST["date_endyear"];
if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($date_start)) // We define date_start and date_end
{
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
}
if (empty($date_end))
{ {
$date_start=dol_mktime(0,0,0,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time())); $date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
$date_end=dol_mktime(23,59,59,strftime("%m",time()),strftime("%d",time()),strftime("%Y",time()));
} }
......
...@@ -1127,19 +1127,6 @@ function dol_getdate($timestamp,$fast=false) ...@@ -1127,19 +1127,6 @@ function dol_getdate($timestamp,$fast=false)
else else
{ {
$arrayinfo=getdate($timestamp); $arrayinfo=getdate($timestamp);
/*$startday=isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
if($startday==1)
{
if ($arrayinfo["wday"]==0)
{
$arrayinfo["wday"]=6;
}
else
{
$arrayinfo["wday"]=$arrayinfo["wday"]-1;
}
}*/
} }
return $arrayinfo; return $arrayinfo;
...@@ -2886,14 +2873,14 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr ...@@ -2886,14 +2873,14 @@ function print_fleche_navigation($page,$file,$options='',$nextpage=0,$betweenarr
print '<div class="pagination"><ul>'; print '<div class="pagination"><ul>';
if ($page > 0) if ($page > 0)
{ {
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>'; if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page-1).$options.'"><</a></li>';
else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>'; else print '<li><a data-role="button" data-icon="arrow-l" data-iconpos="left" href="'.$file.'?page='.($page-1).$options.'">'.$langs->trans("Previous").'</a></li>';
} }
//if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':''); //if ($betweenarrows) print ($page > 0?' ':'').$betweenarrows.($nextpage>0?' ':'');
print $betweenarrows; print $betweenarrows;
if ($nextpage > 0) if ($nextpage > 0)
{ {
if (empty($conf->dol_use_jmobile)) print '<li><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>'; if (empty($conf->dol_use_jmobile)) print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page+1).$options.'">></a></li>';
else print '<li><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a></li>'; else print '<li><a data-role="button" data-icon="arrow-r" data-iconpos="right" href="'.$file.'?page='.($page+1).$options.'">'.$langs->trans("Next").'</a></li>';
} }
if ($afterarrows) if ($afterarrows)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment