http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9659

Frédéric Demians <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #10 from Frédéric Demians <[email protected]> ---
This function is sub-optimal:

sub IsAuthorisedValueCategory {
    my $category = shift;
    my $categories_arrayref = GetAuthorisedValueCategories();

    foreach my $tmp_category (@$categories_arrayref) {
        if ( $tmp_category eq $category ) {
            return 1;
        }
    }

    return 0;
}

You call GetAuthorisedValueCategories which do a SELECT DISTINCT on the
whole authorised values table. You may do it directly in SQL:

sub IsAuthorisedValueCategory {
    my $sth = C4::Context->dbh->prepare(
        "SELECT category FROM authorised_values WHERE category=? LIMIT 1");
    $sth->execute(shift);
    $sth->fetchrow ? 1 : 0;
}

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to