<div dir="ltr">What about the 'Search My Library First' and 'Independent Branches' settings?  Those are dependent right now on reading the users branch from userenv.  I'm not familiar enough with the code base to know where else those settings would get the users branch; is it kept in a cookie?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 29, 2019 at 6:03 PM <<a href="mailto:dcook@prosentient.com.au">dcook@prosentient.com.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-AU"><div class="gmail-m_5968182206807020217WordSection1"><p class="MsoNormal">Totally agree too. Also makes unit testing a million times easier. <u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">David Cook<u></u><u></u></p><p class="MsoNormal">Systems Librarian<u></u><u></u></p><p class="MsoNormal">Prosentient Systems<u></u><u></u></p><p class="MsoNormal">72/330 Wattle St<u></u><u></u></p><p class="MsoNormal">Ultimo, NSW 2007<u></u><u></u></p><p class="MsoNormal">Australia<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Office: 02 9212 0899<u></u><u></u></p><p class="MsoNormal">Direct: 02 8005 0595<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Koha-devel <<a href="mailto:koha-devel-bounces@lists.koha-community.org" target="_blank">koha-devel-bounces@lists.koha-community.org</a>> <b>On Behalf Of </b>Renvoize, Martin<br><b>Sent:</b> Saturday, 28 September 2019 3:14 AM<br><b>To:</b> Tomas Cohen Arazi <<a href="mailto:tomascohen@gmail.com" target="_blank">tomascohen@gmail.com</a>><br><b>Cc:</b> koha-devel <<a href="mailto:koha-devel@lists.koha-community.org" target="_blank">koha-devel@lists.koha-community.org</a>><br><b>Subject:</b> Re: [Koha-devel] A case against some uses of C4::Context->userenv<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">I generally agree here,  I'd rather explicitly pass things like this into objects on instantiation and die if they're not present.. that way we catch cases of missing environments early and as you state, userenv harks back the CGI days and we should generally be moving forward and away from those patterns in my opinion.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"><br clear="all"><u></u><u></u></p><div><div><div><div><div><div><div><div><table style="width:307.5pt" width="410" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="padding:0cm"></td></tr></tbody></table><p class="MsoNormal"><span style="display:none"><u></u> <u></u></span></p><table style="width:337.5pt" width="450" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="width:225pt;padding:0cm" width="300"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Martin Renvoize</span></strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"><u></u><u></u></span></p></td><td style="border-color:currentcolor currentcolor black;border-style:none;border-width:medium medium 1pt;padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><a href="https://www.ptfs-europe.com/" target="_blank"><span style="font-family:"Times New Roman",serif;text-decoration:none"><img style="width: 1.8229in; height: 0.2708in;" id="gmail-m_5968182206807020217_x0000_i1025" width="175" height="26" border="0"></span></a><span style="font-family:"Times New Roman",serif"><u></u><u></u></span></p></td></tr><tr><td colspan="2" style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Development Team Manager<u></u><u></u></span></p></td></tr><tr><td colspan="2" style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-family:"Arial",sans-serif"> <u></u><u></u></span></p></td></tr><tr><td colspan="2" style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-family:"Arial",sans-serif"> <u></u><u></u></span></p></td></tr><tr><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Phone:</span></strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"> +44 (0) 1483 378728<u></u><u></u></span></p></td><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Mobile:</span></strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"> +44 (0) 7725 985 636<u></u><u></u></span></p></td></tr><tr><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Email:</span></strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"> <a href="mailto:martin.renvoize@ptfs-europe.com" target="_blank"><span style="color:rgb(45,92,136)">martin.renvoize@ptfs-europe.com</span></a><u></u><u></u></span></p></td><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Fax:</span></strong><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"> +44 (0) 800 756 6384<u></u><u></u></span></p></td></tr><tr><td style="padding:0cm"></td><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt;line-height:15pt"><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)"><a href="https://www.ptfs-europe.com" target="_blank"><span style="color:rgb(45,92,136)">www.ptfs-europe.com</span></a><u></u><u></u></span></p></td></tr><tr><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-family:"Arial",sans-serif"> <u></u><u></u></span></p></td><td style="padding:0cm"></td></tr><tr><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-family:"Arial",sans-serif"> <u></u><u></u></span></p></td><td style="padding:0cm"></td></tr><tr><td style="padding:0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-family:"Arial",sans-serif"> <u></u><u></u></span></p></td><td style="padding:0cm"></td></tr></tbody></table><p class="MsoNormal"><span style="display:none"><u></u> <u></u></span></p><table style="border-color:rgb(194,194,194) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium" cellspacing="0" cellpadding="0" border="1"><tbody><tr><td style="border:medium none;padding:15pt 0cm 0cm"><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">Registered in the United Kingdom No. 06416372   VAT Reg No. 925 7211 30<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Times New Roman",serif"><u></u> <u></u></span></p><p style="margin:0cm 0cm 0.0001pt"><span style="font-size:9pt;font-family:"Arial",sans-serif;color:rgb(45,92,136)">The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this email message in error, please email the sender at <a href="mailto:info@ptfs-europe.com" target="_blank">info@ptfs-europe.com</a><u></u><u></u></span></p></td></tr></tbody></table><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div></div></div><p class="MsoNormal"><u></u> <u></u></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Fri, 27 Sep 2019 at 17:42, Tomas Cohen Arazi <<a href="mailto:tomascohen@gmail.com" target="_blank">tomascohen@gmail.com</a>> wrote:<u></u><u></u></p></div><blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm"><div><p class="MsoNormal">Hi all, I've been looking at the 'Claims returned' work (awesome!) [1] and I've noticed a pattern we should, in my opinion, start avoiding and reverting.<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">It is quite common to find uses of C4::Context->userenv in the Koha::* namespace, either as a plain requirement (if the borrowernumber is not set we bail out) or just as a fallback. I think it is wrong to expect such environment status in our logic. It complicates things in various ways. [2]<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">It is done this way because:<u></u><u></u></p></div><div><p class="MsoNormal">- We come from the CGI era, in which it made perfect sense<u></u><u></u></p></div><div><p class="MsoNormal">- Cookie auth is well established on the UI<u></u><u></u></p></div><div><p class="MsoNormal">- When migrating from C4:* into Koha:* it is easier to just keep the current behavior and then evolve.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">I propose we leave them out, and add as a parameter whatever we are expecting to find in the userenv hashref. That way we could use this new libs in the API (which is not cookie-only).<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Looking forward to hear your opinions <u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">[1] <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14697" target="_blank">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14697</a><u></u><u></u></p></div><div><p class="MsoNormal">[2] CLI scripts are using Koha::* libraries, and we then need to 'emulate' that userenv or even add code to detect we don't have a userenv.<br clear="all"><u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">-- <u></u><u></u></p><div><div><div><div><div><p class="MsoNormal"><span style="font-size:9.5pt">Tomás Cohen Arazi<u></u><u></u></span></p></div><div><p class="MsoNormal"><span style="font-size:9.5pt">Theke Solutions (<a href="http://theke.io/" target="_blank">http://theke.io</a>)<br></span><span style="font-size:9.5pt;font-family:"Segoe UI Symbol",sans-serif">✆</span><span style="font-size:9.5pt"> +54 9351 3513384<br>GPG: B2F3C15F<u></u><u></u></span></p></div></div></div></div></div></div></div></div><p class="MsoNormal">_______________________________________________<br>Koha-devel mailing list<br><a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br><a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>website : <a href="http://www.koha-community.org/" target="_blank">http://www.koha-community.org/</a><br>git : <a href="http://git.koha-community.org/" target="_blank">http://git.koha-community.org/</a><br>bugs : <a href="http://bugs.koha-community.org/" target="_blank">http://bugs.koha-community.org/</a><u></u><u></u></p></blockquote></div></div></div>_______________________________________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-community.org</a><br>
<a href="https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">http://bugs.koha-community.org/</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div>Michael Hafen<br></div>Washington County School District Technology Department<br></div>Systems Analyst<br><br></div></div></div></div>