Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-12-08 19:23:41 +01:00
commit 3ef215c3eb
2 changed files with 38 additions and 4 deletions

View File

@ -46,6 +46,13 @@ $offset = $limit * $page;
$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';
@ -128,7 +135,7 @@ else if($action === 'downloadcsv') {
* 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);
@ -154,7 +161,27 @@ print ' </div>';
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";
@ -226,6 +253,9 @@ foreach($blocks as &$block) {
}
print '</table>';
print '</form>';
print '</div>';
print '<script type="text/javascript">

View File

@ -580,9 +580,11 @@ class BlockedLog
* @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;
@ -610,9 +612,11 @@ class BlockedLog
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);