mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge pull request #121 from MichaelCSLWeb/master
Update ArchiveWidget.php
This commit is contained in:
commit
09a297da3b
@ -65,6 +65,8 @@ if(class_exists('Widget')) {
|
|||||||
$yearclause = 'YEAR("Date")';
|
$yearclause = 'YEAR("Date")';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Changed the WHERE clause from where ParentID to WHERE SiteTree$suffix.ParentID as it was ambiguous.
|
||||||
|
|
||||||
if($this->DisplayMode == 'month') {
|
if($this->DisplayMode == 'month') {
|
||||||
$sqlResults = DB::query("
|
$sqlResults = DB::query("
|
||||||
SELECT DISTINCT CAST($monthclause AS " . DB::getConn()->dbDataType('unsigned integer') . ")
|
SELECT DISTINCT CAST($monthclause AS " . DB::getConn()->dbDataType('unsigned integer') . ")
|
||||||
@ -72,7 +74,7 @@ if(class_exists('Widget')) {
|
|||||||
$yearclause AS \"Year\"
|
$yearclause AS \"Year\"
|
||||||
FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\"
|
FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\"
|
||||||
ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\"
|
ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\"
|
||||||
WHERE \"ParentID\" IN (" . implode(', ', $ids) . ")
|
WHERE \"SiteTree$suffix\".\"ParentID\" IN (" . implode(', ', $ids) . ")
|
||||||
ORDER BY \"Year\" DESC, \"Month\" DESC;"
|
ORDER BY \"Year\" DESC, \"Month\" DESC;"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -80,11 +82,10 @@ if(class_exists('Widget')) {
|
|||||||
SELECT DISTINCT $yearclause AS \"Year\"
|
SELECT DISTINCT $yearclause AS \"Year\"
|
||||||
FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\"
|
FROM \"SiteTree$suffix\" INNER JOIN \"BlogEntry$suffix\"
|
||||||
ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\"
|
ON \"SiteTree$suffix\".\"ID\" = \"BlogEntry$suffix\".\"ID\"
|
||||||
WHERE \"ParentID\" IN (" . implode(', ', $ids) . ")
|
WHERE \"SiteTree$suffix\".\"ParentID\" IN (" . implode(', ', $ids) . ")
|
||||||
ORDER BY \"Year\" DESC"
|
ORDER BY \"Year\" DESC"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($sqlResults) foreach($sqlResults as $sqlResult) {
|
if($sqlResults) foreach($sqlResults as $sqlResult) {
|
||||||
$isMonthDisplay = $this->DisplayMode == 'month';
|
$isMonthDisplay = $this->DisplayMode == 'month';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user