Bug 23082 - Fatal error editing a restricted patron
Summary: Fatal error editing a restricted patron
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 18.11
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-07 18:55 UTC by Federico Rinaudo
Modified: 2019-06-26 17:27 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.01


Attachments
Bug 23082: FIX debarment removing when editing a patron (1.44 KB, patch)
2019-06-24 15:11 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 23082: FIX debarment removing when editing a patron (1.49 KB, patch)
2019-06-24 15:39 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 23082: Fatal error editing a restricted patron (1.56 KB, patch)
2019-06-24 17:01 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Federico Rinaudo 2019-06-07 18:55:21 UTC
Para reproducir el error, se debe tener un socio con una restricción, ya sea manual o automática:

1- Editar el socio
2- Marcar el checkbox "eliminar" en la restricción
3- Guardar

En ese momento aparece un internal server error

En los logs el mensaje es:

==> /var/log/koha/eco/plack-error.log <==
No property remove_debarment for Koha::Patron

La restricción se elimina, pero se debe abrir una ventana de koha nuevamente.
Comment 1 Jonathan Druart 2019-06-08 19:36:02 UTC
Hola Frederico, no puedo reproducir este problema. Cual versión usas? Reiniciaste Plack?

I cannot recreate this issue, which version are you using? Did you restart Plack?
Comment 2 Federico Rinaudo 2019-06-11 15:00:28 UTC
Reinicie plack y sigue saliendo el mismo error. Utilizo debian 8 y koha está en su viersión 18.11.05.000
Comment 3 Katrin Fischer 2019-06-17 21:42:17 UTC
I've added adding and deleting restrictions from a patron account in staff in 18.11 and it worked ok, no internal server error.

Not sure I tested the right thing, can someone help?
Comment 4 Jonathan Druart 2019-06-19 19:25:23 UTC
Federico, can you locate where you Koha code is (should be something like /usr/share/koha/lib) then copy the output of the following command:
  % grep -r remove_debarment
Comment 5 Federico Rinaudo 2019-06-21 17:29:10 UTC
there is no output for the command
Comment 6 Tomás Cohen Arazi 2019-06-21 18:12:04 UTC
(In reply to Federico Rinaudo from comment #5)
> there is no output for the command

It might come from the templates. Try:

  $ cd /usr/share/koha
  $ grep -r remove_debarment
Comment 7 Federico Rinaudo 2019-06-21 18:13:51 UTC
/usr/share/koha# grep -r remove_debarment
intranet/cgi-bin/members/memberentry.pl:my @debarments_to_remove = $input->multi_param('remove_debarment');
intranet/htdocs/intranet-tmpl/prog/en/modules/members/memberentrygen.tt:                                        <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
intranet/htdocs/intranet-tmpl/prog/es-ES/modules/members/memberentrygen.tt: <input type="checkbox" id="debarment_[% d.borrower_debarment_id | html %]" name="remove_debarment" value="[% d.borrower_debarment_id | html %]" />
Comment 8 Jonathan Druart 2019-06-22 21:38:40 UTC
This is correct Federico, I have no idea what is going wrong.

If you have a test server you could try to apply this debug statement:

@ Object.pm:240 @ sub set {

     foreach my $p ( keys %$properties ) {
         unless ( grep {/^$p$/} @columns ) {
+            my @c = caller; use Data::Printer colored => 1; warn p @c;
             Koha::Exceptions::Object::PropertyNotFound->throw( "No property $p for " . ref($self) );
         }
     }


To understand where it comes from.

Or, you can turn the dev_install flag on in your koha-conf.xml file, then restart plack. You will get a full stack trace of the error which will be easier to track the problem down.
Comment 9 Andrew 2019-06-24 13:23:21 UTC
I'm able to recreate this on 18.11.06. Plack log showing the same error "No property remove_debarment for Koha::Patron." 
When I reload the patron the debarment has been removed, despite the error
Comment 10 Andrew 2019-06-24 13:25:50 UTC
Oh, and I do not get this error when removing the debarment from the restrictions tab on circulation.pl. Only when removing the debarment from memberentry.pl
Comment 11 Jonathan Druart 2019-06-24 14:51:46 UTC
(In reply to Andrew from comment #10)
> Oh, and I do not get this error when removing the debarment from the
> restrictions tab on circulation.pl. Only when removing the debarment from
> memberentry.pl

That was the useful bit, thanks!
Confirmed.
Comment 12 Jonathan Druart 2019-06-24 15:11:34 UTC
Created attachment 90954 [details] [review]
Bug 23082: FIX debarment removing when editing a patron

In members/memberentry.pl we have to explicitely remove the template's
params that are not patron's attributes.

Certainly caused by
  commit 1bb6cec902088d07c7a43addc4b4adb5b0bf3d4f
  Bug 20287: Fix update of patrons, clean the data before ->store

Test plan:
Create a restriction for a patron
Edit patron's details
Remove the restriction
=> Without this patch you get "No property remove_debarment for
Koha::Patron"
=> With this patch applied the restriction is removed
Comment 13 M. Tompsett 2019-06-24 15:39:48 UTC
Created attachment 90958 [details] [review]
Bug 23082: FIX debarment removing when editing a patron

In members/memberentry.pl we have to explicitely remove the template's
params that are not patron's attributes.

Certainly caused by
  commit 1bb6cec902088d07c7a43addc4b4adb5b0bf3d4f
  Bug 20287: Fix update of patrons, clean the data before ->store

Test plan:
Create a restriction for a patron
Edit patron's details
Remove the restriction
=> Without this patch you get "No property remove_debarment for
Koha::Patron"
=> With this patch applied the restriction is removed

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 14 Kyle M Hall 2019-06-24 17:01:44 UTC
Created attachment 90963 [details] [review]
Bug 23082: Fatal error editing a restricted patron

In members/memberentry.pl we have to explicitely remove the template's
params that are not patron's attributes.

Certainly caused by
  commit 1bb6cec902088d07c7a43addc4b4adb5b0bf3d4f
  Bug 20287: Fix update of patrons, clean the data before ->store

Test plan:
Create a restriction for a patron
Edit patron's details
Remove the restriction
=> Without this patch you get "No property remove_debarment for
Koha::Patron"
=> With this patch applied the restriction is removed

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Martin Renvoize 2019-06-25 16:02:06 UTC
Nice work!

Pushed to master for 19.11.00
Comment 16 Fridolin SOMERS 2019-06-26 14:21:34 UTC
Pushed to 19.05.x for 19.05.01
Comment 17 Lucas Gass 2019-06-26 17:27:32 UTC
backported to 18.11.x for 18.11.07