Expected behaviour if itemtype does not exist

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Expected behaviour if itemtype does not exist

Jonathan Druart
Hi devs,

Since bug 17843 I get errors if the item type (items.itype or biblioitems.itemtype depending on the pref item_level_itypes) does not exist as an item type (table itemtypes, filled by Administration › Item types administration).
The error (Can't call method "translated_description" on an undefined value) appears because we call a method on an undefined value.
As this is a configuration issue (right?) I think we should add an alert from the updatedatabase.pl script, then a warning on the about page.
Would that be enough or should we handle the problematic case anyway (i.e. call the method only if the item type exists in DB)?

Cheers,
Jonathan

_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Expected behaviour if itemtype does not exist

Katrin Fischer-2

Hi Jonathan,

I am not sure if I understand correctly, but I think translating the itemtype descriptions should be optional not mandatory, so not causing errors if the itemtype otherwise is set up correctly (having a 'default' description).

Hope that helps,

Katrin


On 12.07.2017 20:50, Jonathan Druart wrote:
Hi devs,

Since bug 17843 I get errors if the item type (items.itype or biblioitems.itemtype depending on the pref item_level_itypes) does not exist as an item type (table itemtypes, filled by Administration › Item types administration).
The error (Can't call method "translated_description" on an undefined value) appears because we call a method on an undefined value.
As this is a configuration issue (right?) I think we should add an alert from the updatedatabase.pl script, then a warning on the about page.
Would that be enough or should we handle the problematic case anyway (i.e. call the method only if the item type exists in DB)?

Cheers,
Jonathan


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Expected behaviour if itemtype does not exist

Jonathan Druart
Hi Katrin,

Sorry for the late reply.

It's not about the translation, but the existence of the item type.
  my $item_type = Koha::ItemTypes->find('BOOK');
  $item_type->description; # Or whatever method call
will fail if "BOOK" is not defined.

My question was: If an item is defined with a items.itype (or biblioitems.itemtype) that is not an entry in the itemtypes table, is it considered as a configuration issue?
If yes, I will write a script to catch them, add something to the about page and the update database process.
If not, we will have to handle that case everywhere in the code.

Cheers,
Jonathan

On Fri, 14 Jul 2017 at 04:37 Katrin <[hidden email]> wrote:

Hi Jonathan,

I am not sure if I understand correctly, but I think translating the itemtype descriptions should be optional not mandatory, so not causing errors if the itemtype otherwise is set up correctly (having a 'default' description).

Hope that helps,

Katrin


On 12.07.2017 20:50, Jonathan Druart wrote:
Hi devs,

Since bug 17843 I get errors if the item type (items.itype or biblioitems.itemtype depending on the pref item_level_itypes) does not exist as an item type (table itemtypes, filled by Administration › Item types administration).
The error (Can't call method "translated_description" on an undefined value) appears because we call a method on an undefined value.
As this is a configuration issue (right?) I think we should add an alert from the updatedatabase.pl script, then a warning on the about page.
Would that be enough or should we handle the problematic case anyway (i.e. call the method only if the item type exists in DB)?

Cheers,
Jonathan


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Expected behaviour if itemtype does not exist

Katrin Fischer-2

Hi Jonathan,

I think in this case it's probably a migration issue that should be fixed. Catching them with a script makes sense to me.

Katrin


On 08.08.2017 18:24, Jonathan Druart wrote:
Hi Katrin,

Sorry for the late reply.

It's not about the translation, but the existence of the item type.
  my $item_type = Koha::ItemTypes->find('BOOK');
  $item_type->description; # Or whatever method call
will fail if "BOOK" is not defined.

My question was: If an item is defined with a items.itype (or biblioitems.itemtype) that is not an entry in the itemtypes table, is it considered as a configuration issue?
If yes, I will write a script to catch them, add something to the about page and the update database process.
If not, we will have to handle that case everywhere in the code.

Cheers,
Jonathan

On Fri, 14 Jul 2017 at 04:37 Katrin <[hidden email]> wrote:

Hi Jonathan,

I am not sure if I understand correctly, but I think translating the itemtype descriptions should be optional not mandatory, so not causing errors if the itemtype otherwise is set up correctly (having a 'default' description).

Hope that helps,

Katrin


On 12.07.2017 20:50, Jonathan Druart wrote:
Hi devs,

Since bug 17843 I get errors if the item type (items.itype or biblioitems.itemtype depending on the pref item_level_itypes) does not exist as an item type (table itemtypes, filled by Administration › Item types administration).
The error (Can't call method "translated_description" on an undefined value) appears because we call a method on an undefined value.
As this is a configuration issue (right?) I think we should add an alert from the updatedatabase.pl script, then a warning on the about page.
Would that be enough or should we handle the problematic case anyway (i.e. call the method only if the item type exists in DB)?

Cheers,
Jonathan


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Expected behaviour if itemtype does not exist

Marc Véron

Hi everybody

I think that a note on the about page would be very useful.

Marc

Am 08.08.2017 um 19:26 schrieb Katrin:

Hi Jonathan,

I think in this case it's probably a migration issue that should be fixed. Catching them with a script makes sense to me.

Katrin


On 08.08.2017 18:24, Jonathan Druart wrote:
Hi Katrin,

Sorry for the late reply.

It's not about the translation, but the existence of the item type.
  my $item_type = Koha::ItemTypes->find('BOOK');
  $item_type->description; # Or whatever method call
will fail if "BOOK" is not defined.

My question was: If an item is defined with a items.itype (or biblioitems.itemtype) that is not an entry in the itemtypes table, is it considered as a configuration issue?
If yes, I will write a script to catch them, add something to the about page and the update database process.
If not, we will have to handle that case everywhere in the code.

Cheers,
Jonathan

On Fri, 14 Jul 2017 at 04:37 Katrin <[hidden email]> wrote:

Hi Jonathan,

I am not sure if I understand correctly, but I think translating the itemtype descriptions should be optional not mandatory, so not causing errors if the itemtype otherwise is set up correctly (having a 'default' description).

Hope that helps,

Katrin


On 12.07.2017 20:50, Jonathan Druart wrote:
Hi devs,

Since bug 17843 I get errors if the item type (items.itype or biblioitems.itemtype depending on the pref item_level_itypes) does not exist as an item type (table itemtypes, filled by Administration › Item types administration).
The error (Can't call method "translated_description" on an undefined value) appears because we call a method on an undefined value.
As this is a configuration issue (right?) I think we should add an alert from the updatedatabase.pl script, then a warning on the about page.
Would that be enough or should we handle the problematic case anyway (i.e. call the method only if the item type exists in DB)?

Cheers,
Jonathan


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/



_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
[hidden email]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Loading...