-UPDATE pkghead SET pkghead_version = '4.7.0' WHERE pkghead_name = 'xt';
+UPDATE pkghead SET pkghead_version = '4.7.0Beta2' WHERE pkghead_name = 'xt';
-SELECT setMetric('ServerVersion', '4.7.0');
+SELECT setMetric('ServerVersion', '4.7.0Beta2');
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
CREATE OR REPLACE FUNCTION _pkgmetasqlalterTrigger() RETURNS TRIGGER 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
- _isdba BOOLEAN := false;
-
BEGIN
- SELECT rolsuper INTO _isdba FROM pg_roles WHERE (rolname=getEffectiveXtUser());
-
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
-- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-- See www.xtuple.com/CPAL for the full text of the software license.
BEGIN
- IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+ IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
IF (TG_OP = 'DELETE') THEN
RETURN OLD;
ELSE
"author": "xTuple <dev@xtuple.com>",
"name": "xtuple",
"description": "xTuple Enterprise Resource Planning Mobile-Web client",
- "version": "4.7.0",
+ "version": "4.7.0-beta2",
"repository": {
"type": "git",
"url": "https://github.com/xtuple/xtuple.git"
grade = "0",
tableName = defaultSchema ? defaultSchema + ".pkgreport" : "report",
description,
- disableSql,
- updateSql,
- insertSql,
- enableSql;
+ upsertSql;
if (lines[3].indexOf(" <name>") !== 0 ||
lines[4].indexOf(" <description>") !== 0) {
grade = grade.substring(0, grade.indexOf("<"));
}
- disableSql = "ALTER TABLE " + tableName + " DISABLE TRIGGER ALL;";
-
- insertSql = "insert into " + tableName + " (report_name, report_descrip, " +
- "report_source, report_loaddate, report_grade) select " +
- "'" + name + "'," +
- "$$" + description + "$$," +
- "$$" + content + "$$," +
- "now(), " + grade +
- " where not exists (select c.report_id from " + tableName + " c " +
- "where report_name = '" + name +
- "' and report_grade = " + grade + ");";
-
- updateSql = "update " + tableName + " set " +
- " report_descrip = $$" + description +
- "$$, report_source = $$" + content +
- "$$, report_loaddate = now() " +
- "where report_name = '" + name +
- "' and report_grade = " + grade + ";";
-
- enableSql = "ALTER TABLE " + tableName + " ENABLE TRIGGER ALL;";
-
- return disableSql + insertSql + updateSql + enableSql;
+ upsertSql = "do language plpgsql $do$" +
+ "declare _id integer := null;" +
+ " begin" +
+ " update " + tableName + " set " +
+ " report_descrip = $$" + description + "$$," +
+ " report_source = $$" + content + "$$," +
+ " report_loaddate = now() " +
+ " where report_name = '" + name + "'" +
+ " and report_grade = " + grade + " returning report_id into _id;" +
+ " if _id is null then " +
+ " insert into " + tableName + " (report_name, report_descrip," +
+ " report_source, report_loaddate, report_grade)" +
+ " select '" + name + "', $$" + description + "$$," +
+ " $$" + content + "$$, now(), min(sequence_value)" +
+ " from sequence" +
+ " where sequence_value >= " + grade + "" +
+ " and sequence_value not in (" +
+ " select c.report_grade from report c where report_name = '" + name + "'" +
+ " );" +
+ " end if;" +
+ " end $do$;";
+ return upsertSql;
};
var convertFromScript = function (content, filename, defaultSchema) {
var name = path.basename(filename, '.js'),
tableName = defaultSchema ? defaultSchema + ".pkgscript" : "unknown",
notes = "", //"xtMfg package",
- disableSql,
insertSql,
- updateSql,
- enableSql;
-
- disableSql = "ALTER TABLE " + tableName + " DISABLE TRIGGER ALL;";
+ updateSql;
insertSql = "insert into " + tableName + " (script_name, script_order, script_enabled, " +
"script_source, script_notes) select " +
"$$, script_notes = '" + notes + "' " +
"where script_name = '" + name + "';";
- enableSql = "ALTER TABLE " + tableName + " ENABLE TRIGGER ALL;";
-
- return disableSql + insertSql + updateSql + enableSql;
+ return insertSql + updateSql;
};
var convertFromUiform = function (content, filename, defaultSchema) {
var name = path.basename(filename, '.ui'),
tableName = defaultSchema ? defaultSchema + ".pkguiform" : "unknown",
notes = "", //"xtMfg package",
- disableSql,
insertSql,
- updateSql,
- enableSql;
-
- disableSql = "ALTER TABLE " + tableName + " DISABLE TRIGGER ALL;";
+ updateSql;
insertSql = "insert into " + tableName + " (uiform_name, uiform_order, uiform_enabled, " +
"uiform_source, uiform_notes) select " +
"uiform_source = $$" + content + "$$, uiform_notes = '" + notes + "' " +
"where uiform_name = '" + name + "';";
- enableSql = "ALTER TABLE " + tableName + " ENABLE TRIGGER ALL;";
-
- return disableSql + insertSql + updateSql + enableSql;
+ return insertSql + updateSql;
};
exports.conversionMap = {
-<package id = "distribution-install-470"
- version = "4.7.0"
+<package id = "distribution-install-470beta2"
+ version = "4.7.0Beta2"
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.8.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta.
</message>
</prerequisite>
-<package id = "distribution-upgrade-470"
- version = "4.7.0"
+<package id = "distribution-upgrade-470beta2"
+ version = "4.7.0Beta2"
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.8.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta.
</message>
</prerequisite>
-<package id = "postbooks-upgrade-470"
- version = "4.7.0"
+<package id = "postbooks-upgrade-470beta2"
+ version = "4.7.0Beta2"
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.8.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta.
</message>
</prerequisite>
-<package id = "manufacturing-install-470"
- version = "4.7.0"
+<package id = "manufacturing-install-470beta2"
+ version = "4.7.0Beta2"
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.8.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0.
+ <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta.
</message>
</prerequisite>
-<package id = "manufacturing-upgrade-470"
- version = "4.7.0"
+<package id = "manufacturing-upgrade-470beta2"
+ version = "4.7.0Beta2"
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.8.0';</query>
- <message>This package may not be applied to a database newer than 4.7.0.
+<query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+ <message>This package may not be applied to a database newer than 4.7.0Beta2.
</message>
</prerequisite>
@description When currency or invoice date is changed outstanding credit should be
recalculated.
*/
- it.("When currency or invoice date is changed outstanding credit should be recalculated",
+ it.skip("When currency or invoice date is changed outstanding credit should be recalculated",
function (done) {
this.timeout(9000);