],
"isSystem": true
},
+ {
+ "context": "xtuple",
+ "nameSpace": "XM",
+ "type": "SalesOrderPayment",
+ "table": "payco",
+ "idSequenceName": "payco_payco_id_seq",
+ "lockable": true,
+ "lockTable": "payco",
+ "isRest": true,
+ "comment": "Sales Order Payment Map",
+ "privileges": {
+ "all": {
+ "create": "ProcessCreditCards",
+ "read": "ProcessCreditCards",
+ "update": "ProcessCreditCards",
+ "delete": false
+ }
+ },
+ "properties": [
+ {
+ "name": "id",
+ "attr": {
+ "type": "Number",
+ "column": "payco_id",
+ "isPrimaryKey": true
+ }
+ },
+ {
+ "name": "uuid",
+ "attr": {
+ "type": "String",
+ "column": "obj_uuid",
+ "isNaturalKey": true
+ }
+ },
+ {
+ "name": "payment",
+ "toOne": {
+ "isNested": true,
+ "type": "CreditCardPayment",
+ "column": "payco_ccpay_id"
+ }
+ },
+ {
+ "name": "salesOrder",
+ "toOne": {
+ "type": "SalesOrderRelation",
+ "column": "payco_cohead_id"
+ }
+ },
+ {
+ "name": "amount",
+ "attr": {
+ "type": "Number",
+ "column": "payco_amount"
+ }
+ }
+ ],
+ "isSystem": true
+ },
+ {
+ "context": "xtuple",
+ "nameSpace": "XM",
+ "type": "CreditCardPayment",
+ "table": "ccpay",
+ "idSequenceName": "ccpay_ccpay_id_seq",
+ "lockable": true,
+ "lockTable": "ccpay",
+ "isRest": true,
+ "comment": "Credit Card Payment Map",
+ "privileges": {
+ "all": {
+ "create": "ProcessCreditCards",
+ "read": "ProcessCreditCards",
+ "update": "ProcessCreditCards",
+ "delete": false
+ }
+ },
+ "properties": [
+ {
+ "name": "id",
+ "attr": {
+ "type": "Number",
+ "column": "ccpay_id",
+ "isPrimaryKey": true
+ }
+ },
+ {
+ "name": "uuid",
+ "attr": {
+ "type": "String",
+ "column": "obj_uuid",
+ "isNaturalKey": true
+ }
+ },
+ {
+ "name": "creditCard",
+ "toOne": {
+ "type": "CreditCard",
+ "column": "ccpay_ccard_id"
+ }
+ },
+ {
+ "name": "customer",
+ "toOne": {
+ "type": "CustomerRelation",
+ "column": "ccpay_cust_id"
+ }
+ },
+ {
+ "name": "amount",
+ "attr": {
+ "type": "Number",
+ "column": "ccpay_amount"
+ }
+ },
+ {
+ "name": "wasPreauthorization",
+ "attr": {
+ "type": "Boolean",
+ "column": "ccpay_auth"
+ }
+ },
+ {
+ "name": "status",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_status"
+ }
+ },
+ {
+ "name": "type",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_type"
+ }
+ },
+ {
+ "name": "originalType",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_auth_charge"
+ }
+ },
+ {
+ "name": "orderNumber",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_order_number"
+ }
+ },
+ {
+ "name": "orderNumberSeq",
+ "attr": {
+ "type": "Number",
+ "column": "ccpay_order_number_seq"
+ }
+ },
+ {
+ "name": "gatewayTransId",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_ordernum"
+ }
+ },
+ {
+ "name": "gatewayAuthCode",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_code"
+ }
+ },
+ {
+ "name": "gatewayTransDate",
+ "attr": {
+ "type": "Date",
+ "column": "ccpay_yp_r_time"
+ }
+ },
+ {
+ "name": "gatewayAvsCode",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_avs"
+ }
+ },
+ {
+ "name": "gatewayTruncPan",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_card_pan_trunc"
+ }
+ },
+ {
+ "name": "gatewayCardType",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_card_type"
+ }
+ },
+ {
+ "name": "gatewayApproved",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_approved"
+ }
+ },
+ {
+ "name": "gatewayMessage",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_message"
+ }
+ },
+ {
+ "name": "gatewayError",
+ "attr": {
+ "type": "String",
+ "column": "ccpay_r_error"
+ }
+ }
+ ],
+ "isSystem": true
+ },
{
"context": "xtuple",
"nameSpace": "SYS",
"_xtdb_postCashReceipt6": "The selected Cash Receipt cannot be posted as the Bank Account cannot be determined. You must make a Bank Account Assignment for this Cash Receipt before you may post it.",
"_xtdb_postCashReceipt7": "The selected Cash Receipt cannot be posted, probably because the Customer's Prepaid Account was not found.",
"_xtdb_postCashReceipt8": "Cannot post this Cash Receipt because the credit card records could not be found.",
+ "_xtdb_postCCCashReceipt1": "Cannot post this Cash Receipt because annot find the default Bank Account for this Credit Card.",
"_xtdb_postCCCashReceipt11": "Cannot post this Cash Receipt because the record of the credit card transaction either does not exist or is not consistent.",
"_xtdb_postCCcredit1": "Cannot post this Credit Card refund because the default Bank Account for this Credit Card could not be found.",
"_xtdb_postCCcredit2": "Cannot post this Credit Card refund because an invalid id/reference-type pair was passed.",
"public/tables/comment_trigger.sql",
"public/tables/pkghead.sql",
"public/tables/schemaord.sql",
+ "priv.sql",
"update_version.sql"
]
}
--- /dev/null
+-- Setup default 'ADMIN' role and grant it to 'admin' user it it doesn't exist.
+
+-- Add 'ADMIN' Role.
+select xt.add_role('ADMIN', 'Administrators Role');
+
+-- Grant 'admin' user 'ADMIN' Role.
+select xt.grant_user_role('admin', 'ADMIN');
"CCCompany",
"CCTest",
"CCRequireCCV",
+ "DashboardLite",
"DefaultPriority",
"RequireProjectAssignment",
"UseProjects"
var sqlCount = "select count(*) as count from public.priv where priv_name = $1;",
sqlId = "select nextval('public.priv_priv_id_seq') as sequence;",
sqlInsert = "insert into public.priv (priv_id, priv_name, priv_module, priv_descrip) values ($1, $2, $3, $4)",
+ sqlGrantToAdmin = "select xt.grant_role_priv('ADMIN', $1, $2)",
count = plv8.execute(sqlCount, [ name ])[0].count,
nextId;
if(count > 0) {
+ /* Grant this priv to the 'ADMIN' role by default. */
+ plv8.execute(sqlGrantToAdmin, [module, name]);
+
return false;
}
/* groop is used to segment the assignment box */
/* module is the name of the extension. was used to filter the assignment box, but doesn't do that any more */
plv8.execute(sqlInsert, [nextId, name, module, descrip]);
+
+ /* Grant this priv to the 'ADMIN' role by default. */
+ plv8.execute(sqlGrantToAdmin, [module, name]);
+
return true;
$$ language plv8;
"use strict";
var lang = XT.stringsFor("en_US", {
+ "_assignedIncidents": "Assigned Incidents",
"_crm": "CRM",
"_crmDescription": "Corporate Relationship Management",
"_highPriority": "High Priority",
"_incidentDefaultPublic": "Comment Default Public",
"_incidentStatusColors": "Incident Status Colors",
- "_openIncidents": "Open Incidents",
+ "_opportunitiesNext30Days": "Opportunities Next 30 Days",
"_maintainEmailProfiles": "Maintain Email Profiles",
"_staleAnalysisWarning": "Free trial demo analysis data will not be updated from your live changes.",
"_viewEmailProfiles": "View Email Profiles"
]
};
+ if (XT.session.settings.get("DashboardLite")) {
+ var dashboardModule = {
+ name: "dashboardLite",
+ label: "_dashboard".loc(),
+ panels: [
+ {
+ name: "dashboardLite",
+ kind: "XV.DashboardLite",
+ newActions: [
+ {name: "assignedIncidents", label: "_assignedIncidents".loc(), item: "XV.AssignedIncidentBarChart"},
+ {name: "opportunities", label: "_opportunities".loc(), item: "XV.OpportunityBarChart"}
+ ]
+ }
+ ]
+ };
+
+ XT.app.$.postbooks.insertModule(dashboardModule, 0);
+ }
+
isBiAvailable = XT.session.config.biAvailable && XT.session.privileges.get("ViewSalesHistory");
if (isBiAvailable) {
module.panels.push({name: "analysisPage", kind: "analysisFrame"});
+++ /dev/null
-/*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
-latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
-trailing:true, white:true*/
-/*global XT:true, XM:true, XV:true, _:true, window: true, enyo:true, nv:true, d3:true, console:true */
-
-(function () {
-
- enyo.kind({
- name: "XV.CrmDashboard",
- kind: "XV.Dashboard",
- collection: "XM.UserChartCollection",
- // this tells the default query what extension to pull charts for
- extension: "crm",
- // title is what show in the "add chart" picker on the
- // dashboard and the chart is the widget to be added
- newActions: [
- {name: "openIncidents", label: "_openIncidents".loc(), item: "XV.OpenIncidentBarChart"},
- {name: "opportunities", label: "_opportunities".loc(), item: "XV.OpportunityBarChart"}
- ]
- });
-}());
enyo.depends(
"list_relations.js",
"list_relations_box.js",
- "dashboard.js",
"workspace.js"
);
XT.extensions.crm.initCharts = function () {
enyo.kind({
- name: "XV.OpenIncidentBarChart",
+ name: "XV.AssignedIncidentBarChart",
kind: "XV.DrilldownBarChart",
collection: "XM.IncidentListItemCollection",
- chartTitle: "_openIncidents".loc(),
+ chartTitle: "_assignedIncidents".loc(),
filterOptions: [
{ name: "all", parameters: [] },
{ name: "highPriority", parameters: [
{ name: "priority" },
{ name: "project" }
],
- // suppress closed incidents
+ // assigned incidents only
query: {
parameters: [{
attribute: "status",
- operator: "!=",
- value: "L"
+ operator: "=",
+ value: "A"
}],
}
});
name: "XV.OpportunityBarChart",
kind: "XV.DrilldownBarChart",
collection: "XM.OpportunityListItemCollection",
- chartTitle: "_opportunities".loc(),
+ chartTitle: "_opportunitiesNext30Days".loc(),
groupByOptions: [
{ name: "opportunityStage", content: "_stage".loc() },
{ name: "opportunitySource", content: "_source".loc() },
{ name: "assignedTo" },
{ name: "priority" }
],
+ query: {
+ parameters: [{
+ attribute: "targetClose",
+ operator: ">=",
+ value: XT.date.applyTimezoneOffset(XV.Date.prototype.textToDate("0"), true)
+ }, {
+ attribute: "targetClose",
+ operator: "<=",
+ value: XT.date.applyTimezoneOffset(XV.Date.prototype.textToDate("+30"), true)
+ }]
+ },
totalField: "amount"
});
"_autoAllocateCreditMemos": "Allocate Credit Memos to New Sales Order on Save",
"_autoSelectForBilling": "Check 'Select for Billing' option on Ship Order",
"_bookings": "Bookings",
+ "_bookingsNext30Days": "Bookings Next 30 Days",
"_convert": "Convert",
"_creditControl": "Credit Control",
"_creditMemo": "Credit Memo",
"_sales": "Sales",
"_salesDescription": "Customer and Sales Order Management",
"_salesHistory": "Sales History",
+ "_salesHistoryLast30Days": "Sales History Last 30 Days",
"_salesOrder": "Sales Order",
"_salesOrderAck": "Sales Order Acknowledgement",
"_scheduled": "Scheduled",
/*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
trailing:true, white:true*/
-/*global XT:true, XV:true, XM:true, enyo:true, console:true */
+/*global XT:true, XV:true, XM:true, enyo:true, console:true, _:true */
(function () {
]
};
+ if (XT.session.settings.get("DashboardLite")) {
+ // TODO if we commit to this approach it would make sense to move this code into
+ // XT.app.$.postbooks.insertDashboardCharts() or something like it
+ var newActions = [
+ {name: "salesHistory", label: "_salesHistory".loc(), item: "XV.SalesHistoryTimeSeriesChart"},
+ {name: "bookings", label: "_bookings".loc(), item: "XV.SalesOrderTimeSeriesChart"}
+ ];
+ var preExistingDashboard = _.find(XT.app.$.postbooks.modules, function (module) {
+ return module.name === "dashboardLite";
+ });
+
+ if (preExistingDashboard) {
+ preExistingDashboard.panels[0].newActions = _.union(preExistingDashboard.panels[0].newActions, newActions);
+
+ } else {
+ var dashboardModule = {
+ name: "dashboardLite",
+ label: "_dashboard".loc(),
+ panels: [
+ {
+ name: "dashboardLite",
+ kind: "XV.DashboardLite",
+ newActions: newActions
+ }
+ ]
+ };
+
+ XT.app.$.postbooks.insertModule(dashboardModule, 0);
+ }
+ }
+
isBiAvailable = XT.session.config.biAvailable && XT.session.privileges.get("ViewSalesHistory");
if (isBiAvailable) {
module.panels.push({name: "salesAnalysisPage", kind: "analysisFrame"});
+++ /dev/null
-/*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
-latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
-trailing:true, white:true*/
-/*global XT:true, XM:true, XV:true, _:true, window: true, enyo:true, nv:true, d3:true, console:true */
-
-(function () {
-
- enyo.kind({
- name: "XV.SalesDashboard",
- kind: "XV.Dashboard",
- collection: "XM.UserChartCollection",
- // title is what show in the "add chart" picker on the
- // dashboard and the chart is the widget to be added
- // this tells the default query what extension to pull charts for
- extension: "sales",
- newActions: [
- {name: "salesHistory", label: "_salesHistory".loc(), item: "XV.SalesHistoryTimeSeriesChart"},
- {name: "bookings", label: "_bookings".loc(), item: "XV.SalesOrderTimeSeriesChart"}
- ]
- });
-
-}());
"list.js",
"list_relations.js",
"list_relations_box.js",
- "dashboard.js",
"workspace.js"
);
(function () {
-
-/*
-unused and out of date. if we want to use this, add correct parameters to
-filter options
- enyo.kind({
- name: "XV.SalesHistoryBarChart",
- kind: "XV.DrilldownBarChart",
- collection: "XM.SalesHistoryCollection",
- chartTitle: "_salesHistory".loc(),
- drillDownAttr: "orderNumber",
- drillDownRecordType: "XM.SalesOrderRelation",
- filterOptions: [
- { name: "today" },
- { name: "thisWeek" },
- { name: "thisMonth" },
- { name: "thisYear" },
- { name: "twoYears" },
- { name: "fiveYears" }
- ],
- groupByOptions: [
- { name: "customer" },
- { name: "salesRep" }
- ],
- totalField: "totalPrice",
- filterData: filterData
- });
-*/
-
enyo.kind({
name: "XV.SalesHistoryTimeSeriesChart",
kind: "XV.TimeSeriesChart",
collection: "XM.SalesHistoryCollection",
- chartTitle: "_salesHistory".loc(),
+ chartTitle: "_salesHistoryLast30Days".loc(),
groupByOptions: [
{ name: "" },
{ name: "customer" },
{ name: "salesRep" }
],
+ query: {
+ parameters: [{
+ attribute: "shipDate",
+ operator: ">=",
+ value: XT.date.applyTimezoneOffset(XV.Date.prototype.textToDate("-30"), true)
+ }]
+ },
dateField: "shipDate",
totalField: "totalPrice"
});
name: "XV.SalesOrderTimeSeriesChart",
kind: "XV.TimeSeriesChart",
collection: "XM.SalesOrderListItemCollection",
- chartTitle: "_bookings".loc(),
+ chartTitle: "_bookingsNext30Days".loc(),
groupByOptions: [
{ name: "" },
{ name: "customer" },
{ name: "salesRep" }
],
+ query: {
+ parameters: [{
+ attribute: "orderDate",
+ operator: ">=",
+ value: XT.date.applyTimezoneOffset(XV.Date.prototype.textToDate("0"), true)
+ }, {
+ attribute: "orderDate",
+ operator: "<=",
+ value: XT.date.applyTimezoneOffset(XV.Date.prototype.textToDate("+30"), true)
+ }]
+ },
dateField: "orderDate",
totalField: "total"
});
"public/trigger_functions/cashrcptitem.sql",
"public/trigger_functions/cashrcptmisc.sql",
"public/trigger_functions/ccard.sql",
+ "public/trigger_functions/ccpay.sql",
"public/trigger_functions/char.sql",
"public/trigger_functions/charass.sql",
"public/trigger_functions/charopt.sql",
"public/tables/bankrecitem.sql",
"public/tables/cashrcpt.sql",
+ "public/tables/ccpay.sql",
"public/tables/metric.sql",
+ "public/tables/payco.sql",
"public/tables/priv.sql",
"public/tables/tax.sql",
"public/tables/taxpay.sql",
"public/tables/report/WarehouseMasterList.xml",
"public/tables/report/items.xml",
- "public/patches/fixacl.sql"
+ "public/patches/fixacl.sql",
+ "public/patches/populate_ccpay_card_type.sql"
]
}
pdoctype TEXT DEFAULT NULL,
pamount NUMERIC DEFAULT NULL) RETURNS INTEGER AS
$$
--- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
+-- 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
_aropenid INTEGER;
BEGIN
SELECT * INTO _c
- FROM ccpay, ccard, custinfo
- WHERE ( (ccpay_id = pCCpay)
- AND (ccpay_ccard_id = ccard_id)
- AND (ccpay_cust_id = cust_id) );
+ FROM ccpay
+ JOIN custinfo ON ccpay_cust_id = cust_id
+ WHERE (ccpay_id = pCCpay);
IF (NOT FOUND) THEN
RAISE EXCEPTION 'Cannot find the Credit Card transaction information [xtuple: postCCcashReceipt, -11, %]',
END IF;
SELECT bankaccnt_id, bankaccnt_accnt_id INTO _bankaccnt_id, _realaccnt
- FROM ccbank JOIN bankaccnt ON (ccbank_bankaccnt_id=bankaccnt_id)
- WHERE (ccbank_ccard_type=_c.ccard_type);
+ FROM ccbank
+ JOIN bankaccnt ON (ccbank_bankaccnt_id=bankaccnt_id)
+ WHERE (ccbank_ccard_type=_c.ccpay_card_type);
IF (_bankaccnt_id IS NULL) THEN
RAISE EXCEPTION 'Cannot find the default Bank Account for this Credit Card [xtuple: postCCcredit, -1, %]',
- _c.ccard_type;
+ _c.ccpay_card_type;
END IF;
- _ccOrderDesc := (_c.ccard_type || '-' || _c.ccpay_order_number::TEXT ||
- '-' || _c.ccpay_order_number_seq::TEXT);
+ _ccOrderDesc := (_c.ccpay_card_type || '-' || _c.ccpay_order_number::TEXT ||
+ '-' || _c.ccpay_order_number_seq::TEXT);
_journal := fetchJournalNumber('C/R');
cashrcpt_usecustdeposit
) VALUES (
_c.ccpay_cust_id, _c.ccpay_amount, _c.ccpay_curr_id,
- _c.ccard_type, _c.ccpay_r_ordernum, _ccOrderDesc,
+ _c.ccpay_card_type, _c.ccpay_r_ordernum, _ccOrderDesc,
CURRENT_DATE, _bankaccnt_id,
fetchMetricBool('EnableCustomerDeposits'))
RETURNING cashrcpt_id INTO _return;
SET cashrcpt_cust_id=_c.ccpay_cust_id,
cashrcpt_amount=_c.ccpay_amount,
cashrcpt_curr_id=_c.ccpay_curr_id,
- cashrcpt_fundstype=_c.ccard_type,
+ cashrcpt_fundstype=_c.ccpay_card_type,
cashrcpt_docnumber=_c.ccpay_r_ordernum,
cashrcpt_notes=_ccOrderDesc,
cashrcpt_distdate=CURRENT_DATE,
_return := _aropenid;
END IF;
- PERFORM insertGLTransaction(_journal, 'A/R', 'CR', _ccOrderDesc,
+ PERFORM insertGLTransaction(_journal, 'A/R', 'CR', _ccOrderDesc,
('Cash Receipt from Credit Card ' || _c.cust_name),
findPrepaidAccount(_c.ccpay_cust_id),
_realaccnt,
NULL,
- ROUND(currToBase(_c.ccpay_curr_id,
- _c.ccpay_amount,
- _c.ccpay_transaction_datetime::DATE),2),
+ ROUND(currToBase(_c.ccpay_curr_id,
+ _c.ccpay_amount,
+ _c.ccpay_transaction_datetime::DATE),2),
CURRENT_DATE);
RETURN _return;
CREATE OR REPLACE FUNCTION postCCcredit(INTEGER, TEXT, INTEGER) RETURNS INTEGER AS $$
--- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
+-- 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
- pCCpay ALIAS FOR $1;
+ pCCpay ALIAS FOR $1;
preftype ALIAS FOR $2;
prefid ALIAS FOR $3;
- _c RECORD;
- _ccOrderDesc TEXT;
+ _c RECORD;
+ _ccOrderDesc TEXT;
_cglaccnt INTEGER;
- _dglaccnt INTEGER;
+ _dglaccnt INTEGER;
_glseriesres INTEGER;
- _notes TEXT := 'Credit via Credit Card';
- _r RECORD;
- _sequence INTEGER;
- _dmaropenid INTEGER;
+ _notes TEXT := 'Credit via Credit Card';
+ _r RECORD;
+ _sequence INTEGER;
+ _dmaropenid INTEGER;
BEGIN
IF ((preftype = 'cohead') AND NOT EXISTS(SELECT cohead_id
- FROM cohead
- WHERE (cohead_id=prefid))) THEN
+ FROM cohead
+ WHERE (cohead_id=prefid))) THEN
RAISE EXCEPTION 'Cannot find original Sales Order for this Credit Card credit [xtuple: postCCcredit, -2, %, %, %]',
pCCpay, preftype, prefid;
ELSIF ((preftype = 'aropen') AND NOT EXISTS(SELECT aropen_id
- FROM aropen
- WHERE (aropen_id=prefid))) THEN
+ FROM aropen
+ WHERE (aropen_id=prefid))) THEN
RAISE EXCEPTION 'Cannot find original A/R Open record for this Credit Card credit [xtuple: postCCcredit, -2, %, %, %]',
pCCpay, preftype, prefid;
ELSIF ((preftype = 'cmhead') AND NOT EXISTS(SELECT cmhead_id
- FROM cmhead
- WHERE cmhead_id=prefid)) THEN
+ FROM cmhead
+ WHERE cmhead_id=prefid)) THEN
RAISE EXCEPTION 'Cannot find original Credit Memo record for this Credit Card credit [xtuple: postCCcredit, -2, %, %, %]',
pCCpay, preftype, prefid;
END IF;
SELECT * INTO _c
- FROM ccpay
- JOIN ccard ON (ccpay_ccard_id = ccard_id)
- JOIN ccbank ON (ccard_type=ccbank_ccard_type)
- WHERE (ccpay_id = pCCpay);
+ FROM ccpay
+ WHERE (ccpay_id = pCCpay);
IF (NOT FOUND) THEN
RAISE EXCEPTION 'Cannot find the record for this Credit Card credit [xtuple: postCCcredit, -3, %, %, %]',
END IF;
SELECT bankaccnt_accnt_id INTO _cglaccnt
- FROM bankaccnt
- WHERE (bankaccnt_id=_c.ccbank_bankaccnt_id);
+ FROM ccbank
+ JOIN bankaccnt ON (ccbank_bankaccnt_id=bankaccnt_id)
+ WHERE (ccbank_ccard_type=_c.ccpay_card_type);
IF (NOT FOUND) THEN
RAISE EXCEPTION 'Cannot find the default Bank Account for this Credit Card [xtuple: postCCcredit, -1, %]',
_sequence := fetchGLSequence();
IF (_c.ccpay_r_ref IS NOT NULL) THEN
- _ccOrderDesc := (_c.ccard_type || '-' || _c.ccpay_r_ref);
+ _ccOrderDesc := (_c.ccpay_card_type || '-' || _c.ccpay_r_ref);
ELSE
- _ccOrderDesc := (_c.ccard_type || '-' || _c.ccpay_order_number::TEXT ||
- '-' || COALESCE(_c.ccpay_order_number_seq::TEXT, ''));
+ _ccOrderDesc := (_c.ccpay_card_type || '-' || _c.ccpay_order_number::TEXT ||
+ '-' || COALESCE(_c.ccpay_order_number_seq::TEXT, ''));
END IF;
_glseriesres := insertIntoGLSeries(_sequence, 'A/R', 'CC', _ccOrderDesc,
IF (FOUND) THEN
SELECT createardebitmemo(
- NULL,
+ NULL,
_r.aropen_cust_id, NULL, fetchARMemoNumber(),
_r.aropen_ordernumber, current_date, _c.ccpay_amount,
_notes,
- -1, -1, -1, CURRENT_DATE, -1, NULL, 0,
+ -1, -1, -1, CURRENT_DATE, -1, NULL, 0,
_r.aropen_curr_id) INTO _dmaropenid;
IF (_r.aropen_open) THEN
PERFORM applyARCreditMemoToBalance(_r.aropen_id, _dmaropenid);
PERFORM postARCreditMemoApplication(_r.aropen_id);
END IF;
-
+
END IF;
IF (preftype = 'cohead') THEN
INSERT INTO payco (
- payco_ccpay_id, payco_cohead_id, payco_amount, payco_curr_id
+ payco_ccpay_id, payco_cohead_id, payco_amount, payco_curr_id
) VALUES (
pCCpay, prefid, 0 - _c.ccpay_amount, _c.ccpay_curr_id
);
IF (_numfound <= 0) THEN
INSERT INTO ccbank (ccbank_ccard_type, ccbank_bankaccnt_id)
VALUES (pccardtype, pbankaccntid)
- RETURNING _ccbankid;
+ RETURNING ccbank_id INTO _ccbankid;
END IF;
RETURN _ccbankid;
BEGIN
IF ( ( SELECT (COUNT(*) > 0)
- FROM poitem
+ FROM poitem LEFT OUTER JOIN recv ON (recv_order_type='PO' AND
+ recv_orderitem_id=poitem_id)
WHERE ( (poitem_pohead_id=pPoheadid)
AND ( (poitem_status='C') OR
(poitem_qty_received > 0.0) OR
(poitem_qty_returned > 0.0) OR
- (poitem_qty_vouchered > 0.0) ) ) ) ) THEN
+ (poitem_qty_vouchered > 0.0) OR
+ (recv_id IS NOT NULL) ) ) ) ) THEN
RETURN -1;
END IF;
--- /dev/null
+-- Issue #23459 adds ccpay_card_type. Populate it from historical ccard relations.
+UPDATE ccpay SET ccpay_card_type = (SELECT ccard_type FROM ccard WHERE ccard_id = ccpay_ccard_id)
+WHERE ccpay_ccard_id IS NOT NULL;
--- /dev/null
+ALTER TABLE ccbank DROP CONSTRAINT IF EXISTS ccbank_ccbank_ccard_type_check;
+ALTER TABLE ccbank ADD CONSTRAINT ccbank_ccbank_ccard_type_check
+ CHECK (ccbank_ccard_type = ANY (ARRAY['A', 'D', 'M', 'P', 'V', 'O']));
--- /dev/null
+-- Add columns for data needed for external pre-auths that will have no ccpay_ccard_id.
+select xt.add_column('ccpay','ccpay_card_pan_trunc', 'text', null, 'public', 'External Pre-Auth truncated PAN. Last four digits of the card.');
+-- TODO: PayPal
+--select xt.add_column('ccpay','ccpay_card_type', 'text', null, 'public', 'External Pre-Auth card type: V=Visa, M=MasterCard, A=American Express, D=Discover, P=Paypal.');
+select xt.add_column('ccpay','ccpay_card_type', 'text', null, 'public', 'External Pre-Auth card type: V=Visa, M=MasterCard, A=American Express, D=Discover.');
--- /dev/null
+-- TODO: Add a precheck in the upgrade package.xml for this.
+select xt.add_constraint('payco','payco_unique_ccpay_id_cohead_id', 'unique(payco_ccpay_id, payco_cohead_id)', 'public');
+-- Add primary key.
+select xt.add_column('payco','payco_id', 'serial', 'primary key', 'public', 'payco table primary key.');
--- /dev/null
+CREATE OR REPLACE FUNCTION _ccpayBeforeTrigger () 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
+ _cardType TEXT;
+
+BEGIN
+ IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN
+ -- If ccpay_ccard_id is set, we don't care if ccpay_card_type is set,
+ -- we want to get the Card Type from ccard.
+ IF (NEW.ccpay_ccard_id IS NOT NULL) THEN
+ SELECT ccard_type INTO _cardType
+ FROM ccard
+ WHERE ccard_id = NEW.ccpay_ccard_id;
+
+ IF (_cardType IS NOT NULL) THEN
+ NEW.ccpay_card_type = _cardType;
+ END IF;
+ END IF;
+ END IF;
+
+ RETURN NEW;
+END;
+$$ LANGUAGE 'plpgsql';
+
+SELECT dropIfExists('TRIGGER', 'ccpayBeforeTrigger');
+CREATE TRIGGER ccpayBeforeTrigger BEFORE INSERT OR UPDATE ON ccpay FOR EACH ROW EXECUTE PROCEDURE _ccpayBeforeTrigger();
QUESTION: 3,
/**
- Constant for `notify` message type question.
+ Constant for `notify` message type question with cancel option.
@static
@constant
*/
YES_NO_CANCEL: 4,
+ /**
+ Constant for `notify` message type ok/cancel.
+
+ @static
+ @constant
+ @type Number
+ @default 5
+ */
+ OK_CANCEL: 5,
+
_status: {
CLEAN: 0x0001, // 1
DIRTY: 0x0002, // 2
Variables for widths/colors
*/
@tile-width: 500px;
-@tile-height: 230px;
+@tile-height: 250px;
@picker-label: 100px;
@bottom-border: #444;
@icon-height: 32px;
}
.dashboard .selectable-chart {
width: 500px;
- height: 230px;
+ height: 250px;
}
.dashboard .selectable-chart .chart-title-bar {
width: 500px;
}
});
+ enyo.kind({
+ name: "XV.DashboardLite",
+ kind: "XV.Dashboard",
+ collection: "XM.UserChartCollection",
+ // this tells the default query what extension to pull charts for
+ extension: "crm",
+ // title is what show in the "add chart" picker on the
+ // dashboard and the chart is the widget to be added
+ newActions: [] // to be added by extensions
+ });
}());
kind: "XV.Groupbox",
classes: "panel xv-grid-box",
events: {
- onChildWorkspace: ""
+ onChildWorkspace: "",
+ onExportAttr: ""
},
handlers: {
ontap: "buttonTapped",
]}
);
- // "New" button
components.push({
kind: "FittableColumns",
name: "navigationButtonPanel",
classes: "xv-buttons",
components: [
- {kind: "onyx.Button", name: "newButton", onclick: "newItem", classes: "icon-plus"}
+ {kind: "onyx.Button", name: "newButton", ontap: "newItem", classes: "icon-plus"},
+ {kind: "onyx.Button", name: "exportButton", ontap: "exportAttr",
+ icon: "share", content: "_export".loc(), classes: "icon-share"}
]
});
editor.render();
editor.setFirstFocus();
},
+ exportAttr: function (inSender, inEvent) {
+ var gridbox = this;
+ this.doExportAttr({ attr: gridbox.attr });
+ },
refreshLists: function () {
this.$.aboveGridList.refresh();
this.$.belowGridList.refresh();
typeToButtonMap[String(XM.Model.WARNING)] = ["notifyOk"];
typeToButtonMap[String(XM.Model.CRITICAL)] = ["notifyOk"];
typeToButtonMap[String(XM.Model.QUESTION)] = ["notifyYes", "notifyNo"];
+ typeToButtonMap[String(XM.Model.OK_CANCEL)] = ["notifyOk", "notifyCancel"];
typeToButtonMap[String(XM.Model.YES_NO_CANCEL)] = ["notifyYes", "notifyNo", "notifyCancel"];
this.$.notifyMessage.setContent(inEvent.message);
// delete out any previously added customComponents/customComponentControls
if (this.$.notifyPopup.$.customComponent) {
this.$.notifyPopup.removeComponent(this.$.notifyPopup.$.customComponent);
-
+
customComponentControls = _.filter(that.$.notifyPopup.controls, function (control) {
return control.name === "customComponent";
});
notifyTap: function (inSender, inEvent) {
var notifyParameter,
callbackObj = {},
+ that = this,
optionsObj = this._notifyOptions || {};
this._notifyDone = true;
notifyParameter = false;
break;
case 'notifyCancel':
- notifyParameter = undefined;
+ notifyParameter = null;
break;
}
// the callback might make its own popup, which we do not want to hide.
this.$.notifyPopup.hide();
callbackObj.answer = notifyParameter;
if (this.$.notifyPopup.$.customComponent) {
+ if (this.$.notifyPopup.$.customComponent.getValueAsync) {
+ this.$.notifyPopup.$.customComponent.getValueAsync(function (result) {
+ callbackObj.componentValue = result;
+ that._notifyCallback(callbackObj, optionsObj);
+ });
+ return;
+ }
callbackObj.componentValue = this.$.notifyPopup.$.customComponent.getValue();
}
this._notifyCallback(callbackObj, optionsObj);
@extends enyo.Panels
@extends XV.ListMenuManagerMixin
*/
- enyo.kind(/** @lends XV.WorkspaceContainer# */{
+ enyo.kind(/** @lends XV.WorkspaceContainer# */_.extend({
name: "XV.WorkspaceContainer",
kind: "XV.ContainerPanels",
classes: "xv-workspace-container",
onReport: "report",
onStatusChange: "statusChanged",
onTitleChange: "titleChanged",
- onSaveTextChange: "saveTextChanged"
+ onSaveTextChange: "saveTextChanged",
+ onExportAttr: "exportAttr"
},
components: [
{kind: "FittableRows", name: "navigationPanel", classes: "xv-menu-container", components: [
saveTextChanged: function (inSender, inEvent) {
this.$.saveButton.setContent(inEvent.content);
},
+
+ exportAttr: function (inSender, inEvent) {
+ this.openExportTab('export', inEvent.attr);
+ return true;
+ },
+
+ // export just one attribute of the model displayed by the workspace
+ openExportTab: function (routeName, attr) {
+ var recordType = this.$.workspace.value.recordType,
+ id = this.$.workspace.value.id,
+ idAttr = this.$.workspace.value.idAttribute,
+ query = { parameters: [{ attribute: idAttr, value: id }],
+ details: { attr: attr, id: id }
+ };
+ // sending the locale information back over the wire saves a call to the db
+ window.open(XT.getOrganizationPath() +
+ '/%@?details={"nameSpace":"%@","type":"%@","query":%@,"culture":%@,"print":%@}'
+ .f(routeName,
+ recordType.prefix(),
+ recordType.suffix(),
+ JSON.stringify(query),
+ JSON.stringify(XT.locale.culture),
+ "false"),
+ '_newtab');
+ },
/**
This is called for each row in the menu List.
The menu text is derived from the corresponding panel index.
menuChanged: function () {
this.$.menu.render();
}
- });
+ }, XV.ListMenuManagerMixin));
}());
model.save(null, options);
} else {
- // answer === undefined means that the user wants to cancel this action
+ // answer === null means that the user wants to cancel this action
// fetching is a good way to throw out the changes
model.fetch({success: function () {
// tell the view to re-render
var that = this;
if (!this.getValue() ||
- !this.getValue().length ||
!this.getFilterAttr() ||
this.getGroupByAttr() === undefined ||
this.getGroupByAttr() === null) {
dateField: ""
},
filterOptions: [
- { name: "thisWeek" },
- { name: "thisMonth" },
- { name: "thisYear" },
- { name: "twoYears" },
- { name: "fiveYears" }
+ { name: "all", parameters: [] }
],
/**
This looks really complicated! I'm just binning the
aggregateData: function (groupedData) {
var that = this,
now = new Date().getTime(),
- earliestDate = now, // won't be now for long
+ earliestDate = now, // might not be now for long
+ latestDate = now, // might not be now for long
dataPoints = _.reduce(groupedData, function (memo, group) {
_.each(group, function (item) {
var dateInt = item.get(that.getDateField()).getTime();
earliestDate = Math.min(earliestDate, dateInt);
+ latestDate = Math.max(latestDate, dateInt);
});
return memo + group.length;
}, 0),
binCount = Math.ceil(Math.sqrt(dataPoints)),
- binWidth = Math.ceil((now - earliestDate) / binCount),
+ binWidth = Math.ceil((latestDate - earliestDate) / binCount),
histoGroup = _.map(groupedData, function (group, groupKey) {
var binnedData, summedData, hole, findHole, foundData;
findHole = function (datum) {
return datum.x === String(hole);
};
- for (hole = earliestDate; hole <= now; hole += binWidth) {
+ for (hole = earliestDate; hole <= latestDate; hole += binWidth) {
foundData = _.find(summedData, findHole);
if (!foundData) {
summedData.push({x: String(hole), y: 0});
return histoGroup;
},
- filterData: function (data, callback) {
- var that = this;
-
- callback(_.filter(data, function (datum) {
- var shipDate = datum.get(that.getDateField()).getTime(),
- now = new Date().getTime(),
- timespan = 0,
- oneDay = 1000 * 60 * 60 * 24;
-
- // XXX use YTD etc.?
- switch (that.getFilterAttr()) {
- case "today":
- timespan = oneDay;
- break;
- case "thisWeek":
- timespan = 7 * oneDay;
- break;
- case "thisMonth":
- timespan = 30 * oneDay;
- break;
- case "thisYear":
- timespan = 365 * oneDay;
- break;
- case "twoYears":
- timespan = 2 * 365 * oneDay;
- break;
- case "fiveYears":
- timespan = 5 * 365 * oneDay;
- break;
- }
- return shipDate + timespan >= now;
- }));
- },
/**
Make the chart using v3 and nv.d3, working off our this.processedData.
*/
filename = inEvent.value,
reader;
+ if (!file) {
+ return;
+ }
+
if (filename.indexOf("C:\\fakepath\\") === 0) {
// some browsers obnoxiously give you a fake path, but the only thing
// we want is the filename really.
var nodemailer = require("nodemailer"),
smtpOptions = {
host: X.options.datasource.smtpHost,
- secureConnection: false,
+ secureConnection: X.options.datasource.smtpPort === 465,
port: X.options.datasource.smtpPort
};
} else {
var resultAsCsv,
filename = "export",
- type;
+ type,
+ number = requestDetails.query &&
+ requestDetails.query.details &&
+ requestDetails.query.details.id,
+ attr = requestDetails.query &&
+ requestDetails.query.details &&
+ requestDetails.query.details.attr
+ ;
try {
- // try to name the file after the record type
type = requestDetails.type;
- // suffix() would be better than substring() but doesn't exist here yet
- filename = type.replace("ListItem", "Export");
+ filename = type.replace("ListItem", "Export") +
+ (attr && number ? "-" + number : "") +
+ (attr ? "-" + attr : "")
+ ;
} catch (error) {
// "export" will have to do.
}
- resultAsCsv = jsonToCsv(result.data.data);
- res.attachment(filename + ".csv");
+ try {
+ /* export requests have 2 flavors: export a list of records (data.data)
+ or export a list of children of the current record ([0][attr]) */
+ if (attr) {
+ resultAsCsv = jsonToCsv(result.data.data[0][attr]);
+ } else {
+ resultAsCsv = jsonToCsv(result.data.data);
+ }
+ res.attachment(filename + ".csv");
+ } catch (error) {
+ resultAsCsv = jsonToCsv(error);
+ }
res.send(resultAsCsv);
}
});
// register extension and dependencies
extensionSql = 'do $$ plv8.elog(NOTICE, "About to register extension ' +
extensionName + '"); $$ language plv8;\n' + extensionSql;
+
registerSql = "select xt.register_extension('%@', '%@', '%@', '', %@);\n"
.f(extensionName, extensionComment, options.extensionLocation, loadOrder);
+ var grantExtToAdmin = "select xt.grant_role_ext('ADMIN', '%@');\n"
+ .f(extensionName);
+
+ extensionSql = grantExtToAdmin + extensionSql;
+
dependencies = manifest.dependencies || [];
_.each(dependencies, function (dependency) {
var dependencySql = "select xt.register_extension_dependency('%@', '%@');\n"
- .f(extensionName, dependency);
- extensionSql = dependencySql + extensionSql;
+ .f(extensionName, dependency),
+ grantDependToAdmin = "select xt.grant_role_ext('ADMIN', '%@');\n"
+ .f(dependency);
+
+ extensionSql = dependencySql + grantDependToAdmin + extensionSql;
});
extensionSql = registerSql + extensionSql;
}
<prerequisite type = "query"
name = "Checking xTuple Edition" >
<query>SELECT fetchMetricText('Application') = 'PostBooks';</query>
- <message>This package must be applied to a Distribution database.</message>
+ <message>This package must be applied to a PostBooks database.</message>
</prerequisite>
<prerequisite type = "query"
</message>
</prerequisite>
- <prerequisite type = "query"
- name = "Checking for bad xTuple ERP database version" >
-<query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
+ <prerequisite type = "query"
+ name = "Checking for bad xTuple ERP database version" >
+ <query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
<message>This package may not be applied to a 4.5+ PostBooks database.
</message>
</prerequisite>
- <prerequisite type = "query"
+ <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>
+ <prerequisite type = "query"
+ name = "Checking for duplicate Credit Card payments on Sales Orders" >
+ <query>
+ WITH counter AS (SELECT COUNT(*) AS freq
+ FROM payco
+ GROUP BY payco_ccpay_id, payco_cohead_id
+ ORDER BY 1)
+ SELECT (COALESCE(MAX(freq), 1) = 0 OR COALESCE(MAX(freq), 1) = 1)
+ FROM counter;
+ </query>
+ <message>There are duplicate payco_ccpay_id and payco_cohead_id on the payco table. 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" />
</message>
</prerequisite>
+ <prerequisite type = "query"
+ name = "Checking for xwd schema" >
+ <query>SELECT NOT EXISTS(SELECT 1 FROM pg_namespace WHERE nspname = 'xwd');</query>
+ <message>This package requires that XWD 240 package to be installed before continuing.</message>
+ </prerequisite>
+
<script file="postbooks_upgrade.sql" />
<script file="inventory_upgrade.sql" />
<script file="distribution_upgrade.sql" />
</message>
</prerequisite>
- <prerequisite type = "query"
- name = "Checking for bad xTuple ERP database version" >
-<query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
+ <prerequisite type = "query"
+ name = "Checking for bad xTuple ERP database version" >
+ <query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
<message>This package may not be applied to a 4.5+ Postbooks database.
</message>
</prerequisite>
- <prerequisite type = "query"
+ <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>
+ <prerequisite type = "query"
+ name = "Checking for duplicate Credit Card payments on Sales Orders" >
+ <query>
+ WITH counter AS (SELECT COUNT(*) AS freq
+ FROM payco
+ GROUP BY payco_ccpay_id, payco_cohead_id
+ ORDER BY 1)
+ SELECT COALESCE(MAX(freq), 1) <= 1
+ FROM counter;
+ </query>
+ <message>There are duplicate payco_ccpay_id and payco_cohead_id on the payco table. Please see your system administrator or contact xTuple.
+ </message>
+ </prerequisite>
+
<script file="postbooks_upgrade.sql" />
</package>
<prerequisite type = "query"
name = "Checking xTuple Edition" >
<query>SELECT fetchMetricText('Application') = 'PostBooks';</query>
- <message>This package must be applied to a Distribution Edition database.</message>
+ <message>This package must be applied to a PostBooks Edition database.</message>
</prerequisite>
<prerequisite type = "query"
</message>
</prerequisite>
- <prerequisite type = "query"
- name = "Checking for bad xTuple ERP database version" >
-<query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
+ <prerequisite type = "query"
+ name = "Checking for bad xTuple ERP database version" >
+ <query>SELECT NOT fetchMetricText('ServerVersion') > '4.5.0' AND fetchMetricText('ServerVersion')!='4.5.0Beta' AND fetchMetricText('ServerVersion')!='4.5.0RC';</query>
<message>This package may not be applied to a 4.5.0+ PostBooks database.
</message>
</prerequisite>
- <prerequisite type = "query"
+ <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>
+ <prerequisite type = "query"
+ name = "Checking for duplicate Credit Card payments on Sales Orders" >
+ <query>
+ WITH counter AS (SELECT COUNT(*) AS freq
+ FROM payco
+ GROUP BY payco_ccpay_id, payco_cohead_id
+ ORDER BY 1)
+ SELECT (COALESCE(MAX(freq), 1) = 0 OR COALESCE(MAX(freq), 1) = 1)
+ FROM counter;
+ </query>
+ <message>There are duplicate payco_ccpay_id and payco_cohead_id on the payco table. 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" />
});
});
- it('should grant all privileges to the user', function (done) {
- var sql = "insert into usrpriv (usrpriv_username, usrpriv_priv_id) " +
- "select $1, priv_id " +
- "from priv " +
- "left join usrpriv on priv_id = usrpriv_priv_id and usrpriv_username = $1 " +
- "where usrpriv_id is null";
-
- creds.database = databaseName;
- creds.parameters = [loginData.username];
- datasource.query(sql, creds, function (err, res) {
- assert.isNull(err);
- done();
- });
- });
-
- it('should grant all extensions to the user', function (done) {
- var sql = "insert into xt.usrext (usrext_usr_username, usrext_ext_id) " +
- "select $1, ext_id " +
- "from xt.ext " +
- "left join xt.usrext on ext_id = usrext_ext_id and usrext_usr_username = $1 " +
- "where usrext_id is null";
-
- creds.database = databaseName;
- creds.parameters = [loginData.username];
- datasource.query(sql, creds, function (err, res) {
- assert.isNull(err);
- done();
- });
- });
});
}());
_.each(XV, function (value, key) {
var list,
kinds = ['SalesOrderList', 'QuoteList', 'InvoiceList', 'ReturnList', 'ProjectList'];
- // loop through lists with grid boxes
- if (XV.inheritsFrom(value.prototype, "XV.List") && _.contains(kinds, key)) {
+ // lists with grid boxes; TODO: find candidates automatically
+ if (_.contains(kinds, key)) {
describe('Create Workspace for XV.' + key, function () {
it('Create a Workspace', function () {
smoke.navigateToNewWorkspace(XT.app, list, function (workspaceContainer) {
var workspace = workspaceContainer.$.workspace;
_.each(workspace.$, function (component) {
- if (XV.inheritsFrom(component, 'XV.GridBox') && XV.inheritsFrom(component, 'XV.WorkflowGridBox')) {
+ if (XV.inheritsFrom(component, 'XV.GridBox')) {
describe('Test creating line items for ' + component, function () {
it('Create line items', function () {
// verify again that a row has been added
assert.equal(gridBox.liveModels().length, startingRows += 1);
});
+
+ it('Check export', function () {
+ var getExportButton = function (obj) {
+ var result = null;
+ if (_.isObject(obj.$)) {
+ result = obj.$.exportButton ||
+ _.find(obj.$, getExportButton);
+ }
+ return result;
+ };
+
+ var gridBox = component,
+ exportButton = getExportButton(gridBox);
+ assert.ok(exportButton);
+ // TODO: need to populate before we can export
+ // assert.doesNotThrow(exportButton.doTap());
+ // TODO: find the generated file & check contents
+ });
});
}
});
assert.equal(gridBox.liveModels().length, 1);
});
});
+ it('Supply list should have action to open Item Workbench', function (done) {
+ if (!XT.extensions.inventory) {
+ done();
+ return;
+ }
+ var verify,
+ action = _.find(gridBox.$.supplyList.actions, function (action) {
+ return action.name === "openItemWorkbench";
+ }),
+ prereq = action.prerequisite;
+ gridBox.$.supplyButton.bubble("ontap");
+ gridBox.$.supplyList.select(0);
+
+ gridBox.$.supplyList.value.models[0][prereq](function (hasPriv) {
+ assert.isTrue(hasPriv);
+ if (hasPriv) {
+ gridBox.$.supplyList.actionSelected(null, {action: {method: "openItemWorkbench"}, index: 0});
+
+ setTimeout(function () {
+ assert.equal(XT.app.$.postbooks.getActive().$.workspace.kind, "XV.ItemWorkbenchWorkspace");
+ XT.app.$.postbooks.getActive().doPrevious();
+ assert.equal(XT.app.$.postbooks.getActive().$.workspace.kind, "XV.SalesOrderWorkspace");
+ done();
+ }, 3000);
+ } else {done(); }
+ });
+ });
it('adding a second line item should not copy the item', function (done) {
workspace.value.once("change:total", done());