[Koha] Fwd: Unable to reindex after massive upgrade

Tim Young Tim.Young at LightSys.org
Fri Sep 15 03:20:23 NZST 2017


I am revisiting an old topic here; we still have some inconsistencies in 
our data.

Previously in this thread: We were getting an error to the likes of: 
*Can't call method "branchname" on an undefined value at 
/usr/share/koha/lib/C4/Biblio.pm line 1627*

This was due to some bad data; our holding information had somehow 
gotten bad library codes.  I was given some SQL to replace holdingbranch 
and homebranch in the items table.

But, it turns out that the fields are being pulled from the marc data, 
not the items table.  We still have some bad data stored in the marc 
fields somewhere.

Luckily for me, I am a sysadmin.  I have all sorts of potentially 
destructive, but very possible solutions.  My plan is to do a big sql 
dump of the database, and then use a regular expression to do a 
database-wide change of that bad data to the good data.  It is a pretty 
unique code that does not seem to appear anywhere else than "branch" 
areas.  This bulk change would solve the problem, but it would also 
change any legacy archives and stuff like that...  The data would be 
back in sync, but it is somewhat of a shotgun approach...

Anyone have any wisdom for me before I take such a drastic measure?

     - Tim Young


On 6/27/2017 1:46 PM, Tim Young wrote:
>
> Great!  Thanks.  & Thanks for the sql.  Worked fine.
>
>     - Tim
>
>
> On 6/27/2017 12:55 PM, Tomas Cohen Arazi wrote:
>> Tim, the authorised_values_branches table is not related.
>>
>> The problem is that there are fields in your record(s) that are 
>> expected to contain a branchcode. And they don't. That's why 
>> Koha::Libraries->find() is returning an undefined value (undef in Perl).
>>
>> When you removed the FK constraint, you did hide the basic problem of 
>> inconsistency.
>>
>> I suggest that you find your only library's branchcode and make sure 
>> your items all have homebranch and holdingbranch set to that. Then 
>> reindex. You should do it like this:
>>
>> # Enter to mysql
>> $ sudo koha-mysql lib
>> > UPDATE items SET homebranch='LIB', holdingbranch='LIB';
>> > \q
>> $ sudo koha-rebuild-zebra -f -a -b -v lib
>>
>> Note: replace 'lib' for your instance name, and 'LIB' for your 
>> library's branchcode.
>>
>> Regards.
>>
>>
>> El mar., 27 jun. 2017 a las 13:59, Tim Young (<Tim.Young at lightsys.org 
>> <mailto:Tim.Young at lightsys.org>>) escribió:
>>
>>     Awesome. Thanks.  I may be able to figure it out (I am pretty good at
>>     poking and prodding, and finally figuring it out).  I believe we only
>>     have one branch, so I should be able to simply replace everything
>>     in the
>>     sql to match the correct branch... (Yikes! Branchcode is used all
>>     over
>>     the place!)
>>
>>     BUT, I am a sysadmin, not a Koha admin.  This looks like it might be
>>     easier to fix through the web interface... So excuse the dumb
>>     questions.  :)
>>
>>     That particular error seems to stem from something be authorized by
>>     branches.  My "authorised_values_branches" table is empty. Should
>>     I set
>>     up an authorized branch or something somewhere?
>>
>>     We do have a branch configured (I can see it in the branches
>>     table)...
>>
>>     The code seems to be looking at
>>     Koha::Libraries->find($value)->branchname;
>>
>>     and (I have "value" being undefined, or defined improperly. But I do
>>     not see a libraries table...)
>>
>>     But, at the same time:
>>     $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq
>>     "branches".  So I
>>     somewhere seem to be saying to authorize by branch, and I do not have
>>     any authorized branches (or the authorised_values_branches is
>>     empty)...
>>
>>     Is there a simple web area I should check out before I jump into the
>>     mysql and make changes that might not be supported?
>>
>>          - Tim
>>
>>
>>     On 6/27/2017 9:26 AM, Tomas Cohen Arazi wrote:
>>     > You need to fix your data, so fields linked to branch codes
>>     actually
>>     > contain valid branchcodes. The band aid will work, but I think you
>>     > need to fix your data for good.
>>     >
>>     > Koha got stricter regarding the data quality/completeness. This
>>     > particular case could be saved by some tweak like the one you
>>     propose.
>>     > It is maybe worth filling a bug, because the previous behaviour
>>     worked
>>     > more gracefuly.
>>     >
>>
>>     _______________________________________________
>>     Koha mailing list http://koha-community.org
>>     Koha at lists.katipo.co.nz <mailto:Koha at lists.katipo.co.nz>
>>     https://lists.katipo.co.nz/mailman/listinfo/koha
>>
>> -- 
>> Tomás Cohen Arazi
>> Theke Solutions (https://theke.io <http://theke.io/>)
>> ✆ +54 9351 3513384
>> GPG: B2F3C15F
>



More information about the Koha mailing list