From bugzilla-daemon@bugs.koha-community.org Fri Jan 5 17:49:39 2018 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 15494] Block renewals by arbitrary item values Date: Fri, 05 Jan 2018 16:49:34 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1362742773261266571==" --===============1362742773261266571== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D15494 Marcel de Rooy changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #21 from Marcel de Rooy --- + unless ($item) { carp "No item passed in!" && return } Not our preferred coding style + return () if (! $yaml =3D~ /\S/ ); Just return here. The only call is in scalar context. We do not need a list. Shorter: return if $yaml !~ /\S/; + eval { + $denyingrules =3D YAML::Load($yaml); + }; How much time are we spending on doing this? What is the performance effect? = If the pref always looks like field1: [val]\nfield2: [val2] we can just split on newline and split on ':', etc. Give me some convincing numbers please. + return (); Same as above + my $val; + if (exists $item->{$field}) { + $val =3D $item->{$field}; + } + $val =3D '' unless defined $val; Why not in just one line: my $val =3D $item->{$field} // ''; + - How to write these rules is documented on the Koha wiki. This is from the preference file. Not sure if this is the preferred way. A wi= ki page could be gone just as easily. Why not just provide an example as close as possible to the pref itself. Just another 40 chars ? Just curious too if this supports denying renewal on an empty string? If so, the conversion from undef to empty string might not be what we want. Can we signal empty string or undef to be a blocking value? [No blocker for me btw := )] Changing status. Please make some adjustments. --=20 You are receiving this mail because: You are watching all bug changes. --===============1362742773261266571==--