Time  Nick  Message
13:03 kyle  kados, you around?
13:04 kyle  paul?
13:04 dewey i heard paul was preparing to issue a release while the NPL templates are not working for the record editor now.
13:04 paul  yep
13:04 paul  hello kyle
13:04 cm    hi paul.
13:04 paul  kados should still be sleeping i think
13:04 kyle  hello paul, I have some questions about Accounts2.pm and pay.pl
13:04 cm    i bet kados isn't around--it's 5 am in NZ.
13:04 kyle  oh, yeah ; )
13:04 paul  mmm... i'm not sure at all i'll be able to answer, but throw your question ;-)
13:05 hdl   dewey: forget paul
13:05 dewey hdl: I forgot paul
13:05 hdl   you nasty bot.
13:05 kyle  first, the documentation in Accounts2.pm for makepayment and recordpayment is incorrect.
13:06 kyle  both functions state that they store the branch code where the fine was paid, but neither do.
13:06 kyle  We need that functionality for our libraries.
13:06 kyle  I can even understand when recordpayment is called from pay.pl,
13:06 kyle  can't understand, that is.
13:08 kyle  really, what I need to know is how do I get the branchcode of the library so I can pass it to makepayment
13:10 kyle  in pay.pl there is a bit of code like this:
13:10 kyle  $user=~ s/Levin/C/i;
13:11 kyle  $user=~ s/Foxton/F/i;
13:11 kyle  $user=~ s/Shannon/S/i;
13:11 kyle  $user is then passed to makepayment(), any idea what the heck that is?
13:11 paul  mmm... dirty code... coming from HLT, the *1st* library that used Koha in the world, 7 years ago.
13:13 paul  you should try to get the branch from C4::Context->userenv->{branch}
13:13 kyle  like $branchcode = C4::Context->userenv->{branch}; ?
13:13 paul  yep
13:13 kyle  I'll give that a shot
13:27 kyle  paul, for some reason it doesn't work. I added a new column 'branchcode' to our accountlines table
13:28 kyle  and changed the sql in Accounts2::makepayment to insert the branchcode into it
13:28 kyle  if I hardcode a string, it works just fine, but if I try using  C4::Context->userenv->{branch} the payment doesn't even show up in the database.
13:29 paul  you're not logged in with the mySQL login/password ?
13:30 paul  mmm... another note :
13:30 kyle  what?
13:31 paul  if you use koha with the mySQL login/password, you don't have a branch, as it's not really a user.
13:31 paul  I know where it comes from :
13:31 paul  the userenv is only available AFTER checking/reading the member information.
13:32 paul  and that is done in get_template_and_user
13:32 kyle  I'm paying the fines from within koha, logged in as kohaadmin, whose branch is set to MPL
13:32 paul  this MUST be at the beginning of every script.
13:32 paul  in pay.pl, you makepayement BEFORE opening template & user
13:33 cm    kyle, what if you try mplm or one of our other logins?
13:33 kyle  ok, what I've been doing is altering makepayment() in Account2.pm, so I cannot get the branchcode from within Account2.pm
13:33 paul  move the get_template_and_user that is line 83 at the beginning
13:33 paul  kyle : read me pls.
13:33 paul  I understand (99% sure) where it comes from
13:33 kyle  I'll try that, paul
13:33 paul  just move get_template_and_user at the beginning of the script.
13:34 paul  this is a BIG SECURITY bug for instance.
13:34 paul  because someone that would call pay.pl with proper http get parameters could "pay" what he want...
13:35 paul  as payement is recorded BEFORE checking for permission.
13:35 paul  i'll write a mail on koha-devel immediatly about that, for kados & others.
13:41 paul  mail sent.
13:45 rch   kyle: are you using the user account with db access?
13:45 rch   i don't think userenv is set properly for that user
13:46 kyle  I logged in as one of our regular accouts
13:48 kyle  for some reason, I had to put quotes around my variable to insert on line 180 or Accounts2.pm. I don't understand why, but it wouldn't work without them
13:49 kyle  Perl makes me feel like a crazy person ; )
13:49 rch   :)
13:50 kyle  Now comes a big questions, once I've updated all the files to take into account this new column 'branchcode' in 'accountlines', if I commit it, everyone elses fine payments will break.
13:50 kyle  because they don't have that new column. What do I do about that?
13:54 rch   hmm
13:54 rch   yes that's a problem
13:54 paul  not really...
13:55 paul  thanks to updater/updatedatabase !
13:55 paul  just add your column here, and anyone that want to be synch'ed just has to run updatedatabase.
13:55 rch   I have some fines related commits that i haven't been able to finish...
13:55 rch   yes, the db column is no problem
13:55 rch   that makes sense to be there.
13:57 kyle  where is the updatedatabase script located?
13:57 paul  updater/updatedatabase
13:57 kyle  thanks ; )
13:57 kyle  ls
13:57 paul  ls means nothing on irc :-D
13:58 kyle  I thought I had switched to my console session, heh
14:03 rch   kyle: go ahead and make your commits; i can duplicate script if there are conflicts.
14:04 rch   sorry i didn't get to finish my fines work earlier...
14:07 kyle  ok. thanks for the help, both of you.
14:19 kyle  I've committed the updated files, but I'm not sure where to put the database update in updatedatabases
14:19 kyle  it's just a varchar(4) column named 'branchcode' in the accountlines table
14:28 rch   kyle: my %fielddefinitions  hash
14:28 rch   around line 473
14:30 kyle  so I should add accountlines to it and put in the data about the new column?
14:30 rch   accountlines => [
14:30 rch    { field => 'branchcode',
14:30 rch   etc
14:30 rch   yep
14:32 kyle  done. thanks again.
14:36 rch   np
14:56 tnb   paul: you there still?
17:44 chris morning