Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Dec 8, 2017
2 parents a5bdadf + c0f7d83 commit 3ef215c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
32 changes: 31 additions & 1 deletion htdocs/blockedlog/admin/blockedlog_list.php
Expand Up @@ -46,6 +46,13 @@
$pageprev = $page - 1;
$pagenext = $page + 1;

$search_start = -1;
if(GETPOST('search_startyear')!='') $search_start = dol_mktime(0, 0, 0, GETPOST('search_startmonth'), GETPOST('search_startday'), GETPOST('search_startyear'));

$search_end = -1;
if(GETPOST('search_endyear')!='') $search_end= dol_mktime(0, 0, 0, GETPOST('search_endmonth'), GETPOST('search_endday'), GETPOST('search_endyear'));


if (empty($sortfield)) $sortfield='rowid';
if (empty($sortorder)) $sortorder='DESC';

Expand Down Expand Up @@ -128,7 +135,7 @@
* View
*/

$blocks = $block_static->getLog('all', 0, GETPOST('all','alpha') ? 0 : 50, $sortfield, $sortorder);
$blocks = $block_static->getLog('all', 0, GETPOST('all','alpha') ? 0 : 50, $sortfield, $sortorder, $search_start, $search_end);

$form=new Form($db);

Expand All @@ -154,7 +161,27 @@


print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table

print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

print '<table class="noborder" width="100%">';
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">&nbsp;</td>';

print '<td class="liste_titre">';
print $form->select_date($search_start,'search_start');
print $form->select_date($search_end,'search_end');
print '</td>';

print '<td class="liste_titre" colspan="7">&nbsp;</td>';

// Action column
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';

print '</tr>';

print '<tr class="liste_titre">';
print getTitleFieldOfList($langs->trans('#'), 0, $_SERVER["PHP_SELF"],'rowid','','','',$sortfield,$sortorder,'minwidth50 ')."\n";
Expand Down Expand Up @@ -226,6 +253,9 @@
}

print '</table>';

print '</form>';

print '</div>';

print '<script type="text/javascript">
Expand Down
10 changes: 7 additions & 3 deletions htdocs/blockedlog/class/blockedlog.class.php
Expand Up @@ -580,9 +580,11 @@ private function getPreviousHash($withlock=0, $beforeid=0)
* @param int $limit max number of element, 0 for all
* @param string $sortfield sort field
* @param string $sortorder sort order
* @param int $search_start start time limit
* @param int $search_end end time limit
* @return array array of object log
*/
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '')
public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_start = -1, $search_end = -1)
{
global $conf, $cachedlogs;

Expand Down Expand Up @@ -610,9 +612,11 @@ public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sorto
WHERE element='".$element."' AND fk_object=".(int) $fk_object;
}

if($search_start > 0) $sql.=" AND date_creation >= '".$this->db->idate($search_start)."'";
if($search_end> 0) $sql.=" AND date_creation <= '".$this->db->idate($search_end)."'";

$sql.=$this->db->order($sortfield, $sortorder);
//($order<0 ? ' ORDER BY rowid DESC ' : ' ORDER BY rowid ASC ');


if($limit > 0 )$sql.=' LIMIT '.$limit;

$res = $this->db->query($sql);
Expand Down

0 comments on commit 3ef215c

Please sign in to comment.