[Koha-bugs] [Bug 15239] Add multiple items fail on barcode

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Aug 23 14:25:26 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15239

Tomás Cohen Arazi <tomascohen at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tomascohen at gmail.com

--- Comment #10 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Hi Ruben,

(In reply to Ruben Norori from comment #9)
> I have the definitive solution:
> First we must add two new procedures, functions, methods, which consult in
> the database the registry homebranch.

I didn't go deep into the problem you're trying to solve, but I suggest you
don't introduce new subs, but use the current api instead.

We have a (sort of) DAO class called Koha::Items that exposes a ->search
method, which returns Koha::Item objects. So you can simply do something like
this:

  use Koha::Items;

  my $item = Koha::Items->find( $barcode );

->find gets an id column to find the row and create the object. 'barcode' is a
unique key, so this works.

Now you have a Koha::Item object, representing the item with the passed
barcode. You can then use it like:

  my $homebranch = $item->homebranch;

Hope it clarifies! This conversations are easier on the koha-devel list or on
the IRC channel.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list