Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for bug #280 -- searches using subelement_key_name parameter now only return current versions #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Bric/Biz/Asset/Business/Media.pm
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ use constant PARAM_WHERE_MAP => {
expired => '(i.expire_date IS NOT NULL AND i.expire_date <= CURRENT_TIMESTAMP)',
desk_id => 'mt.desk__id = ?',
name => 'LOWER(i.name) LIKE LOWER(?)',
subelement_key_name => 'i.id = mct.object_instance_id AND mct.element_type__id = subet.id AND LOWER(subet.key_name) LIKE LOWER(?)',
subelement_key_name => 'i.id = mct.object_instance_id AND mct.active = TRUE AND mct.element_type__id = subet.id AND LOWER(subet.key_name) LIKE LOWER(?)',
subelement_id => 'i.id = sme.object_instance_id AND sme.active = TRUE AND sme.element_type__id = ?',
related_story_id => 'i.id = mctrs.object_instance_id AND mctrs.related_story__id = ?',
related_media_id => 'i.id = mctrm.object_instance_id AND mctrm.related_media__id = ?',
Expand Down Expand Up @@ -295,7 +295,7 @@ use constant PARAM_WHERE_MAP => {
use constant PARAM_ANYWHERE_MAP => {
element_key_name => [ 'mt.element_type__id = e.id',
'LOWER(e.key_name) LIKE LOWER(?)' ],
subelement_key_name => [ 'i.id = mct.object_instance_id AND mct.element_type__id = subet.id',
subelement_key_name => [ 'i.id = mct.object_instance_id AND mct.active = TRUE AND mct.element_type__id = subet.id',
'LOWER(subet.key_name) LIKE LOWER(?)' ],
subelement_id => [ 'i.id = sme.object_instance_id AND sme.active = TRUE',
'sme.element_type__id = ?' ],
Expand Down
4 changes: 2 additions & 2 deletions lib/Bric/Biz/Asset/Business/Story.pm
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ use constant PARAM_WHERE_MAP => {
expired => '(i.expire_date IS NOT NULL AND i.expire_date <= CURRENT_TIMESTAMP)',
desk_id => 's.desk__id = ?',
name => 'LOWER(i.name) LIKE LOWER(?)',
subelement_key_name => 'i.id = sct.object_instance_id AND sct.element_type__id = subet.id AND LOWER(subet.key_name) LIKE LOWER(?)',
subelement_key_name => 'i.id = sct.object_instance_id AND sct.active = TRUE AND sct.element_type__id = subet.id AND LOWER(subet.key_name) LIKE LOWER(?)',
subelement_id => 'i.id = sse.object_instance_id AND sse.active = TRUE AND sse.element_type__id = ?',
related_story_id => 'i.id = sctrs.object_instance_id AND sctrs.related_story__id = ?',
related_media_id => 'i.id = sctrm.object_instance_id AND sctrm.related_media__id = ?',
Expand Down Expand Up @@ -418,7 +418,7 @@ use constant PARAM_WHERE_MAP => {
use constant PARAM_ANYWHERE_MAP => {
element_key_name => [ 's.element_type__id = e.id',
'LOWER(e.key_name) LIKE LOWER(?)' ],
subelement_key_name => [ 'i.id = sct.object_instance_id AND sct.element_type__id = subet.id',
subelement_key_name => [ 'i.id = sct.object_instance_id AND sct.active = TRUE AND sct.element_type__id = subet.id',
'LOWER(subet.key_name) LIKE LOWER(?)' ],
subelement_id => [ 'i.id = sse.object_instance_id AND sse.active = TRUE',
'sse.element_type__id = ?' ],
Expand Down