1 SELECT dropIfExists('FUNCTION', 'toggleBankrecCleared(int,text,int)', 'public');
3 CREATE OR REPLACE FUNCTION toggleBankrecCleared(INTEGER, TEXT, INTEGER, NUMERIC, NUMERIC) RETURNS BOOLEAN AS $$
4 -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 -- See www.xtuple.com/CPAL for the full text of the software license.
7 pBankrecid ALIAS FOR $1;
9 pSourceid ALIAS FOR $3;
10 pCurrrate ALIAS FOR $4;
14 RETURN toggleBankrecCleared(pBankrecid, pSource, pSourceid, pCurrrate, pAmount, NULL);
16 $$ LANGUAGE 'plpgsql';
18 CREATE OR REPLACE FUNCTION toggleBankrecCleared(INTEGER, TEXT, INTEGER, NUMERIC, NUMERIC, DATE) RETURNS BOOLEAN AS $$
19 -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
20 -- See www.xtuple.com/CPAL for the full text of the software license.
22 pBankrecid ALIAS FOR $1;
24 pSourceid ALIAS FOR $3;
25 pCurrrate ALIAS FOR $4;
32 SELECT bankrecitem_id, bankrecitem_cleared INTO _r
34 WHERE ( (bankrecitem_bankrec_id=pBankrecid)
35 AND (bankrecitem_source=pSource)
36 AND (bankrecitem_source_id=pSourceid) );
39 INSERT INTO bankrecitem
40 (bankrecitem_bankrec_id, bankrecitem_source,
41 bankrecitem_source_id, bankrecitem_cleared,
42 bankrecitem_curr_rate, bankrecitem_amount,
51 DELETE FROM bankrecitem
52 WHERE bankrecitem_id = _r.bankrecitem_id;
57 $$ LANGUAGE 'plpgsql';