Permalink
Browse files

Merge branch 'master' into 19453

  • Loading branch information...
2 parents 93a9dd3 + f9ef590 commit c59e61812708b03b18fb1be9692d42f23e57056b Linda Nichols committed Mar 19, 2013
@@ -697,7 +697,11 @@ trailing:true white:true*/
placeholder: "_noCloseTarget".loc(),
classes: "right"}
]},
- {kind: "XV.ListAttr", attr: "name"}
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListAttr", attr: "name"},
+ {kind: "XV.ListAttr", attr: "amount", classes: "right",
+ formatter: "formatAmount"}
+ ]}
]},
{kind: "XV.ListColumn", classes: "second",
components: [
@@ -720,6 +724,11 @@ trailing:true white:true*/
]}
]}
],
+ formatAmount: function (value, view, model) {
+ var currency = model ? model.get("currency") : false,
+ scale = XT.session.locale.attributes.moneyScale;
+ return currency ? currency.format(value, scale) : "";
+ },
formatTargetClose: function (value, view, model) {
var isLate = model && model.get('isActive') &&
(XT.date.compareDate(value, new Date()) < 1);
@@ -85,55 +85,16 @@ regexp:true, undef:true, trailing:true, white:true */
*/
create: function () {
this.inherited(arguments);
+ this.setCurrency(XT.baseCurrency());
+ this.$.picker.setValue(this.getCurrency(), {silent: true});
this.$.baseLabel.setContent(XT.baseCurrency().get('abbreviation'));
// the currency picker may be disabled or hidden on creation in certain situations
this.$.picker.setDisabled(this.getCurrencyDisabled());
this.$.picker.setShowing(this.getCurrencyShowing());
},
- /**
- Returns the published effective value.
- */
- getEffective: function () {
- return this.effective;
- },
-
- /**
- Sets the effective date and sets visibility
- of base panel based on value.
- */
- setEffective: function (value) {
- this.effective = value;
+ effectiveChanged: function () {
this.setBasePanelShowing();
},
-
- /**
- Returns the published currency value.
- */
- getCurrency: function () {
- return this.currency;
- },
-
- /**
- Sets the value of the published currency value.
- */
- setCurrency: function (value) {
- this.currency = value;
- },
-
- /**
- Returns the published amount value.
- */
- getAmount: function () {
- return this.amount;
- },
-
- /**
- Sets the value of the published currency value.
- */
- setAmount: function (value) {
- this.amount = value;
- },
-
/**
Sets visibility of base panel
*/
@@ -213,8 +174,8 @@ regexp:true, undef:true, trailing:true, white:true */
}
} else if (attribute === "currency") {
oldValue = this.getCurrency();
- if (oldValue !== newValue) {
- this.setCurrency(newValue || XT.baseCurrency());
+ if (newValue && oldValue !== newValue) {
+ this.setCurrency(newValue);
this.$.picker.setValue(this.getCurrency(), options);
}
}
@@ -873,6 +873,20 @@
"inverse": "username"
}
},
+ {
+ "name": "amount",
+ "attr": {
+ "type": "Number",
+ "column": "ophead_amount"
+ }
+ },
+ {
+ "name": "currency",
+ "toOne": {
+ "type": "Currency",
+ "column": "ophead_curr_id"
+ }
+ },
{
"name": "priorityOrder",
"attr": {
@@ -632,7 +632,8 @@ select xt.install_js('XT','Data','xtuple', $$
/* Determine whether to insert or update */
sql = 'select ' + ext.relations[0].column + ' from ' + ext.table +
' where ' + ext.relations[0].column + ' = $1;';
- plv8.elog(NOTICE, 'sql =', sql, value[pkey]);
+
+ if (DEBUG) { plv8.elog(NOTICE, 'sql =', sql, value[pkey]); }
rows = plv8.execute(sql, [value[pkey]]);
if (rows.length) {
sql = this.prepareUpdate(ext, value);
@@ -1092,7 +1093,7 @@ select xt.install_js('XT','Data','xtuple', $$
if (pcheck.length) { break; } /* valid lock */
} else {
lockExp = new Date(lock.lock_expires);
- plv8.elog(NOTICE, "Lock found", lockExp > expires, lockExp, expires);
+ if (DEBUG) { plv8.elog(NOTICE, "Lock found", lockExp > expires, lockExp, expires); }
if (lockExp > expires) { break; } /* valid lock */
}
@@ -1142,7 +1143,8 @@ select xt.install_js('XT','Data','xtuple', $$
plv8.execute(sqlKey, [options.key]);
} else {
oid = typeof options.table === "string" ? this.getTableOid(options.table) : options.table;
- plv8.elog(NOTICE, oid, options.id, username)
+
+ if (DEBUG) { plv8.elog(NOTICE, oid, options.id, username); }
plv8.execute(sqlUsr, [oid, options.id, username]);
}
return true;
View
@@ -239,7 +239,7 @@ app.configure(function () {
app.use(express.bodyParser());
// See cookie stopm above for more details.
- app.use(express.session({ store: sessionStore, secret: '.T#T@r5EkPM*N@C%9K-iPW!+T', cookie: { path: '/', httpOnly: true, secure: true, maxAge: 1800000 } }));
+ app.use(express.session({ store: sessionStore, secret: '.T#T@r5EkPM*N@C%9K-iPW!+T', cookie: { path: '/', httpOnly: true, secure: true, maxAge: 3600000 } }));
app.use(passport.initialize());
app.use(passport.session());
@@ -44,7 +44,7 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
var data;
if (err) {
- callback({isError: true, error: err, message: err.message});
+ callback({isError: true, error: err, message: err.message, description: err.message});
} else if (res && res.rows && res.rows.length > 0) {
// the data comes back in an awkward res.rows[0].dispatch form,
// and we want to normalize that here so that the data is in response.data
@@ -17,7 +17,6 @@ regexp:true, undef:true, strict:true, trailing:true, white:true */
routersDirectory: "./lib/routers",
enhancedAuthKey: "xTuple",
datasource: {
- sessionTimeout: 15,
bindAddress: "localhost",
port: 443,
keyFile: "./lib/private/key.pem",
@@ -183,7 +183,7 @@ var _ = require("underscore"),
model.off('statusChange', callback);
that.callback(null, data);
} else if (status === K.ERROR) {
- that.callback(data.model.lastError);
+ that.callback(data.model.lastError || "Unspecified error");
}
};
model.on('statusChange', callback);
@@ -195,7 +195,8 @@ var _ = require("underscore"),
that.callback(null, data);
}, exports.waitTime);
},
- 'Status is `DESTROYED_CLEAN`': function (data) {
+ 'Status is `DESTROYED_CLEAN`': function (error, data) {
+ assert.equal(error, null);
assert.equal(data.model.getStatusString(), 'DESTROYED_CLEAN');
}
};
@@ -24,7 +24,7 @@ var XVOWS = XVOWS || {};
};
vows.describe('XM.Account CRUD test').addBatch({
- 'INITIALIZE ': {
+ 'We can INITIALIZE an Account Model': {
topic: function () {
var that = this,
callback = function () {
@@ -38,39 +38,39 @@ var XVOWS = XVOWS || {};
}
}
}).addBatch({
- 'CREATE ': crud.create(data, {
+ 'We can CREATE an Account Model': crud.create(data, {
'-> Set values': {
topic: function (data) {
data.model.set(data.createHash);
return data;
},
- 'Last Error is null': function (data) {
+ 'Verify the Last Error is null': function (data) {
assert.isNull(data.model.lastError);
},
- '-> Save': crud.save(data)
+ '-> Save Account': crud.save(data)
}
})
}).addBatch({
- 'READ': {
+ 'We can READ an Account Model': {
topic: function () {
return data;
},
- 'Last Error is null': function (data) {
+ 'Verify the Last Error is null': function (data) {
assert.isNull(data.model.lastError);
}
}
}).addBatch({
- 'UPDATE ': crud.update(data, {
+ 'We can UPDATE an Account Model': crud.update(data, {
'-> Set values': {
topic: function () {
data.model.set(data.updateHash);
return data;
},
- '-> Commit': crud.save(data)
+ '-> Commit Account': crud.save(data)
}
})
}).addBatch({
- 'DESTROY': crud.destroy(data)
+ 'We can DESTROY an Account Model': crud.destroy(data)
}).export(module);
-}());
+}());
@@ -23,7 +23,7 @@ var XVOWS = XVOWS || {};
};
vows.describe('XM.Address CRUD test').addBatch({
- 'INITIALIZE ': {
+ 'We can INITIALIZE an Address Model': {
topic: function () {
var that = this,
callback = function () {
@@ -32,44 +32,44 @@ var XVOWS = XVOWS || {};
};
zombieAuth.loadApp(callback);
},
- 'The record type is XM.Address': function (data) {
+ 'Verify the record type is XM.Address': function (data) {
assert.equal(data.model.recordType, "XM.Address");
}
}
}).addBatch({
- 'CREATE ': crud.create(data, {
- '-> Set values': {
+ 'We can CREATE an Address Model': crud.create(data, {
+ '-> Set values to the Address': {
topic: function (data) {
data.model.set(data.createHash);
return data;
},
- 'Last Error is null': function (data) {
+ 'Verify the Last Error is null': function (data) {
assert.isNull(data.model.lastError);
},
- '-> Save': crud.save(data)
+ '-> Save Address': crud.save(data)
}
})
}).addBatch({
- 'READ': {
+ 'We can READ the Address Model': {
topic: function () {
return data;
},
- 'Last Error is null': function (data) {
+ 'Verify the Last Error is null': function (data) {
assert.isNull(data.model.lastError);
}
}
}).addBatch({
- 'UPDATE ': crud.update(data, {
- '-> Set values': {
+ 'We can UPDATE the Address Model ': crud.update(data, {
+ '-> Set values to the Address': {
topic: function () {
data.model.set(data.updateHash);
return data;
},
- '-> Commit': crud.save(data)
+ '-> Commit Address': crud.save(data)
}
})
}).addBatch({
- 'DESTROY': crud.destroy(data)
+ 'We can DESTROY an Address Model': crud.destroy(data)
}).export(module);
}());
@@ -24,7 +24,7 @@ var XVOWS = XVOWS || {};
};
vows.describe('XM.Contact CRUD test').addBatch({
- 'INITIALIZE ': {
+ 'We can INITIALIZE a Contact Model': {
topic: function () {
var that = this,
callback = function () {
@@ -33,26 +33,26 @@ var XVOWS = XVOWS || {};
};
zombieAuth.loadApp(callback);
},
- 'The record type is XM.Contact': function (data) {
+ 'Verify the record type is XM.Contact': function (data) {
assert.equal(data.model.recordType, "XM.Contact");
}
}
}).addBatch({
- 'CREATE ': crud.create(data, {
- '-> Set values': {
+ 'We can CREATE a Contact ': crud.create(data, {
+ '-> Set values of the Contact': {
topic: function (data) {
data.model.set(data.createHash);
data.model.unset('address'); //because asynchronus nonsense
return data;
},
- 'Last Error is null': function (data) {
+ 'Verify the Last Error is null': function (data) {
assert.isNull(data.model.lastError);
},
- '-> Save': crud.save(data)
+ '-> Save the Contact': crud.save(data)
}
})
}).addBatch({
- 'READ': {
+ 'We can READ a Contact': {
topic: function () {
return data;
},
@@ -64,20 +64,20 @@ var XVOWS = XVOWS || {};
}
}
}).addBatch({
- 'UPDATE ': crud.update(data, {
- '-> Set values': {
+ 'We can UPDATE a Contact Model': crud.update(data, {
+ '-> Set values of the Contact': {
topic: function () {
data.model.set(data.updateHash);
return data;
},
- 'Name is `Mike`': function (data) {
+ 'Contact Name is `Mike`': function (data) {
assert.equal(data.model.get("name"), data.updateHash.name);
},
- '-> Commit': crud.save(data)
+ '-> Commit the Contact': crud.save(data)
}
})
}).addBatch({
- 'DESTROY': crud.destroy(data)
+ 'We can DESTROY a Contact Model': crud.destroy(data)
}).export(module);
-}());
+}());
Oops, something went wrong.

0 comments on commit c59e618

Please sign in to comment.