mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge branch '3.8'
Conflicts: composer.lock lib/Alchemy/Phrasea/Application.php lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php lib/Alchemy/Phrasea/Controller/AbstractDelivery.php lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php lib/Alchemy/Phrasea/Controller/Prod/Edit.php lib/Alchemy/Phrasea/Controller/Prod/Story.php lib/Alchemy/Phrasea/Controller/Prod/Upload.php lib/Alchemy/Phrasea/Controller/Report/Activity.php lib/Alchemy/Phrasea/Controller/Report/Root.php lib/Alchemy/Phrasea/Controller/Root/Account.php lib/Alchemy/Phrasea/Core/PhraseaEvents.php lib/Alchemy/Phrasea/Core/Version.php lib/classes/API/V1/adapter.php lib/classes/User/Adapter.php lib/classes/databox.php lib/classes/media/subdef.php lib/classes/module/report.php lib/classes/module/report/activity.php lib/classes/module/report/connexion.php lib/classes/module/report/download.php lib/classes/module/report/nav.php lib/classes/module/report/question.php lib/classes/module/report/sqlaction.php lib/classes/module/report/sqlconnexion.php lib/classes/module/report/sqldownload.php lib/classes/module/report/sqlfilter.php lib/classes/task/abstract.php locale/de_DE/LC_MESSAGES/phraseanet.mo locale/de_DE/LC_MESSAGES/phraseanet.po locale/en_GB/LC_MESSAGES/phraseanet.mo locale/en_GB/LC_MESSAGES/phraseanet.po locale/fr_FR/LC_MESSAGES/phraseanet.mo locale/fr_FR/LC_MESSAGES/phraseanet.po locale/nl_NL/LC_MESSAGES/phraseanet.mo locale/nl_NL/LC_MESSAGES/phraseanet.po locale/phraseanet.pot templates/web/prod/index.html.twig tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php tests/classes/api/v1/api_v1_adapterTest.php tests/classes/report/activityTest.php tests/classes/report/editTest.php
This commit is contained in:
@@ -21,7 +21,6 @@ class module_report_download extends module_report
|
||||
'activite' => 'log.activite',
|
||||
'fonction' => 'log.fonction',
|
||||
'usrid' => 'log.usrid',
|
||||
'coll_id' => 'log_colls.coll_id',
|
||||
'ddate' => "log_docs.date",
|
||||
'id' => 'log_docs.id',
|
||||
'log_id' => 'log_docs.log_id',
|
||||
@@ -44,8 +43,14 @@ class module_report_download extends module_report
|
||||
*/
|
||||
public function __construct(Application $app, $arg1, $arg2, $sbas_id, $collist)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
|
||||
$this->title = $this->app->trans('report:: telechargements');
|
||||
=======
|
||||
// parent::__construct($app, $arg1, $arg2, $sbas_id, $collist);
|
||||
parent::__construct($app, $arg1, $arg2, $sbas_id, "");
|
||||
$this->title = _('report:: telechargements');
|
||||
>>>>>>> 3.8
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,9 +60,12 @@ class module_report_download extends module_report
|
||||
*/
|
||||
protected function buildReq($groupby = false, $on = false)
|
||||
{
|
||||
$this->setDateField('log_docs.date');
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
$sql = $this->sqlBuilder('download')
|
||||
->setOn($on)->setGroupBy($groupby)->buildSql();
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
$this->req = $sql->getSql();
|
||||
$this->params = $sql->getParams();
|
||||
$this->total = $sql->getTotalRows();
|
||||
@@ -102,6 +110,7 @@ class module_report_download extends module_report
|
||||
{
|
||||
$i = 0;
|
||||
$pref = parent::getPreff($app, $this->sbas_id);
|
||||
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, var_export($rs, true)), FILE_APPEND);
|
||||
|
||||
foreach ($rs as $row) {
|
||||
if ($this->enable_limit && ($i > $this->nb_record))
|
||||
@@ -112,23 +121,28 @@ class module_report_download extends module_report
|
||||
}
|
||||
|
||||
if (array_key_exists('record_id', $row)) {
|
||||
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, $row['record_id']), FILE_APPEND);
|
||||
try {
|
||||
$record = new \record_adapter($app, $this->sbas_id, $row['record_id']);
|
||||
$caption = $record->get_caption();
|
||||
foreach ($pref as $field) {
|
||||
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s) %s\n\n", __FILE__, __LINE__, $field), FILE_APPEND);
|
||||
try {
|
||||
$this->result[$i][$field] = $caption
|
||||
->get_field($field)
|
||||
->get_serialized_values();
|
||||
} catch (\Exception $e) {
|
||||
$this->result[$i][$field] = '';
|
||||
}
|
||||
}
|
||||
} catch (\Exception_Record_AdapterNotFound $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($pref as $field) {
|
||||
try {
|
||||
$this->result[$i][$field] = $record->get_caption()
|
||||
->get_field($field)
|
||||
->get_serialized_values();
|
||||
} catch (\Exception $e) {
|
||||
foreach ($pref as $field) {
|
||||
$this->result[$i][$field] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$i ++;
|
||||
//// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n\n", __FILE__, __LINE__), FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,15 +189,20 @@ class module_report_download extends module_report
|
||||
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
||||
$conn = $databox->get_connection();
|
||||
|
||||
<<<<<<< HEAD
|
||||
$params = [':site_id' => $app['conf']->get(['main', 'key'])];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
=======
|
||||
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
|
||||
$params = array_merge($params, $datefilter['params']);
|
||||
>>>>>>> 3.8
|
||||
|
||||
$finalfilter = $datefilter['sql'] . ' AND ';
|
||||
$finalfilter .= $collfilter['sql'] . ' AND ';
|
||||
$finalfilter .= 'log.site = :site_id';
|
||||
|
||||
/*
|
||||
$sql = '
|
||||
SELECT SUM(1) AS nb
|
||||
FROM (
|
||||
@@ -198,6 +217,18 @@ class module_report_download extends module_report
|
||||
)
|
||||
) AS tt
|
||||
';
|
||||
*/
|
||||
$sql = "SELECT SUM(1) AS nb\n"
|
||||
. " FROM (\n"
|
||||
. " SELECT DISTINCT(log.id)\n"
|
||||
. " FROM log FORCE INDEX (date_site)"
|
||||
. " INNER JOIN log_docs"
|
||||
. " WHERE " . $finalfilter . "\n"
|
||||
. " AND ( log_docs.action = 'download' OR log_docs.action = 'mail' )\n"
|
||||
. " ) AS tt";
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
@@ -211,10 +242,16 @@ class module_report_download extends module_report
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
$conn = $databox->get_connection();
|
||||
|
||||
<<<<<<< HEAD
|
||||
$params = [':site_id' => $app['conf']->get(['main', 'key'])];
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
=======
|
||||
$params = array(':site_id' => $app['phraseanet.configuration']['main']['key']);
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date');
|
||||
$params = array_merge($params, $datefilter['params']);
|
||||
>>>>>>> 3.8
|
||||
|
||||
$finalfilter = "";
|
||||
$array = [
|
||||
@@ -223,9 +260,8 @@ class module_report_download extends module_report
|
||||
];
|
||||
|
||||
$finalfilter .= $datefilter['sql'] . ' AND ';
|
||||
$finalfilter .= $collfilter['sql'] . ' AND ';
|
||||
$finalfilter .= 'log.site = :site_id';
|
||||
|
||||
/*
|
||||
$sql = '
|
||||
SELECT tt.id, tt.name, SUM(1) AS nb
|
||||
FROM (
|
||||
@@ -244,6 +280,20 @@ class module_report_download extends module_report
|
||||
) AS tt
|
||||
GROUP BY id, name
|
||||
';
|
||||
*/
|
||||
$sql = "SELECT tt.id, tt.name, SUM(1) AS nb\n"
|
||||
. " FROM (\n"
|
||||
. " SELECT DISTINCT(log.id) AS log_id, log_docs.record_id as id, subdef.name\n"
|
||||
. " FROM ( log )\n"
|
||||
. " INNER JOIN log_docs ON (log.id = log_docs.log_id)\n"
|
||||
. " INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)\n"
|
||||
. " WHERE (" . $finalfilter . ")\n"
|
||||
. " AND ( log_docs.action = 'download' OR log_docs.action = 'mail' )\n"
|
||||
. " AND subdef.name = log_docs.final\n"
|
||||
. " ) AS tt\n"
|
||||
. " GROUP BY id, name\n";
|
||||
|
||||
// no_file_put_contents("/tmp/report.txt", sprintf("%s (%s)\n%s\n\n", __FILE__, __LINE__, $sql), FILE_APPEND);
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
|
Reference in New Issue
Block a user