[Koha-devel] Generating transactions
Magnus Enger
magnus at enger.priv.no
Tue Apr 12 12:18:31 CEST 2011
On 9 April 2011 09:55, Magnus Enger <magnus at enger.priv.no> wrote:
> On 7 April 2011 22:56, Chris Cormack <chris at bigballofwax.co.nz> wrote:
>> As far as I know such a
>> script does not exist. I would offer to write one, as it sounds like
>> fun, but I am in the middle of release management work. I am sure
>> however that one of the other developers could do this.
>
> I thought it sounded like fun too, so I have started to work on one
> during the trip to and from Marseille. It's not finished yet, but I
> hope to get a long, good wait for the last plane home to Bodø, and I
> will let you know when it can be tested.
Here is a basic version of the script for generating patrons:
https://github.com/MagnusEnger/LibrioTools/blob/master/sim/patrons.pl
See here for some context:
https://github.com/MagnusEnger/LibrioTools/tree/master/sim
I'm sort of stuck on the script for the actual transactions, though:
https://github.com/MagnusEnger/LibrioTools/blob/master/sim/circ.pl
The call to C4::Circulation::AddIssue() results in this error:
Can't use an undefined value as a HASH reference at
/home/magnus/scripts/kohanor32/C4/Circulation.pm line 1048.
Line 1048 and it's surroundings in Circulation.pm looks like this:
http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=C4/Circulation.pm;h=b977524b3f871477d2d18f5a8ba4150853ae68f0;hb=HEAD#l1048
1042 unless ($datedue) {
1043 my $itype = (
C4::Context->preference('item-level_itypes') ) ? $biblio->{'itype'} :
$biblio->{'itemtype'};
1044 $datedue = CalcDateDue( C4::Dates->new( $issuedate,
'iso' ), $itype, $branch, $borrower );
1045
1046 }
1047 $sth->execute(
1048 $borrower->{'borrowernumber'}, # borrowernumber
1049 $item->{'itemnumber'}, # itemnumber
1050 $issuedate, # issuedate
1051 $datedue->output('iso'), # date_due
1052 C4::Context->userenv->{'branch'} # branchcode
1053 );
When i introduce a "die Dumper $borrower;" after line 1046 i get what
looks like a perfectly accpetable representation of a borrower, and I
can't for the life of me understand why it should be undefined two
lines further down.
If anyone with a keener eye than mine should find this to be an
interesting challenge I'm all ears... ;-)
Best regards,
Magnus Enger
libriotech.no
More information about the Koha-devel
mailing list