Skip to content
This repository
Browse code

Merge pull request #32 from gregheo/bug242

Simple search should search current versions only
  • Loading branch information...
commit 12959c70dff384ba623685c3df9090226dc160ec 2 parents 2c497e0 + ea91cc2
David E. Wheeler authored August 05, 2011
2  lib/Bric/Biz/Asset/Business/Media.pm
@@ -281,7 +281,7 @@ use constant PARAM_WHERE_MAP => {
281 281
                              . 'mt.id = mm2.object_id',
282 282
       simple                => 'mt.id IN ('
283 283
                              . 'SELECT mmt.id FROM media mmt '
284  
-                             . 'JOIN media_instance mi2 ON media__id = mmt.id '
  284
+                             . 'JOIN media_instance mi2 ON (media__id = mmt.id AND version = mmt.current_version) '
285 285
                              . 'WHERE LOWER(mi2.name) LIKE LOWER(?) '
286 286
                              . 'OR LOWER(mi2.description) LIKE LOWER(?) '
287 287
                              . 'OR LOWER(mi2.uri) LIKE LOWER(?) '
2  lib/Bric/Biz/Asset/Business/Story.pm
@@ -404,7 +404,7 @@ use constant PARAM_WHERE_MAP => {
404 404
                               . 's.id = sm2.object_id',
405 405
       simple                 => 's.id IN ('
406 406
                               . 'SELECT ss.id FROM story ss '
407  
-                              . 'JOIN story_instance si2 ON story__id = ss.id '
  407
+                              . 'JOIN story_instance si2 ON (story__id = ss.id AND version = ss.current_version) '
408 408
                               . 'WHERE LOWER(si2.name) LIKE LOWER(?) '
409 409
                               . 'OR LOWER(si2.description) LIKE LOWER(?) '
410 410
                               . 'OR LOWER(si2.primary_uri) LIKE LOWER(?) '

0 notes on commit 12959c7

Please sign in to comment.
Something went wrong with that request. Please try again.