Mailing List Archive

autocomplete_categories.html bug ?
Im running a system with bric 1.11.1 with multiple sites installed

my autocomplete_categories.html is rev 8288
and I got the error Too many Bric::Biz::Categories found.

After replacing the line

my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri });
with
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri, ($site_id ? (site_id => $site_id) : () ) });

it worked well.

Now I've seen that in the svn the current code looks like :


==== snip

if ( FULL_SEARCH ) {
@categories = Bric::Biz::Category->list({
uri => "%" . $new_category_autocomplete . "%",
site_id => $site_id || $story->get_site_id,
});
} else {
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri });
.....
}

===== /snip
checked this out and with FULL_SEARCH disabled the same error
happes again (if you have more than one site ).


So am I missing something or is this a bug ?


Rolf Schaufelberger
rs at plusw.de
Re: autocomplete_categories.html bug ? [ In reply to ]
On Mar 19, 2009, at 1:40 PM, Rolf Schaufelberger wrote:

> if ( FULL_SEARCH ) {
> @categories = Bric::Biz::Category->list({
> uri => "%" . $new_category_autocomplete . "%",
> site_id => $site_id || $story->get_site_id,
> });
> } else {
> my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> $parent_cat_uri });
> .....
> }
>
> ===== /snip
> checked this out and with FULL_SEARCH disabled the same error
> happes again (if you have more than one site ).
>
>
> So am I missing something or is this a bug ?

Hrm. It should not happen, but I've seen it myself. Anyone know what
the proper fix it?

Best,

David
Re: autocomplete_categories.html bug ? [ In reply to ]
> On Mar 19, 2009, at 1:40 PM, Rolf Schaufelberger wrote:
>
> > if ( FULL_SEARCH ) {
> > @categories = Bric::Biz::Category->list({
> > uri => "%" . $new_category_autocomplete . "%",
> > site_id => $site_id || $story->get_site_id,
> > });
> > } else {
> > my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> > $parent_cat_uri });
> > .....
> > }
> >
> > ===== /snip
> > checked this out and with FULL_SEARCH disabled the same error
> > happes again (if you have more than one site ).
> >
> >
> > So am I missing something or is this a bug ?
>
> Hrm. It should not happen, but I've seen it myself. Anyone know what
> the proper fix it?
>
> Best,
>
> David

If you have several sites it's obvious to me that lookup fails
because it returns
more than 1 result as long as you have the same category name in
different sites ( and each site has a root category '/' ..) .
I just don't understand, why the site_id parameter is not passed to
lookup ?


Rolf
Re: autocomplete_categories.html bug ? [ In reply to ]
On Mar 20, 2009, at 7:29 AM, Rolf Schaufelberger wrote:

> If you have several sites it's obvious to me that lookup fails
> because it returns
> more than 1 result as long as you have the same category name in
> different sites ( and each site has a root category '/' ..) .
> I just don't understand, why the site_id parameter is not passed to
> lookup ?

Clearly it should be. If you make sure it's always passed, does the
error go away for you?

Thanks,

David
Re: autocomplete_categories.html bug ? [ In reply to ]
Rolf Schaufelberger wrote:

> I just don't understand, why the site_id parameter is not passed to
> lookup ?

Because you're right and it is a bug and it should be being passed ?

Does this patch fix your issue ?

===================================================================
--- comp/widgets/story_prof/autocomplete_categories.html (revision 8514)
+++ comp/widgets/story_prof/autocomplete_categories.html (working copy)
@@ -20,7 +20,10 @@
site_id => $site_id || $story->get_site_id,
});
} else {
- my $parent_cat = Bric::Biz::Category->lookup({ uri => $parent_cat_uri });
+ ( my $parent_cat ) = Bric::Biz::Category->list({
+ uri => $parent_cat_uri });
+ site_id => $site_id || $story->get_site_id,
+ });

regards,

Paul

--
Paul Orrock Digital Craftsmen
Lead SysAdmin www.digitalcraftsmen.net
Exmouth House, 3 Pine Street, London, EC1R 0JH
Tel: 020 7183 1410 Fax: 020 7099 5140
Re: autocomplete_categories.html bug ? [ In reply to ]
Yes,
changing line 23 of r8386 to

} else {
my $parent_cat = Bric::Biz::Category->lookup({ uri =>
$parent_cat_uri,
site_id => $site_id
|| $story->get_site_id,});


works . Tested in creating a new story and in story edit when adding
another category.

Am 20.03.2009 um 15:49 schrieb David E. Wheeler:

> On Mar 20, 2009, at 7:29 AM, Rolf Schaufelberger wrote:
>
>> If you have several sites it's obvious to me that lookup fails
>> because it returns
>> more than 1 result as long as you have the same category name in
>> different sites ( and each site has a root category '/' ..) .
>> I just don't understand, why the site_id parameter is not passed to
>> lookup ?
>
> Clearly it should be. If you make sure it's always passed, does the
> error go away for you?
>
> Thanks,
>
> David
>

Rolf Schaufelberger
Re: autocomplete_categories.html bug ? [ In reply to ]
Yep, just see my reply to david

Am 20.03.2009 um 16:04 schrieb Paul Orrock:

>
>
> Rolf Schaufelberger wrote:
>
>> I just don't understand, why the site_id parameter is not passed
>> to lookup ?
>
> Because you're right and it is a bug and it should be being passed ?
>
> Does this patch fix your issue ?
>
> ===================================================================
> --- comp/widgets/story_prof/autocomplete_categories.html (revision
> 8514)
> +++ comp/widgets/story_prof/autocomplete_categories.html (working
> copy)
> @@ -20,7 +20,10 @@
> site_id => $site_id || $story->get_site_id,
> });
> } else {
> - my $parent_cat = Bric::Biz::Category->lookup({ uri =>
> $parent_cat_uri });
> + ( my $parent_cat ) = Bric::Biz::Category->list({
> + uri => $parent_cat_uri });
> + site_id => $site_id || $story->get_site_id,
> + });
>
> regards,
>
> Paul
>
> --
> Paul Orrock Digital Craftsmen
> Lead SysAdmin www.digitalcraftsmen.net
> Exmouth House, 3 Pine Street, London, EC1R 0JH
> Tel: 020 7183 1410 Fax: 020 7099 5140

Mt freundlchen Grüßen
Rolf Schaufelberger

plusW GmbH
Stuttgarter Str. 26 Tel. 07183 30 21 36
73635 Rudersberg Fax 07183 30 21 85

www.plusw.de
www.mypixler.com
www.calendrino.de
Re: autocomplete_categories.html bug ? [ In reply to ]
Committed in rev 8515

regards,

Paul

Rolf Schaufelberger wrote:
> Yep, just see my reply to david
>
> Am 20.03.2009 um 16:04 schrieb Paul Orrock:
>
>>
>>
>> Rolf Schaufelberger wrote:
>>
>>> I just don't understand, why the site_id parameter is not passed to
>>> lookup ?
>>
>> Because you're right and it is a bug and it should be being passed ?
>>
>> Does this patch fix your issue ?
>>
>> ===================================================================
>> --- comp/widgets/story_prof/autocomplete_categories.html (revision
>> 8514)
>> +++ comp/widgets/story_prof/autocomplete_categories.html (working
>> copy)
>> @@ -20,7 +20,10 @@
>> site_id => $site_id || $story->get_site_id,
>> });
>> } else {
>> - my $parent_cat = Bric::Biz::Category->lookup({ uri =>
>> $parent_cat_uri });
>> + ( my $parent_cat ) = Bric::Biz::Category->list({
>> + uri => $parent_cat_uri });
>> + site_id => $site_id || $story->get_site_id,
>> + });
>>
>> regards,
>>
>> Paul
>>
>> --
>> Paul Orrock Digital Craftsmen
>> Lead SysAdmin www.digitalcraftsmen.net
>> Exmouth House, 3 Pine Street, London, EC1R 0JH
>> Tel: 020 7183 1410 Fax: 020 7099 5140
>
> Mt freundlchen Grüßen
> Rolf Schaufelberger
>
> plusW GmbH
> Stuttgarter Str. 26 Tel. 07183 30 21 36
> 73635 Rudersberg Fax 07183 30 21 85
>
> www.plusw.de
> www.mypixler.com
> www.calendrino.de
>
>
>
>

--
Paul Orrock Digital Craftsmen
Lead SysAdmin www.digitalcraftsmen.net
Exmouth House, 3 Pine Street, London, EC1R 0JH
Tel: 020 7183 1410 Fax: 020 7099 5140