-UPDATE pkghead SET pkghead_version = '4.7.0Beta2' WHERE pkghead_name = 'xt';
+UPDATE pkghead SET pkghead_version = '4.7.0' WHERE pkghead_name = 'xt';
BEGIN
RETURN issueToShipping('SO', $1, $2, 0, CURRENT_TIMESTAMP);
END;
-$$ LANGUAGE 'plpgsql';
+$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION issueToShipping(INTEGER, NUMERIC, INTEGER) RETURNS INTEGER AS $$
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
BEGIN
RETURN issueToShipping('SO', $1, $2, $3, CURRENT_TIMESTAMP);
END;
-$$ LANGUAGE 'plpgsql';
+$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION issueToShipping(TEXT, INTEGER, NUMERIC, INTEGER, TIMESTAMP WITH TIME ZONE) RETURNS INTEGER AS $$
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
BEGIN
RETURN issueToShipping($1, $2, $3, $4, $5, NULL);
END;
-$$ LANGUAGE 'plpgsql';
-
-CREATE OR REPLACE FUNCTION issueToShipping(TEXT, INTEGER, NUMERIC, INTEGER, TIMESTAMP WITH TIME ZONE, INTEGER) RETURNS INTEGER AS $$
+$$ LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION issueToShipping(pordertype TEXT,
+ pitemid INTEGER,
+ pQty NUMERIC,
+ pItemlocSeries INTEGER,
+ pTimestamp TIMESTAMP WITH TIME ZONE,
+ pinvhistid INTEGER) RETURNS INTEGER AS $$
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
DECLARE
- pordertype ALIAS FOR $1;
- pitemid ALIAS FOR $2;
- pQty ALIAS FOR $3;
- _itemlocSeries INTEGER := $4;
- _timestamp TIMESTAMP WITH TIME ZONE := $5;
- pinvhistid ALIAS FOR $6;
- _coholdtype TEXT;
- _invhistid INTEGER;
- _shipheadid INTEGER;
- _shipnumber INTEGER;
+ _itemlocSeries INTEGER;
+ _timestamp TIMESTAMP WITH TIME ZONE;
+ _coholdtype TEXT;
+ _balance NUMERIC;
+ _invhistid INTEGER;
+ _shipheadid INTEGER;
+ _shipnumber INTEGER;
_cntctid INTEGER;
_p RECORD;
_m RECORD;
_value NUMERIC;
- _warehouseid INTEGER;
- _shipitemid INTEGER;
+ _warehouseid INTEGER;
+ _shipitemid INTEGER;
_freight NUMERIC;
BEGIN
- IF (_timestamp IS NULL) THEN
+ IF (pTimestamp IS NULL) THEN
_timestamp := CURRENT_TIMESTAMP;
+ ELSE
+ _timestamp := pTimestamp;
END IF;
- IF (_itemlocSeries = 0) THEN
+ IF (pItemlocSeries = 0) THEN
_itemlocSeries := NEXTVAL('itemloc_series_seq');
+ ELSE
+ _itemlocSeries := pItemlocSeries;
END IF;
IF (pordertype = 'SO') THEN
END IF;
END IF;
+ -- Check Credit Hold
+ SELECT cohead_holdtype INTO _coholdtype
+ FROM coitem JOIN cohead ON (cohead_id=coitem_cohead_id)
+ WHERE (coitem_id=pitemid);
+
+ SELECT calcSalesOrderAmt(cohead_id) -
+ COALESCE(SUM(currToCurr(aropenalloc_curr_id, cohead_curr_id,
+ aropenalloc_amount, cohead_orderdate)),0) INTO _balance
+ FROM coitem JOIN cohead ON (cohead_id=coitem_cohead_id)
+ LEFT OUTER JOIN aropenalloc ON (aropenalloc_doctype='S' AND
+ aropenalloc_doc_id=cohead_id)
+ WHERE (coitem_id=pitemid)
+ GROUP BY cohead_id;
+
+ --RAISE NOTICE 'issueToShipping - order balance is %', _balance;
+ IF ( (_coholdtype = 'C') AND (_balance > 0.0) ) THEN
+ RETURN -12;
+ ELSIF (_coholdtype = 'P') THEN
+ RETURN -13;
+ ELSIF (_coholdtype = 'R') THEN
+ RETURN -14;
+ END IF;
+
SELECT shiphead_id INTO _shipheadid
FROM shiphead, coitem JOIN itemsite ON (itemsite_id=coitem_itemsite_id)
WHERE ( (coitem_id=pitemid)
RETURN -10;
END IF;
- SELECT cohead_holdtype INTO _coholdtype
- FROM cohead, coitem
- WHERE ((cohead_id=coitem_cohead_id)
- AND (coitem_id=pitemid));
-
- IF (_coholdtype = 'C') THEN
- RETURN -12;
- ELSIF (_coholdtype = 'P') THEN
- RETURN -13;
- ELSIF (_coholdtype = 'R') THEN
- RETURN -14;
- END IF;
-
INSERT INTO shiphead
( shiphead_id, shiphead_number, shiphead_order_id, shiphead_order_type,
shiphead_shipped,
RETURN _itemlocSeries;
END;
-$$ LANGUAGE 'plpgsql';
+$$ LANGUAGE plpgsql;
WHERE ( (apopen_doctype='V')
AND (apopen_id=pApopenid) );
IF (NOT FOUND) THEN
- RAISE EXCEPTION 'Cannot Void Voucher #% as apopen not found', pApopenid;
+ RAISE EXCEPTION 'Cannot Void Voucher Id % as apopen not found [xtuple: voidAPOpenVoucher, -10, %]',
+ pApopenid, pApopenid;
END IF;
-- Cache Voucher Infomation
LEFT OUTER JOIN pohead ON (vohead_pohead_id = pohead_id)
WHERE (vohead_number=_n.apopen_docnumber);
IF (NOT FOUND) THEN
- RAISE EXCEPTION 'Cannot Void Voucher #% as vohead not found', _n.apopen_docnumber;
+ RAISE EXCEPTION 'Cannot Void Voucher #% as vohead not found [xtuple: voidAPOpenVoucher, -20, %]',
+ _n.apopen_docnumber, _n.apopen_docnumber;
+ END IF;
+
+-- Check for APApplications
+ SELECT apapply_id INTO _test
+ FROM apapply
+ WHERE (apapply_target_apopen_id=_n.apopen_id)
+ LIMIT 1;
+ IF (FOUND) THEN
+ RAISE EXCEPTION 'Cannot Void Voucher #% as applications exist [xtuple: voidAPOpenVoucher, -30, %]',
+ _n.apopen_docnumber, _n.apopen_docnumber;
END IF;
_glDate := COALESCE(_p.vohead_gldistdate, _p.vohead_distdate);
AND (expcat_liability_accnt_id=lb.accnt_id)
AND (expcat_id=_g.poitem_expcat_id) );
IF (NOT FOUND) THEN
- RAISE EXCEPTION 'Cannot Void Voucher #% due to unassigned G/L Accounts.', _p.vohead_number;
+ RAISE EXCEPTION 'Cannot Void Voucher #% due to unassigned G/L Accounts [xtuple: voidAPOpenVoucher, -40, %]',
+ _p.vohead_number, _p.vohead_number;
END IF;
ELSE
SELECT pp.accnt_id AS pp_accnt_id,
AND (costcat_liability_accnt_id=lb.accnt_id)
AND (costcat_id=_g.costcatid) );
IF (NOT FOUND) THEN
- RAISE EXCEPTION 'Cannot Void Voucher #% due to unassigned G/L Accounts.', _p.vohead_number;
+ RAISE EXCEPTION 'Cannot Void Voucher #% due to unassigned G/L Accounts [xtuple: voidAPOpenVoucher, -50, %]',
+ _p.vohead_number, _p.vohead_number;
END IF;
END IF;
WHERE ( (findAPAccount(vohead_vend_id)=0 OR accnt_id > 0) -- G/L interface might be disabled
AND (vohead_id=_p.vohead_id) );
IF (NOT FOUND) THEN
- RAISE EXCEPTION 'Cannot Void Voucher #% due to an unassigned A/P Account.', _p.vohead_number;
+ RAISE EXCEPTION 'Cannot Void Voucher #% due to an unassigned A/P Account [xtuple: voidAPOpenVoucher, -60, %]',
+ _p.vohead_number, _p.vohead_number;
END IF;
PERFORM postGLSeries(_sequence, pJournalNumber);
SELECT postAPCreditMemoApplication(_apopenid) INTO _result;
IF (_result < 0) THEN
- RAISE EXCEPTION 'Credit application failed with result %.', _result;
+ RAISE EXCEPTION 'Credit application failed with result % [xtuple: voidAPOpenVoucher, -70, %]',
+ _result, _result;
END IF;
-- Reopen all of the P/O Items that were closed by this Voucher
-SELECT setMetric('ServerVersion', '4.7.0Beta2');
+SELECT setMetric('ServerVersion', '4.7.0');
"author": "xTuple <dev@xtuple.com>",
"name": "xtuple",
"description": "xTuple Enterprise Resource Planning Mobile-Web client",
- "version": "4.7.0-beta2",
+ "version": "4.7.0",
"repository": {
"type": "git",
"url": "https://github.com/xtuple/xtuple.git"
-<package id = "distribution-install-470beta2"
- version = "4.7.0Beta2"
+<package id = "distribution-install-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
-<package id = "distribution-upgrade-470beta2"
- version = "4.7.0Beta2"
+<package id = "distribution-upgrade-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
-<package id = "enterprise-upgrade-470beta2"
- version = "4.7.0Beta2"
+<package id = "enterprise-upgrade-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
-<package id = "postbooks-upgrade-470beta2"
- version = "4.7.0Beta2"
+<package id = "postbooks-upgrade-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
-<package id = "manufacturing-install-470beta2"
- version = "4.7.0Beta2"
+<package id = "manufacturing-install-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
-<package id = "manufacturing-upgrade-470beta2"
- version = "4.7.0Beta2"
+<package id = "manufacturing-upgrade-470"
+ version = "4.7.0"
developer = "xTuple"
descrip = "load PostBooks resources"
updater = "2.2.4" >
<prerequisite type = "query"
name = "Checking for too-new xTuple ERP database version" >
- <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0Beta.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.8.0' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>