Bugzilla – Attachment 76533 Details for
Bug 21011
Data inconsistencies - items.holdingbranch | items.homebranch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21011: Search for items with not defined homebranch and/or holdingbranch
Bug-21011-Search-for-items-with-not-defined-homebr.patch (text/plain), 3.02 KB, created by
Jonathan Druart
on 2018-06-27 18:34:48 UTC
(
hide
)
Description:
Bug 21011: Search for items with not defined homebranch and/or holdingbranch
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-27 18:34:48 UTC
Size:
3.02 KB
patch
obsolete
>From c716308add0285686e335e2080d6a156290f7832 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 27 Jun 2018 15:32:56 -0300 >Subject: [PATCH] Bug 21011: Search for items with not defined homebranch > and/or holdingbranch > >From bug 5789: scripts can fail if items.homebranch and/or >items.holdingbranch is not defined > >This script will help people catching these migration issues. > >Test plan: >Update your items table to set some homebranch or holdingbranch to NULL >Run this script >It will display the different items with not defined values in these >fields. >--- > .../maintenance/search_for_data_inconsistencies.pl | 67 ++++++++++++++++++++++ > 1 file changed, 67 insertions(+) > create mode 100644 misc/maintenance/search_for_data_inconsistencies.pl > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >new file mode 100644 >index 0000000000..5105f6cfc0 >--- /dev/null >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -0,0 +1,67 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Koha::Items; >+ >+{ >+ my $items = Koha::Items->search({ -or => { homebranch => undef, holdingbranch => undef }}); >+ if ( $items->count ) { new_section("Not defined items.homebranch and/or items.holdingbranch")} >+ while ( my $item = $items->next ) { >+ if ( not $item->homebranch and not $item->holdingbranch ) { >+ new_item(sprintf "Item with itemnumber=%s does not have homebranch and holdingbranch defined", $item->itemnumber); >+ } elsif ( $item->homebranch ) { >+ new_item(sprintf "Item with itemnumber=%s does not have homebranch defined", $item->itemnumber); >+ } else { >+ new_item(sprintf "Item with itemnumber=%s does not have holdingbranch defined", $item->itemnumber); >+ } >+ } >+ if ( $items->count ) { new_hint("Edit these items and set valid homebranch and/or holdingbranch")} >+} >+ >+sub new_section { >+ my ( $name ) = @_; >+ say "\n== $name =="; >+} >+ >+sub new_item { >+ my ( $name ) = @_; >+ say "\t* $name"; >+} >+sub new_hint { >+ my ( $name ) = @_; >+ say "=> $name"; >+} >+ >+=head1 NAME >+ >+search_for_data_inconsistencies.pl >+ >+=head1 SYNOPSIS >+ >+ perl search_for_data_inconsistencies.pl >+ >+=head1 DESCRIPTION >+ >+Catch data inconsistencies in Koha database >+ >+* Items with not defined homebranch and/or holdingbranch >+ >+=back >+ >+=cut >-- >2.11.0
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 21011
:
76533
|
76536
|
76537
|
77384
|
77385