[pLog-svn] r2033 - in plog/branches/plog-1.0.1/class/dao: .
customfields
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Fri May 20 11:01:16 GMT 2005
Author: oscar
Date: 2005-05-20 11:01:15 +0000 (Fri, 20 May 2005)
New Revision: 2033
Modified:
plog/branches/plog-1.0.1/class/dao/article.class.php
plog/branches/plog-1.0.1/class/dao/customfields/customfieldsvalues.class.php
Log:
fixed issue 503 (http://bugs.plogworld.net/view.php?id=503)
Modified: plog/branches/plog-1.0.1/class/dao/article.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/dao/article.class.php 2005-05-20 11:00:46 UTC (rev 2032)
+++ plog/branches/plog-1.0.1/class/dao/article.class.php 2005-05-20 11:01:15 UTC (rev 2033)
@@ -681,7 +681,7 @@
if( $this->_fields == null ) {
// get the custom fields
$customFields = new CustomFieldsValues();
- $fields = $customFields->getArticleCustomFieldsValues( $this->getId(), true );
+ $fields = $customFields->getArticleCustomFieldsValues( $this->getId(), $this->getBlog());
$this->setFields( $fields );
}
Modified: plog/branches/plog-1.0.1/class/dao/customfields/customfieldsvalues.class.php
===================================================================
--- plog/branches/plog-1.0.1/class/dao/customfields/customfieldsvalues.class.php 2005-05-20 11:00:46 UTC (rev 2032)
+++ plog/branches/plog-1.0.1/class/dao/customfields/customfieldsvalues.class.php 2005-05-20 11:01:15 UTC (rev 2033)
@@ -42,10 +42,11 @@
* the custom fields available for an article
*
* @param articleId The id of the article
+ * @param the blog id to which the fields belong
* @param includeHidden Whether to return hidden fields or not
* @return An array of CustomFieldValue objects, or false if error
*/
- function getArticleCustomFieldsValues( $articleId, $includeHidden = true )
+ function getArticleCustomFieldsValues( $articleId, $blogId, $includeHidden = true )
{
//
// it's quite a big query and has a 'right outer join', but the whole point is that
@@ -59,9 +60,10 @@
d.field_description AS field_description
FROM {$prefix}custom_fields_values v
RIGHT OUTER JOIN {$prefix}custom_fields_definition d
- ON v.article_id = $articleId AND v.field_id = d.id";
+ ON v.article_id = $articleId AND v.field_id = d.id
+ WHERE d.blog_id = '".Db::qstr($blogId)."'";
if( !$includeHidden )
- $query .= " WHERE d.hidden = 0 ";
+ $query .= " AND d.hidden = 0 ";
$query .= " ORDER BY date ASC";
$result = $this->Execute( $query );
@@ -80,7 +82,11 @@
return $fields;
}
- function getArticleCustomFieldsValuesByIds( $articleIds, $includeHidden = true )
+ /**
+ * @private
+ * @see getArticleCustomFieldsValues
+ */
+ function getArticleCustomFieldsValuesByIds( $articleIds, $blogId, $includeHidden = true )
{
//
// it's quite a big query and has a 'right outer join', but the whole point is that
@@ -94,9 +100,10 @@
d.field_description AS field_description
FROM {$prefix}custom_fields_values v
RIGHT OUTER JOIN {$prefix}custom_fields_definition d
- ON v.article_id IN (".$articleIds.") AND v.field_id = d.id";
+ ON v.article_id IN (".$articleIds.") AND v.field_id = d.id
+ WHERE d.blog_id = '".Db::qstr($blogId)."'";
if( !$includeHidden )
- $query .= " WHERE d.hidden = 0 ";
+ $query .= " AND d.hidden = 0 ";
$query .= " ORDER BY date ASC";
$result = $this->Execute( $query );
More information about the pLog-svn
mailing list