Thanks Jason - looks like I eventually narrowed the problem down. The address
was being written to the database but not linked to the patron. In
_add_update_addresses in Actor.pm the following lines were to blame:
if( $patron->billing_address() and
$patron->billing_address() == $current_id ) {
$new_patron->billing_address($address->id());
$logger->info("setting billing addr to $current_id");
$new_patron->ischanged(1);
}
if( $patron->mailing_address() and
$patron->mailing_address() == $current_id ) {
$new_patron->mailing_address($address->id());
$logger->info("setting mailing addr to $current_id");
$new_patron->ischanged(1);
}
At this point neither $patron->mailing_address or $patron->billing_address
exist so the address id is not passed into $new_patron. Adding the following
seems to do the trick:
if (!$patron->mailing_address() and !$patron->billing_address())
{
$new_patron->mailing_address($address->id());
$new_patron->billing_address($address->id());
$logger->info("setting mailing and billing addr to $current_id");
$new_patron->ischanged(1);
}
Thanks again for the advice - I doubt I'd have got to the bottom of it
otherwise!
Mark
On 20 Dec 2011, at 14:27, Jason Etheridge wrote:
>> Thanks for this. In this particular instance the library in question would
>> like the borrowers to be loaded automatically to a restricted borrower
>> category so that they meet current customer service response standards and
>> minimise staff intervention.
>
> Ah, well in that case...
>
>> I have a feeling that the problem may be caused by something to do with the
>> address fieldmapper object - I have seen something in the log about no
>> response being returned within 10 seconds so the transaction is rolled back.
>
> Hrmm.
>
>> [
>> 'MAILING', '<city>', <country>', '<county>', undef, '<postcode>',
>> '<state>', '<street1>', '<street2>', -1, 't', 't', undef, 'f'
>> ], 'Fieldmapper::actor::user_address'
>
> Nothing leaps out at me here. You're using
> Fieldmapper::actor::user_address->new I assume? Oh wait, are you
> setting isnew to true on that?
>
>> Does anyone have any idea where I'm going wrong? Any help is greatly
>> appreciated as this has been driving me mad for hours!
>
> If isnew isn't the issue, I would try sprinkling Actor.pm with lots of
> $logger->info('here, there, etc.');, especially inside sub
> _add_address and the caller.
>
> --
> Jason Etheridge
> | Equinox Software, Inc. / The Open Source Experts
> | phone: 1-877-OPEN-ILS (673-6457)
> | email: [email protected]
> | web: http://www.esilibrary.com