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

Srdjan Jankovic <[email protected]> changed:

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

--- Comment #3 from Srdjan Jankovic <[email protected]> ---
1.
+my $sth = $dbh->prepare("SELECT * FROM items WHERE biblionumber=?;");
+$sth->execute($biblionumber);
+
+my @itemsmatchingbiblionumber;
+my $matchingitem = $sth->fetchrow_hashref;
+while ($matchingitem) {
+    push @itemsmatchingbiblionumber,$matchingitem;
+    $matchingitem = $sth->fetchrow_hashref;
+}

is perhaps better written as
my $itemsmatchingbiblionumber = $dbh->selectall_arrayref($sql, { Slice => {}},
$biblionumber)

2. Database queries should all be placed in modules (probably C4/Items.pm for
this one, maybe theres even something similar already there) so they can be
tested

3. There should be a check
if ($biblionumber) {
  get the items
  etc
}
so we do not make database calls in vain

-- 
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