Time Nick Message 13:24 owen Anybody awake this morning/afternoon/evening/ungodly hour of the night? 14:13 pecisk :) 14:14 pecisk newest one always wins 14:52 kados morning all 14:56 owen Hi kados 14:56 kados howdy 14:57 owen kados, do you know if it's possible to tell from anywhere in Koha how many times an item has been renewed? 14:57 kados owen: I looked into that yesterday a bit 14:58 kados owen: it's kinda tricky 14:58 kados especially if they've had the same book checked out before 14:59 owen We really should re-think how we're storing issues data if we can't get something as simple as a renew count 15:00 kados agreed 15:00 owen Koha must /have/ the data, because it can restrict whether an item can be renewed again! 15:00 kados if you look in opac-user.pl 15:00 kados it calls 'renewstatus' 15:01 kados i added $renewsleft 15:01 kados just need to get it working :-) 15:02 kados so what you can find is: 15:02 kados the item in the issues table, checked out by a specific patron, that's not been returned yet 15:03 kados and you can also tell how many times they've renewed 15:03 kados because if there is more than one entry for the same item, they've renewed it 15:03 kados owen: so do you want 'how many renews left' or 'how many times renewed'? 15:04 owen I'm not sure why, I think the former for the OPAC and the latter for the intranet. Does that sound crazy? 15:05 kados nope 15:20 kados owen: issues actually stores the renewal count 15:20 kados owen: so it's trivial to get that out 15:21 kados but for some reason, lastreneweddate isn't getting set 15:21 kados :( 15:23 kados owen: new variable passed to opac-user.pl: renewalcount 15:24 kados owen: it'll be null if there haven't been renewals on that item 15:25 kados owen: want me to add it to the template, or you wanna? 15:31 owen Are you working with just the issues loop or is it available to the overdues one as well? 15:33 kados it's now called 'renewcount' to be consistant 15:33 kados and it's in both loops 15:42 owen Doesn't seem to be coming through 15:43 kados hmmm 15:43 owen <!-- TMPL_VAR NAME="renewalcount" --> ? 15:44 kados ahh, yea, see above 15:44 kados i changed the name :-) 15:44 kados renewcount 15:44 kados sorry :-) 15:44 kados koha never calls them 'renewals' ... just 'renew' so I figured better be consistent 15:44 owen No, I tried it both ways 15:45 kados works for me 15:45 kados ie, on my account I see (1) 15:46 kados for those I've renewed 15:46 owen I see 15:47 owen So that's the count of how many times it's been renewed? 15:47 kados yea 15:47 kados did I missunderstand the requirements? :-) 15:48 owen We should probably expose both variables to the templates just to be safe, but I thought we should have the 'renewals left' count on the opac 15:48 kados ahh, sorry 15:50 kados owen: so should it also take into account reserves? 15:50 kados ie, shouldn't it tell you 'this is on reserve, you can't renew it'? 15:51 owen Right now the "status" variable tells the template whether an item can be renewed, right? 15:52 owen It'd be nice to have one variable that means "Renewals possible? Yes or no." and then a couple of variable to explain why 15:52 kados status tells you if they are possible 15:52 owen So, <!--tmpl_if name="on-reserve" -->Item is on reserve 15:53 owen <!--tmpl_if name="renewalspossible"--> Too many renewals 15:53 owen ...where renewals possible is 0 and evaluates as false? Don't know if it would work that way. 15:55 kados guess not, not translatable easily 15:55 kados hmmm 15:57 kados how about the following variables in the OPAC template: 'status' (flag), 'onreserve', 'renewsleft' 'renewcount' 15:57 owen Sounds good 15:58 kados renewsleft is gonna have the count, but won't take into account the reserve status 15:58 kados so in your template, you'll want logic like: 15:58 kados if (can renew) { 15:58 kados renewsleft renewcount 15:59 kados } else { 15:59 kados if (onreserve) { 15:59 kados "item is on reserve" 15:59 kados } else { 15:59 kados too many renewals 15:59 kados } 15:59 kados make sense? 15:59 owen Yup 16:11 kados status, renewcount and onreserve done 16:14 kados owen: do you want 'renewsleft' or 'renewsallowed'? 16:14 kados ie, do you want koha to do the math for you? 16:15 owen How about both? So we can say "1 of 2 renewals left" 16:15 kados hehe 16:15 kados ok 16:22 owen kados, did you just take down our server? 16:23 kados yea, for about 5 seconds, sorry :/ 16:25 kados well, 'status' (flag), 'onreserve', 'renewsleft' 'renewcount' are all there now 16:25 kados so have fun with the templates 16:25 kados :-) 16:26 kados brb 16:31 owen kados: renewsallowed is coming through, but not renewcount or renewsleft 16:36 kados if it's 0 it'll come through as null 16:37 owen But renewcount and renewsleft can't /both/ be null 16:37 kados right 16:37 kados mind if I check the template? 16:37 owen Of course not 16:38 owen I'm outputting those values in a comment in the ISSUES loop right after the renew link 16:38 kados k 16:40 kados ok, I see the problem 16:40 kados it's on my side 16:40 kados I was only filling renewsleft if renewsallowed was greater than renewcount 16:41 kados should be fixed now 16:41 kados hmmm 16:41 kados nope :-) 16:51 kados ahh 16:51 kados typo in opac-user.pl 16:51 kados owen: working, and even understands 0 :-) 16:51 kados knowing_diff_between_0_and_null++ :-) 16:56 kados owen: sent you an email :-) 16:56 kados hehe 17:01 owen Not sure I've got the best wording, but I'll have to look at it again after lunch 17:27 kados owen-away: when you return, let me know, I've got somthing to show you 18:01 owen kados: I'm back 18:18 kados owen: hey 18:46 owen kados: what are the chances we could get similar changes to the intranet side of things in terms of renewal counts, etc.? 18:48 owen I'm not sure how we'd fit it all in, but I know librarians would love to be able to see renew counts on issues.pl. Or at least have the display reflect whether an item could be renewed or not. 19:02 kados owen: brb 20:51 chris statistics table 20:51 chris has all that info 21:00 kados hey chris 21:00 kados it's also available for currently issued items in the issues table 21:08 chris yep