From 8c2c8b8b8f3ce4655ecaf80da87f3b3d74fb1791 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 20 Mar 2008 19:37:54 +0000 Subject: [PATCH] fixed: Editting matrix listings shows fields from other matrix assets fixed: Matrix assets show pending listings from all matrix assets on a site --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/Wobject/Matrix.pm | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2267dffb2..fe9a087d8 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -6,6 +6,8 @@ - Add Gallery search limiting by user ID - Remaining i18n for Gallery templates - Fix: Search form now visible in Photo assets + - fixed: Editting matrix listings shows fields from other matrix assets + - fixed: Matrix assets show pending listings from all matrix assets on a site 7.5.7 - fixed: HttpProxy mixes original site's content encoding with WebGUI's diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index 50bb22be8..e1c55b93c 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -629,10 +629,11 @@ sub www_editListing { $f->raw(''.$category.''); my $a; if ($self->session->form->process("listingId") ne "new") { - $a = $self->session->db->read("select a.name, a.fieldType, a.defaultValue, a.description, a.label, b.value, a.fieldId - from Matrix_field a left join Matrix_listingData b on a.fieldId=b.fieldId and - listingId=".$self->session->db->quote($self->session->form->process("listingId"))." where - a.category=".$self->session->db->quote($category)." order by a.label"); + $a = $self->session->db->read( + "select a.name, a.fieldType, a.defaultValue, a.description, a.label, b.value, a.fieldId + from Matrix_field a left join Matrix_listingData b on a.fieldId=b.fieldId and + listingId=? where a.category=? and a.assetId=? order by a.label", + [$self->session->form->process("listingId"), $category, $self->getId]); } else { $a = $self->session->db->read("select name, fieldType, defaultValue, description, label, fieldId from Matrix_field where category=".$self->session->db->quote($category)." and assetId=".$self->session->db->quote($self->getId)); @@ -1102,7 +1103,7 @@ sub view { ($var{'user.count'}) = $self->session->db->quickArray("select count(*) from users"); ($var{'current.user.count'}) = $self->session->db->quickArray("select count(*)+0 from userSession where lastPageView>".($self->session->datetime->time()-600)); ($var{'listing.count'}) = $self->session->db->quickArray("select count(*) from Matrix_listing where status = 'approved' and assetId=".$self->session->db->quote($self->getId)); - $sth = $self->session->db->read("select listingId,productName from Matrix_listing where status='pending'"); + $sth = $self->session->db->read("select listingId,productName from Matrix_listing where status='pending' and assetId=?",[$self->getId]); while (my ($id,$name) = $sth->array) { push(@{$var{pending_list}},{ url=>$self->formatURL("viewDetail",$id),