[Koha-bugs] [Bug 24161] Add ability to track the claim dates of later orders
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Apr 5 11:45:08 CEST 2022
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24161
--- Comment #74 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to Katrin Fischer from comment #73)
> I am not sure if the database for this one works correctly. It looks like
> the timestamp was always set to the 'update date' instead of the last known
> claim date as it should have been. :(
>
> <pre>
> $DBversion = '19.12.00.085';
> if( CheckVersion( $DBversion ) ) {
> unless ( TableExists( 'aqorders_claims' ) ) {
> $dbh->do(q|
> CREATE TABLE aqorders_claims (
> id int(11) AUTO_INCREMENT,
> ordernumber INT(11) NOT NULL,
> claimed_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
> PRIMARY KEY (id),
> CONSTRAINT aqorders_claims_ibfk_1 FOREIGN KEY (ordernumber)
> REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE
> ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE =
> utf8mb4_unicode_ci
> |);
>
> my $orders = $dbh->selectall_arrayref(q|
> SELECT ordernumber, claims_count, claimed_date
> FROM aqorders
> WHERE claims_count > 0
> |, { Slice => {} });
> my $insert_claim_sth = $dbh->prepare(q|
> INSERT INTO aqorders_claims (ordernumber, claimed_on)
> VALUES (?,?)
> |);
>
> for my $order ( @$orders ) {
> for my $claim (1..$order->{claims_count}) {
> $insert_claim_sth->execute($order->{ordernumber},
> $order->{claimed_on});
> }
> }
>
> $dbh->do(q|ALTER TABLE aqorders DROP COLUMN claims_count, DROP
> COLUMN claimed_date|);
> }
>
> NewVersion( $DBversion, 24161, "Add new join table aqorders_claims to
> keep track of claims");
> }
Looks like the following line
22065 $insert_claim_sth->execute($order->{ordernumber},
$order->{claimed_on});
should have used $order->{claimed_on} instead.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list