fix #138 report / user downloads

This commit is contained in:
Nicolas Le Goff
2012-01-03 16:12:41 +01:00
parent c70755e9ec
commit 6872ceb3db
4 changed files with 34 additions and 15 deletions

View File

@@ -28,7 +28,7 @@ class module_report_download extends module_report
'usrid' => 'log.usrid',
'coll_id' => 'record.coll_id',
'xml' => 'record.xml',
'ddate' => "log.date",
'ddate' => "log_docs.date",
'id' => 'log_docs.id',
'log_id' => 'log_docs.log_id',
'record_id' => 'log_docs.record_id',
@@ -39,6 +39,7 @@ class module_report_download extends module_report
'file' => 'subdef.file'
);
protected $isInformative;
/**
* constructor
*
@@ -277,5 +278,16 @@ class module_report_download extends module_report
return $array;
}
public function IsInformative()
{
return $this->isInformative;
}
public function setIsInformative($isInformative)
{
$this->isInformative = $isInformative;
}
}

View File

@@ -18,9 +18,15 @@
class module_report_sqldownload extends module_report_sql implements module_report_sqlReportInterface
{
protected $restrict = false;
public function __construct(module_report $report)
{
parent::__construct($report);
if($report->isInformative())
{
$this->restrict = true;
}
}
public function buildSql()
@@ -58,11 +64,13 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= $report_filters['sql'] ? : '';
$this->sql .= ' AND ( log_docs.action = \'download\' OR log_docs.action = \'mail\')';
if($this->restrict)
$this->sql .= ' AND ( log_docs.final = "document" OR log_docs.final = "preview")';
$this->sql .= empty($record_filters['sql']) ? '' : ' AND ( ' . $record_filters['sql'] . ' )';
$this->sql .= $this->filter->getOrderFilter() ? : '';
// var_dump(str_replace(array_keys($this->params), array_values($this->params), $this->sql), $this->sql, $this->params);
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();
@@ -141,7 +149,8 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= ( $name == 'record_id' && $this->on == 'DOC') ? ' , final' : '';
if ($this->filter->getOrderFilter()) $this->sql .= $this->filter->getOrderFilter();
if ($this->filter->getOrderFilter())
$this->sql .= $this->filter->getOrderFilter();
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);

View File

@@ -396,8 +396,9 @@ function getHistory($obj, $param, $twig, $conf, $dl = false, $title)
elseif (!empty($param['on']) && !empty($param['user']))
$filter->addfilter($param['on'], '=', $param['user']);
if ($dl)
$filter->addfilter("(log_docs.final = 'document'", "OR", "log_docs.final = 'preview')");
{
$obj->setIsInformative(true);
}
$tab_filter = $filter->getTabFilter();
$obj->setFilter($tab_filter);

View File

@@ -129,6 +129,7 @@ iframe{
padding: 0 auto;
clear:both;
margin-bottom:10px;
overflow:auto;
}
.report-table table {
@@ -417,15 +418,11 @@ table.tablesorter tr th.SortDown {
}
.onload{
background-image:url(ajax-loader.gif);
background-position:center center;
background-repeat:no-repeat;
}
.onloadd{
background-image:url(ajax-loader2.gif);
background-position:center center;
background-repeat:no-repeat;
}
.ui-tabs, .ui-tabs .ui-tabs-panel{
padding:0;
}