1 create or replace function xt.sordtype_did_change() returns trigger as $$
2 /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 See www.xm.ple.com/CPAL for the full text of the software license. */
11 rows = plv8.execute("select * from xt.sordtype");
15 rows.forEach(function (row) {
17 row.sordtype_col_sochild_id + " as sochild_id, " +
18 "''" + row.sordtype_code + "''::text" + " as sochild_type, " +
19 row.sordtype_col_sochild_uuid + " as sochild_uuid, " +
20 row.sordtype_col_sochild_key + " as sochild_key, " +
21 row.sordtype_col_sochild_number + " as sochild_number, " +
22 row.sordtype_col_sochild_status + " as sochild_status, " +
23 row.sordtype_col_sochild_duedate + " as sochild_duedate, " +
24 row.sordtype_col_sochild_qty + " as sochild_qty " +
25 "from " + row.sordtype_nsname + "." + row.sordtype_tblname + " ";
27 if (row.sordtype_joins) {
28 sql = sql + row.sordtype_joins;
31 plv8.elog(WARNING, "sql: ", sql);
35 sql = "select xt.create_view('xt.sochild','" + ary.join(" union all ") + "', true)";
36 plv8.elog(WARNING, "sql2: ", sql);