diff --git a/lib/classes/databox.php b/lib/classes/databox.php index 325c2b545b..7bea4f31b5 100644 --- a/lib/classes/databox.php +++ b/lib/classes/databox.php @@ -672,6 +672,8 @@ class databox extends base */ public function get_meta_structure() { + $metaStructData = array(); + if ($this->meta_struct) { return $this->meta_struct; } @@ -685,13 +687,15 @@ class databox extends base $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $metaStructData = $rs; - $this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT); + if ($rs) { + $metaStructData = $rs; + $this->set_data_to_cache($metaStructData, self::CACHE_META_STRUCT); + } } $this->meta_struct = new databox_descriptionStructure(); - foreach ($metaStructData as $row) { + foreach ((array) $metaStructData as $row) { $this->meta_struct->add_element(databox_field::get_instance($this->app, $this, $row['id'])); } diff --git a/lib/classes/module/report/activity.php b/lib/classes/module/report/activity.php index 59940457cf..1ca2b58ec0 100644 --- a/lib/classes/module/report/activity.php +++ b/lib/classes/module/report/activity.php @@ -466,7 +466,7 @@ class module_report_activity extends module_report //set title $this->title = _('report:: Detail des telechargements'); - $this->setDateField('log_search.date'); + $this->setDateField('log_docs.date'); $sqlBuilder = new module_report_sql($this->app, $this); $filter = $sqlBuilder->getFilters()->getReportFilter(); $params = array_merge(array(), $filter['params']); @@ -602,7 +602,7 @@ class module_report_activity extends module_report $params = array(':site_id' => $app['phraseanet.configuration']['main']['key']); - $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_search.date'); + $datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax, 'log_docs.date'); $params = array_merge($params, $datefilter['params']); /* $sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid @@ -623,11 +623,11 @@ class module_report_activity extends module_report */ $sql = "SELECT tt.usrid, tt.user, tt.final, tt.record_id, SUM(1) AS nb, SUM(size) AS poid\n" . " FROM (\n" - . " SELECT DISTINCT(log.id), log.usrid, user, final, log_date.record_id\n" - . " FROM (log_docs AS log_date)\n" - . " INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_date.log_id)\n" + . " SELECT DISTINCT(log.id), log.usrid, user, final, log_docs.record_id\n" + . " FROM (log_docs)\n" + . " INNER JOIN log FORCE INDEX (date_site) ON (log.id = log_docs.log_id)\n" . " WHERE log.site = :site_id\n" - . " AND log_date.action = 'download'\n" + . " AND log_docs.action = 'download'\n" . " AND (" . $datefilter['sql'] . ")\n" . ") AS tt\n" . "LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)\n" diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php index cf77544c78..e07e696b50 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php @@ -523,6 +523,8 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testPostEmptyCollectionWithHighRecordAmount() { + $this->markTestSkipped('This tests lasts for 40 sec.'); + $this->setAdmin(true); $collection = $this->createOneCollection(); diff --git a/tests/classes/report/editTest.php b/tests/classes/report/editTest.php index a09bc6c7d7..8d6b6e1766 100644 --- a/tests/classes/report/editTest.php +++ b/tests/classes/report/editTest.php @@ -34,7 +34,6 @@ class editTest extends PhraseanetPHPUnitAuthenticatedAbstract 'record_id' => array("", 1, 1, 1, 1), 'file' => array("", 1, 0, 1, 1), 'mime' => array("", 1, 0, 1, 1), - 'size' => array("", 1, 0, 1, 1) ); foreach ($this->ret as $sbasid => $collections) { @@ -160,7 +159,6 @@ class editTest extends PhraseanetPHPUnitAuthenticatedAbstract if (! $groupby) { foreach ($report['result'] as $row) { foreach ($conf as $key => $value) { - $this->assertArrayHasKey($key, $row); $condition = is_string($row[$key]) || is_int($row[$key]); $this->assertTrue($condition);