create or replace function xt.pg_advisory_unlock(oid integer, id integer) returns boolean as $$
- var sql = "select pg_catalog.pg_advisory_unlock($1, $2) as result;";
- return plv8.execute(sql, [oid, id])[0].result;
- /* temporary: let qt client use advisory locks but web client use xt.lock */
-
var pid = plv8.execute("select pg_backend_pid() as pid;")[0].pid,
username = plv8.execute("select geteffectivextuser() as username;")[0].username,
sql = "select * from xt.lock where lock_table_oid = $1 and lock_record_id = $2 and lock_username = $3 and lock_pid = $4;",
create or replace function xt.trylock(oid integer, id integer) returns boolean as $$
- var sql = "select public.trylock($1, $2) as result;";
- return plv8.execute(sql, [oid, id])[0].result;
- /* temporary: let qt client use advisory locks but web client use xt.lock */
-
var pid = plv8.execute("select pg_backend_pid() as pid;")[0].pid,
data = Object.create(XT.Data),
lock = data.tryLock(oid, id, {pid: pid});
-- 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
*/
setList: function (options) {
var component,
- list = options.list;
+ contentHeader = this.$.contentHeader,
+ list = options.list;
component = this.createComponent({
name: "list",
memoizeEnabled: false,
fit: true
});
+
+ contentHeader.destroyClientControls();
+ if (component.headerComponents) {
+ contentHeader.createComponents(component.headerComponents);
+ contentHeader.render();
+ }
}
this.init = true;
"googleapis": "~0.4.6"
},
"engines": {
- "node": "^0.10"
+ "node": "0.10.32"
},
"main": "node-datasource/main.js",
"scripts": {
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 _grade integer := null;" +
+ " begin" +
+ " select min(report_grade) into _grade" +
+ " from " + tableName +
+ " where report_name = '" + name + "';" +
+ " if _grade 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 report_grade from report" +
+ " where report_name = '" + name + "'" +
+ " );" +
+ " else " +
+ " update " + tableName + " set" +
+ " report_descrip = $$" + description + "$$," +
+ " report_source = $$" + content + "$$," +
+ " report_loaddate = now() " +
+ " where report_name = '" + name + "'" +
+ " and report_grade = _grade;" +
+ " 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 = {
# Usage: ./scripts/release_build.sh 4 5 0-beta
echo "BUILDING RELEASE "$MAJ"."$MIN"."$PAT""
-git fetch XTUPLE
-git checkout XTUPLE/$MAJ"_"$MIN"_"x
+#git fetch XTUPLE
+#git checkout XTUPLE/$MAJ"_"$MIN"_"x
rm -rf scripts/output
npm run-script build-basic-postbooks-package-sql
npm run-script build-basic-quickstart
cd ../private-extensions
-git fetch XTUPLE
-git checkout XTUPLE/$MAJ"_"$MIN"_"x
+#git fetch XTUPLE
+#git checkout XTUPLE/$MAJ"_"$MIN"_"x
npm run-script build-basic-manufacturing-package-sql
npm run-script build-basic-manufacturing-empty
cd scripts/output
tar -zcvf manufacturing-install-$MAJ$MIN$PAT.gz manufacturing-install-$MAJ$MIN$PAT/
+#enterprise upgrade
+cd ../../
+mkdir scripts/output/enterprise-upgrade-$MAJ$MIN$PAT
+cp scripts/xml/ent_package.xml scripts/output/enterprise-upgrade-$MAJ$MIN$PAT/package.xml
+cp scripts/output/postbooks_upgrade.sql scripts/output/enterprise-upgrade-$MAJ$MIN$PAT
+cp scripts/output/inventory_upgrade.sql scripts/output/enterprise-upgrade-$MAJ$MIN$PAT
+cp scripts/output/distribution_upgrade.sql scripts/output/enterprise-upgrade-$MAJ$MIN$PAT
+cp scripts/output/manufacturing_upgrade.sql scripts/output/enterprise-upgrade-$MAJ$MIN$PAT
+cd scripts/output
+tar -zcvf enterprise-upgrade-$MAJ$MIN$PAT.gz enterprise-upgrade-$MAJ$MIN$PAT/
+
+#enterprise install
+cd ../../
+mkdir scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/xml/ent_package.xml scripts/output/enterprise-install-$MAJ$MIN$PAT/package.xml
+cp scripts/output/postbooks_upgrade.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/inventory_basic_install.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/inventory_upgrade.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/distribution_basic_install.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/distribution_upgrade.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/manufacturing_basic_install.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cp scripts/output/manufacturing_upgrade.sql scripts/output/enterprise-install-$MAJ$MIN$PAT
+cd scripts/output
+tar -zcvf enterprise-install-$MAJ$MIN$PAT.gz enterprise-install-$MAJ$MIN$PAT/
+
ADMIN=admin
PORT=5432
-HOST=xtuple-vagrant
+HOST=localhost
DB_LIST="postbooks_demo empty quickstart distempty distquickstart mfgempty mfgquickstart mfgdemo";
for DB in $DB_LIST ; do
rm -rf scripts/output/inventory_upgrade.sql
rm -rf scripts/output/manufacturing-install-$MAJ$MIN$PAT/
rm -rf scripts/output/manufacturing-upgrade-$MAJ$MIN$PAT/
+rm -rf scripts/output/enterprise-upgrade-$MAJ$MIN$PAT/
+rm -rf scripts/output/enterprise-install-$MAJ$MIN$PAT/
rm -rf scripts/output/manufacturing_basic_install.sql
rm -rf scripts/output/manufacturing_upgrade.sql
<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.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>
<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.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>
--- /dev/null
+<package id = "enterprise-install-470"
+ version = "4.7.0"
+ developer = "xTuple"
+ descrip = "load PostBooks resources"
+ updater = "2.2.4" >
+
+ <prerequisite type = "query"
+ name = "Checking xTuple Edition" >
+ <query>SELECT fetchMetricText('Application') = 'PostBooks';</query>
+ <message>This package must be applied to a PostBooks database.</message>
+ </prerequisite>
+
+ <prerequisite type = "query"
+ name = "Checking for too-old xTuple ERP database version" >
+ <query>SELECT fetchMetricText('ServerVersion') > '4.4.';</query>
+ <message>This package must be applied to a 4.4+ database.
+ </message>
+ </prerequisite>
+
+ <prerequisite type = "query"
+ name = "Checking for too-new xTuple ERP database version" >
+ <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>
+
+ <prerequisite type = "query"
+ name = "Checking for mobile-enabled schemas" >
+ <query>SELECT NOT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = 'xm');</query>
+ <message>This package may not be applied to a mobile-enabled database. Please see your system administrator or contact xTuple.
+ </message>
+ </prerequisite>
+
+ <script file="postbooks_upgrade.sql" />
+ <script file="inventory_basic_install.sql" />
+ <script file="inventory_upgrade.sql" />
+ <script file="distribution_basic_install.sql" />
+ <script file="distribution_upgrade.sql" />
+ <script file="manufacturing_basic_install.sql" />
+ <script file="manufacturing_upgrade.sql" />
+
+</package>
--- /dev/null
+<package id = "enterprise-upgrade-470"
+ version = "4.7.0"
+ developer = "xTuple"
+ descrip = "load PostBooks resources"
+ updater = "2.2.4" >
+
+ <prerequisite type = "query"
+ name = "Checking xTuple Edition" >
+ <query>SELECT fetchMetricText('Application') = 'Standard';</query>
+ <message>This package must be applied to a Manufacturing Edition database.</message>
+ </prerequisite>
+
+ <prerequisite type="query"
+ name ="Checking xtmfg package" >
+ <query>SELECT TRUE FROM pkghead WHERE pkghead_name = 'xtmfg';</query>
+ <message>This package must be applied to an xTuple ERP database that already contains the xtmfg package.</message>
+ </prerequisite>
+
+ <prerequisite type="query" name="Checking xtmfg Package Version">
+ <query>SELECT TRUE FROM pkghead WHERE pkghead_name = 'xtmfg' AND (pkghead_version >= '4.4');</query>
+ <message>This package must be applied against the 4.4+ version of the xtmfg package.</message>
+ </prerequisite>
+
+ <prerequisite type = "query"
+ name = "Checking for too-old xTuple ERP database version" >
+ <query>SELECT fetchMetricText('ServerVersion') > '4.4.';</query>
+ <message>This package must be applied to a 4.4+ database.
+ </message>
+ </prerequisite>
+
+ <prerequisite type = "query"
+ name = "Checking for too-new xTuple ERP database version" >
+ <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>
+
+ <prerequisite type = "query"
+ name = "Checking for mobile-enabled schemas" >
+ <query>SELECT NOT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = 'xm');</query>
+ <message>This package may not be applied to a mobile-enabled database. Please see your system administrator or contact xTuple.
+ </message>
+ </prerequisite>
+
+ <script file="postbooks_upgrade.sql" />
+ <script file="inventory_upgrade.sql" />
+ <script file="distribution_upgrade.sql" />
+ <script file="manufacturing_upgrade.sql" />
+
+</package>
<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.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>
<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.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>
</message>
</prerequisite>
-<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.
+ <prerequisite type = "query"
+ name = "Checking for too-new xTuple ERP database version" >
+ <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>
-
+ </prerequisite>
<prerequisite type = "query"
name = "Checking for mobile-enabled schemas" >
@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);