Merge pull request #1858 from shackbarth/1854
authorGreg Pazo <gpazo@xtuple.com>
Mon, 29 Sep 2014 19:56:58 +0000 (15:56 -0400)
committerGreg Pazo <gpazo@xtuple.com>
Mon, 29 Sep 2014 19:56:58 +0000 (15:56 -0400)
allow headers on transaction lists

33 files changed:
enyo-client/database/source/delete_system_orms.sql
enyo-client/database/source/update_version.sql
enyo-client/database/source/wipe_views.sql
enyo-client/extensions/source/sales/database/source/manifest.js
enyo-client/extensions/source/sales/database/source/xt/tables/sharetype.sql
enyo-client/extensions/source/sales/database/source/xt/views/share_users_shipto_cust.sql [new file with mode: 0644]
foundation-database/public/functions/logout.sql
foundation-database/public/tables/metric.sql
foundation-database/public/tables/setVersion.sql
foundation-database/public/trigger_functions/pkgcmd.sql
foundation-database/public/trigger_functions/pkgcmdarg.sql
foundation-database/public/trigger_functions/pkgimage.sql
foundation-database/public/trigger_functions/pkgmetasql.sql
foundation-database/public/trigger_functions/pkgpriv.sql
foundation-database/public/trigger_functions/pkgreport.sql
foundation-database/public/trigger_functions/pkgscript.sql
foundation-database/public/trigger_functions/pkguiform.sql
lib/enyo-x/source/app.js
lib/enyo-x/source/en/strings.js
lib/enyo-x/source/views/transaction_list.js
lib/enyo-x/source/views/transaction_list_container.js
lib/orm/source/xt/javascript/data.sql
node-datasource/routes/generate_report.js
npm-shrinkwrap.json
package.json
scripts/install_xtuple.sh
scripts/lib/build_database.js
scripts/lib/util/convert_specialized.js
scripts/xml/distribution_install.xml
scripts/xml/distribution_package.xml
scripts/xml/postbooks_package.xml
scripts/xml/xtmfg_install.xml
scripts/xml/xtmfg_package.xml

index 79e2b31..66ea976 100644 (file)
@@ -1,10 +1,10 @@
-DO $$
+do $$
  /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
-     See www.xm.ple.com/CPAL for the full text of the software license. */
+    See www.xtuple.com/CPAL for the full text of the software license. */
 
-  plv8.execute("select xt.js_init()");
-  plv8.execute("alter table xt.orm disable trigger orm_did_change");
+  plv8.execute("select xt.js_init();");
+  plv8.execute("alter table xt.orm disable trigger orm_did_change;");
   plv8.execute("delete from xt.orm where orm_json ~ '\"isSystem\":true';");
-  plv8.execute("alter table xt.orm enable trigger orm_did_change");
+  plv8.execute("alter table xt.orm enable trigger orm_did_change;");
 
 $$ language plv8;
index a23ed94..276adb2 100644 (file)
@@ -1 +1 @@
-UPDATE pkghead SET pkghead_version = '4.7.0Beta' WHERE pkghead_name = 'xt';
+UPDATE pkghead SET pkghead_version = '4.7.0Beta2' WHERE pkghead_name = 'xt';
index 87ec0d3..2116aec 100644 (file)
@@ -1,19 +1,16 @@
-DO $$
+do $$
  /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
      See www.xm.ple.com/CPAL for the full text of the software license. */
-
-  var sql,
-    result,
-    viewname,
-    schemaname,
-    i;
-
-  sql = "select schemaname, viewname from pg_views where schemaname in ('xm','sys', 'xt');"
-  result = plv8.execute(sql);
-  for (i = 0; i < result.length; i++) {
-    viewname = result[i].viewname;
-    schemaname = result[i].schemaname;
-    plv8.execute('drop view if exists ' + schemaname + '.' + viewname + ' cascade;');
-  }
-
-$$ language plv8;
+declare
+  sqlstring text;
+begin
+  select string_agg('drop view if exists ' || t.oid::regclass || ' cascade;', ' ') into sqlstring
+    from pg_class t
+    join pg_namespace n on n.oid = relnamespace
+   where relkind = 'v'
+     and nspname in ('xm','sys', 'xt');
+  if length(sqlstring) > 0 then
+    execute sqlstring;
+  end if;
+end
+$$;
index ce8ba77..a0938aa 100644 (file)
@@ -10,6 +10,7 @@
     "xt/views/share_users_shipto.sql",
     "xt/views/share_users_shipto_cntct.sql",
     "xt/views/share_users_shipto_addr.sql",
+    "xt/views/share_users_shipto_cust.sql",
     "xt/tables/sharetype.sql"
   ]
 }
index 69301f3..3e343bf 100644 (file)
@@ -54,6 +54,20 @@ insert into xt.sharetype (
   'username'
 );
 
+-- Customer that a Ship To is on CRM Account's users.
+delete from xt.sharetype where sharetype_tblname = 'share_users_shipto_cust';
+insert into xt.sharetype (
+  sharetype_nsname,
+  sharetype_tblname,
+  sharetype_col_obj_uuid,
+  sharetype_col_username
+) values (
+  'xt',
+  'share_users_shipto_cust',
+  'obj_uuid',
+  'username'
+);
+
 -- Sales Order CRM Account's users.
 delete from xt.sharetype where sharetype_tblname = 'share_users_cohead';
 insert into xt.sharetype (
diff --git a/enyo-client/extensions/source/sales/database/source/xt/views/share_users_shipto_cust.sql b/enyo-client/extensions/source/sales/database/source/xt/views/share_users_shipto_cust.sql
new file mode 100644 (file)
index 0000000..d852f1f
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * This view lists all postgres usernames that are associated with a CRM
+ * Account that owns a resource. That associaiton is either the main user
+ * account, owner's user account, customer's sale rep's user account or
+ * a shared access that has been specifically granted.
+ *
+ * This view can be used to determine which users have personal privilege
+ * access to a Customer that a Ship To is on based on what CRM Account the
+ * Ship To belongs to.
+ */
+
+select xt.create_view('xt.share_users_shipto_cust', $$
+
+  -- Customer that is for a Ship To CRM Account's users.
+  SELECT
+    shipto_cust_crmacct_id.obj_uuid::uuid AS obj_uuid,
+    username::text AS username
+  FROM (
+    SELECT
+      custinfo.obj_uuid,
+      crmacct.crmacct_id
+    FROM shiptoinfo
+    LEFT JOIN crmacct ON crmacct_cust_id = shipto_cust_id
+    LEFT JOIN custinfo ON cust_id = shipto_cust_id
+  ) shipto_cust_crmacct_id
+  LEFT JOIN xt.crmacct_users USING (crmacct_id)
+  WHERE 1=1
+    AND username IS NOT NULL
+    AND obj_uuid IS NOT NULL;
+
+$$, false);
index 1626bf2..5806fc8 100644 (file)
@@ -3,9 +3,16 @@ CREATE OR REPLACE FUNCTION logout() 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.
 BEGIN
-  PERFORM pg_advisory_unlock(datid::integer, procpid)
+  IF (compareversion('9.2.0') <= 0)
+  THEN
+    PERFORM pg_advisory_unlock(datid::integer, pid)
      FROM pg_stat_activity
-    WHERE(procpid = pg_backend_pid());
+    WHERE(pid = pg_backend_pid());
+  ELSE
+    PERFORM pg_advisory_unlock(datid::integer, procpid)
+       FROM pg_stat_activity
+      WHERE(procpid = pg_backend_pid());
+  END IF;
 
   RETURN 0;
 END;
index 21c8615..f7ac35a 100644 (file)
@@ -2,3 +2,4 @@
 insert into metric (metric_name, metric_value)
 select 'UnifiedBuild', 'true'
 where not exists (select c.metric_id from metric c where c.metric_name = 'UnifiedBuild');
+
index bf8d03a..0d396dd 100644 (file)
@@ -1 +1 @@
-SELECT setMetric('ServerVersion', '4.7.0Beta');
+SELECT setMetric('ServerVersion', '4.7.0Beta2');
index 3905379..be407b8 100644 (file)
@@ -45,7 +45,7 @@ CREATE OR REPLACE FUNCTION _pkgcmdalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index 8eb9cb7..09eaa61 100644 (file)
@@ -27,7 +27,7 @@ CREATE OR REPLACE FUNCTION _pkgcmdargalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index 1d51cb1..0f8ae1d 100644 (file)
@@ -43,7 +43,7 @@ CREATE OR REPLACE FUNCTION _pkgimagealterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index 10f7f07..3f9f3c3 100644 (file)
@@ -52,13 +52,8 @@ $$ LANGUAGE 'plpgsql';
 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
index edb8f63..b3af003 100644 (file)
@@ -47,7 +47,7 @@ CREATE OR REPLACE FUNCTION _pkgprivalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index 94f9c4b..d32f4f0 100644 (file)
@@ -50,7 +50,7 @@ CREATE OR REPLACE FUNCTION _pkgreportalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index 954418c..40e2fb4 100644 (file)
@@ -27,7 +27,7 @@ CREATE OR REPLACE FUNCTION _pkgscriptalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index a5f1a92..dc0e307 100644 (file)
@@ -27,7 +27,7 @@ CREATE OR REPLACE FUNCTION _pkguiformalterTrigger() 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.
 BEGIN
-  IF (pkgMayBeModified(TG_TABLE_SCHEMA)) THEN
+  IF (pkgMayBeModified(TG_TABLE_SCHEMA) OR isDba()) THEN
     IF (TG_OP = 'DELETE') THEN
       RETURN OLD;
     ELSE
index bd18801..ff4a060 100644 (file)
@@ -44,7 +44,7 @@ white:true*/
     */
     handleKeyDown: function (inSender, inEvent) {
       var that = this,
-        keyCode = inEvent.keyCode,
+        keyCode = inEvent.which,
         exoticTransforms = {},
         numberShiftCharacters = ")!@#$%^&*(";
 
index 18236bf..bd06bbe 100644 (file)
@@ -139,6 +139,7 @@ strict:true, trailing:true, white:true */
     "_noDescription": "No Description",
     "_noDocumentFound": "No Document Found.",
     "_noEligibleActions": "No Eligible Actions",
+    "_noItemFound": "No item found",
     "_noOldPassword": "Please enter your old password",
     "_unsavedChanges": "You have unsaved changes.",
     "_saveYourWork?": "Do you want to save your work?"
index 99ea887..e371c11 100644 (file)
@@ -24,7 +24,8 @@ trailing:true, white:true, strict:false*/
     events: {
       onProcessingChanged: "",
       onOrderChanged: "",
-      onShipmentChanged: ""
+      onShipmentChanged: "",
+      onUpdateHeader: ""
     },
     handlers: {
       onBarcodeCapture: "captureBarcode"
@@ -48,7 +49,11 @@ trailing:true, white:true, strict:false*/
       });
       if (models.length > 0) {
         this.transact(models, true, true);
+      } else {
+        inEvent.noItemFound = true;
       }
+
+      this.doUpdateHeader(inEvent);
     },
     /**
         Helper function for transacting `transact` on an array of models.
index aeab330..7e3518e 100644 (file)
@@ -33,7 +33,8 @@ trailing:true, white:true, strict:false*/
       onListItemMenuTap: "showListItemMenu",
       onParameterChange: "requery",
       onProcessingChanged: "processingChanged",
-      onSelectionChanged: "selectionChanged"
+      onSelectionChanged: "selectionChanged",
+      onUpdateHeader: "updateHeader"
     },
     init: false,
     components: [
@@ -48,7 +49,7 @@ trailing:true, white:true, strict:false*/
             {kind: "onyx.Menu", name: "actionMenu"}
           ]}
         ]},
-        {classes: "xv-header", content: "_search".loc()},
+        {classes: "xv-header", name: "transactionListHeader", content: "_search".loc()},
         {kind: "XV.ScrollableGroupbox", name: "parameterScroller", classes: "xv-search-container", fit: true}
       ]},
       {name: "listPanel", kind: "FittableRows", components: [
@@ -277,6 +278,14 @@ trailing:true, white:true, strict:false*/
       for (i = 0; i < collection.length; i++) {
         collection.at(i).transactionDate = transDate;
       }
+    },
+    updateHeader: function (inSender, inEvent) {
+      if (inEvent.noItemFound) {
+        this.$.transactionListHeader.setContent("_noItemFound".loc() + ": " + inEvent.data);
+
+      } else if (this.$.transactionListHeader.getContent() !== "_search".loc()) {
+        this.$.transactionListHeader.setContent("");
+      }
     }
   };
 
index 0cacd18..ada5e1b 100644 (file)
@@ -1727,6 +1727,31 @@ select xt.install_js('XT','Data','xtuple', $$
       return ret;
     },
 
+    /**
+     * Get the current database server version.
+     * If the optional precision argument is passed, return the first prec
+     * fields of the full version number.
+     *
+     * @example
+     * var x   = getPgVersion(1),       // '9'
+     *     xy  = getPgVersion(2),       // '9.1'
+     *     xyz = getPgVersion(3),       // '9.1.3'
+     *     all = getPgVersion();        // '9.1.3'
+     *
+     * @param   {Number} proc - optional precision
+     * @returns {String} X[.Y[.Z]]
+     */
+    getPgVersion: function (prec) {
+      var q = plv8.execute("select setting from pg_settings " +
+                           "where name='server_version';"),
+          ret;
+      ret = q[0].setting;
+      if (typeof prec === 'number') {
+        ret = ret.split(".").slice(0,prec).join(".");
+      }
+      return ret;
+    },
+
     /**
      * Get the oid for a given table name.
      *
@@ -2399,12 +2424,14 @@ select xt.install_js('XT','Data','xtuple', $$
         lockExp,
         oid,
         pcheck,
+        pgver = 0 + XT.Data.getPgVersion(2),
         pid = options.pid || null,
-        pidSql = "select usename, procpid " +
+        pidcol = (pgver < 9.2) ? "procpid" : "pid",
+        pidSql = "select usename, {pidcol} " +
                  "from pg_stat_activity " +
                  "where datname=current_database() " +
                  " and usename=$1 " +
-                 " and procpid=$2;",
+                 " and {pidcol}=$2;",
         query,
         selectSql = "select * " +
                     "from xt.lock " +
@@ -2412,6 +2439,8 @@ select xt.install_js('XT','Data','xtuple', $$
                     " and lock_record_id = $2;",
         username = XT.username;
 
+      pidSql = pidSql.replace(/{pidcol}/g, pidcol);
+
       /* If passed a table name, look up the oid. */
       oid = typeof table === "string" ? this.getTableOid(table) : table;
 
index 60019d0..5eefd43 100644 (file)
@@ -15,6 +15,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
     path = require("path"),
     ipp = require("ipp"),
     Report = require('fluentreports').Report,
+    qr = require('qr-image'),
     queryForData = require("./export").queryForData;
 
   /**
@@ -137,6 +138,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
      */
     var transformElementData = function (def, data) {
       var textOnly,
+        mapSource,
         params;
 
       if (def.transform) {
@@ -146,12 +148,13 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
 
       if (def.element === 'image') {
         // if the image is not found, we don't want to print it
-        if (!imageFilenameMap[def.definition]) {
+        mapSource = _.isString(def.definition) ? def.definition : (def.definition[0].attr || def.definition[0].text);
+        if (!imageFilenameMap[mapSource]) {
           return "";
         }
 
-        // we save the images under a different name then they're described in the definition
-        return path.join(workingDir, imageFilenameMap[def.definition]);
+        // we save the images under a different name than they're described in the definition
+        return path.join(workingDir, imageFilenameMap[mapSource]);
       }
 
       // these elements are expecting a parameter that is a number, not
@@ -451,7 +454,9 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       //
       var allElements = _.flatten(_.union(reportDefinition.headerElements,
           reportDefinition.detailElements, reportDefinition.footerElements)),
-        allImages = _.unique(_.pluck(_.where(allElements, {element: "image"}), "definition"));
+        allImages = _.unique(_.pluck(_.filter(allElements, function (el) {
+          return el.element === "image" && el.imageType !== "qr";
+        }), "definition"));
         // thanks Jeremy
 
       if (allImages.length === 0) {
@@ -509,6 +514,57 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       queryForData(req.session, requestDetails, callback);
     };
 
+
+    /*
+     Elements can be defined by attr or text
+     {
+       "element": "image",
+       "imageType": "qr",
+       "definition": [{"attr": "billtoName"}],
+       "options": {"x": 200, "y": 180}
+    },
+    {
+       "element": "image",
+       "imageType": "qr",
+       "definition": [{"text": "_invoiceNumber"}],
+       "options": {"x": 0, "y": 195}
+     },
+    */
+    var createQrCodes = function (done) {
+      //
+      // Figure out what images we need to fetch, if any
+      //
+      var allElements = _.flatten(_.union(reportDefinition.headerElements,
+          reportDefinition.detailElements, reportDefinition.footerElements)),
+        allQrElements = _.unique(_.pluck(_.where(allElements, {element: "image", imageType: "qr"}), "definition")),
+        marriedQrElements = _.map(allQrElements, function (el) {
+          return {
+            source: el[0].attr || el[0].text,
+            target: marryData(el, reportData[0])[0].data
+          };
+        });
+        // thanks Jeremy
+
+      if (allQrElements.length === 0) {
+        // no need to try to fetch no images
+        done();
+        return;
+      }
+
+      async.eachSeries(marriedQrElements, function (element, next) {
+        var targetFilename = element.target.replace(/\W+/g, "") + ".png",
+        qr_svg = qr.image(element.target, { type: 'png' }),
+        writeStream = fs.createWriteStream(path.join(workingDir, targetFilename));
+
+        qr_svg.pipe(writeStream);
+        writeStream.on("finish", function () {
+          imageFilenameMap[element.source] = targetFilename;
+          next();
+        });
+
+      }, done);
+    };
+
     /**
       Fetch all the translatable strings in the user's language for use
       when we render.
@@ -645,6 +701,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       fetchTranslations,
       fetchData,
       fetchImages,
+      createQrCodes,
       printReport,
       sendReport,
       cleanUpFiles
index 3762709..b6c4cdd 100644 (file)
     },
     "backbone-relational": {
       "version": "0.8.0",
-      "from": "backbone-relational@0.8.0"
+      "from": "backbone-relational@0.8.0",
+      "resolved": "https://registry.npmjs.org/backbone-relational/-/backbone-relational-0.8.0.tgz"
     },
     "bcrypt": {
       "version": "0.7.8",
       "from": "bcrypt@0.7.x",
+      "resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-0.7.8.tgz",
       "dependencies": {
         "bindings": {
           "version": "1.0.0",
-          "from": "bindings@1.0.0"
+          "from": "bindings@1.0.0",
+          "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.0.0.tgz"
         }
       }
     },
@@ -33,7 +36,8 @@
     },
     "colors": {
       "version": "0.6.2",
-      "from": "colors@0.6.x"
+      "from": "colors@0.6.x",
+      "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz"
     },
     "commander": {
       "version": "1.2.0",
       "dependencies": {
         "keypress": {
           "version": "0.1.0",
-          "from": "keypress@0.1.x"
+          "from": "keypress@0.1.x",
+          "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz"
         }
       }
     },
     "congruence": {
       "version": "1.2.9",
       "from": "congruence@~1.2.4",
+      "resolved": "https://registry.npmjs.org/congruence/-/congruence-1.2.9.tgz",
       "dependencies": {
         "moment": {
           "version": "2.5.1",
@@ -64,7 +70,8 @@
     },
     "connect-ensure-login": {
       "version": "0.1.1",
-      "from": "connect-ensure-login@0.1.x"
+      "from": "connect-ensure-login@0.1.x",
+      "resolved": "https://registry.npmjs.org/connect-ensure-login/-/connect-ensure-login-0.1.1.tgz"
     },
     "csslint": {
       "version": "0.10.0",
       "dependencies": {
         "parserlib": {
           "version": "0.2.5",
-          "from": "parserlib@~0.2.2"
+          "from": "parserlib@~0.2.2",
+          "resolved": "https://registry.npmjs.org/parserlib/-/parserlib-0.2.5.tgz"
         }
       }
     },
     "ejs": {
       "version": "0.8.8",
-      "from": "ejs@0.8.x"
+      "from": "ejs@0.8.x",
+      "resolved": "https://registry.npmjs.org/ejs/-/ejs-0.8.8.tgz"
     },
     "express": {
       "version": "3.1.2",
             },
             "bytes": {
               "version": "0.2.0",
-              "from": "bytes@0.2.0"
+              "from": "bytes@0.2.0",
+              "resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.0.tgz"
             },
             "pause": {
               "version": "0.0.1",
-              "from": "pause@0.0.1"
+              "from": "pause@0.0.1",
+              "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
             }
           }
         },
         },
         "range-parser": {
           "version": "0.0.4",
-          "from": "range-parser@0.0.4"
+          "from": "range-parser@0.0.4",
+          "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz"
         },
         "mkdirp": {
           "version": "0.3.5",
-          "from": "mkdirp@~0.3.4"
+          "from": "mkdirp@~0.3.4",
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
         },
         "cookie": {
           "version": "0.0.5",
         },
         "fresh": {
           "version": "0.1.0",
-          "from": "fresh@0.1.0"
+          "from": "fresh@0.1.0",
+          "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.1.0.tgz"
         },
         "methods": {
           "version": "0.0.1",
           "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.0.tgz"
         },
         "debug": {
-          "version": "1.0.4",
+          "version": "2.0.0",
           "from": "debug@*",
+          "resolved": "https://registry.npmjs.org/debug/-/debug-2.0.0.tgz",
           "dependencies": {
             "ms": {
               "version": "0.6.2",
           "dependencies": {
             "png-js": {
               "version": "0.1.1",
-              "from": "png-js@>=0.1.0"
+              "from": "png-js@>=0.1.0",
+              "resolved": "https://registry.npmjs.org/png-js/-/png-js-0.1.1.tgz"
             }
           }
         }
           "dependencies": {
             "qs": {
               "version": "0.6.6",
-              "from": "qs@~0.6.0"
+              "from": "qs@~0.6.0",
+              "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz"
             },
             "json-stringify-safe": {
               "version": "5.0.0",
-              "from": "json-stringify-safe@~5.0.0"
+              "from": "json-stringify-safe@~5.0.0",
+              "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz"
             },
             "forever-agent": {
               "version": "0.5.2",
-              "from": "forever-agent@~0.5.0"
+              "from": "forever-agent@~0.5.0",
+              "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz"
             },
             "tunnel-agent": {
               "version": "0.3.0",
-              "from": "tunnel-agent@~0.3.0"
+              "from": "tunnel-agent@~0.3.0",
+              "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.3.0.tgz"
             },
             "http-signature": {
               "version": "0.10.0",
               "from": "http-signature@~0.10.0",
+              "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz",
               "dependencies": {
                 "assert-plus": {
                   "version": "0.1.2",
                 },
                 "ctype": {
                   "version": "0.5.2",
-                  "from": "ctype@0.5.2"
+                  "from": "ctype@0.5.2",
+                  "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz"
                 }
               }
             },
             "hawk": {
               "version": "1.0.0",
               "from": "hawk@~1.0.0",
+              "resolved": "https://registry.npmjs.org/hawk/-/hawk-1.0.0.tgz",
               "dependencies": {
                 "hoek": {
                   "version": "0.9.1",
             },
             "oauth-sign": {
               "version": "0.3.0",
-              "from": "oauth-sign@~0.3.0"
+              "from": "oauth-sign@~0.3.0",
+              "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.3.0.tgz"
             },
             "cookie-jar": {
               "version": "0.3.0",
-              "from": "cookie-jar@~0.3.0"
+              "from": "cookie-jar@~0.3.0",
+              "resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.3.0.tgz"
             },
             "node-uuid": {
               "version": "1.4.1",
-              "from": "node-uuid@~1.4.0"
+              "from": "node-uuid@~1.4.0",
+              "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz"
             },
             "mime": {
               "version": "1.2.11",
-              "from": "mime@~1.2.9"
+              "from": "mime@~1.2.7",
+              "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
             },
             "form-data": {
               "version": "0.1.4",
                 "tap": {
                   "version": "0.3.3",
                   "from": "tap@~0.3.3",
+                  "resolved": "https://registry.npmjs.org/tap/-/tap-0.3.3.tgz",
                   "dependencies": {
                     "inherits": {
                       "version": "1.0.0"
                     },
                     "slide": {
                       "version": "1.1.5",
-                      "from": "slide@*"
+                      "from": "slide@*",
+                      "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.5.tgz"
                     },
                     "runforcover": {
                       "version": "0.0.2",
                       "from": "runforcover@~0.0.2",
+                      "resolved": "https://registry.npmjs.org/runforcover/-/runforcover-0.0.2.tgz",
                       "dependencies": {
                         "bunker": {
                           "version": "0.1.2",
                           "from": "bunker@0.1.X",
+                          "resolved": "https://registry.npmjs.org/bunker/-/bunker-0.1.2.tgz",
                           "dependencies": {
                             "burrito": {
                               "version": "0.2.12",
                               "from": "burrito@>=0.2.5 <0.3",
+                              "resolved": "https://registry.npmjs.org/burrito/-/burrito-0.2.12.tgz",
                               "dependencies": {
                                 "traverse": {
                                   "version": "0.5.2",
                     },
                     "mkdirp": {
                       "version": "0.3.5",
-                      "from": "mkdirp@~0.3"
+                      "from": "mkdirp@~0.3",
+                      "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
                     },
                     "difflet": {
                       "version": "0.2.6",
                       "from": "difflet@~0.2.0",
+                      "resolved": "https://registry.npmjs.org/difflet/-/difflet-0.2.6.tgz",
                       "dependencies": {
                         "traverse": {
                           "version": "0.6.6",
-                          "from": "traverse@0.6.x"
+                          "from": "traverse@0.6.x",
+                          "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz"
                         },
                         "charm": {
                           "version": "0.1.2",
-                          "from": "charm@0.1.x"
+                          "from": "charm@0.1.x",
+                          "resolved": "https://registry.npmjs.org/charm/-/charm-0.1.2.tgz"
                         },
                         "deep-is": {
                           "version": "0.1.3",
                     },
                     "deep-equal": {
                       "version": "0.0.0",
-                      "from": "deep-equal@~0.0.0"
+                      "from": "deep-equal@~0.0.0",
+                      "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz"
                     },
                     "buffer-equal": {
                       "version": "0.0.1",
       "resolved": "https://registry.npmjs.org/html5/-/html5-0.3.13.tgz",
       "dependencies": {
         "jsdom": {
-          "version": "1.0.0-pre.3",
+          "version": "1.0.0-pre.6",
           "from": "jsdom@>= 0.6.0",
-          "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-1.0.0-pre.3.tgz",
+          "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-1.0.0-pre.6.tgz",
           "dependencies": {
             "htmlparser2": {
               "version": "3.7.3",
                     },
                     "isarray": {
                       "version": "0.0.1",
-                      "from": "isarray@0.0.1"
+                      "from": "isarray@0.0.1",
+                      "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
                     },
                     "string_decoder": {
                       "version": "0.10.31",
                 },
                 "entities": {
                   "version": "1.0.0",
-                  "from": "entities@1.0"
+                  "from": "entities@1.0",
+                  "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz"
                 }
               }
             },
             },
             "nwmatcher": {
               "version": "1.3.3",
-              "from": "nwmatcher@~1.3.2"
+              "from": "nwmatcher@~1.3.2",
+              "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.3.3.tgz"
             },
             "xmlhttprequest": {
               "version": "1.6.0",
             },
             "cssstyle": {
               "version": "0.2.14",
-              "from": "cssstyle@~0.2.9"
+              "from": "cssstyle@~0.2.9",
+              "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.14.tgz"
             },
             "contextify": {
               "version": "0.1.8",
               "from": "contextify@~0.1.5",
+              "resolved": "https://registry.npmjs.org/contextify/-/contextify-0.1.8.tgz",
               "dependencies": {
                 "bindings": {
                   "version": "1.2.1",
                 },
                 "nan": {
                   "version": "1.0.0",
-                  "from": "nan@~1.0.0"
+                  "from": "nan@~1.0.0",
+                  "resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
                 }
               }
             }
         },
         "opts": {
           "version": "1.2.2",
-          "from": "opts@~1.2.1"
+          "from": "opts@~1.2.1",
+          "resolved": "https://registry.npmjs.org/opts/-/opts-1.2.2.tgz"
         },
         "html5-entities": {
           "version": "0.5.1",
     },
     "ipp": {
       "version": "0.0.5",
-      "from": "ipp@0.0.5"
+      "from": "ipp@0.0.5",
+      "resolved": "https://registry.npmjs.org/ipp/-/ipp-0.0.5.tgz"
     },
     "jquery": {
       "version": "2.1.1",
                 },
                 "isarray": {
                   "version": "0.0.1",
-                  "from": "isarray@0.0.1"
+                  "from": "isarray@0.0.1",
+                  "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
                 },
                 "string_decoder": {
                   "version": "0.10.31",
       "dependencies": {
         "mime": {
           "version": "1.2.11",
-          "from": "mime@~1.2.7"
+          "from": "mime@1.2.x",
+          "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
         },
         "mkdirp": {
           "version": "0.3.5",
-          "from": "mkdirp@~0.3.4"
+          "from": "mkdirp@~0.3.4",
+          "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz"
         },
         "clean-css": {
           "version": "1.0.12",
           "from": "clean-css@1.0.x",
+          "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-1.0.12.tgz",
           "dependencies": {
             "commander": {
               "version": "1.3.2",
               "dependencies": {
                 "keypress": {
                   "version": "0.1.0",
-                  "from": "keypress@0.1.x"
+                  "from": "keypress@0.1.x",
+                  "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz"
                 }
               }
             }
           "dependencies": {
             "amdefine": {
               "version": "0.1.0",
-              "from": "amdefine@>=0.0.4"
+              "from": "amdefine@>=0.0.4",
+              "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz"
             }
           }
         }
         },
         "growl": {
           "version": "1.7.0",
-          "from": "growl@1.7.x"
+          "from": "growl@1.7.x",
+          "resolved": "https://registry.npmjs.org/growl/-/growl-1.7.0.tgz"
         },
         "jade": {
           "version": "0.26.3",
         },
         "diff": {
           "version": "1.0.2",
-          "from": "diff@1.0.2"
+          "from": "diff@1.0.2",
+          "resolved": "https://registry.npmjs.org/diff/-/diff-1.0.2.tgz"
         },
         "debug": {
-          "version": "1.0.4",
+          "version": "2.0.0",
           "from": "debug@*",
+          "resolved": "https://registry.npmjs.org/debug/-/debug-2.0.0.tgz",
           "dependencies": {
             "ms": {
               "version": "0.6.2",
         },
         "ms": {
           "version": "0.3.0",
-          "from": "ms@0.3.0"
+          "from": "ms@0.3.0",
+          "resolved": "https://registry.npmjs.org/ms/-/ms-0.3.0.tgz"
         }
       }
     },
                 },
                 "addressparser": {
                   "version": "0.2.1",
-                  "from": "addressparser@~0.2.1"
+                  "from": "addressparser@~0.2.1",
+                  "resolved": "https://registry.npmjs.org/addressparser/-/addressparser-0.2.1.tgz"
                 }
               }
             },
             "mime": {
               "version": "1.2.11",
-              "from": "mime@1.2.x"
+              "from": "mime@~1.2.11",
+              "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
             },
             "he": {
               "version": "0.3.6",
-              "from": "he@~0.3.6"
+              "from": "he@~0.3.6",
+              "resolved": "https://registry.npmjs.org/he/-/he-0.3.6.tgz"
             },
             "follow-redirects": {
               "version": "0.0.3",
               "dependencies": {
                 "punycode": {
                   "version": "1.2.4",
-                  "from": "punycode@~1.2.4"
+                  "from": "punycode@~1.2.4",
+                  "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.2.4.tgz"
                 }
               }
             }
           }
         },
         "simplesmtp": {
-          "version": "0.3.32",
+          "version": "0.3.33",
           "from": "simplesmtp@>= 0.1.28",
+          "resolved": "https://registry.npmjs.org/simplesmtp/-/simplesmtp-0.3.33.tgz",
           "dependencies": {
             "rai": {
               "version": "0.1.11",
             },
             "xoauth2": {
               "version": "0.1.8",
-              "from": "xoauth2@~0.1.8"
+              "from": "xoauth2@~0.1.8",
+              "resolved": "https://registry.npmjs.org/xoauth2/-/xoauth2-0.1.8.tgz"
             }
           }
         },
         "optimist": {
           "version": "0.6.1",
           "from": "optimist@*",
+          "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
           "dependencies": {
             "wordwrap": {
               "version": "0.0.2",
-              "from": "wordwrap@~0.0.2"
+              "from": "wordwrap@~0.0.2",
+              "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz"
             },
             "minimist": {
               "version": "0.0.10",
     "nodemon": {
       "version": "1.0.20",
       "from": "nodemon@~1.0.15",
+      "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-1.0.20.tgz",
       "dependencies": {
         "update-notifier": {
           "version": "0.1.10",
           "from": "update-notifier@~0.1.8",
+          "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-0.1.10.tgz",
           "dependencies": {
             "chalk": {
               "version": "0.4.0",
               "from": "chalk@^0.4.0",
+              "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz",
               "dependencies": {
                 "has-color": {
                   "version": "0.1.7",
-                  "from": "has-color@~0.1.0"
+                  "from": "has-color@~0.1.0",
+                  "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz"
                 },
                 "ansi-styles": {
                   "version": "1.0.0",
-                  "from": "ansi-styles@~1.0.0"
+                  "from": "ansi-styles@~1.0.0",
+                  "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz"
                 },
                 "strip-ansi": {
                   "version": "0.1.1",
-                  "from": "strip-ansi@~0.1.0"
+                  "from": "strip-ansi@~0.1.0",
+                  "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz"
                 }
               }
             },
               "dependencies": {
                 "graceful-fs": {
                   "version": "3.0.2",
-                  "from": "graceful-fs@^3.0.2",
+                  "from": "graceful-fs@~3.0.1",
                   "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.2.tgz"
                 },
                 "js-yaml": {
                   "version": "3.0.2",
                   "from": "js-yaml@~3.0.1",
+                  "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.0.2.tgz",
                   "dependencies": {
                     "argparse": {
                       "version": "0.1.15",
-                      "from": "argparse@~ 0.1.11"
+                      "from": "argparse@~ 0.1.11",
+                      "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.15.tgz"
                     },
                     "esprima": {
                       "version": "1.0.4",
-                      "from": "esprima@~ 1.0.2"
+                      "from": "esprima@~ 1.0.2",
+                      "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz"
                     }
                   }
                 },
                 },
                 "uuid": {
                   "version": "1.4.1",
-                  "from": "uuid@~1.4.1"
+                  "from": "uuid@~1.4.1",
+                  "resolved": "https://registry.npmjs.org/uuid/-/uuid-1.4.1.tgz"
                 }
               }
             },
             "request": {
-              "version": "2.40.0",
+              "version": "2.42.0",
               "from": "request@^2.36.0",
-              "resolved": "https://registry.npmjs.org/request/-/request-2.40.0.tgz",
+              "resolved": "https://registry.npmjs.org/request/-/request-2.42.0.tgz",
               "dependencies": {
+                "bl": {
+                  "version": "0.9.1",
+                  "from": "bl@~0.9.0",
+                  "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.1.tgz",
+                  "dependencies": {
+                    "readable-stream": {
+                      "version": "1.0.31",
+                      "from": "readable-stream@~1.0.26",
+                      "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz",
+                      "dependencies": {
+                        "core-util-is": {
+                          "version": "1.0.1",
+                          "from": "core-util-is@~1.0.0"
+                        },
+                        "isarray": {
+                          "version": "0.0.1",
+                          "from": "isarray@0.0.1",
+                          "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
+                        },
+                        "string_decoder": {
+                          "version": "0.10.31",
+                          "from": "string_decoder@~0.10.x",
+                          "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
+                        },
+                        "inherits": {
+                          "version": "2.0.1",
+                          "from": "inherits@~2.0.1"
+                        }
+                      }
+                    }
+                  }
+                },
+                "caseless": {
+                  "version": "0.6.0",
+                  "from": "caseless@~0.6.0",
+                  "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.6.0.tgz"
+                },
+                "forever-agent": {
+                  "version": "0.5.2",
+                  "from": "forever-agent@~0.5.0",
+                  "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.5.2.tgz"
+                },
                 "qs": {
-                  "version": "1.0.2",
-                  "from": "qs@~1.0.0",
-                  "resolved": "https://registry.npmjs.org/qs/-/qs-1.0.2.tgz"
+                  "version": "1.2.2",
+                  "from": "qs@~1.2.0",
+                  "resolved": "https://registry.npmjs.org/qs/-/qs-1.2.2.tgz"
                 },
                 "json-stringify-safe": {
                   "version": "5.0.0",
-                  "from": "json-stringify-safe@~5.0.0"
+                  "from": "json-stringify-safe@~5.0.0",
+                  "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz"
                 },
                 "mime-types": {
                   "version": "1.0.2",
                   "from": "mime-types@~1.0.1",
                   "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-1.0.2.tgz"
                 },
-                "forever-agent": {
-                  "version": "0.5.2",
-                  "from": "forever-agent@~0.5.0"
-                },
                 "node-uuid": {
                   "version": "1.4.1",
-                  "from": "node-uuid@~1.4.0"
+                  "from": "node-uuid@~1.4.0",
+                  "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz"
+                },
+                "tunnel-agent": {
+                  "version": "0.4.0",
+                  "from": "tunnel-agent@~0.4.0",
+                  "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz"
                 },
                 "tough-cookie": {
                   "version": "0.12.1",
                     },
                     "mime": {
                       "version": "1.2.11",
-                      "from": "mime@~1.2.11"
+                      "from": "mime@~1.2.11",
+                      "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
                     },
                     "async": {
                       "version": "0.9.0",
                     }
                   }
                 },
-                "tunnel-agent": {
-                  "version": "0.4.0",
-                  "from": "tunnel-agent@~0.4.0",
-                  "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.0.tgz"
-                },
                 "http-signature": {
                   "version": "0.10.0",
                   "from": "http-signature@~0.10.0",
+                  "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-0.10.0.tgz",
                   "dependencies": {
                     "assert-plus": {
                       "version": "0.1.2",
                     },
                     "ctype": {
                       "version": "0.5.2",
-                      "from": "ctype@0.5.2"
+                      "from": "ctype@0.5.2",
+                      "resolved": "https://registry.npmjs.org/ctype/-/ctype-0.5.2.tgz"
                     }
                   }
                 },
                 "oauth-sign": {
-                  "version": "0.3.0",
-                  "from": "oauth-sign@~0.3.0"
+                  "version": "0.4.0",
+                  "from": "oauth-sign@~0.4.0",
+                  "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.4.0.tgz"
                 },
                 "hawk": {
                   "version": "1.1.1",
                 },
                 "aws-sign2": {
                   "version": "0.5.0",
-                  "from": "aws-sign2@~0.5.0"
+                  "from": "aws-sign2@~0.5.0",
+                  "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz"
                 },
                 "stringstream": {
                   "version": "0.0.4",
         "ps-tree": {
           "version": "0.0.3",
           "from": "ps-tree@0.0.3",
+          "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-0.0.3.tgz",
           "dependencies": {
             "event-stream": {
               "version": "0.5.3",
               "from": "event-stream@~0.5",
+              "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-0.5.3.tgz",
               "dependencies": {
                 "optimist": {
                   "version": "0.2.8",
                   "dependencies": {
                     "wordwrap": {
                       "version": "0.0.2",
-                      "from": "wordwrap@>=0.0.1 <0.1.0"
+                      "from": "wordwrap@>=0.0.1 <0.1.0",
+                      "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz"
                     }
                   }
                 }
       }
     },
     "npm": {
-      "version": "1.4.24",
+      "version": "1.4.26",
       "from": "npm@1.4.x",
+      "resolved": "https://registry.npmjs.org/npm/-/npm-1.4.26.tgz",
       "dependencies": {
         "abbrev": {
           "version": "1.0.5",
           "from": "../chownr"
         },
         "cmd-shim": {
-          "version": "1.1.2",
-          "from": "cmd-shim@~1.1.1",
-          "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-1.1.2.tgz"
+          "version": "2.0.0",
+          "from": "git://github.com/othiym23/cmd-shim",
+          "resolved": "git://github.com/othiym23/cmd-shim#12de64ca97f45ac600910092f19afacc3d5376dd"
         },
         "columnify": {
-          "version": "1.1.0",
-          "from": "columnify@latest",
-          "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.1.0.tgz",
+          "version": "1.2.1",
+          "from": "columnify@^1.2.1",
+          "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.2.1.tgz",
           "dependencies": {
             "strip-ansi": {
-              "version": "0.2.2",
-              "from": "strip-ansi@^0.2.1",
-              "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.2.2.tgz",
+              "version": "1.0.0",
+              "from": "strip-ansi@^1.0.0",
+              "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-1.0.0.tgz",
               "dependencies": {
                 "ansi-regex": {
-                  "version": "0.1.0",
-                  "from": "ansi-regex@^0.1.0",
-                  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.1.0.tgz"
+                  "version": "0.2.1",
+                  "from": "ansi-regex@^0.2.1",
+                  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
                 }
               }
             },
-            "wcwidth.js": {
-              "version": "0.0.4",
-              "from": "wcwidth.js@~0.0.4",
-              "resolved": "https://registry.npmjs.org/wcwidth.js/-/wcwidth.js-0.0.4.tgz",
+            "wcwidth": {
+              "version": "1.0.0",
+              "from": "wcwidth@^1.0.0",
+              "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.0.tgz",
               "dependencies": {
-                "underscore": {
-                  "version": "1.6.0",
-                  "from": "underscore@>= 1.3.0",
-                  "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
+                "defaults": {
+                  "version": "1.0.0",
+                  "from": "defaults@^1.0.0",
+                  "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.0.tgz",
+                  "dependencies": {
+                    "clone": {
+                      "version": "0.1.18",
+                      "from": "clone@~0.1.5",
+                      "resolved": "https://registry.npmjs.org/clone/-/clone-0.1.18.tgz"
+                    }
+                  }
                 }
               }
             }
           "resolved": "https://registry.npmjs.org/editor/-/editor-0.1.0.tgz"
         },
         "fstream": {
-          "version": "1.0.0",
+          "version": "1.0.2",
           "from": "fstream@latest"
         },
         "fstream-npm": {
           }
         },
         "github-url-from-git": {
-          "version": "1.3.0",
-          "from": "github-url-from-git@latest",
-          "resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.3.0.tgz"
+          "version": "1.4.0",
+          "from": "github-url-from-git@^1.4.0",
+          "resolved": "https://registry.npmjs.org/github-url-from-git/-/github-url-from-git-1.4.0.tgz"
         },
         "github-url-from-username-repo": {
-          "version": "0.2.0",
-          "from": "github-url-from-username-repo@latest",
-          "resolved": "https://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-0.2.0.tgz"
+          "version": "1.0.0",
+          "from": "github-url-from-username-repo@^1.0.0",
+          "resolved": "https://registry.npmjs.org/github-url-from-username-repo/-/github-url-from-username-repo-1.0.0.tgz"
         },
         "glob": {
           "version": "4.0.5",
           }
         },
         "lockfile": {
-          "version": "0.4.2",
-          "from": "lockfile@0.4.2",
-          "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-0.4.2.tgz"
+          "version": "1.0.0",
+          "from": "lockfile@latest"
         },
         "lru-cache": {
           "version": "2.5.0",
           "from": "npm-install-checks@latest"
         },
         "npm-registry-client": {
-          "version": "2.0.4",
-          "from": "npm-registry-client@2.0.4",
-          "resolved": "https://registry.npmjs.org/npm-registry-client/-/npm-registry-client-2.0.4.tgz"
+          "version": "2.0.7",
+          "from": "npm-registry-client@^2.0.7"
         },
         "npm-user-validate": {
           "version": "0.1.0",
           }
         },
         "read-package-json": {
-          "version": "1.2.6",
-          "from": "read-package-json@latest",
+          "version": "1.2.7",
+          "from": "read-package-json@^1.2.7",
+          "resolved": "https://registry.npmjs.org/read-package-json/-/read-package-json-1.2.7.tgz",
           "dependencies": {
             "normalize-package-data": {
-              "version": "1.0.0",
-              "from": "normalize-package-data@^1.0.0"
+              "version": "1.0.1",
+              "from": "normalize-package-data@^1.0.0",
+              "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-1.0.1.tgz"
             }
           }
         },
           "from": "sorted-object@"
         },
         "tar": {
-          "version": "1.0.0",
+          "version": "1.0.1",
           "from": "tar@latest"
         },
         "text-table": {
     "oauth2orize": {
       "version": "0.1.0",
       "from": "oauth2orize@0.1.x",
+      "resolved": "https://registry.npmjs.org/oauth2orize/-/oauth2orize-0.1.0.tgz",
       "dependencies": {
         "debug": {
           "version": "0.7.4",
     "oauth2orize-jwt-bearer": {
       "version": "0.1.0",
       "from": "oauth2orize-jwt-bearer@0.1.x",
+      "resolved": "https://registry.npmjs.org/oauth2orize-jwt-bearer/-/oauth2orize-jwt-bearer-0.1.0.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         }
       }
     },
     "passport": {
       "version": "0.1.18",
       "from": "passport@0.1.x",
+      "resolved": "https://registry.npmjs.org/passport/-/passport-0.1.18.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         },
         "pause": {
           "version": "0.0.1",
-          "from": "pause@0.0.1"
+          "from": "pause@0.0.1",
+          "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz"
         }
       }
     },
     "passport-http": {
       "version": "0.2.2",
       "from": "passport-http@0.2.x",
+      "resolved": "https://registry.npmjs.org/passport-http/-/passport-http-0.2.2.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         }
       }
     },
     "passport-http-bearer": {
       "version": "0.2.1",
       "from": "passport-http-bearer@0.2.x",
+      "resolved": "https://registry.npmjs.org/passport-http-bearer/-/passport-http-bearer-0.2.1.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         }
       }
     },
     "passport-local": {
       "version": "0.1.6",
       "from": "passport-local@0.1.x",
+      "resolved": "https://registry.npmjs.org/passport-local/-/passport-local-0.1.6.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         }
       }
     },
     "passport-oauth2-client-password": {
-      "version": "0.1.1",
+      "version": "0.1.2",
       "from": "passport-oauth2-client-password@0.1.x",
+      "resolved": "https://registry.npmjs.org/passport-oauth2-client-password/-/passport-oauth2-client-password-0.1.2.tgz",
       "dependencies": {
-        "pkginfo": {
-          "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+        "passport-strategy": {
+          "version": "1.0.0",
+          "from": "passport-strategy@1.x.x",
+          "resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz"
         }
       }
     },
     "passport-oauth2-jwt-bearer": {
       "version": "0.1.1",
       "from": "passport-oauth2-jwt-bearer@0.1.x",
+      "resolved": "https://registry.npmjs.org/passport-oauth2-jwt-bearer/-/passport-oauth2-jwt-bearer-0.1.1.tgz",
       "dependencies": {
         "pkginfo": {
           "version": "0.2.3",
-          "from": "pkginfo@0.2.x"
+          "from": "pkginfo@0.2.x",
+          "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz"
         }
       }
     },
     "paynode": {
       "version": "0.3.6",
       "from": "paynode@0.3.6",
+      "resolved": "https://registry.npmjs.org/paynode/-/paynode-0.3.6.tgz",
       "dependencies": {
         "braintree": {
           "version": "1.17.0",
               "dependencies": {
                 "sax": {
                   "version": "0.6.0",
-                  "from": "sax@>=0.1.1"
+                  "from": "sax@>=0.1.1",
+                  "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.0.tgz"
                 }
               }
             },
                   "dependencies": {
                     "amdefine": {
                       "version": "0.1.0",
-                      "from": "amdefine@>=0.0.4"
+                      "from": "amdefine@>=0.0.4",
+                      "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz"
                     }
                   }
                 }
       "dependencies": {
         "generic-pool": {
           "version": "2.0.4",
-          "from": "generic-pool@~2.0.2"
+          "from": "generic-pool@~2.0.2",
+          "resolved": "https://registry.npmjs.org/generic-pool/-/generic-pool-2.0.4.tgz"
         },
         "deprecate": {
           "version": "0.1.0",
-          "from": "deprecate@~0.1.0"
+          "from": "deprecate@~0.1.0",
+          "resolved": "https://registry.npmjs.org/deprecate/-/deprecate-0.1.0.tgz"
         }
       }
     },
+    "qr-image": {
+      "version": "1.1.0",
+      "from": "qr-image@1.1.x"
+    },
     "request": {
       "version": "2.14.0",
       "from": "request@2.14.x",
     },
     "rimraf": {
       "version": "2.2.8",
-      "from": "rimraf@2.2.x"
+      "from": "rimraf@2.2.x",
+      "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz"
     },
     "rjson": {
       "version": "0.2.4",
       "from": "rjson@~0.2.4",
+      "resolved": "https://registry.npmjs.org/rjson/-/rjson-0.2.4.tgz",
       "dependencies": {
         "commander": {
           "version": "1.1.1",
           "dependencies": {
             "keypress": {
               "version": "0.1.0",
-              "from": "keypress@0.1.x"
+              "from": "keypress@0.1.x",
+              "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz"
             }
           }
         }
             "ws": {
               "version": "0.4.32",
               "from": "ws@0.4.x",
+              "resolved": "https://registry.npmjs.org/ws/-/ws-0.4.32.tgz",
               "dependencies": {
                 "commander": {
                   "version": "2.1.0",
                 },
                 "nan": {
                   "version": "1.0.0",
-                  "from": "nan@~1.0.0"
+                  "from": "nan@~1.0.0",
+                  "resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
                 },
                 "tinycolor": {
                   "version": "0.0.1",
-                  "from": "tinycolor@0.x"
+                  "from": "tinycolor@0.x",
+                  "resolved": "https://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
                 },
                 "options": {
                   "version": "0.0.5",
-                  "from": "options@>=0.0.5"
+                  "from": "options@>=0.0.5",
+                  "resolved": "https://registry.npmjs.org/options/-/options-0.0.5.tgz"
                 }
               }
             },
             "active-x-obfuscator": {
               "version": "0.0.1",
               "from": "active-x-obfuscator@0.0.1",
+              "resolved": "https://registry.npmjs.org/active-x-obfuscator/-/active-x-obfuscator-0.0.1.tgz",
               "dependencies": {
                 "zeparser": {
                   "version": "0.0.5",
-                  "from": "zeparser@0.0.5"
+                  "from": "zeparser@0.0.5",
+                  "resolved": "https://registry.npmjs.org/zeparser/-/zeparser-0.0.5.tgz"
                 }
               }
             }
         },
         "base64id": {
           "version": "0.1.0",
-          "from": "base64id@0.1.0"
+          "from": "base64id@0.1.0",
+          "resolved": "https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz"
         },
         "redis": {
           "version": "0.7.3",
     },
     "underscore.string": {
       "version": "2.3.3",
-      "from": "underscore.string@~2.3.3"
+      "from": "underscore.string@~2.3.3",
+      "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.3.3.tgz"
     },
     "winston": {
       "version": "0.7.3",
       "from": "winston@0.7.x",
+      "resolved": "https://registry.npmjs.org/winston/-/winston-0.7.3.tgz",
       "dependencies": {
         "cycle": {
           "version": "1.0.3",
-          "from": "cycle@1.0.x"
+          "from": "cycle@1.0.x",
+          "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz"
         },
         "eyes": {
           "version": "0.1.8",
-          "from": "eyes@0.1.x"
+          "from": "eyes@0.1.x",
+          "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
         },
         "pkginfo": {
           "version": "0.3.0",
             },
             "mime": {
               "version": "1.2.11",
-              "from": "mime@~1.2.7"
+              "from": "mime@~1.2.7",
+              "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
             },
             "hawk": {
               "version": "0.10.2",
               "dependencies": {
                 "hoek": {
                   "version": "0.7.6",
-                  "from": "hoek@0.7.x"
+                  "from": "hoek@0.7.x",
+                  "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.7.6.tgz"
                 },
                 "boom": {
                   "version": "0.3.8",
-                  "from": "boom@0.3.x"
+                  "from": "boom@0.3.x",
+                  "resolved": "https://registry.npmjs.org/boom/-/boom-0.3.8.tgz"
                 },
                 "cryptiles": {
                   "version": "0.1.3",
-                  "from": "cryptiles@0.1.x"
+                  "from": "cryptiles@0.1.x",
+                  "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.1.3.tgz"
                 },
                 "sntp": {
                   "version": "0.1.4",
-                  "from": "sntp@0.1.x"
+                  "from": "sntp@0.1.x",
+                  "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.1.4.tgz"
                 }
               }
             },
             "node-uuid": {
               "version": "1.4.1",
-              "from": "node-uuid@~1.4.0"
+              "from": "node-uuid@~1.4.0",
+              "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.1.tgz"
             },
             "cookie-jar": {
               "version": "0.2.0",
         },
         "stack-trace": {
           "version": "0.0.9",
-          "from": "stack-trace@0.0.x"
+          "from": "stack-trace@0.0.x",
+          "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz"
         }
       }
     },
           "dependencies": {
             "htmlparser": {
               "version": "1.7.7",
-              "from": "htmlparser@1.x"
+              "from": "htmlparser@1.x",
+              "resolved": "https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.7.tgz"
             },
             "cssom": {
               "version": "0.2.5",
-              "from": "cssom@0.2.x"
+              "from": "cssom@0.2.x",
+              "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.2.5.tgz"
             },
             "cssstyle": {
               "version": "0.2.14",
               "from": "cssstyle@>=0.2.3",
+              "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.14.tgz",
               "dependencies": {
                 "cssom": {
                   "version": "0.3.0",
             "contextify": {
               "version": "0.1.8",
               "from": "contextify@0.1.x",
+              "resolved": "https://registry.npmjs.org/contextify/-/contextify-0.1.8.tgz",
               "dependencies": {
                 "bindings": {
                   "version": "1.2.1",
                 },
                 "nan": {
                   "version": "1.0.0",
-                  "from": "nan@~1.0.0"
+                  "from": "nan@~1.0.0",
+                  "resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
                 }
               }
             }
         },
         "mime": {
           "version": "1.2.11",
-          "from": "mime@~1.2.7"
+          "from": "mime@~1.2.11",
+          "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz"
         },
         "ms": {
           "version": "0.1.0",
         "tough-cookie": {
           "version": "0.9.15",
           "from": "tough-cookie@~0.9.13",
+          "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-0.9.15.tgz",
           "dependencies": {
             "punycode": {
               "version": "1.3.1",
         "ws": {
           "version": "0.4.32",
           "from": "ws@~0.4.21",
+          "resolved": "https://registry.npmjs.org/ws/-/ws-0.4.32.tgz",
           "dependencies": {
             "commander": {
               "version": "2.1.0",
             },
             "nan": {
               "version": "1.0.0",
-              "from": "nan@~1.0.0"
+              "from": "nan@~1.0.0",
+              "resolved": "https://registry.npmjs.org/nan/-/nan-1.0.0.tgz"
             },
             "tinycolor": {
               "version": "0.0.1",
-              "from": "tinycolor@0.x"
+              "from": "tinycolor@0.x",
+              "resolved": "https://registry.npmjs.org/tinycolor/-/tinycolor-0.0.1.tgz"
             },
             "options": {
               "version": "0.0.5",
-              "from": "options@>=0.0.5"
+              "from": "options@>=0.0.5",
+              "resolved": "https://registry.npmjs.org/options/-/options-0.0.5.tgz"
             }
           }
         }
index 88d940f..94742bd 100644 (file)
@@ -2,7 +2,7 @@
   "author": "xTuple <dev@xtuple.com>",
   "name": "xtuple",
   "description": "xTuple Enterprise Resource Planning Mobile-Web client",
-  "version": "4.7.0-beta",
+  "version": "4.7.0-beta2",
   "repository": {
     "type": "git",
     "url": "https://github.com/xtuple/xtuple.git"
@@ -36,6 +36,7 @@
     "passport-oauth2-jwt-bearer": "0.1.x",
     "paynode": "0.3.6",
     "pg": "0.14.x",
+    "qr-image": "1.1.x",
     "request": "2.14.x",
     "rimraf": "2.2.x",
     "rjson": "~0.2.4",
index ee2121b..b8ae265 100644 (file)
@@ -139,7 +139,10 @@ install_packages() {
   sudo add-apt-repository -y "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBDIST}-pgdg main"
   sudo wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
   sudo apt-get -qq update 2>&1 | tee -a $LOG_FILE
-  sudo apt-get -q -y install curl build-essential libssl-dev postgresql-9.1 postgresql-server-dev-9.1 postgresql-contrib-9.1 postgresql-9.1-plv8 2>&1 | tee -a $LOG_FILE
+  sudo apt-get -q -y install curl build-essential libssl-dev \
+    postgresql-${PG_VERSION} postgresql-server-dev-${PG_VERSION} \
+    postgresql-contrib-${PG_VERSION} postgresql-${PG_VERSION}-plv8 2>&1 \
+    | tee -a $LOG_FILE
 
   if [ ! -d "/usr/local/nvm" ]; then
     sudo rm -f /usr/local/bin/nvm
@@ -154,10 +157,11 @@ install_packages() {
   sudo nvm alias xtuple $NODE_VERSION
 
   # use latest npm
-  npm install -fg npm@1.4.25
+  sudo npm install -fg npm@1.4.25
        # npm no longer supports its self-signed certificates
        log "telling npm to use known registrars..."
        npm config set ca ""
+        sudo chown -R $USER $HOME/.npm
 
   log "installing npm modules..."
   npm install --unsafe-perm 2>&1 | tee -a $LOG_FILE
@@ -189,7 +193,7 @@ setup_postgres() {
                return 1
        fi
 
-       PGDIR=/etc/postgresql/9.1/main
+       PGDIR=/etc/postgresql/${PG_VERSION}/main
 
   log "copying configs..."
        sudo cp $PGDIR/postgresql.conf $PGDIR/postgresql.conf.default
index aa0b85c..8ae4296 100644 (file)
@@ -191,9 +191,8 @@ var  async = require('async'),
           return memo + script;
         }, "");
 
-        // Without this, when we delegate to exec psql the err var will not be set even
-        // on the case of error.
-        allSql = "\\set ON_ERROR_STOP TRUE;\n" + allSql;
+        // Without this, psql runs all input and returns success even if errors occurred
+        allSql = "\\set ON_ERROR_STOP TRUE\n" + allSql;
 
         winston.info("Applying build to database " + spec.database);
         credsClone.database = spec.database;
index 95b8d52..c952b8a 100644 (file)
@@ -50,10 +50,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       grade = "0",
       tableName = defaultSchema ? defaultSchema + ".pkgreport" : "report",
       description,
-      disableSql,
-      updateSql,
-      insertSql,
-      enableSql;
+      upsertSql;
 
     if (lines[3].indexOf(" <name>") !== 0 ||
         lines[4].indexOf(" <description>") !== 0) {
@@ -68,40 +65,36 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       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 " +
@@ -117,21 +110,15 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       "$$, 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 " +
@@ -146,9 +133,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
       "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 = {
index b82f1bd..94147e7 100644 (file)
@@ -1,5 +1,5 @@
-<package id        = "distribution-install-460"
-         version   = "4.7.0Beta"
+<package id        = "distribution-install-470beta2"
+         version   = "4.7.0Beta2"
          developer = "xTuple"
          descrip   = "load PostBooks resources"
          updater   = "2.2.4" >
index 9ff6ab6..44532c6 100644 (file)
@@ -1,5 +1,5 @@
-<package id        = "distribution-upgrade-460"
-         version   = "4.7.0Beta"
+<package id        = "distribution-upgrade-470beta2"
+         version   = "4.7.0Beta2"
          developer = "xTuple"
          descrip   = "load PostBooks resources"
          updater   = "2.2.4" >
@@ -19,7 +19,7 @@
 
   <prerequisite type = "query"
                 name = "Checking for too-new xTuple ERP database version" >
-    <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+    <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.
     </message>
   </prerequisite>
index 041993b..7a8c3e2 100644 (file)
@@ -1,5 +1,5 @@
-<package id        = "postbooks-upgrade-460"
-         version   = "4.7.0Beta"
+<package id        = "postbooks-upgrade-470beta2"
+         version   = "4.7.0Beta2"
          developer = "xTuple"
          descrip   = "load PostBooks resources"
          updater   = "2.2.4" >
@@ -19,7 +19,7 @@
 
   <prerequisite type = "query"
                 name = "Checking for too-new xTuple ERP database version" >
-    <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+    <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.
     </message>
   </prerequisite>
index b6eb595..671a4fb 100644 (file)
@@ -1,5 +1,5 @@
-<package id        = "manufacturing-install-460"
-         version   = "4.7.0Beta"
+<package id        = "manufacturing-install-470beta2"
+         version   = "4.7.0Beta2"
          developer = "xTuple"
          descrip   = "load PostBooks resources"
          updater   = "2.2.4" >
@@ -19,7 +19,7 @@
 
   <prerequisite type = "query"
                 name = "Checking for too-new xTuple ERP database version" >
-    <query>SELECT NOT fetchMetricText('ServerVersion') >= '4.7.0';</query>
+    <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.
     </message>
   </prerequisite>
index ff787b4..264a45a 100644 (file)
@@ -1,5 +1,5 @@
-<package id        = "manufacturing-upgrade-460"
-         version   = "4.7.0Beta"
+<package id        = "manufacturing-upgrade-470beta2"
+         version   = "4.7.0Beta2"
          developer = "xTuple"
          descrip   = "load PostBooks resources"
          updater   = "2.2.4" >
@@ -30,8 +30,8 @@
 
 <prerequisite type = "query"
                name = "Checking for too-new xTuple ERP database version" >
-<query>SELECT NOT 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.7.0Beta2' AND fetchMetricText('ServerVersion') != '4.7.0';</query>
+    <message>This package may not be applied to a database newer than 4.7.0Beta2.
     </message>
 </prerequisite>