2 CREATE OR REPLACE FUNCTION toggleBankrecCleared(INTEGER, TEXT, INTEGER, NUMERIC, NUMERIC) RETURNS BOOLEAN AS $$
3 -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 -- See www.xtuple.com/CPAL for the full text of the software license.
6 pBankrecid ALIAS FOR $1;
8 pSourceid ALIAS FOR $3;
9 pCurrrate ALIAS FOR $4;
13 RETURN toggleBankrecCleared(pBankrecid, pSource, pSourceid, pCurrrate, pAmount, NULL);
15 $$ LANGUAGE 'plpgsql';
17 CREATE OR REPLACE FUNCTION toggleBankrecCleared(INTEGER, TEXT, INTEGER, NUMERIC, NUMERIC, DATE) RETURNS BOOLEAN AS $$
18 -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
19 -- See www.xtuple.com/CPAL for the full text of the software license.
21 pBankrecid ALIAS FOR $1;
23 pSourceid ALIAS FOR $3;
24 pCurrrate ALIAS FOR $4;
31 SELECT bankrecitem_id, bankrecitem_cleared INTO _r
33 WHERE ( (bankrecitem_bankrec_id=pBankrecid)
34 AND (bankrecitem_source=pSource)
35 AND (bankrecitem_source_id=pSourceid) );
38 INSERT INTO bankrecitem
39 (bankrecitem_bankrec_id, bankrecitem_source,
40 bankrecitem_source_id, bankrecitem_cleared,
41 bankrecitem_curr_rate, bankrecitem_amount,
50 DELETE FROM bankrecitem
51 WHERE bankrecitem_id = _r.bankrecitem_id;
56 $$ LANGUAGE 'plpgsql';