Index: openacs-4/packages/ecommerce/tcl/ecommerce-state-changes-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-state-changes-procs-postgresql.xql,v diff -u -r1.8 -r1.8.8.1 --- openacs-4/packages/ecommerce/tcl/ecommerce-state-changes-procs-postgresql.xql 30 Nov 2002 17:31:18 -0000 1.8 +++ openacs-4/packages/ecommerce/tcl/ecommerce-state-changes-procs-postgresql.xql 3 Aug 2005 23:10:44 -0000 1.8.8.1 @@ -62,7 +62,7 @@ select gift_certificate_id, gift_certificate_amount_left(gift_certificate_id) as amount_available from ec_gift_certificates_approved where user_id = :user_id - and current_timestamp - expires < 0 + and current_timestamp < expires and amount_remaining_p = 't' and gift_certificate_amount_left(gift_certificate_id) > 0 order by expires