[Koha-devel] Proposed coding standard: always check for object existence before use

2018-06-13 Thread Barton Chittenden
Calling a method or accessing a member of an undefined object will throw a fatal error that looks like this: "can't call method * on an undefined value at ..." For example, this code will cause a software error if $data->{itemnumber} exists, but the item doesn't exist (maybe it's been deleted?):

Re: [Koha-devel] Proposed coding standard: always check for object existence before use

2018-06-13 Thread Jonathan Druart
Hi Barton, Yes, and no. It depends. Example 1) my $biblio_to_edit = Koha::Biblios->find( $query->param('biblionumber') ); say sprintf "you are editing %s", $biblio_to_edit->title; Here we need to display a message if the biblio you want to edit does no longer exist (or invalid id). Example 2

Re: [Koha-devel] [Koha] How to introduce a new user-permission to Koha?

2018-06-13 Thread Chris Cormack
Kia ora Markus Shifting this over to the development list. As you are more likely to get an answer there. If no one has answered by the time I get in front of a computer, I'll try :) Chris On 14 June 2018 7:02:30 AM NZST, Markus Becker wrote: >Dear Koha-Community, > >i did not find any hint o

Re: [Koha-devel] [Koha] How to introduce a new user-permission to Koha?

2018-06-13 Thread Jonathan Druart
Hi Markus, Permissions are stored in the tables 'permissions' and 'userflags' For instance "tools" is a group of permissions (userflags.flag="tools" with a bit=13), and the permissions table will contain the subpermissions. select * from permissions where module_bit=13; will give your the subpe

Re: [Koha-devel] Proposed coding standard: always check for object existence before use

2018-06-13 Thread Barton Chittenden
On Wed, Jun 13, 2018 at 3:07 PM, Jonathan Druart < jonathan.dru...@bugs.koha-community.org> wrote: > Hi Barton, > > Yes, and no. It depends. > ... the dark side of TMTOWTDI ;-) I read through your examples, they all made good sense. Basically, we should avoid indentation blocks (if ( defined $i

[Koha-devel] Call for News: June 2018 Newsletter

2018-06-13 Thread kohanews
I'm collecting news for the June newsletter. Send anything noteworthy to: k o h a news AT gmail dot com News criteria: --- ** For events **:    - Please include dates for past events. If I can't find dates I may not add it.    - Announcements for future events with date