[Koha-bugs] [Bug 22569] Add a 'Transfers to send' report

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 18 10:30:10 CET 2021


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

--- Comment #48 from Martin Renvoize <martin.renvoize at ptfs-europe.com> ---
(In reply to Jonathan Druart from comment #46)
> 2. 
> -    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->itemnumber
> );
> +    my $transfer = $item->get_transfer;
> 
> This GetTransfers is pretty bad, it could return several transfers, but
> callers are not ready for that:
> opac/opac-detail.pl:     my ( $transfertwhen, $transfertfrom, $transfertto )
> = GetTransfers($itm->{itemnumber});                                         
> 
> 
> So that's definitely a good move to have a get_transfer method that will
> return only 1, the current one.
> However, cannot we enforce this constraint at DB level (DB unique key) and
> have a ->find call in ->get_transfer to replace the ->first?

Internally '->find' theoretically checks for constraints (Unique, Primary Key,
etc).. if it doesn't find any, it falls back to search and throws an error if
more than one row is found.. So in reality one would need to pass the order_by
and rows attributes to get the correct single row.. So in effect they're the
code results in the same thing...  

As for adding a unique constraint at the DB... I can't see what constraint
would work here...  We're looking for the first with 'datesent' OR if there
isn't a sent one, then the oldest 'daterequested'..

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


More information about the Koha-bugs mailing list