Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2019-03-28 10:44:49 +0300
committerGitHub <noreply@github.com>2019-03-28 10:44:49 +0300
commitebf779c27e32a5603146000fc4feef6cb20a6e1e (patch)
tree2f7312b7500c0a98451736d0e701e9d3d1fd9274
parent6aedd2a147cd966487058910da5c9d9c8fcc8f89 (diff)
Fix row evolution for flattened social networks report (#14266)
-rw-r--r--plugins/Referrers/API.php42
1 files changed, 26 insertions, 16 deletions
diff --git a/plugins/Referrers/API.php b/plugins/Referrers/API.php
index 3a7e19910e..b59ac8a36b 100644
--- a/plugins/Referrers/API.php
+++ b/plugins/Referrers/API.php
@@ -622,24 +622,34 @@ class API extends \Piwik\Plugin\API
}));
$urlsTable = $urlsTable->mergeSubtables();
- foreach ($dataTable->getRows() as $row) {
- $row->removeSubtable();
-
- $social = $row->getColumn('label');
- $newTable = $urlsTable->getEmptyClone();
-
- $rows = $urlsTable->getRows();
- foreach ($rows as $id => $urlsTableRow) {
- $url = $urlsTableRow->getColumn('label');
- if (Social::getInstance()->isSocialUrl($url, $social)) {
- $newTable->addRow($urlsTableRow);
- $urlsTable->deleteRow($id);
+ if ($dataTable instanceof DataTable\Map) {
+ $dataTables = $dataTable->getDataTables();
+ $urlsTables = $urlsTable->getDataTables();
+ } else {
+ $dataTables = [$dataTable];
+ $urlsTables = [$urlsTable];
+ }
+
+ foreach ($dataTables as $label => $dataTable) {
+ foreach ($dataTable->getRows() as $row) {
+ $row->removeSubtable();
+
+ $social = $row->getColumn('label');
+ $newTable = $urlsTables[$label]->getEmptyClone();
+
+ $rows = $urlsTables[$label]->getRows();
+ foreach ($rows as $id => $urlsTableRow) {
+ $url = $urlsTableRow->getColumn('label');
+ if (Social::getInstance()->isSocialUrl($url, $social)) {
+ $newTable->addRow($urlsTableRow);
+ $urlsTables[$label]->deleteRow($id);
+ }
}
- }
- if ($newTable->getRowsCount()) {
- $newTable->filter('Piwik\Plugins\Referrers\DataTable\Filter\UrlsForSocial', array($expanded));
- $row->setSubtable($newTable);
+ if ($newTable->getRowsCount()) {
+ $newTable->filter('Piwik\Plugins\Referrers\DataTable\Filter\UrlsForSocial', array($expanded));
+ $row->setSubtable($newTable);
+ }
}
}