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!

CommentFileSizeAuthor
#5 duplicatepatronuid.patch3.56 KBjastraat

Comments

jastraat’s picture

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.

rajiv.r.in’s picture

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

jastraat’s picture

Check admin/settings/library/patrons

rajiv.r.in’s picture

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.

jastraat’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new3.56 KB

Here's a patch that fixes the above problem.

jastraat’s picture

Category: support » bug
Priority: Critical » Normal
Status: Patch (to be ported) » Needs review
jastraat’s picture

Status: Needs review » Fixed

patch applied to latest dev version

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.