[Koha-bugs] [Bug 9011] Add the ability to store the last patron to return an item

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Aug 13 09:30:53 CEST 2015


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

--- Comment #136 from Katrin Fischer <katrin.fischer at bsz-bw.de> ---
(In reply to Nick Clemens from comment #130)
> My consortium sponsored this development, and it has taken some time to
> progress it this far forward. If MySQL performance is the only blocker right
> now I would really like to see a solution that addresses that and unsticks
> the bug rather than requiring a rewrite of the feature.
> 
> I played around with the query and the below, while still containing a NOT
> IN, eliminates the GROUP BY and improves speed significantly:
> if ( C4::Context->preference('StoreLastBorrower') ) {
>         # Do not delete the newest old_issue for any itemnumber
>         $query .= " AND issue_id NOT IN ( SELECT issue_id FROM (Select
> oi.issue_id from old_issues oi LEFT OUTER JOIN old_issues oi2 ON
> oi.itemnumber=oi2.itemnumber AND oi2.issue_id>oi.issue_id WHERE
> oi.borrowernumber= ? AND oi2.borrowernumber IS NULL) AS oi ) ";
>         push @bind_params, $borrowernumber;

I haven't tested if this works, but I am hopeful it does and improves speed. 

> Another option is to just use the query labeleed as 'oi' above in a separate
> update.  It effectively finds all the 'last returned' info for a borrower
> and would allow you to mark those somehow (say invert borrower number to
> negative of borrowernumber) then perform the regular anonymizing, and then
> update any rows with a negative borrowrnumber to a positive borrowernumber
> (or whatever marker was used)

This seems a bit hacky... but doesn't mean it couldn't work.

> If the above queries don't work, a new table could work, though I do wonder
> about the redundancy.  I wonder if it would be possible to use the 'return'
> column in old_issues to mark 'lastreturned' or something similar to allow
> for easy SQL selection.

Hm not sure how the return could be used - can you explain?

Kyle, could you take a look at these options?

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


More information about the Koha-bugs mailing list