Bugzilla – Attachment 77523 Details for
Bug 21150
Data inconsistencies - item types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21150: Search for item types inconsistencies
Bug-21150-Search-for-item-types-inconsistencies.patch (text/plain), 4.75 KB, created by
Owen Leonard
on 2018-08-07 13:41:38 UTC
(
hide
)
Description:
Bug 21150: Search for item types inconsistencies
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-08-07 13:41:38 UTC
Size:
4.75 KB
patch
obsolete
>From 198bd4c0232c99a5aa4b6ce291406d80e53c9636 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 3 Aug 2018 14:59:33 -0300 >Subject: [PATCH] Bug 21150: Search for item types inconsistencies > >search_for_data_inconsistencies.pl will now display errors if: >1.item-level_itypes is set to "specific item" and items.itype is not set >or not set to an item type defined in the system (itemtypes.itemtype) >2.item-level_itypes is set to "biblio record" and biblioitems.itemtype is not set >or not set to an item type defined in the system (itemtypes.itemtype) > >Test plan: >Use the script and the different possible combinations to display the >errors > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../maintenance/search_for_data_inconsistencies.pl | 65 ++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index 6f69060..797f554 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -18,6 +18,8 @@ > use Modern::Perl; > > use Koha::Items; >+use Koha::Biblioitems; >+use Koha::ItemTypes; > use Koha::Authorities; > > { >@@ -46,6 +48,65 @@ use Koha::Authorities; > if ( $authorities->count ) {new_hint("Go to 'Home ⺠Administration ⺠Authority types' to define them")} > } > >+{ >+ if ( C4::Context->preference('item-level_itypes') ) { >+ my $items_without_itype = Koha::Items->search( { itype => undef } ); >+ if ( $items_without_itype->count ) { >+ new_section("Items do not have itype defined"); >+ while ( my $item = $items_without_itype->next ) { >+ new_item( >+ sprintf "Item with itemnumber=%s does not have a itype value, biblio's item type will be used (%s)", >+ $item->itemnumber, $item->biblioitem->itemtype >+ ); >+ } >+ new_hint("The system preference item-level_itypes expects item types to be defined at item level"); >+ } >+ } >+ else { >+ my $biblioitems_without_itemtype = Koha::Biblioitems->search( { itemtype => undef } ); >+ if ( $biblioitems_without_itemtype->count ) { >+ new_section("Biblioitems do not have itemtype defined"); >+ while ( my $biblioitem = $biblioitems_without_itemtype->next ) { >+ new_item( >+ sprintf "Biblioitem with biblioitemnumber=%s does not have a itemtype value", >+ $biblioitem->biblioitemnumber >+ ); >+ } >+ new_hint("The system preference item-level_itypes expects item types to be defined at biblio level"); >+ } >+ } >+ >+ my @itemtypes = Koha::ItemTypes->search->get_column('itemtype'); >+ if ( C4::Context->preference('item-level_itypes') ) { >+ my $items_with_invalid_itype = Koha::Items->search( { itype => { not_in => \@itemtypes } } ); >+ if ( $items_with_invalid_itype->count ) { >+ new_section("Items have invalid itype defined"); >+ while ( my $item = $items_with_invalid_itype->next ) { >+ new_item( >+ sprintf "Item with itemnumber=%s does not have a valid itype value (%s)", >+ $item->itemnumber, $item->itype >+ ); >+ } >+ new_hint("The items must have a itype value that is defined in the item types of Koha (Home ⺠Administration ⺠Item types administration)"); >+ } >+ } >+ else { >+ my $biblioitems_with_invalid_itemtype = Koha::Biblioitems->search( >+ { itemtype => { not_in => \@itemtypes } } >+ ); >+ if ( $biblioitems_with_invalid_itemtype->count ) { >+ new_section("Biblioitems do not have itemtype defined"); >+ while ( my $biblioitem = $biblioitems_with_invalid_itemtype->next ) { >+ new_item( >+ sprintf "Biblioitem with biblioitemnumber=%s does not have a valid itemtype value", >+ $biblioitem->biblioitemnumber >+ ); >+ } >+ new_hint("The biblioitems must have a itemtype value that is defined in the item types of Koha (Home ⺠Administration ⺠Item types administration)"); >+ } >+ } >+} >+ > sub new_section { > my ( $name ) = @_; > say "\n== $name =="; >@@ -74,5 +135,9 @@ Catch data inconsistencies in Koha database > > * Items with undefined homebranch and/or holdingbranch > * Authorities with undefined authtypecodes/authority types >+* Item types: >+ * if item types are defined at item level (item-level_itypes=specific item), >+ then items.itype must be set else biblioitems.itemtype must be set >+ * Item types defined in items or biblioitems must be defined in the itemtypes table > > =cut >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21150
:
77481
|
77523
|
77534
|
77537
|
77562
|
77563