Unable to create second 'Patron'

rajiv.r.in - July 14, 2009 - 14:52
Project:Library
Version:6.x-1.x-dev
Component:User interface
Category:support request
Priority:critical
Assigned:Unassigned
Status:active
Description

I can create the first 'Patron', but when I attempt to create another one (or more), I get the following error:

user warning: Duplicate entry '0' for key 'patron_uid' query: INSERT INTO library_patrons (nid, name_last, name_first, email, patron_uid, barcode, disabled) VALUES (194, 'lastname', 'firstname', 'firstname.lastname@domain.com', 0, '', 0) in C:\xampp\htdocs\drupal\sites\all\modules\library-6.x-1.x-dev\library\patron\patron.module on line 123.

However, the content does get created: as is indicated by the following message:

Library Patron firstname lastname has been created.

However, this 'Patron' is not visible in 'parton list'

Any help would be highly appreciated. thx!

#1

jastraat - July 15, 2009 - 14:55

Sounds like you're using the patron module without the patrons as users option. I wouldn't recommend this in the long term since my current plan (if I were to release a Drupal 7 version) is to simplify the module by removing the 'patron' submodule altogether and just use Drupal users.

I think I've found the error, but it may take me a while to release an update since I don't currently have an environment to test it. If you'd like to try it, change line 190 in the patron module to the following:

  $node->patron_uid = NULL;

Then run the following SQL statement on your database:
UPDATE library_patrons SET patron_uid = NULL WHERE patron_uid = 0

If you try it, please let me know if it fixes the problem.

#2

rajiv.r.in - July 15, 2009 - 21:18

Thx Jastraat for responding!

I will try the solution and will let you know the results. However, I did not see the option of "patrons are users" anywhere while configuring the module. If you can point me to that, I'll try that first before attempting to change the code in the module.

Thx agian, Rajiv

#3

jastraat - July 15, 2009 - 21:27

Check admin/settings/library/patrons

#4

rajiv.r.in - July 16, 2009 - 07:47

Thank you so much! I followed the link and activated the user setting “Associate Library Partons with Drupal Users” and it solved the problem. The problem was, there is no link visible on ‘admin/settings/library’. But when I typed ‘admin/settings/library/patrons’ in the browser, I was straightway taken to the ‘Parton Settings’ page. There, I activated the option.

 
 

Drupal is a registered trademark of Dries Buytaert.