├── lib
├── tools
│ ├── .gitmodules
│ ├── source
│ │ ├── .gitignore
│ │ ├── ext
│ │ │ ├── proto
│ │ │ │ └── package.js
│ │ │ └── package.js
│ │ ├── log.js
│ │ └── package.js
│ ├── README.md
│ ├── .gitignore
│ ├── package.js
│ ├── lib
│ │ └── package.js
│ ├── .gitignore.orig
│ └── package.json
├── backbone-x
│ ├── .gitmodules
│ ├── package.json
│ ├── package.js
│ ├── source
│ │ ├── ext
│ │ │ └── package.js
│ │ ├── package.js
│ │ └── core.js
│ ├── README.md
│ ├── .gitignore
│ └── lib
│ │ └── package.js
├── enyo-x
│ ├── .gitmodules
│ ├── source
│ │ ├── .gitignore
│ │ ├── less
│ │ │ ├── .gitignore
│ │ │ ├── print.less
│ │ │ └── search.less
│ │ ├── layout
│ │ │ └── package.js
│ │ ├── package.js
│ │ ├── stylesheets
│ │ │ ├── print.css
│ │ │ └── ie.css
│ │ └── views
│ │ │ └── listboard.js
│ ├── .gitignore
│ ├── package.js
│ ├── lib
│ │ ├── font-awesome
│ │ │ └── font
│ │ │ │ ├── FontAwesome.otf
│ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ └── fontawesome-webfont.woff
│ │ └── package.js
│ └── .gitignore.orig
├── module
└── orm
│ ├── source
│ ├── create_plv8.sql
│ ├── create_sys_schema.sql
│ ├── create_xm_schema.sql
│ └── xt
│ │ ├── functions
│ │ ├── retrieve_record.sql
│ │ ├── fetch.sql
│ │ ├── dispatch.sql
│ │ ├── commit_record.sql
│ │ ├── decamelize.sql
│ │ ├── any_text.sql
│ │ ├── any_uuid.sql
│ │ ├── begins_with.sql
│ │ ├── ends_with.sql
│ │ ├── any_numeric.sql
│ │ ├── not_any_text.sql
│ │ ├── not_any_numeric.sql
│ │ ├── raise_exception.sql
│ │ ├── text_gt_date.sql
│ │ ├── text_lt_date.sql
│ │ ├── execute_query.sql
│ │ ├── is_date.sql
│ │ ├── install_orm.sql
│ │ ├── schema.sql
│ │ ├── generate_uuid.sql
│ │ ├── show_search_path.sql
│ │ └── uuid_generate_v4.sql
│ │ ├── tables
│ │ ├── obj.sql
│ │ ├── wftype.sql
│ │ ├── extdep.sql
│ │ ├── usrext.sql
│ │ ├── grpext.sql
│ │ └── ext.sql
│ │ └── operators
│ │ ├── any_text.sql
│ │ ├── any_uuid.sql
│ │ ├── ends_with.sql
│ │ ├── begins_with.sql
│ │ ├── not_any_text.sql
│ │ ├── text_gt_date.sql
│ │ ├── text_lt_date.sql
│ │ ├── any_numeric.sql
│ │ └── not_any_numeric.sql
│ └── README.md
├── node-datasource
├── .gitmodules
├── xt
│ ├── readme.md
│ ├── version.txt
│ ├── package.json
│ ├── .gitignore
│ ├── database
│ │ └── package.json
│ └── foundation
│ │ └── package.json
├── fonts
│ └── f39.ttf
├── views
│ ├── account.ejs
│ ├── assets
│ │ ├── logo.png
│ │ ├── checkbox.png
│ │ ├── favicon.ico
│ │ ├── oauth-2-sm.png
│ │ └── you-shall-not-pass.png
│ └── layout.ejs
├── .gitignore
├── oauth2
│ └── db
│ │ └── index.js
├── scripts
│ └── node.conf
├── lib
│ └── query
│ │ └── npm-shrinkwrap.json
└── routes
│ └── vcfExport.js
├── enyo-client
├── extensions
│ ├── index.html
│ ├── .gitmodules
│ ├── source
│ │ ├── billing
│ │ │ ├── client
│ │ │ │ ├── en
│ │ │ │ │ └── package.js
│ │ │ │ ├── less
│ │ │ │ │ ├── package.js
│ │ │ │ │ └── cash_receipt.less
│ │ │ │ ├── widgets
│ │ │ │ │ ├── package.js
│ │ │ │ │ └── relation.js
│ │ │ │ ├── package.js
│ │ │ │ ├── models
│ │ │ │ │ ├── package.js
│ │ │ │ │ └── startup.js
│ │ │ │ ├── views
│ │ │ │ │ ├── package.js
│ │ │ │ │ └── receivable.js
│ │ │ │ └── core.js
│ │ │ └── database
│ │ │ │ └── source
│ │ │ │ └── xt
│ │ │ │ ├── functions
│ │ │ │ ├── ar_balance.sql
│ │ │ │ └── ar_tax_total.sql
│ │ │ │ ├── tables
│ │ │ │ └── sharetype.sql
│ │ │ │ └── views
│ │ │ │ └── cashrcpt.sql
│ │ ├── oauth2
│ │ │ ├── client
│ │ │ │ ├── widgets
│ │ │ │ │ └── package.js
│ │ │ │ ├── models
│ │ │ │ │ └── package.js
│ │ │ │ ├── views
│ │ │ │ │ └── package.js
│ │ │ │ ├── package.js
│ │ │ │ └── core.js
│ │ │ └── database
│ │ │ │ └── source
│ │ │ │ ├── priv.sql
│ │ │ │ └── manifest.js
│ │ ├── crm
│ │ │ ├── client
│ │ │ │ ├── widgets
│ │ │ │ │ └── package.js
│ │ │ │ ├── package.js
│ │ │ │ ├── views
│ │ │ │ │ └── package.js
│ │ │ │ ├── models
│ │ │ │ │ └── package.js
│ │ │ │ └── core.js
│ │ │ └── database
│ │ │ │ └── source
│ │ │ │ └── manifest.js
│ │ ├── sales
│ │ │ ├── client
│ │ │ │ ├── widgets
│ │ │ │ │ └── package.js
│ │ │ │ ├── package.js
│ │ │ │ ├── views
│ │ │ │ │ └── package.js
│ │ │ │ ├── models
│ │ │ │ │ └── package.js
│ │ │ │ └── core.js
│ │ │ └── database
│ │ │ │ └── source
│ │ │ │ └── manifest.js
│ │ ├── project
│ │ │ ├── client
│ │ │ │ ├── package.js
│ │ │ │ ├── models
│ │ │ │ │ └── package.js
│ │ │ │ ├── widgets
│ │ │ │ │ └── package.js
│ │ │ │ ├── views
│ │ │ │ │ ├── package.js
│ │ │ │ │ └── documents_box.js
│ │ │ │ └── core.js
│ │ │ └── database
│ │ │ │ └── source
│ │ │ │ ├── xt
│ │ │ │ ├── tables
│ │ │ │ │ ├── wftype.sql
│ │ │ │ │ ├── prjtypeext.sql
│ │ │ │ │ └── prjwf.sql
│ │ │ │ └── functions
│ │ │ │ │ ├── prj_balance_exp.sql
│ │ │ │ │ ├── prj_balance_hrs.sql
│ │ │ │ │ ├── prj_actual_exp.sql
│ │ │ │ │ ├── prj_budget_exp.sql
│ │ │ │ │ ├── prj_actual_hrs.sql
│ │ │ │ │ └── prj_budget_hrs.sql
│ │ │ │ └── public
│ │ │ │ └── tables
│ │ │ │ ├── emp.sql
│ │ │ │ └── empgrp.sql
│ │ └── purchasing
│ │ │ ├── client
│ │ │ ├── package.js
│ │ │ ├── widgets
│ │ │ │ └── package.js
│ │ │ ├── views
│ │ │ │ └── package.js
│ │ │ ├── models
│ │ │ │ └── package.js
│ │ │ └── core.js
│ │ │ └── database
│ │ │ └── source
│ │ │ └── xt
│ │ │ ├── tables
│ │ │ ├── wftype.sql
│ │ │ ├── poheadext.sql
│ │ │ └── powf.sql
│ │ │ ├── views
│ │ │ └── itemsrcmfg.sql
│ │ │ ├── functions
│ │ │ ├── po_line_extended_price.sql
│ │ │ ├── po_total.sql
│ │ │ ├── po_freight_subtotal.sql
│ │ │ ├── po_subtotal.sql
│ │ │ ├── po_line_tax.sql
│ │ │ ├── po_schedule_date.sql
│ │ │ └── po_tax_total.sql
│ │ │ └── trigger_functions
│ │ │ └── itemsrc_did_change.sql
│ ├── .gitignore
│ ├── README.md
│ └── tools
│ │ ├── deploy.bat
│ │ └── deploy.sh
├── application
│ ├── lib
│ ├── .gitmodules
│ ├── icon.png
│ ├── api
│ │ ├── icon.png
│ │ └── assets
│ │ │ ├── busy.gif
│ │ │ ├── favicon.ico
│ │ │ ├── search-input-search.png
│ │ │ └── manifest.json
│ ├── source
│ │ ├── ext
│ │ │ └── package.js
│ │ ├── package.js
│ │ ├── widgets
│ │ │ └── package.js
│ │ ├── views
│ │ │ └── package.js
│ │ └── models
│ │ │ └── remit_to.js
│ ├── tools
│ │ ├── package.js
│ │ ├── minify.bat
│ │ └── minify.sh
│ ├── .gitignore
│ └── .gitignore.orig
└── database
│ ├── .gitmodules
│ ├── source
│ ├── xt
│ │ ├── functions
│ │ │ ├── co_line_profit.sql
│ │ │ ├── average_cost.sql
│ │ │ ├── quote_line_profit.sql
│ │ │ ├── co_margin.sql
│ │ │ ├── quote_margin.sql
│ │ │ ├── co_total.sql
│ │ │ ├── quote_schedule_date.sql
│ │ │ ├── quote_total.sql
│ │ │ ├── invc_total.sql
│ │ │ ├── cm_line_tax_total.sql
│ │ │ ├── co_subtotal.sql
│ │ │ ├── quote_subtotal.sql
│ │ │ ├── co_line_extended_price.sql
│ │ │ ├── quote_line_extended_price.sql
│ │ │ ├── cm_total.sql
│ │ │ ├── invc_line_extended_price.sql
│ │ │ ├── co_line_customer_discount.sql
│ │ │ ├── quote_line_customer_discount.sql
│ │ │ ├── co_line_ship_balance.sql
│ │ │ ├── quote_line_list_price.sql
│ │ │ ├── quote_line_list_price_discount.sql
│ │ │ ├── co_line_base_price.sql
│ │ │ ├── co_line_list_price_discount.sql
│ │ │ ├── quote_line_base_price.sql
│ │ │ ├── cm_subtotal.sql
│ │ │ ├── trylock.sql
│ │ │ ├── co_line_list_price.sql
│ │ │ ├── co_total_cost.sql
│ │ │ ├── invc_subtotal.sql
│ │ │ ├── quote_total_cost.sql
│ │ │ ├── co_schedule_date.sql
│ │ │ ├── cm_tax_total.sql
│ │ │ ├── co_line_at_shipping.sql
│ │ │ ├── invc_tax_total.sql
│ │ │ ├── co_freight_weight.sql
│ │ │ ├── quote_freight_weight.sql
│ │ │ ├── co_line_margin.sql
│ │ │ ├── quote_line_margin.sql
│ │ │ ├── co_allocated_credit.sql
│ │ │ ├── invc_allocated_credit.sql
│ │ │ ├── cntctrestore.sql
│ │ │ ├── co_line_tax.sql
│ │ │ ├── change_password.sql
│ │ │ ├── quote_line_tax.sql
│ │ │ ├── cntctmerge.sql
│ │ │ ├── mergecrmaccts.sql
│ │ │ └── undomerge.sql
│ │ ├── views
│ │ │ ├── iteminfo.sql
│ │ │ ├── cohistinfo.sql
│ │ │ ├── invcitemtaxinfo.sql
│ │ │ ├── remittoinfo.sql
│ │ │ ├── cntctinfo.sql
│ │ │ └── opheadinfo.sql
│ │ ├── javascript
│ │ │ └── init.sql
│ │ └── tables
│ │ │ ├── rptdef.sql
│ │ │ ├── saletypeext.sql
│ │ │ ├── userpref.sql
│ │ │ ├── sessionstore.sql
│ │ │ ├── custcustemlprofile.sql
│ │ │ ├── incdtcatemlprofile.sql
│ │ │ ├── localeext.sql
│ │ │ └── coheadwf.sql
│ ├── add_admin_role.sql
│ ├── update_version.sql
│ ├── grant_roles.sql
│ ├── public
│ │ └── tables
│ │ │ ├── priv.sql
│ │ │ ├── usrpriv
│ │ │ ├── grppriv.sql
│ │ │ ├── usrpriv.sql
│ │ │ ├── metric.sql
│ │ │ ├── crmacct.sql
│ │ │ ├── cmhead.sql
│ │ │ ├── cmitem.sql
│ │ │ ├── usrpref.sql
│ │ │ ├── cashrcpt.sql
│ │ │ ├── pr.sql
│ │ │ ├── wo.sql
│ │ │ ├── comment_trigger.sql
│ │ │ ├── addr.sql
│ │ │ ├── docass.sql
│ │ │ ├── pohead.sql
│ │ │ ├── poitem.sql
│ │ │ ├── womatl.sql
│ │ │ ├── aropen.sql
│ │ │ ├── cohist.sql
│ │ │ ├── arapply.sql
│ │ │ ├── invchead.sql
│ │ │ ├── invcitem.sql
│ │ │ ├── shiphead.sql
│ │ │ ├── cmheadtax.sql
│ │ │ ├── cmitemtax.sql
│ │ │ ├── itemsite.sql
│ │ │ ├── vendinfo.sql
│ │ │ ├── invcitemtax.sql
│ │ │ ├── shiptoinfo.sql
│ │ │ ├── vendaddrinfo.sql
│ │ │ ├── schemaord.sql
│ │ │ ├── cntct.sql
│ │ │ ├── coitem.sql
│ │ │ ├── ophead.sql
│ │ │ ├── quitem.sql
│ │ │ ├── todoitem.sql
│ │ │ └── prjtask.sql
│ ├── xm
│ │ └── javascript
│ │ │ └── user_preference.sql
│ ├── version_check.sql
│ ├── populate_data.js
│ └── delete_system_orms.sql
│ └── .gitignore
├── scripts
└── .gitignore
├── test
├── .gitignore
└── lib
│ └── sample_login_data.js
├── docs
└── images
│ ├── xbo.png
│ └── js_arch.png
├── foundation-database
└── public
│ ├── patches
│ ├── fixacl.sql
│ └── populate_ccpay_card_type.sql
│ ├── tables
│ ├── setVersion.sql
│ ├── tax.sql
│ ├── bankrecitem.sql
│ ├── cashrcpt.sql
│ ├── checkhead.sql
│ ├── bankaccnt.sql
│ ├── metric.sql
│ ├── ccbank.sql
│ ├── metasql
│ │ ├── updatePrices-dropselsched.mql
│ │ ├── glseries-postjournal.mql
│ │ ├── contactmerge-delete.mql
│ │ ├── contactmerge-contactused.mql
│ │ ├── contactmerge-deselect.mql
│ │ ├── contactmerge-selectcol.mql
│ │ ├── updatePrices-createselsched.mql
│ │ ├── contactmerge-select.mql
│ │ ├── updatePrices-remove.mql
│ │ ├── updatePrices-selsched.mql
│ │ ├── contactmerge-restore.mql
│ │ ├── contactmerge-merge.mql
│ │ └── summarizedBankrecHistory-detail.mql
│ ├── priv.sql
│ ├── payco.sql
│ ├── itemsite.sql
│ └── taxpay.sql
│ ├── indexes
│ ├── evntlog.sql
│ ├── invchead.sql
│ └── shipitem.sql
│ ├── views
│ ├── apmemo.sql
│ ├── armemo.sql
│ ├── sopack.sql
│ └── budget.sql
│ ├── functions
│ ├── fetchcmnumber.sql
│ ├── fetchponumber.sql
│ ├── fetchqunumber.sql
│ ├── fetchsonumber.sql
│ ├── fetchtonumber.sql
│ ├── endoftime.sql
│ ├── fetchprnumber.sql
│ ├── fetchvonumber.sql
│ ├── fetchwonumber.sql
│ ├── startoftime.sql
│ ├── fetcharmemonumber.sql
│ ├── fetchinvcnumber.sql
│ ├── formatratio.sql
│ ├── formatweight.sql
│ ├── isdba.sql
│ ├── releaseprnumber.sql
│ ├── releasevonumber.sql
│ ├── releasewonumber.sql
│ ├── fetchapmemonumber.sql
│ ├── fetchcashrcptnumber.sql
│ ├── formatprice.sql
│ ├── formatqty.sql
│ ├── formatcost.sql
│ ├── formatmoney.sql
│ ├── formatscrap.sql
│ ├── postporeceipt.sql
│ ├── formatprcnt.sql
│ ├── formatqtyper.sql
│ ├── postporeceipts.sql
│ ├── fetchcrmaccountnumber.sql
│ ├── fetchincidentnumber.sql
│ ├── formatuomratio.sql
│ ├── releaseapmemonumber.sql
│ ├── releaseincidentnumber.sql
│ ├── formatextprice.sql
│ ├── formatpurchprice.sql
│ ├── formatsalesprice.sql
│ ├── releasearmemonumber.sql
│ ├── releasecashrcptnumber.sql
│ ├── fetchdefaultfob.sql
│ ├── releasecrmaccountnumber.sql
│ ├── usercancreateusers.sql
│ ├── nextwosubnumber.sql
│ ├── ismulticurr.sql
│ ├── postbankreconciliation.sql
│ ├── reopenbankreconciliation.sql
│ ├── createurl.sql
│ ├── voidapcheck.sql
│ ├── itemcapuom.sql
│ ├── itemsellinguom.sql
│ ├── deleteapcheck.sql
│ ├── rollupactualcost.sql
│ ├── deletemetasql.sql
│ ├── itemaltcapuom.sql
│ ├── rollupstandardcost.sql
│ ├── itemcapinvrat.sql
│ ├── createapchecks.sql
│ ├── itemaltcapinvrat.sql
│ ├── postapchecks.sql
│ ├── postapopenitems.sql
│ ├── postaropenitems.sql
│ ├── deleteipsitem.sql
│ ├── deleteitemuom.sql
│ ├── deleteuomconv.sql
│ ├── deleteipsprodcat.sql
│ ├── markapcheckasprinted.sql
│ ├── replacevoidedapcheck.sql
│ ├── todoitemmoveup.sql
│ ├── todoitemmovedown.sql
│ ├── formatboolyn.sql
│ ├── markapcheckasposted.sql
│ ├── deleteunusedclasscodes.sql
│ ├── fetchglsequence.sql
│ ├── formatbytea.sql
│ ├── replaceallvoidedapchecks.sql
│ ├── clearpayment.sql
│ ├── noneg.sql
│ ├── nopos.sql
│ ├── adjustments.sql
│ ├── issues.sql
│ ├── scraps.sql
│ ├── createfile.sql
│ ├── deletebudgetitems.sql
│ ├── detag.sql
│ ├── changeprqty.sql
│ ├── createrecurringinvoices.sql
│ ├── deleteunusedfreightclasses.sql
│ ├── explodewoeffective.sql
│ ├── hasevents.sql
│ ├── markcheckasposted.sql
│ ├── markcheckasprinted.sql
│ ├── shipments.sql
│ ├── receipts.sql
│ ├── woeffectivedate.sql
│ ├── firstline.sql
│ ├── getfreighttaxtypeid.sql
│ ├── formatsonumber.sql
│ ├── getprjaccntid.sql
│ ├── attachcontact.sql
│ ├── calcpurchaseorderduedate.sql
│ ├── fetchmetrictext.sql
│ ├── formatwonumber.sql
│ ├── getsostatus.sql
│ ├── intervaltominutes.sql
│ ├── deletefile.sql
│ ├── deleteqryhead.sql
│ ├── deleteurl.sql
│ ├── formatcreditmemonumber.sql
│ ├── formatinvcnumber.sql
│ ├── last_agg.sql
│ ├── postpogltransactions.sql
│ ├── deletebudget.sql
│ ├── formatshipmentnumber.sql
│ ├── getadjustmenttaxtypeid.sql
│ ├── deletecreditmemo.sql
│ ├── numofserverusers.sql
│ ├── postsogltransactions.sql
│ ├── qtyreserved.sql
│ ├── revokegroup.sql
│ ├── wostarted.sql
│ ├── calctotalslipqty.sql
│ ├── deletetodoitem.sql
│ ├── deleteuom.sql
│ ├── updatelistprice.sql
│ ├── snoozemessage.sql
│ ├── deletebomworkset.sql
│ ├── tonumeric.sql
│ ├── changeprdate.sql
│ ├── getquotescheddate.sql
│ ├── deletebankreconciliation.sql
│ ├── basecurrid.sql
│ ├── deletequoteitem.sql
│ ├── detachccpayfromso.sql
│ ├── userid.sql
│ ├── asofinvnn.sql
│ ├── asofinvqty.sql
│ └── currentapmemonumber.sql
│ ├── types
│ ├── flcoldata.sql
│ ├── subtax.sql
│ ├── seqiss.sql
│ └── taxassign.sql
│ └── trigger_functions
│ └── report.sql
├── REACT-README.md
├── bower.json
├── .gitattributes
├── .travis.yml
└── .gitignore
/lib/tools/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/backbone-x/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/enyo-x/.gitmodules:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/lib/module:
--------------------------------------------------------------------------------
1 | ../node_modules/
--------------------------------------------------------------------------------
/node-datasource/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/enyo-client/extensions/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/node-datasource/xt/readme.md:
--------------------------------------------------------------------------------
1 | #X
--------------------------------------------------------------------------------
/scripts/.gitignore:
--------------------------------------------------------------------------------
1 | *.deb
2 | 1
--------------------------------------------------------------------------------
/enyo-client/application/lib:
--------------------------------------------------------------------------------
1 | ../../lib
--------------------------------------------------------------------------------
/enyo-client/database/.gitmodules:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/enyo-client/extensions/.gitmodules:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/less/.gitignore:
--------------------------------------------------------------------------------
1 | *.css
--------------------------------------------------------------------------------
/enyo-client/application/.gitmodules:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/lib/tools/source/.gitignore:
--------------------------------------------------------------------------------
1 | /.sass-cache/
2 |
--------------------------------------------------------------------------------
/node-datasource/xt/version.txt:
--------------------------------------------------------------------------------
1 | 1.0.0-beta
2 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/layout/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "panels.js"
3 | );
--------------------------------------------------------------------------------
/lib/orm/source/create_plv8.sql:
--------------------------------------------------------------------------------
1 | CREATE EXTENSION IF NOT EXISTS plv8;
2 |
--------------------------------------------------------------------------------
/lib/orm/source/create_sys_schema.sql:
--------------------------------------------------------------------------------
1 | select xt.create_schema('sys');
2 |
--------------------------------------------------------------------------------
/lib/orm/source/create_xm_schema.sql:
--------------------------------------------------------------------------------
1 | select xt.create_schema('xm');
2 |
--------------------------------------------------------------------------------
/test/.gitignore:
--------------------------------------------------------------------------------
1 | lib/demo-test.backup
2 | mocha/lib/demo-test.backup
3 |
--------------------------------------------------------------------------------
/lib/tools/README.md:
--------------------------------------------------------------------------------
1 | tools
2 | =====
3 |
4 | Common JavaScript foundation tools
--------------------------------------------------------------------------------
/node-datasource/xt/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "xt",
3 | "main": "xt.js"
4 | }
--------------------------------------------------------------------------------
/node-datasource/xt/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | npm-debug.log
4 | *.swp
5 |
--------------------------------------------------------------------------------
/node-datasource/xt/database/package.json:
--------------------------------------------------------------------------------
1 | { "name": "database", "main": "database.js" }
--------------------------------------------------------------------------------
/docs/images/xbo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/docs/images/xbo.png
--------------------------------------------------------------------------------
/foundation-database/public/patches/fixacl.sql:
--------------------------------------------------------------------------------
1 | -- fixes issue #1476
2 | SELECT fixacl();
3 |
--------------------------------------------------------------------------------
/node-datasource/xt/foundation/package.json:
--------------------------------------------------------------------------------
1 | { "name": "foundation", "main": "foundation.js" }
--------------------------------------------------------------------------------
/docs/images/js_arch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/docs/images/js_arch.png
--------------------------------------------------------------------------------
/lib/backbone-x/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "backbone-x",
3 | "main": "source/package.js"
4 | }
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/en/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "strings.js"
3 | );
4 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/setVersion.sql:
--------------------------------------------------------------------------------
1 | SELECT setMetric('ServerVersion', '4.8.0Beta');
2 |
--------------------------------------------------------------------------------
/lib/enyo-x/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | build
3 | *.swp
4 | tmp
5 | npm-debug.log
6 | build
7 | deploy
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "picker.js"
3 | );
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/less/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | 'cash_receipt.less'
3 | );
4 |
--------------------------------------------------------------------------------
/node-datasource/fonts/f39.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/fonts/f39.ttf
--------------------------------------------------------------------------------
/node-datasource/views/account.ejs:
--------------------------------------------------------------------------------
1 |
Username: <%= user.username %>
2 | Name: <%= user.name %>
3 |
--------------------------------------------------------------------------------
/enyo-client/application/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/enyo-client/application/icon.png
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "chart.js",
3 | "parameter.js"
4 | );
--------------------------------------------------------------------------------
/foundation-database/public/tables/tax.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('tax','tax_dist_accnt_id', 'INTEGER', NULL, 'public');
--------------------------------------------------------------------------------
/lib/enyo-x/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "$lib/layout",
3 | "$lib/onyx",
4 | "lib",
5 | "source"
6 | );
7 |
--------------------------------------------------------------------------------
/enyo-client/application/api/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/enyo-client/application/api/icon.png
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_profit.sql:
--------------------------------------------------------------------------------
1 | drop function if exists xt.co_line_profit(coitem) cascade;
2 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "oauth2.js",
3 | "static.js"
4 | );
5 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/retrieve_record.sql:
--------------------------------------------------------------------------------
1 | /* replaced by get */
2 | drop function if exists xt.retrieve_record(text);
--------------------------------------------------------------------------------
/enyo-client/database/source/add_admin_role.sql:
--------------------------------------------------------------------------------
1 | -- Add 'ADMIN' Role.
2 | select xt.add_role('ADMIN', 'Administrators Role');
3 |
--------------------------------------------------------------------------------
/enyo-client/database/source/update_version.sql:
--------------------------------------------------------------------------------
1 | UPDATE pkghead SET pkghead_version = '4.8.0Beta' WHERE pkghead_name = 'xt';
2 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "parameter.js",
3 | "chart.js"
4 | );
5 |
--------------------------------------------------------------------------------
/node-datasource/views/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/views/assets/logo.png
--------------------------------------------------------------------------------
/enyo-client/database/source/grant_roles.sql:
--------------------------------------------------------------------------------
1 | -- Grant 'admin' user 'ADMIN' Role.
2 | select xt.grant_user_role('admin', 'ADMIN');
3 |
--------------------------------------------------------------------------------
/enyo-client/extensions/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /builds
3 | /deploy
4 | *.swp
5 | /*.DS_Store
6 | .DS_Store
7 | debug.js
8 | enyo
9 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/bankrecitem.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('bankrecitem','bankrecitem_effdate', 'DATE', NULL, 'public');
--------------------------------------------------------------------------------
/foundation-database/public/tables/cashrcpt.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('cashrcpt','cashrcpt_alt_curr_rate', 'NUMERIC', NULL, 'public');
--------------------------------------------------------------------------------
/node-datasource/views/assets/checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/views/assets/checkbox.png
--------------------------------------------------------------------------------
/node-datasource/views/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/views/assets/favicon.ico
--------------------------------------------------------------------------------
/enyo-client/application/api/assets/busy.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/enyo-client/application/api/assets/busy.gif
--------------------------------------------------------------------------------
/foundation-database/public/tables/checkhead.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('checkhead','checkhead_alt_curr_rate', 'NUMERIC', NULL, 'public');
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/fetch.sql:
--------------------------------------------------------------------------------
1 | /* This function has been superceded by xt.get */
2 | drop function if exists xt.fetch(text);
3 |
--------------------------------------------------------------------------------
/node-datasource/views/assets/oauth-2-sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/views/assets/oauth-2-sm.png
--------------------------------------------------------------------------------
/enyo-client/application/api/assets/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/enyo-client/application/api/assets/favicon.ico
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/dispatch.sql:
--------------------------------------------------------------------------------
1 | /* This function has been replaced by xt.post */
2 | drop function if exists xt.dispatch(text);
3 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/average_cost.sql:
--------------------------------------------------------------------------------
1 | -- deprecated... for now
2 | drop function if exists xt.average_cost(integer) cascade;
3 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_profit.sql:
--------------------------------------------------------------------------------
1 | -- deprecated
2 | drop function if exists xt.quote_line_profit(quitem) cascade;
3 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/iteminfo.sql:
--------------------------------------------------------------------------------
1 | -- Deprecated. Using derived fields on orm now
2 | drop view if exists xt.iteminfo cascade;
3 |
--------------------------------------------------------------------------------
/lib/enyo-x/lib/font-awesome/font/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/lib/enyo-x/lib/font-awesome/font/FontAwesome.otf
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/commit_record.sql:
--------------------------------------------------------------------------------
1 | /* Replaced by xt.post, xt.patch and xt.delete */
2 | drop function if exists xt.commit_record(text);
--------------------------------------------------------------------------------
/lib/tools/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | build
3 | *.swp
4 | tmp
5 | npm-debug.log
6 | \.sass-cache
7 | build
8 | deploy
9 | /.sass-cache/
10 |
--------------------------------------------------------------------------------
/lib/tools/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "lib",
4 | "source"
5 | );
6 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/priv.sql:
--------------------------------------------------------------------------------
1 | select xt.add_priv('InstallExtension', 'Can Install Extensions', 'command_center', 'CommandCenter');
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/usrpriv:
--------------------------------------------------------------------------------
1 | -- Remove dead rows
2 | delete from usrpriv where usrpriv_priv_id not in (select priv_id from priv);
--------------------------------------------------------------------------------
/lib/backbone-x/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "lib",
4 | "source"
5 | );
6 |
--------------------------------------------------------------------------------
/lib/backbone-x/source/ext/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "session.js"
4 | );
5 |
--------------------------------------------------------------------------------
/lib/tools/source/ext/proto/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "string.js"
4 | );
5 |
--------------------------------------------------------------------------------
/node-datasource/views/assets/you-shall-not-pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/node-datasource/views/assets/you-shall-not-pass.png
--------------------------------------------------------------------------------
/foundation-database/public/tables/bankaccnt.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('bankaccnt','bankaccnt_prnt_check', 'BOOLEAN', 'NOT NULL DEFAULT TRUE', 'public');
2 |
--------------------------------------------------------------------------------
/lib/backbone-x/README.md:
--------------------------------------------------------------------------------
1 | backbone-x
2 | ========
3 |
4 | Model abstraction based on Backbone.js
5 |
6 | Currently has a dependency on the tools repo
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/grppriv.sql:
--------------------------------------------------------------------------------
1 | -- Remove invalid data
2 | delete from grppriv where grppriv_priv_id not in (select priv_id from priv);
3 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "core.js",
3 | "models",
4 | "views",
5 | "widgets",
6 | "postbooks.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "list_relations.js",
3 | "list_relations_box.js",
4 | "workspace.js"
5 | );
6 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "list.js",
3 | "list_relations_editor_box.js",
4 | "workspace.js"
5 | );
6 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/database/source/priv.sql:
--------------------------------------------------------------------------------
1 | select xt.add_priv('MaintainOauth2clients', 'Can Maintain OAUTH2 Clients', 'oauth2', 'OAUTH2');
2 |
--------------------------------------------------------------------------------
/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/enyo-client/application/api/assets/search-input-search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/enyo-client/application/api/assets/search-input-search.png
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/usrpriv.sql:
--------------------------------------------------------------------------------
1 | -- Remove invalid data
2 | delete from usrpriv where usrpriv_priv_id not in (select priv_id from priv);
3 |
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "core.js",
3 | "models",
4 | "widgets",
5 | "views",
6 | "postbooks.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "core.js",
3 | "models",
4 | "widgets",
5 | "views",
6 | "postbooks.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "core.js",
3 | "models",
4 | "widgets",
5 | "views",
6 | "postbooks.js"
7 | );
8 |
--------------------------------------------------------------------------------
/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/catfood/xtuple/4_8_x/lib/enyo-x/lib/font-awesome/font/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/lib/enyo-x/source/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "stylesheets/screen.css",
3 | "core.js",
4 | "layout",
5 | "widgets",
6 | "views",
7 | "app.js"
8 | );
9 |
--------------------------------------------------------------------------------
/enyo-client/application/source/ext/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "../../lib/module/rjson/rjson.js",
3 | "core.js",
4 | "datasource.js",
5 | "session.js"
6 | );
7 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "list_item.js",
3 | "picker.js",
4 | "parameter.js",
5 | "relation.js"
6 | );
7 |
--------------------------------------------------------------------------------
/lib/backbone-x/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | node_modules
3 | build
4 | *.swp
5 | tmp
6 | npm-debug.log
7 | \.sass-cache
8 | build
9 | deploy
10 | /.sass-cache/
11 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/decamelize.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.decamelize(str text) returns text immutable as $$
2 | return XT.decamelize(str);
3 | $$ language plv8;
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "list.js",
3 | "list_relations.js",
4 | "list_relations_box.js",
5 | "workspace.js"
6 | );
7 |
--------------------------------------------------------------------------------
/lib/tools/lib/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "underscore/underscore.js",
4 | "async/lib/async.js"
5 | );
6 |
--------------------------------------------------------------------------------
/node-datasource/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | npm-debug.log
3 | pid*
4 | config*
5 | datasource.log
6 | datasource-err.log
7 | www
8 | lib/private/*
9 | pid/*
10 | temp/*
11 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "configure.js",
3 | "customer.js",
4 | "quote.js",
5 | "sales_order.js",
6 | "startup.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "core.js",
3 | "error.js",
4 | "models",
5 | "widgets",
6 | "views",
7 | "postbooks.js"
8 | );
9 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "account.js",
3 | "configure.js",
4 | "invoice.js",
5 | "startup.js",
6 | "static.js"
7 | );
8 |
--------------------------------------------------------------------------------
/foundation-database/public/indexes/evntlog.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('index', 'evntlog_evntlog_username_idx');
2 | CREATE INDEX evntlog_evntlog_username_idx ON evntlog(evntlog_username);
3 |
--------------------------------------------------------------------------------
/enyo-client/application/tools/package.js:
--------------------------------------------------------------------------------
1 | /*
2 | == DO NOT EDIT THIS FILE! ==
3 | This is necessary to keep paths correct for the minification process
4 | */
5 | enyo.depends("../source");
6 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/any_text.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.any_text(arg1 text, arg2 text[]) returns boolean immutable as $$
2 | select array[$1] <@ $2;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/any_uuid.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.any_uuid(arg1 uuid, arg2 uuid[]) returns boolean immutable as $$
2 | select array[$1] <@ $2;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/enyo-client/application/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | build
3 | *.swp
4 | /test/selenium/lib/loginData.js
5 | tmp
6 | npm-debug.log
7 | \.sass-cache
8 | build
9 | deploy
10 | /.sass-cache/
11 |
--------------------------------------------------------------------------------
/enyo-client/application/tools/minify.bat:
--------------------------------------------------------------------------------
1 | REM build enyo
2 | @CALL ..\enyo\minify\minify.bat
3 |
4 | REM build app
5 | @CALL ..\enyo\tools\minify.bat package.js -output ..\build\app
6 |
7 | pause
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "characteristic.js",
3 | "configure.js",
4 | "invoice.js",
5 | "project.js",
6 | "startup.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "characteristics.js",
3 | "chart.js",
4 | "parameter.js",
5 | "picker.js",
6 | "relation.js"
7 | );
8 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/begins_with.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.begins_with(arg1 text, arg2 text) returns boolean immutable as $$
2 | select $1 ~* ('^' || $2);
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/ends_with.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.ends_with(arg1 text, arg2 text) returns boolean immutable as $$
2 | select $1 ~* ($2 || '$');
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/node-datasource/views/layout.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | OAuth2orize Example
5 |
6 |
7 | <%- body %>
8 |
9 |
10 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | // "less/",
3 | "en/",
4 | "core.js",
5 | "models",
6 | "views",
7 | "widgets",
8 | "postbooks.js"
9 | );
10 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/any_numeric.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.any_numeric(arg1 numeric, arg2 numeric[]) returns boolean immutable as $$
2 | select array[$1] <@ $2;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/not_any_text.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.not_any_text(arg1 text, arg2 text[]) returns boolean immutable as $$
2 | select not array[$1] <@ $2;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/tools/source/ext/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "proto",
4 | "pluralize.js",
5 | "string.js",
6 | "startup_task.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/database/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore swap files
2 | *.swp
3 |
4 | # ignore tmp directories
5 | tmp
6 | # ignore OSX .DS_Store files
7 | *.DS_Store
8 | output.txt
9 | /*.backup
10 |
11 | *.log
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/README.md:
--------------------------------------------------------------------------------
1 | Public extensions
2 | =================
3 |
4 | Extensions for the xTuple platform
5 |
6 | To build all the public extensions for xTuple Postbooks, use /scripts/build_app.js
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/metric.sql:
--------------------------------------------------------------------------------
1 | select setmetric('MobileWelcomePage', 'https://www.xtuple.com/welcome');
2 | select setmetric('CCValidDays', '7');
3 | select setmetric('DashboardLite', 't');
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/not_any_numeric.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.not_any_numeric(arg1 numeric, arg2 numeric[]) returns boolean immutable as $$
2 | select not array[$1] <@ $2;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_margin.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_margin(cohead) returns numeric stable as $$
2 | select round(xt.co_subtotal($1) - xt.co_total_cost($1),2);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "characteristics.js",
3 | "chart.js",
4 | "dependencies.js",
5 | "parameter.js",
6 | "picker.js",
7 | "relation.js"
8 | );
9 |
--------------------------------------------------------------------------------
/lib/enyo-x/lib/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "date_format/date_format.js",
3 | "gts-plugins/DatePicker",
4 | "font-onyx/lib/Icon.js",
5 | "font-onyx/lib/IconButton.js",
6 | "font-onyx/lib/TextIcon.js"
7 | );
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_margin.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_margin(quhead) returns numeric stable as $$
2 | select round(xt.quote_subtotal($1) - xt.quote_total_cost($1),2);
3 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/cohistinfo.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.cohistinfo', $$
2 |
3 | SELECT *,
4 | round(cohist_qtyshipped * cohist_unitprice, 2) AS cohist_extprice
5 | FROM cohist;
6 |
7 | $$, false);
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/database/source/xt/functions/ar_balance.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.ar_balance(aropen) returns numeric stable as $$
2 | select $1.aropen_amount - $1.aropen_paid;
3 | $$ language sql;
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/raise_exception.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.raise_exception(message text) returns void as $$
2 | begin
3 |
4 | raise exception '%', message;
5 |
6 | end;
7 | $$ language 'plpgsql';
8 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/obj.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('obj');
4 | select xt.add_column('obj','obj_uuid', 'uuid');
5 |
6 | comment on table xt.js is 'Core table for xTuple Objects Reference';
7 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "comment_box.js",
3 | "list.js",
4 | "list_relations.js",
5 | "list_relations_editor_box.js",
6 | "grid_box.js",
7 | "workspace.js"
8 | );
9 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/less/print.less:
--------------------------------------------------------------------------------
1 | /* Use this file to define print styles.
2 | * Import this file using the following HTML or equivalent:
3 | * */
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/tables/wftype.sql:
--------------------------------------------------------------------------------
1 |
2 | insert into xt.wftype (wftype_tblname, wftype_code)
3 | select 'prjwf', 'PRJ'
4 | where not exists (select * from xt.wftype where wftype_tblname = 'prj');
5 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/tables/wftype.sql:
--------------------------------------------------------------------------------
1 |
2 | insert into xt.wftype (wftype_tblname, wftype_code)
3 | select 'powf', 'PO'
4 | where not exists (select * from xt.wftype where wftype_tblname = 'powf');
5 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/text_gt_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.text_gt_date(arg1 text, arg2 date) returns boolean immutable as $$
2 | select case when xt.is_date($1) then $1::date > $2 else false end;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/text_lt_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.text_lt_date(arg1 text, arg2 date) returns boolean immutable as $$
2 | select case when xt.is_date($1) then $1::date < $2 else false end;
3 | $$ language 'sql';
4 |
--------------------------------------------------------------------------------
/lib/tools/source/log.js:
--------------------------------------------------------------------------------
1 |
2 | XT.log = function() {
3 | var args = XT.$A(arguments);
4 | if (console.log.apply) {
5 | console.log.apply(console, args);
6 | } else {
7 | console.log(args.join(" "));
8 | }
9 | };
10 |
--------------------------------------------------------------------------------
/node-datasource/oauth2/db/index.js:
--------------------------------------------------------------------------------
1 | exports.users = require('./users');
2 | exports.clients = require('./clients');
3 | exports.accessTokens = require('./accesstokens');
4 | exports.authorizationCodes = require('./authorizationcodes');
5 |
6 |
--------------------------------------------------------------------------------
/REACT-README.md:
--------------------------------------------------------------------------------
1 | ```
2 | $ cd xtuple
3 | $ npm link ../xtuple-accounting
4 | $ ./scripts/build_app.js -d demo_dev -e node_modules/xtuple-accounting -n
5 | ```
6 | Then goto `https://host/dev/client/lib/module/xtuple-accounting/public/index.html`
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_total(cohead) returns numeric stable as $$
2 | select xt.co_subtotal($1) + xt.co_tax_total($1) + $1.cohead_freight + $1.cohead_misc;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/views/itemsrcmfg.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.itemsrcmfg', $$
2 |
3 | select distinct itemsrc_manuf_name from itemsrc where length(trim(itemsrc_manuf_name)) > 0;
4 |
5 | $$);
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/indexes/invchead.sql:
--------------------------------------------------------------------------------
1 | --CREATE INDEX invchead_invchead_cust_id_idx on invchead using btree (invchead_cust_id);
2 | select xt.add_index('invchead', 'invchead_cust_id','invchead_invchead_cust_id_idx', 'btree', 'public');
3 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/less/search.less:
--------------------------------------------------------------------------------
1 |
2 | .xv-search {
3 | .xv-header {
4 | .xv-navigator > .xv-header;
5 | border: none;
6 | }
7 |
8 | .xv-search-container {
9 | .xv-pullout > .xv-parameter-panel;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/stylesheets/print.css:
--------------------------------------------------------------------------------
1 | /* Use this file to define print styles.
2 | * Import this file using the following HTML or equivalent:
3 | * */
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/crmacct.sql:
--------------------------------------------------------------------------------
1 | -- trigger
2 | drop trigger if exists crmacct_owner_change on crmacct;
3 | create trigger crmacct_owner_change after insert on crmacct for each row execute procedure xt.owner_record_did_change();
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_schedule_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_schedule_date(quhead) returns date stable as $$
2 | select min(quitem_scheddate) from quitem where quitem_quhead_id=$1.quhead_id;
3 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_total(quhead) returns numeric stable as $$
2 | select xt.quote_subtotal($1) + xt.quote_tax_total($1) + $1.quhead_freight + $1.quhead_misc;
3 | $$ language sql;
--------------------------------------------------------------------------------
/foundation-database/public/tables/metric.sql:
--------------------------------------------------------------------------------
1 | -- Proof of concept
2 | insert into metric (metric_name, metric_value)
3 | select 'UnifiedBuild', 'true'
4 | where not exists (select c.metric_id from metric c where c.metric_name = 'UnifiedBuild');
5 |
6 |
--------------------------------------------------------------------------------
/lib/backbone-x/lib/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "backbone/backbone.js",
4 | "Backbone-relational/backbone-relational.js",
5 | "JSON-Patch/src/json-patch-duplex.js"
6 | );
7 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/execute_query.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.execute_query(query text) returns boolean volatile as $$
2 | begin
3 |
4 | execute query;
5 |
6 | return true;
7 |
8 | end;
9 | $$ language 'plpgsql';
10 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/any_text.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists <@ (
2 | text,
3 | text[]
4 | );
5 |
6 | create operator <@ (
7 | leftarg = text,
8 | rightarg = text[],
9 | procedure = xt.any_text,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/any_uuid.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists <@ (
2 | uuid,
3 | uuid[]
4 | );
5 |
6 | create operator <@ (
7 | leftarg = uuid,
8 | rightarg = uuid[],
9 | procedure = xt.any_uuid,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/ends_with.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists ~? (
2 | text,
3 | text
4 | );
5 |
6 | create operator ~? (
7 | leftarg = text,
8 | rightarg = text,
9 | procedure = xt.ends_with,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "configure.js",
3 | "sales_category.js",
4 | "sales_order.js",
5 | "receivable.js",
6 | "static.js",
7 | "cash_receipt.js",
8 | "startup.js"
9 | );
10 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/stylesheets/ie.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Import this file using the following HTML or equivalent:
3 | * */
6 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/begins_with.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists ~^ (
2 | text,
3 | text
4 | );
5 |
6 | create operator ~^ (
7 | leftarg = TEXT,
8 | rightarg = TEXT,
9 | procedure = xt.begins_with,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/not_any_text.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists !<@ (
2 | text,
3 | text[]
4 | );
5 |
6 | create operator !<@ (
7 | leftarg = text,
8 | rightarg = text[],
9 | procedure = xt.not_any_text,
10 | hashes, merges
11 | );
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/text_gt_date.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists > (
2 | text,
3 | date
4 | );
5 |
6 | create operator > (
7 | leftarg = text,
8 | rightarg = date,
9 | procedure = xt.text_gt_date,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/text_lt_date.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists < (
2 | text,
3 | date
4 | );
5 |
6 | create operator < (
7 | leftarg = text,
8 | rightarg = date,
9 | procedure = xt.text_lt_date,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_balance_exp.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_balance_exp(prj_id integer) returns numeric stable as $$
2 | select xt.prj_budget_exp($1) - xt.prj_actual_exp($1);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_balance_hrs.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_balance_hrs(prj_id integer) returns numeric stable as $$
2 | select xt.prj_budget_hrs($1) - xt.prj_actual_hrs($1);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/foundation-database/public/views/apmemo.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE VIEW apmemo AS
2 | SELECT apopen_id, apopen_docnumber
3 | FROM apopen
4 | WHERE apopen_doctype IN ('D', 'C');
5 | REVOKE ALL ON TABLE apmemo FROM PUBLIC;
6 | GRANT ALL ON TABLE apmemo TO xtrole;
7 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/database/source/manifest.js:
--------------------------------------------------------------------------------
1 | {
2 | "name": "oauth2",
3 | "comment": "OAUTH2 Administration extension",
4 | "loadOrder": 100,
5 | "version": "4.4.0",
6 | "databaseScripts": [
7 | "priv.sql"
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/enyo-client/application/source/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "preliminaries.js",
3 | "../lib/tools",
4 | "../lib/backbone-x",
5 | "../lib/enyo-x",
6 | "ext",
7 | "models",
8 | "widgets",
9 | "views",
10 | "startup.js",
11 | "app.js"
12 | );
13 |
--------------------------------------------------------------------------------
/enyo-client/application/tools/minify.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | # build enyo
6 | pushd ../enyo/minify > /dev/null
7 | ./minify.sh
8 | popd > /dev/null
9 |
10 | # build app
11 | ../enyo/tools/minify.sh package.js -output ../build/app
12 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/any_numeric.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists <@ (
2 | numeric,
3 | numeric[]
4 | );
5 |
6 | create operator <@ (
7 | leftarg = numeric,
8 | rightarg = numeric[],
9 | procedure = xt.any_numeric,
10 | hashes, merges
11 | );
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_line_extended_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_line_extended_price(poitem) returns numeric stable as $$
2 | select round($1.poitem_qty_ordered * $1.poitem_unitprice,2);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/operators/not_any_numeric.sql:
--------------------------------------------------------------------------------
1 | drop operator if exists !<@ (
2 | numeric,
3 | numeric[]
4 | );
5 |
6 | create operator !<@ (
7 | leftarg = numeric,
8 | rightarg = numeric[],
9 | procedure = xt.not_any_numeric,
10 | hashes, merges
11 | );
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/invc_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.invc_total(invchead) returns numeric stable as $$
2 | select xt.invc_subtotal($1) + xt.invc_tax_total($1.invchead_id) + $1.invchead_freight + $1.invchead_misc_amount;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/client/models/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "characteristic.js",
3 | "configure.js",
4 | "item_site.js",
5 | "item_source.js",
6 | "purchase_order.js",
7 | "vendor.js",
8 | "static.js",
9 | "startup.js"
10 | );
11 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/ccbank.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE ccbank DROP CONSTRAINT IF EXISTS ccbank_ccbank_ccard_type_check;
2 | ALTER TABLE ccbank ADD CONSTRAINT ccbank_ccbank_ccard_type_check
3 | CHECK (ccbank_ccard_type = ANY (ARRAY['A', 'D', 'M', 'P', 'V', 'O']));
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/is_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.is_date(text) returns boolean immutable as $$
2 | begin
3 | perform coalesce($1,'')::date;
4 | return true;
5 | exception when others then
6 | return false;
7 | end;
8 | $$ language plpgsql;
9 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "xtuple",
3 | "version": "4.8.0-beta2",
4 | "dependencies": {
5 | "bootstrap": "3.2.0",
6 | "jquery": "2.1.1",
7 | "less": "1.5.0",
8 | "nvd3": "1.1.x",
9 | "globalize": "~0.1.1",
10 | "moment": "~2.8.3"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cm_line_tax_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cm_line_tax_total(cmitem_id integer) returns numeric stable as $$
2 | select -1 * sum(taxhist_tax) as tax_total
3 | from cmitemtax
4 | where taxhist_parent_id=$1;
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_subtotal(cohead) returns numeric stable as $$
2 | select coalesce(sum(xt.co_line_extended_price(coitem)),0)
3 | from coitem
4 | where (coitem_cohead_id=$1.cohead_id);
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_actual_exp.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_actual_exp(prj_id integer) returns numeric stable as $$
2 | select coalesce(sum(prjtask_exp_actual),0) from prjtask where prjtask_prj_id=$1;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_budget_exp.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_budget_exp(prj_id integer) returns numeric stable as $$
2 | select coalesce(sum(prjtask_exp_budget),0) from prjtask where prjtask_prj_id=$1;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_total(pohead) returns numeric stable as $$
2 | select xt.po_subtotal($1) + xt.po_freight_subtotal($1) + xt.po_tax_total($1) + $1.pohead_freight;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cmhead.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('cmhead', 'obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
2 | select xt.add_inheritance('cmhead', 'xt.obj');
3 | select xt.add_constraint('cmhead', 'cmhead_obj_uuid', 'unique(obj_uuid)', 'public');
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cmitem.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('cmitem', 'obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
2 | select xt.add_inheritance('cmitem', 'xt.obj');
3 | select xt.add_constraint('cmitem', 'cmitem_obj_uuid', 'unique(obj_uuid)', 'public');
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_subtotal(quhead) returns numeric stable as $$
2 | select coalesce(sum(xt.quote_line_extended_price(quitem)),0)
3 | from quitem
4 | where (quitem_quhead_id=$1.quhead_id);
5 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/invcitemtaxinfo.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.invcitemtaxinfo', $$
2 | -- this view exists to silently quash any writes to this business object.
3 | -- the data is all taken care of with triggers
4 | select * from invcitemtax;
5 |
6 | $$, true);
7 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_actual_hrs.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_actual_hrs(prj_id integer) returns numeric stable as $$
2 | select coalesce(sum(prjtask_hours_actual),0) from prjtask where prjtask_prj_id=$1;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/functions/prj_budget_hrs.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.prj_budget_hrs(prj_id integer) returns numeric stable as $$
2 | select coalesce(sum(prjtask_hours_budget),0) from prjtask where prjtask_prj_id=$1;
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/foundation-database/public/patches/populate_ccpay_card_type.sql:
--------------------------------------------------------------------------------
1 | -- Issue #23459 adds ccpay_card_type. Populate it from historical ccard relations.
2 | UPDATE ccpay SET ccpay_card_type = (SELECT ccard_type FROM ccard WHERE ccard_id = ccpay_ccard_id)
3 | WHERE ccpay_ccard_id IS NOT NULL;
4 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/install_orm.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.install_orm(json text) returns void volatile as $$
2 | try {
3 | XT.Orm.install(json);
4 | XT.message(200, "OK");
5 | } catch (err) {
6 | XT.error(err);
7 | }
8 |
9 | $$ language plv8;
10 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set default behavior, change CRLF to LF
2 | * text eol=lf
3 |
4 | # Do not treat these as text
5 | *.jpg binary
6 | *.data binary
7 | *.png binary
8 | *.ttf binary
9 | *.otf binary
10 | *.eot binary
11 | *.gif binary
12 | *.gz binary
13 | *.ico binary
14 | *.phar binary
--------------------------------------------------------------------------------
/enyo-client/application/source/widgets/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "characteristics.js",
3 | "checkbox.js",
4 | "combobox.js",
5 | "item_site.js",
6 | "money.js",
7 | "number.js",
8 | "picker.js",
9 | "parameter.js",
10 | "relation.js",
11 | "tree.js"
12 | );
13 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/database/source/xt/functions/ar_tax_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.ar_tax_total(aropen_id integer) returns numeric stable as $$
2 | select coalesce(sum(taxhist_tax),0)
3 | from aropentax
4 | where (taxhist_parent_id = $1);
5 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_extended_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_extended_price(coitem) returns numeric stable as $$
2 | select round(($1.coitem_qtyord * $1.coitem_qty_invuomratio) * ($1.coitem_price / $1.coitem_price_invuomratio),2);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_extended_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_extended_price(quitem) returns numeric stable as $$
2 | select round(($1.quitem_qtyord * $1.quitem_qty_invuomratio) * ($1.quitem_price / $1.quitem_price_invuomratio),2);
3 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "documents_box.js",
3 | "grid_box.js",
4 | "list.js",
5 | "list_relations.js",
6 | "list_relations_box.js",
7 | "list_relations_editor_box.js",
8 | "workspace.js",
9 | "dashboard.js"
10 | );
11 |
--------------------------------------------------------------------------------
/lib/tools/source/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "foundation.js",
4 | "error.js",
5 | "log.js",
6 | "datasource.js",
7 | "date.js",
8 | "math.js",
9 | "session.js",
10 | "locale.js",
11 | "ext"
12 | );
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cm_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cm_total(cmhead_id integer, cmhead_freight numeric, cmhead_misc numeric) returns numeric stable as $$
2 | select xt.cm_subtotal($1) + xt.cm_tax_total($1) + COALESCE($2, 0.0) + COALESCE($3, 0.0);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "sales_category.js",
3 | "cash_receipt.js",
4 | "list.js",
5 | "list_relations.js",
6 | "list_relations_box.js",
7 | "list_relations_editor_box.js",
8 | "receivable.js",
9 | "workspace.js"
10 | );
11 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/usrpref.sql:
--------------------------------------------------------------------------------
1 | -- remove old trigger if any
2 |
3 | select dropIfExists('TRIGGER', 'usrpref_did_change');
4 |
5 | -- create trigger
6 |
7 | create trigger usrpref_did_change after insert or update on usrpref for each row execute procedure xt.usrpref_did_change();
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/invc_line_extended_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.invc_line_extended_price(quantity numeric, quantity_ratio numeric, price numeric, price_ratio numeric)
2 | returns numeric stable as $$
3 | select round(($1 * $2) * ($3 / $4),2);
4 | $$ language sql;
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/javascript/init.sql:
--------------------------------------------------------------------------------
1 | select xt.install_js('XT','Init','xtuple', $$
2 |
3 | /* Set search path based on xTuple logic */
4 | var searchPath = plv8.execute('select buildsearchpath() as path')[0].path,
5 | sql = 'set search_path to ' + searchPath;
6 | plv8.execute(sql);
7 | $$ );
--------------------------------------------------------------------------------
/test/lib/sample_login_data.js:
--------------------------------------------------------------------------------
1 | //----- Data for login function -----
2 | exports.data = {
3 | webaddress: 'https://localhost:8443',
4 | username: 'admin', //------- Enter the xTuple username
5 | pwd: 'admin', //------ enter the password here
6 | org: 'dev' //------ enter the database name here
7 | };
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cashrcpt.sql:
--------------------------------------------------------------------------------
1 | select xt.add_column('cashrcptitem', 'obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
2 | select xt.add_inheritance('cashrcptitem', 'xt.obj');
3 | select xt.add_constraint('cashrcptitem', 'cashrcptitem_obj_uuid', 'unique(obj_uuid)', 'public');
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_customer_discount.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_customer_discount(coitem) returns numeric stable as $$
2 | select round((case when $1.coitem_custprice = 0 then null else (1.0 - ($1.coitem_price / $1.coitem_custprice)) end),6);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_customer_discount.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_customer_discount(quitem) returns numeric stable as $$
2 | select round((case when $1.quitem_custprice = 0 then null else (1.0 - ($1.quitem_price / $1.quitem_custprice)) end),6);
3 | $$ language sql;
--------------------------------------------------------------------------------
/foundation-database/public/indexes/shipitem.sql:
--------------------------------------------------------------------------------
1 | DROP INDEX IF EXISTS shipitem_orderitem_id_idx;
2 | CREATE INDEX shipitem_orderitem_id_idx ON shipitem (shipitem_orderitem_id);
3 |
4 | DROP INDEX IF EXISTS shipitem_invcitem_id_idx;
5 | CREATE INDEX shipitem_invcitem_id_idx ON shipitem (shipitem_invcitem_id);
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/updatePrices-dropselsched.mql:
--------------------------------------------------------------------------------
1 | -- Group: updateprices
2 | -- Name: dropselsched
3 | -- Notes:
4 | -- Notes:
5 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
6 | -- See www.xtuple.com/CPAL for the full text of the software license.
7 |
8 | DROP TABLE selsched;
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/remittoinfo.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.remittoinfo', $$
2 |
3 | select remitto_name, 1 as remitto_id, 1 as remitto_key,
4 | formatAddr(remitto_address1, remitto_address2, remitto_address3, remitto_citystatezip, remitto_country) AS remitto_adr
5 | from remitto;
6 |
7 | $$);
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_freight_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_freight_subtotal(pohead) returns numeric stable as $$
2 | select round(coalesce(sum(poitem_freight), 0), 2)
3 | from poitem
4 | where poitem_pohead_id=$1.pohead_id;
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_subtotal(pohead) returns numeric stable as $$
2 | select coalesce(sum(poitem_qty_ordered * poitem_unitprice),0)
3 | from poitem
4 | where (poitem_pohead_id=$1.pohead_id);
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchcmnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchCMNumber() RETURNS text AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('CmNumber');
5 | $$ LANGUAGE sql;
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchponumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchPoNumber() RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('PoNumber');
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchqunumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchQuNumber() RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('QuNumber');
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchsonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchSoNumber() RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('SoNumber');
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchtonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchToNumber() RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('ToNumber');
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/priv.sql:
--------------------------------------------------------------------------------
1 | insert into priv (priv_module, priv_name, priv_descrip)
2 | select 'Accounting', 'ChangeCashRecvPostDate',
3 | 'Can change the distribution date when posting Cash Receipts'
4 | where not exists (select c.priv_id from priv c where c.priv_name = 'ChangeCashRecvPostDate');
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_ship_balance.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_ship_balance(coitem) returns numeric stable as $$
2 | select case when $1.coitem_status = 'O' then
3 | round($1.coitem_qtyord - $1.coitem_qtyshipped + $1.coitem_qtyreturned,6)
4 | else 0 end;
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_list_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_list_price(quitem) returns numeric stable as $$
2 | select round(item_listprice * ($1.quitem_price_invuomratio / iteminvpricerat(item_id)),4)
3 | from item
4 | where item_id=$1.quitem_item_id;
5 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_list_price_discount.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_list_price_discount(quitem) returns numeric stable as $$
2 | select round(case when $1.quitem_custprice = 0 then null else (1.0 - ($1.quitem_price / xt.quote_line_list_price($1))) end,6);
3 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/pr.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('pr','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('pr', 'xt.obj');
4 | select xt.add_constraint('pr', 'pr_obj_uuid','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/wo.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('wo','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('wo', 'xt.obj');
4 | select xt.add_constraint('wo', 'wo_obj_uuid','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/foundation-database/public/functions/endoftime.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION endoftime() RETURNS DATE IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT DATE('2100-01-01') as result;
6 | $$ LANGUAGE sql;
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchprnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchPrNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('PrNumber')::INTEGER;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchvonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchVoNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('VcNumber')::INTEGER;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchwonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchWoNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('WoNumber')::INTEGER;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/glseries-postjournal.mql:
--------------------------------------------------------------------------------
1 | -- Group: glseries
2 | -- Name: postjournal
3 | -- Notes:
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT postJournals( value("sequence") ?>) AS result;
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/startoftime.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION startoftime() RETURNS DATE IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT DATE('1970-01-01') AS return;
6 | $$ LANGUAGE sql;
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetcharmemonumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION fetchARMemoNumber() RETURNS TEXT AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT fetchNextNumber('ARMemoNumber');
6 | $$ LANGUAGE 'sql';
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchinvcnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchInvcNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('InvcNumber')::integer;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatratio.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatRatio(NUMERIC) RETURNS TEXT IMMUTABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT formatNumeric($1, 'uomratio');
5 | $$ LANGUAGE 'sql';
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatweight.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatWeight(NUMERIC) RETURNS TEXT IMMUTABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT formatNumeric($1, 'weight') AS result
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/isdba.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION isDBA(TEXT DEFAULT NULL) RETURNS BOOLEAN AS $$
2 | SELECT (datdba=pg_roles.oid OR rolsuper) AS issuper
3 | FROM pg_database, pg_roles
4 | WHERE ((datname=current_database())
5 | AND (rolname=COALESCE($1, getEffectiveXtUser())));
6 | $$ LANGUAGE SQL;
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releaseprnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releasePrNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('PrNumber', $1) > 0;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releasevonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releaseVoNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('VcNumber', $1) > 0;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releasewonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releaseWoNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('WoNumber', $1) > 0;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/node-datasource/scripts/node.conf:
--------------------------------------------------------------------------------
1 | check process node with pidfile /var/run/node-datasource.pid
2 | group www
3 | start program = "/etc/init.d/node start"
4 | stop program = "/etc/init.d/node stop"
5 | if failed host localhost port 80
6 | protocol HTTP request "/login" then restart
7 | if 5 restart within 5 cycles then timeout
8 |
9 |
--------------------------------------------------------------------------------
/enyo-client/application/source/views/package.js:
--------------------------------------------------------------------------------
1 | enyo.depends(
2 | "list.js",
3 | "list_relations.js",
4 | "list_relations_box.js",
5 | "list_relations_editor_box.js",
6 | "grid_box.js",
7 | "workspace.js",
8 | "comment_box.js",
9 | "assignment_box.js",
10 | "documents_box.js",
11 | "module_container.js"
12 | );
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/comment_trigger.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | -- remove old trigger if any
4 |
5 | select dropIfExists('TRIGGER', 'comment_did_change');
6 |
7 | -- create trigger
8 |
9 | create trigger comment_did_change before update on comment for each row execute procedure xt.comment_did_change();
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/cntctinfo.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.cntctinfo', $$
2 |
3 | select cntct.*, a.crmacct_number, p.crmacct_number as crmacct_parent_number
4 | from cntct
5 | left join crmacct a on a.crmacct_id=cntct_crmacct_id
6 | left join crmacct p on a.crmacct_parent_id=p.crmacct_id;
7 |
8 | $$);
9 |
10 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchapmemonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchAPMemoNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('APMemoNumber')::INTEGER;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchcashrcptnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchCashRcptNumber() RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('CashRcptNumber');
5 | $$ LANGUAGE 'sql';
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatprice.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatPrice(NUMERIC) RETURNS TEXT IMMUTABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT formatNumeric($1, 'salesprice') AS result;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatqty.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatQty(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''qty'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-delete.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: delete
3 | -- Notes: Delete a contact
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | DELETE FROM cntct WHERE (cntct_id= value("cntct_id") ?>);
8 |
--------------------------------------------------------------------------------
/foundation-database/public/views/armemo.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE VIEW armemo AS
2 | SELECT aropen_id, aropen_docnumber
3 | FROM aropen
4 | WHERE aropen_doctype IN ('D', 'C', 'R')
5 | UNION
6 | SELECT cmhead_id, cmhead_number
7 | FROM cmhead;
8 |
9 | REVOKE ALL ON TABLE armemo FROM PUBLIC;
10 | GRANT ALL ON TABLE armemo TO xtrole;
11 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/addr.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('addr','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('addr', 'xt.obj');
4 | select xt.add_constraint('addr', 'addr_obj_uuid_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/docass.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('docass','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('docass', 'xt.obj');
4 | select xt.add_constraint('docass', 'docass_obj_uui_id','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/pohead.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because we need it on the client
2 | select xt.add_column('pohead','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('pohead', 'xt.obj');
4 | select xt.add_constraint('pohead', 'pohead_obj_uui_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/poitem.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because we need it on the client
2 | select xt.add_column('poitem','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('poitem', 'xt.obj');
4 | select xt.add_constraint('poitem', 'poitem_obj_uui_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/womatl.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('womatl','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('womatl', 'xt.obj');
4 | select xt.add_constraint('womatl', 'womatl_obj_uuid','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatcost.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatCost(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''cost'');
6 | END;'
7 | LANGUAGE 'plpgsql';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatmoney.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatMoney(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''curr'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatscrap.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatScrap(NUMERIC) RETURNS TEXT IMMUTABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT formatNumeric(($1 * 100), 'percent') AS result
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postporeceipt.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postPoReceipt(INTEGER, INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN postReceipt($1, $2);
6 | END;
7 | ' LANGUAGE 'plpgsql';
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/aropen.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('aropen','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('aropen', 'xt.obj');
4 | select xt.add_constraint('aropen', 'aropen_obj_uuid_id','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cohist.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('cohist','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('cohist', 'xt.obj');
4 | select xt.add_constraint('cohist', 'cohist_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_base_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_base_price(coitem) returns numeric stable as $$
2 | select round($1.coitem_price - (
3 | select sum(charass_price)
4 | from charass
5 | where charass_target_type='SI'
6 | and charass_target_id=$1.coitem_id),4);
7 | $$ language sql;
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_list_price_discount.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_list_price_discount(coitem) returns numeric stable as $$
2 | select round(case when $1.coitem_custprice = 0 or xt.co_line_list_price($1) = 0 then null else (1.0 - ($1.coitem_price / xt.co_line_list_price($1))) end,6);
3 | $$ language sql;
4 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_base_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_base_price(quitem) returns numeric stable as $$
2 | select round($1.quitem_price - (
3 | select sum(charass_price)
4 | from charass
5 | where charass_target_type='QI'
6 | and charass_target_id=$1.quitem_id),4);
7 | $$ language sql;
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatprcnt.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatPrcnt(NUMERIC) RETURNS TEXT IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT formatNumeric($1 * 100, 'percent') AS result
6 | $$ LANGUAGE 'sql';
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatqtyper.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatQtyPer(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''qtyper'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postporeceipts.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postPoReceipts(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN postReceipts(''PO'', $1, NULL);
6 | END;
7 | ' LANGUAGE 'plpgsql';
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/arapply.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('arapply','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('arapply', 'xt.obj');
4 | select xt.add_constraint('arapply', 'arapply_obj_uuid_id','unique(obj_uuid)', 'public');
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/tables/prjtypeext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('prjtypeext');
2 |
3 | select xt.add_column('prjtypeext','prjtypeext_id', 'integer', 'primary key');
4 | select xt.add_column('prjtypeext','prjtypeext_emlprofile_id', 'integer');
5 |
6 | comment on table xt.prjtypeext is 'Project type extension table';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchcrmaccountnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION fetchCRMAccountNumber() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT fetchNextNumber('CRMAccountNumber')::INTEGER;
5 | $$ LANGUAGE 'sql';
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchincidentnumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION fetchIncidentNumber() RETURNS INTEGER AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT fetchNextNumber('IncidentNumber')::integer;
6 | $$ LANGUAGE 'sql';
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatuomratio.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatUOMRatio(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''uomratio'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releaseapmemonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releaseAPMemoNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('APMemoNumber', $1::INTEGER) > 0;
5 | $$ LANGUAGE 'sql';
6 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releaseincidentnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releaseIncidentNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('IncidentNumber', $1) = 1;
5 | $$ LANGUAGE sql;
6 |
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/invchead.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('invchead','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('invchead', 'xt.obj');
4 | select xt.add_constraint('invchead', 'invchead_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/invcitem.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('invcitem','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('invcitem', 'xt.obj');
4 | select xt.add_constraint('invcitem', 'invcitem_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/shiphead.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('shiphead','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('shiphead', 'xt.obj');
4 | select xt.add_constraint('shiphead', 'shiphead_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatextprice.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatExtPrice(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''extprice'');
6 | END;'
7 | LANGUAGE 'plpgsql';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatpurchprice.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatPurchPrice(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''purchprice'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatsalesprice.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatSalesPrice(NUMERIC) RETURNS TEXT IMMUTABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN formatNumeric($1, ''salesprice'');
6 | END;' LANGUAGE 'plpgsql';
7 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/payco.sql:
--------------------------------------------------------------------------------
1 | -- TODO: Add a precheck in the upgrade package.xml for this.
2 | select xt.add_constraint('payco','payco_unique_ccpay_id_cohead_id', 'unique(payco_ccpay_id, payco_cohead_id)', 'public');
3 | -- Add primary key.
4 | select xt.add_column('payco','payco_id', 'serial', 'primary key', 'public', 'payco table primary key.');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cmheadtax.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('cmheadtax','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('cmheadtax', 'xt.obj');
4 | select xt.add_constraint('cmheadtax', 'cmheadtax_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cmitemtax.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('cmitemtax','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('cmitemtax', 'xt.obj');
4 | select xt.add_constraint('cmitemtax', 'cmitemtax_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/itemsite.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('itemsite','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('itemsite', 'xt.obj');
4 | select xt.add_constraint('itemsite', 'itemsite_obj_uui_id','unique(obj_uuid)', 'public');
5 |
6 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/vendinfo.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('vendinfo','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('vendinfo', 'xt.obj');
4 | select xt.add_constraint('vendinfo', 'vendinfo_obj_uuid_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xm/javascript/user_preference.sql:
--------------------------------------------------------------------------------
1 | select xt.install_js('XM','UserPreference','xtuple', $$
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. */
4 |
5 | XM.UserPreference = {
6 | options: ["PrintSettings"]
7 | };
8 |
9 | $$ );
10 |
11 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/public/tables/emp.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('emp','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('emp', 'xt.obj');
4 | select xt.add_constraint('emp', 'emp_obj_uui_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releasearmemonumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION releaseARMemoNumber(INTEGER) RETURNS BOOLEAN AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | select releaseNumber('ARMemoNumber', $1::INTEGER) > 0;
6 | $$ LANGUAGE 'sql';
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releasecashrcptnumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION releaseCashRcptNumber(INTEGER) RETURNS BOOLEAN AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT releaseNumber('CashRcptNumber', $1) > 0;
6 | $$ LANGUAGE 'sql';
7 |
8 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/itemsite.sql:
--------------------------------------------------------------------------------
1 | -- incident 23507:change how qoh, qoh available, and qoh netable are determined
2 | do $$
3 | begin
4 | if fetchMetricText('ServerVersion') < '4.7.0' then
5 | update itemsite set itemsite_qtyonhand=(itemsite_qtyonhand + itemsite_nnqoh);
6 | alter table itemsite drop column itemsite_nnqoh cascade;
7 | end if;
8 | end$$;
--------------------------------------------------------------------------------
/foundation-database/public/types/flcoldata.sql:
--------------------------------------------------------------------------------
1 | select dropifexists('FUNCTION', 'getflcoldata(int,int)');
2 | select dropifexists('FUNCTION', 'getflcoldata(character,integer[], boolean)');
3 | select dropifexists('TYPE', 'flcoldata');
4 | CREATE TYPE flcoldata AS (
5 | flcoldata_column INTEGER,
6 | flcoldata_start DATE,
7 | flcoldata_end DATE
8 | );
9 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/schema.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.getSchema(namespace text, type text) returns text as $$
2 | try {
3 | /* usage: select xt.getSchema('XM', 'Contact'); */
4 | var orm = XT.Orm.fetch(namespace, type);
5 | return JSON.stringify(orm);
6 | } catch (err) {
7 | XT.error(err);
8 | }
9 | $$ LANGUAGE plv8;
10 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "0.10"
4 |
5 | install:
6 | - "bash scripts/install_xtuple.sh -ipn"
7 |
8 | before_script:
9 | - "cd node-datasource"
10 | - "node main.js &"
11 | - "sleep 10"
12 | - "cd .."
13 |
14 | script:
15 | - "npm run-script test-datasource"
16 | - "npm run-script test"
17 | - "npm run-script jshint"
18 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cm_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cm_subtotal(cmhead_id integer) returns numeric stable as $$
2 | select coalesce(sum(xt.invc_line_extended_price(cmitem_qtycredit, cmitem_qty_invuomratio,
3 | cmitem_unitprice, cmitem_price_invuomratio)),0)
4 | from cmitem
5 | where (cmitem_cmhead_id=$1);
6 | $$ language sql;
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/trylock.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.trylock(oid integer, id integer) returns boolean as $$
2 | var pid = plv8.execute("select pg_backend_pid() as pid;")[0].pid,
3 | data = Object.create(XT.Data),
4 | lock = data.tryLock(oid, id, {pid: pid});
5 |
6 | return lock.key ? true : false;
7 |
8 | $$ language plv8;
9 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/database/source/manifest.js:
--------------------------------------------------------------------------------
1 | {
2 | "name": "crm",
3 | "comment": "Corporate Relationship Management extension",
4 | "loadOrder": 10,
5 | "databaseScripts": [
6 | "xt/tables/acttype.sql",
7 | "xt/views/share_users_cntct.sql",
8 | "xt/views/share_users_addr.sql",
9 | "xt/tables/sharetype.sql"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchdefaultfob.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION FetchDefaultFob(pWarehousId INTEGER) RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT warehous_fob
5 | FROM whsinfo
6 | WHERE (warehous_id=$1);
7 | $$ LANGUAGE SQL;
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/releasecrmaccountnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION releaseCRMAccountNumber(INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT releaseNumber('CRMAccountNumber', $1::INTEGER) > 0;
5 | $$ LANGUAGE sql;
6 |
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/usercancreateusers.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION userCanCreateUsers(TEXT) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT rolcreaterole OR rolsuper
5 | FROM pg_roles
6 | WHERE rolname=($1);
7 | $$ LANGUAGE SQL;
8 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-contactused.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: contactused
3 | -- Notes: Checks to see if this contact is used anywhere
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT cntctused( value("cntct_id") ?>) AS used;
8 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-deselect.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: deselect
3 | -- Notes: Removes contact selection
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | DELETE FROM cntctsel
8 | WHERE (cntctsel_cntct_id= value("cntct_id") ?>);
9 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-selectcol.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: selectcol
3 | -- Notes: Selects a specific column
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT cntctselectcol( value("cntct_id") ?>, value("col_number") ?>);
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/invcitemtax.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('invcitemtax','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('invcitemtax', 'xt.obj');
4 | select xt.add_constraint('invcitemtax', 'invcitemtax_obj_uuid','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/shiptoinfo.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('shiptoinfo','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('shiptoinfo', 'xt.obj');
4 | select xt.add_constraint('shiptoinfo', 'shiptoinfo_obj_uuid_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/nextwosubnumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION nextWoSubnumber(INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT COALESCE((MAX(wo_subnumber) + 1), 1)
5 | FROM wo
6 | WHERE (wo_number=($1));
7 | $$ LANGUAGE 'sql';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/types/subtax.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('FUNCTION', 'getsubtax(integer,integer)');
2 | SELECT dropIfExists('TYPE', 'subtax');
3 |
4 | CREATE TYPE subtax AS
5 | (subtax_taxcode_id integer,
6 | subtax_taxcode_code "text",
7 | subtax_taxcode_descrip "text",
8 | subtax_taxcode_level integer);
9 | ALTER TYPE subtax OWNER TO "admin";
10 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/public/tables/empgrp.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('empgrp','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('empgrp', 'xt.obj');
4 | select xt.add_constraint('empgrp', 'empgrp_obj_uui_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/wftype.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('wftype', 'xt');
4 | select xt.add_column('wftype','wftype_id', 'serial', 'primary key', 'xt');
5 | select xt.add_column('wftype','wftype_tblname', 'text', '', 'xt');
6 | select xt.add_column('wftype','wftype_code', 'text', '', 'xt');
7 |
8 | comment on table xt.wftype is 'Workflow Type Map';
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/vendaddrinfo.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('vendaddrinfo','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('vendaddrinfo', 'xt.obj');
4 | select xt.add_constraint('vendaddrinfo', 'vendaddrinfo_obj_uuid_id','unique(obj_uuid)', 'public');
5 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_list_price.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_list_price(coitem) returns numeric stable as $$
2 | select round(item_listprice * ($1.coitem_price_invuomratio / iteminvpricerat(item_id)),4)
3 | from itemsite
4 | inner join item on itemsite_item_id = item_id
5 | where itemsite_id=$1.coitem_itemsite_id;
6 | $$ language sql;
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_total_cost.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_total_cost(cohead) returns numeric stable as $$
2 | select coalesce(sum(round((coitem_qtyord * coitem_qty_invuomratio) * currtocurr(basecurrId(), $1.cohead_curr_id, coitem_unitcost, $1.cohead_orderdate),2)),0)
3 | from coitem
4 | where (coitem_cohead_id=$1.cohead_id);
5 | $$ language sql;
6 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/invc_subtotal.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.invc_subtotal(invchead) returns numeric stable as $$
2 | select coalesce(sum(xt.invc_line_extended_price(invcitem_billed, invcitem_qty_invuomratio,
3 | invcitem_price, invcitem_price_invuomratio)),0)
4 | from invcitem
5 | where (invcitem_invchead_id=$1.invchead_id);
6 | $$ language sql;
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_total_cost.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_total_cost(quhead) returns numeric stable as $$
2 | select coalesce(sum(round((quitem_qtyord * quitem_qty_invuomratio) * currtocurr(basecurrId(), $1.quhead_curr_id, quitem_unitcost, $1.quhead_quotedate),2)),0)
3 | from quitem
4 | where (quitem_quhead_id=$1.quhead_id);
5 | $$ language sql;
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/updatePrices-createselsched.mql:
--------------------------------------------------------------------------------
1 | -- Group: updateprices
2 | -- Name: createselsched
3 | -- Notes:
4 | -- Notes:
5 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
6 | -- See www.xtuple.com/CPAL for the full text of the software license.
7 |
8 | CREATE TEMPORARY TABLE selsched (
9 | selsched_ipshead_id INTEGER PRIMARY KEY );
10 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/crm/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.crm = {};
10 |
11 | }());
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/ismulticurr.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION isMultiCurr() RETURNS BOOL IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | BEGIN
6 | RETURN (SELECT (count(*) > 1)
7 | FROM curr_symbol);
8 | END;
9 | $$ LANGUAGE 'plpgsql';
10 |
11 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/generate_uuid.sql:
--------------------------------------------------------------------------------
1 | /**
2 | Generate a universally unique identifier.
3 |
4 | @returns {uuid}
5 | */
6 | create or replace function xt.generate_uuid() returns text as $$
7 |
8 | plv8.elog(WARNING, ("The xt.generate_uuid() function is depricated, use xt.uuid_generate_v4()."))
9 |
10 | return XT.generateUUID();
11 |
12 | $$ language plv8;
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_schedule_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_schedule_date(cohead) returns date stable as $$
2 | select coitem_scheddate
3 | from coitem
4 | where coitem_cohead_id=$1.cohead_id
5 | and coitem_status='O'
6 | and coitem_qtyord - coitem_qtyshipped + coitem_qtyreturned > 0
7 | order by coitem_scheddate
8 | limit 1;
9 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/extensions/source/oauth2/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.oauth2 = {};
10 |
11 | }());
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.sales = {};
10 |
11 | }());
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postbankreconciliation.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postBankReconciliation(pBankrecid INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN bankReconciliation(pBankrecid, 'post');
6 | END;
7 | $$ LANGUAGE 'plpgsql';
8 |
9 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-select.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: select
3 | -- Notes: Processes contact selections
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT cntctselect(
8 | value("cntct_id") ?>,
9 | value("target") ?>) AS result;
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cm_tax_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cm_tax_total(cmhead_id integer) returns numeric stable as $$
2 | SELECT SUM(tax) * -1 AS tax
3 | FROM (
4 | SELECT ROUND(SUM(taxdetail_tax),2) AS tax
5 | FROM tax JOIN calculateTaxDetailSummary('CM', $1, 'T') ON (taxdetail_tax_id=tax_id)
6 | GROUP BY tax_id
7 | ) AS data;
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.project = {};
10 |
11 | }());
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/reopenbankreconciliation.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION reopenBankReconciliation(pBankrecid INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RETURN bankReconciliation(pBankrecid, 'reopen');
6 | END;
7 | $$ LANGUAGE 'plpgsql';
8 |
9 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/show_search_path.sql:
--------------------------------------------------------------------------------
1 | create or replace function show_search_path() returns text as $$
2 | declare
3 | path text;
4 | rec record;
5 | begin
6 | -- This exists because show search_path command doesn't work in plv8
7 | for rec in execute 'show search_path'
8 | loop
9 | return rec.search_path::text;
10 | end loop;
11 | end;
12 | $$ language plpgsql;
13 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/widgets/relation.js:
--------------------------------------------------------------------------------
1 | XT.extensions.billing.initRelationWidgets = function () {
2 |
3 | enyo.kind({
4 | name: 'XV.BankAccountWidget',
5 | kind: 'XV.RelationWidget',
6 | collection: 'XM.BankAccountRelationCollection',
7 | list: 'XV.BankAccountList',
8 | keyAttribute: 'name',
9 | nameAttribute: 'description'
10 | });
11 | };
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.purchasing = {};
10 |
11 | }());
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/createurl.sql:
--------------------------------------------------------------------------------
1 | create or replace function createUrl(text, text) returns integer as $$
2 | declare
3 | pTitle ALIAS FOR $1;
4 | pUrl ALIAS FOR $2;
5 | _id integer;
6 | begin
7 | _id := nextval('urlinfo_url_id_seq');
8 | insert into urlinfo (url_id, url_title, url_url) values (_id, pTitle, pUrl);
9 | return _id;
10 | end;
11 | $$ language 'plpgsql';
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/voidapcheck.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION voidAPCheck(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''voidAPCheck() is deprecated - use voidCheck() instead'';
6 | RETURN voidCheck($1);
7 | END;
8 | ' LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/rptdef.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('rptdef');
2 |
3 | select xt.add_column('rptdef','rptdef_id', 'serial', 'primary key');
4 | select xt.add_column('rptdef','rptdef_record_type', 'text');
5 | select xt.add_column('rptdef','rptdef_grade', 'integer');
6 | select xt.add_column('rptdef','rptdef_definition', 'text');
7 |
8 | comment on table xt.rptdef is 'Report definitions';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/itemcapuom.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION itemCapUOM(INTEGER) RETURNS TEXT STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN itemUOMByType(pItemid, 'Capacity');
9 | END;
10 | $$ LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/itemsellinguom.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION itemSellingUOM(INTEGER) RETURNS TEXT AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN itemUOMByType(pItemid, ''Selling'');
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/lib/orm/README.md:
--------------------------------------------------------------------------------
1 | #Postgres Object Relational Map System
2 |
3 | ##Use
4 |
5 | In order to use any of the functionality provided by this project you must run the following sql statement: `select xt.js_init();`
6 |
7 | The main purpose of this project is to provide an Object Relational Map (ORM) structure and APIs to retreive and manipulate records as json objects, and to make function calls on the database.
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/saletypeext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('saletypeext');
2 |
3 | select xt.add_column('saletypeext','saletypeext_id', 'integer', 'primary key');
4 | select xt.add_column('saletypeext','saletypeext_emlprofile_id', 'integer');
5 | select xt.add_column('saletypeext','saletypeext_default_hold_type', 'text');
6 |
7 | comment on table xt.saletypeext is 'Sale type extension table';
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_line_tax.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_line_tax(poitem) returns numeric stable as $$
2 | select calculateTax(
3 | pohead_taxzone_id,
4 | $1.poitem_taxtype_id,
5 | pohead_orderdate,pohead_curr_id,round(xt.po_line_extended_price($1),2)) AS tax
6 | from pohead
7 | where (pohead_id=$1.poitem_pohead_id)
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteapcheck.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteAPCheck(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''deleteAPCheck() is deprecated - use deleteCheck() instead'';
6 | RETURN deleteCheck($1);
7 | END;
8 | ' LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/rollupactualcost.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION rollUpActualCost(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN rollUpSorACost(pitemid, TRUE);
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.log
2 | *.DS_Store
3 | *.sw*
4 | *~
5 | *.backup
6 | *.deb
7 | node_modules
8 | bower_components
9 | npm-debug.log
10 | scripts/private
11 | scripts/lib/temp_query*
12 | scripts/output
13 | scripts/1
14 | scripts/lib/build
15 | scripts/lib/deploy
16 | scripts/lib/package.js
17 | test/lib/demo-test.backup
18 | test/lib/login_data.js
19 | test/mocha/lib/demo-test.backup
20 | test/shared/login_data.js
21 |
--------------------------------------------------------------------------------
/enyo-client/database/source/version_check.sql:
--------------------------------------------------------------------------------
1 | do $$
2 |
3 | var qry = plv8.execute("select * from metric where metric_name = 'ServerVersion'"),
4 | major = qry[0].metric_value.slice(0,1),
5 | minor = qry[0].metric_value.slice(2,3);
6 |
7 | if (major < 4 || (major === "4" && minor < 2)) {
8 | plv8.elog(ERROR, "Database version must be 4.2.0 or higher");
9 | }
10 |
11 | $$ language plv8;
12 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_at_shipping.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_at_shipping(coitem) returns numeric stable as $$
2 | select round(coalesce(sum(shipitem_qty),0), 6)
3 | from shipitem
4 | join shiphead on shiphead_id=shipitem_shiphead_id
5 | where shipitem_orderitem_id=$1.coitem_id
6 | and shiphead_order_type='SO'
7 | and not shiphead_shipped;
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletemetasql.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteMetaSQL(INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pid ALIAS FOR $1;
6 | BEGIN
7 | DELETE FROM metasql WHERE metasql_id = pid;
8 | RETURN 0;
9 | END;
10 | $$ LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/itemaltcapuom.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION itemAltCapUOM(INTEGER) RETURNS TEXT STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN itemUOMByType(pItemid, 'AltCapacity');
9 | END;
10 | $$ LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/rollupstandardcost.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION rollUpStandardCost(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN rollUpSorACost(pItemid, FALSE);
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/itemcapinvrat.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION itemCapInvRat(INTEGER) RETURNS NUMERIC STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN itemUOMRatioByType(pItemid, 'Capacity');
9 | END;
10 | $$ LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/updatePrices-remove.mql:
--------------------------------------------------------------------------------
1 | -- Group: updateprices
2 | -- Name: remove
3 | -- Notes:
4 | -- Notes:
5 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
6 | -- See www.xtuple.com/CPAL for the full text of the software license.
7 |
8 | DELETE FROM selsched
9 | if exists("ipshead_id") ?>
10 | WHERE (selsched_ipshead_id= value("ipshead_id") ?>)
11 | endif ?>
12 | ;
13 |
--------------------------------------------------------------------------------
/foundation-database/public/views/sopack.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('view', 'sopack');
2 |
3 | CREATE VIEW sopack AS
4 | SELECT pack_id AS sopack_id,
5 | pack_head_id AS sopack_sohead_id,
6 | pack_printed AS sopack_printed,
7 | pack_shiphead_id AS sopack_cosmisc_id
8 | FROM pack
9 | WHERE (pack_head_type='SO');
10 | REVOKE ALL ON TABLE sopack FROM PUBLIC;
11 | GRANT ALL ON TABLE sopack TO GROUP xtrole;
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | XT.extensions.billing = {
10 | name: "billing"
11 | };
12 |
13 | }());
14 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/client/views/documents_box.js:
--------------------------------------------------------------------------------
1 | /*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
2 | latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
3 | trailing:true, white:true, strict:false*/
4 | /*global XT:true, XV:true, enyo:true*/
5 |
6 | (function () {
7 |
8 | XT.extensions.project.initDocumentsBox = function () {
9 |
10 |
11 | };
12 |
13 | }());
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/createapchecks.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION createAPChecks(INTEGER, DATE) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE 'createAPChecks() is deprecated - use createChecks() instead';
6 | RETURN createChecks($1, $2);
7 | END;
8 | $$ LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/itemaltcapinvrat.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION itemAltCapInvRat(INTEGER) RETURNS NUMERIC STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 |
7 | BEGIN
8 | RETURN itemUOMRatioByType(pItemid, 'AltCapacity');
9 | END;
10 | $$ LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postapchecks.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postAPChecks(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | RAISE NOTICE ''postAPChecks() is deprecated - use postChecks() instead'';
7 | RETURN postChecks($1);
8 |
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postapopenitems.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postApopenItems() RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | UPDATE apopen
7 | SET apopen_posted=TRUE
8 | WHERE (NOT apopen_posted);
9 |
10 | RETURN TRUE;
11 |
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postaropenitems.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postAropenItems() RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | UPDATE aropen
7 | SET aropen_posted=TRUE
8 | WHERE (NOT aropen_posted);
9 |
10 | RETURN TRUE;
11 |
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
--------------------------------------------------------------------------------
/foundation-database/public/views/budget.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('VIEW', 'budget');
2 | CREATE VIEW budget AS
3 | SELECT budgitem_id AS budget_id,
4 | budgitem_period_id AS budget_period_id,
5 | budgitem_accnt_id AS budget_accnt_id,
6 | budgitem_amount AS budget_amount
7 | FROM budgitem;
8 | REVOKE ALL ON TABLE budget FROM PUBLIC;
9 | GRANT ALL ON TABLE budget TO GROUP xtrole;
10 |
11 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/extdep.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('extdep');
4 | select xt.add_column('extdep','extdep_id', 'serial', 'primary key');
5 | select xt.add_column('extdep','extdep_from_ext_id', 'integer', 'references xt.ext (ext_id)');
6 | select xt.add_column('extdep','extdep_to_ext_id', 'integer', 'references xt.ext (ext_id)');
7 |
8 | comment on table xt.extdep is 'Extension dependencies';
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/schemaord.sql:
--------------------------------------------------------------------------------
1 | -- Put schema in path
2 | delete from schemaord where schemaord_name in ('xt','pg_catalog');
3 | insert into schemaord (schemaord_name, schemaord_order) values ('xt', 50);
4 | -- This is so we can over-ride the pg_advisory_unlock function. For that to work on gui client pg_catalog has to be last.
5 | insert into schemaord (schemaord_name, schemaord_order) values ('pg_catalog', 999);
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/invc_tax_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.invc_tax_total(invchead_id integer) returns numeric stable as $$
2 | SELECT COALESCE(SUM(tax), 0) AS tax
3 | FROM (
4 | SELECT ROUND(SUM(taxdetail_tax),2) AS tax
5 | FROM tax
6 | JOIN calculateTaxDetailSummary('I', $1, 'T') ON (taxdetail_tax_id=tax_id)
7 | GROUP BY tax_id
8 | ) AS data;
9 | $$ language sql;
10 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_schedule_date.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_schedule_date(pohead) returns date stable as $$
2 | select poitem_duedate
3 | from poitem
4 | where poitem_pohead_id=$1.pohead_id
5 | and poitem_status in ('U','O')
6 | and poitem_qty_ordered - poitem_qty_received + poitem_qty_returned > 0
7 | order by poitem_duedate
8 | limit 1;
9 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/functions/po_tax_total.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.po_tax_total(pohead) returns numeric stable as $$
2 | select coalesce(sum(tax),0) as tax
3 | from (
4 | select round(sum(taxdetail_tax),2) as tax
5 | from tax
6 | join calculatetaxdetailsummary('PO', $1.pohead_id, 'T') on (taxdetail_tax_id=tax_id)
7 | group by tax_id) as data;
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_freight_weight.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_freight_weight(cohead) returns numeric stable as $$
2 | select round(coalesce(coitem_qtyord * coitem_qty_invuomratio * (item_prodweight + item_packweight), 0), 2)
3 | from coitem
4 | join itemsite on coitem_itemsite_id=itemsite_id
5 | join item on item_id=itemsite_item_id
6 | where coitem_cohead_id=$1.cohead_id;
7 | $$ language sql;
8 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/userpref.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('userpref');
2 |
3 | select xt.add_column('userpref','userpref_id', 'serial', 'primary key');
4 | select xt.add_column('userpref','userpref_usr_username', 'text');
5 | select xt.add_column('userpref','userpref_name', 'text');
6 | select xt.add_column('userpref','userpref_value', 'text');
7 |
8 | comment on table xt.userpref is 'User preference data';
9 |
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/views/opheadinfo.sql:
--------------------------------------------------------------------------------
1 | select xt.create_view('xt.opheadinfo', $$
2 | select ophead.*, coalesce(incdtpriority_order, 99999) as priority_order,
3 | crmacct_number, cntct_number
4 | from ophead
5 | join crmacct on crmacct_id=ophead_crmacct_id
6 | left join cntct on cntct_id=ophead_cntct_id
7 | left join incdtpriority on (ophead_priority_id=incdtpriority_id);
8 | $$);
9 |
10 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/database/source/xt/tables/sharetype.sql:
--------------------------------------------------------------------------------
1 | -- Invoice CRM Account's users.
2 | delete from xt.sharetype where sharetype_tblname = 'share_users_invchead';
3 | insert into xt.sharetype (
4 | sharetype_nsname,
5 | sharetype_tblname,
6 | sharetype_col_obj_uuid,
7 | sharetype_col_username
8 | ) values (
9 | 'xt',
10 | 'share_users_invchead',
11 | 'obj_uuid',
12 | 'username'
13 | );
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteipsitem.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteIpsItem(pIpsItemId INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 |
6 | BEGIN
7 |
8 | DELETE FROM ipsiteminfo WHERE ipsitem_id=pIpsItemId;
9 |
10 | RETURN 1;
11 | END;
12 | $$ LANGUAGE 'plpgsql';
13 |
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteitemuom.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteItemUOM(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemuomid ALIAS FOR $1;
6 |
7 | BEGIN
8 | DELETE FROM itemuom WHERE itemuom_id=pItemuomid;
9 |
10 | RETURN 0;
11 | END;
12 | ' LANGUAGE 'plpgsql';
13 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteuomconv.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteUOMConv(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pUomconvid ALIAS FOR $1;
6 |
7 | BEGIN
8 | DELETE FROM uomconv WHERE uomconv_id=pUomconvid;
9 |
10 | RETURN 0;
11 | END;
12 | ' LANGUAGE 'plpgsql';
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_freight_weight.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_freight_weight(quhead) returns numeric stable as $$
2 | select round(coalesce(quitem_qtyord * quitem_qty_invuomratio * (item_prodweight + item_packweight), 0), 2)
3 | from quitem
4 | join itemsite on quitem_itemsite_id=itemsite_id
5 | join item on item_id=itemsite_item_id
6 | where quitem_quhead_id=$1.quhead_id;
7 | $$ language sql;
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteipsprodcat.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteIpsProdCat(pIpsItemId INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 |
6 | BEGIN
7 |
8 | DELETE FROM ipsiteminfo WHERE ipsitem_id=pIpsItemId;
9 |
10 | RETURN 1;
11 | END;
12 | $$ LANGUAGE 'plpgsql';
13 |
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/markapcheckasprinted.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION markAPCheckAsPrinted(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''markAPCheckAsPrinted() is deprecated - use markCheckAsPrinted()'';
6 | RETURN markCheckAsPrinted($1);
7 | END;
8 | ' LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/replacevoidedapcheck.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION replaceVoidedAPCheck(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''replaceVoidedAPCheck() is deprecated - use replaceVoidedCheck()'';
6 | RETURN replaceVoidedCheck($1);
7 | END;
8 | ' LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/lib/enyo-x/.gitignore.orig:
--------------------------------------------------------------------------------
1 | # ignore OS X directory files
2 | *.DS_Store
3 |
4 | # ignore VIM swap files
5 | *.swp
6 | # ignore temporary directories
7 | tmp
8 | # ignore npm debugging
9 | npm-debug.log
10 | # do not include enyo
11 | enyo
12 | # do not include any third-party libs
13 | # except what is explicitly added
14 | lib/*
15 | \.sass-cache
16 | package.js
17 | <<<<<<< HEAD
18 | =======
19 | /.sass-cache/
20 | >>>>>>> xtuple
21 |
--------------------------------------------------------------------------------
/lib/tools/.gitignore.orig:
--------------------------------------------------------------------------------
1 | # ignore OS X directory files
2 | *.DS_Store
3 |
4 | # ignore VIM swap files
5 | *.swp
6 | # ignore temporary directories
7 | tmp
8 | # ignore npm debugging
9 | npm-debug.log
10 | # do not include enyo
11 | enyo
12 | # do not include any third-party libs
13 | # except what is explicitly added
14 | lib/*
15 | \.sass-cache
16 | package.js
17 | <<<<<<< HEAD
18 | =======
19 | /.sass-cache/
20 | >>>>>>> xtuple
21 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_margin.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_margin(coitem) returns numeric stable as $$
2 | select round(xt.co_line_extended_price($1) - (
3 | currtocurr(basecurrid(), cohead_curr_id, $1.coitem_unitcost, cohead_orderdate) *
4 | $1.coitem_qtyord * $1.coitem_qty_invuomratio / $1.coitem_price_invuomratio), 2)
5 | from cohead where cohead_id = $1.coitem_cohead_id;
6 | $$ language sql;
7 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/todoitemmoveup.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION todoItemMoveUp(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | ptodoItemId ALIAS FOR $1;
7 | BEGIN
8 | RETURN todoItemMove(ptodoItemId, -1); -- move toward front of list
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
12 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/updatePrices-selsched.mql:
--------------------------------------------------------------------------------
1 | -- Group: updateprices
2 | -- Name: selsched
3 | -- Notes:
4 | -- Notes:
5 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
6 | -- See www.xtuple.com/CPAL for the full text of the software license.
7 |
8 | SELECT selsched_ipshead_id, ipshead_name, ipshead_descrip
9 | FROM selsched
10 | JOIN ipshead ON (selsched_ipshead_id=ipshead_id)
11 | ORDER BY ipshead_name
12 |
--------------------------------------------------------------------------------
/enyo-client/application/.gitignore.orig:
--------------------------------------------------------------------------------
1 | # ignore OS X directory files
2 | *.DS_Store
3 |
4 | # ignore VIM swap files
5 | *.swp
6 | # ignore temporary directories
7 | tmp
8 | # ignore npm debugging
9 | npm-debug.log
10 | # do not include enyo
11 | enyo
12 | # do not include any third-party libs
13 | # except what is explicitly added
14 | lib/*
15 | \.sass-cache
16 | package.js
17 | <<<<<<< HEAD
18 | =======
19 | /.sass-cache/
20 | >>>>>>> xtuple
21 |
--------------------------------------------------------------------------------
/enyo-client/extensions/tools/deploy.bat:
--------------------------------------------------------------------------------
1 | @REM don't watch the sausage being made
2 | @ECHO OFF
3 |
4 | REM the folder this script is in (*/bootplate/tools)
5 | SET TOOLS=%~DP0
6 |
7 | REM enyo location
8 | SET ENYO=%TOOLS%\..\enyo
9 |
10 | REM deploy script location
11 | SET DEPLOY=%ENYO%\tools\deploy.js
12 |
13 | REM node location
14 | SET NODE=node.exe
15 |
16 | REM use node to invoke deploy.js with imported parameters
17 | %NODE% "%DEPLOY%" %*
--------------------------------------------------------------------------------
/foundation-database/public/functions/todoitemmovedown.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION todoItemMoveDown(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | ptodoItemId ALIAS FOR $1;
7 | BEGIN
8 | RETURN todoItemMove(ptodoItemId, 1); -- move toward end of list
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
12 |
--------------------------------------------------------------------------------
/node-datasource/lib/query/npm-shrinkwrap.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "xtuple-query",
3 | "version": "1.0.0",
4 | "dependencies": {
5 | "congruence": {
6 | "version": "1.2.3",
7 | "from": "congruence@1.2.3"
8 | },
9 | "moment": {
10 | "version": "2.4.0",
11 | "from": "moment@~2.4.0"
12 | },
13 | "underscore": {
14 | "version": "1.5.2",
15 | "from": "underscore@~1.5.2"
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_margin.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_margin(quitem) returns numeric stable as $$
2 | select round(xt.quote_line_extended_price($1) - (
3 | currtocurr(basecurrid(), quhead_curr_id, $1.quitem_unitcost, quhead_quotedate) *
4 | $1.quitem_qtyord * $1.quitem_qty_invuomratio / $1.quitem_price_invuomratio), 2)
5 | from quhead where quhead_id = $1.quitem_quhead_id;
6 | $$ language sql;
7 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/models/startup.js:
--------------------------------------------------------------------------------
1 | (function () {
2 | "use strict";
3 |
4 | XT.extensions.billing.initStartup = function () {
5 | XT.cacheCollection("XM.bankAccountRelations", "XM.BankAccountRelationCollection");
6 | XT.cacheCollection("XM.customerEmailProfiles", "XM.CustomerEmailProfileCollection");
7 | XT.cacheCollection("XM.incidentCategories", "XM.IncidentCategoryCollection");
8 | };
9 |
10 | }());
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatboolyn.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatBoolYN(BOOLEAN) RETURNS TEXT IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE pBool ALIAS FOR $1;
6 | BEGIN
7 | IF (pBool) THEN
8 | RETURN ''Yes'';
9 | ELSE
10 | RETURN ''No'';
11 | END IF;
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/markapcheckasposted.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION markAPCheckASPosted(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''markAPCheckAsPosted() is deprecated - use markCheckAsPosted() instead'';
6 | RETURN markCheckAsPosted($1);
7 |
8 | END;
9 | ' LANGUAGE 'plpgsql';
10 |
--------------------------------------------------------------------------------
/lib/backbone-x/source/package.js:
--------------------------------------------------------------------------------
1 | var depends = (typeof enyo !== 'undefined') ? enyo.depends : X.depends;
2 | depends(
3 | "ext",
4 | "core.js",
5 | "model_mixin.js",
6 | "model.js",
7 | "view.js",
8 | "simple_model.js",
9 | "collection.js",
10 | "static.js",
11 | "document.js",
12 | "info.js",
13 | "comment.js",
14 | "characteristic.js",
15 | "alarm.js",
16 | "settings.js",
17 | "workflow.js",
18 | "router.js"
19 | );
20 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/functions/uuid_generate_v4.sql:
--------------------------------------------------------------------------------
1 | /**
2 | Generate a universally unique identifier.
3 |
4 | @returns {text}
5 | */
6 | create or replace function xt.uuid_generate_v4() returns uuid as $$
7 |
8 | /* TODO: Consider using uuid-ossp extension instead. */
9 | /* http://www.postgresql.org/docs/9.1/static/uuid-ossp.html */
10 | /* CREATE EXTENSION "uuid-ossp"; */
11 |
12 | return XT.generateUUID();
13 |
14 | $$ language plv8;
15 |
--------------------------------------------------------------------------------
/enyo-client/database/source/populate_data.js:
--------------------------------------------------------------------------------
1 | module.exports = [
2 | {"nameSpace":"XM","type":"Customer","id":"TTOYS","patches":[{"op":"add","path":"/creditCards/0","value":{"isActive":true,"name":"John Brown","address1":"123 Test St","address2":"","city":"Norfolk","country":"United States","state":"VA","zip":"23517","creditCardType":"V","number":"4111111111111111","monthExpired":"12","yearExpired":"2020"}}],"binaryField":null,"requery":false,"encoding":"rjson"}
3 | ];
4 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteunusedclasscodes.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteUnusedClassCodes() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | DELETE FROM classcode
7 | WHERE (classcode_id NOT IN (SELECT DISTINCT item_classcode_id FROM item));
8 |
9 | RETURN 0;
10 |
11 | END;
12 | $$ LANGUAGE 'plpgsql';
13 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchglsequence.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION fetchGLSequence() RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | _sequence INTEGER;
7 |
8 | BEGIN
9 |
10 | SELECT NEXTVAL(''gltrans_sequence_seq'') INTO _sequence;
11 | RETURN _sequence;
12 |
13 | END;
14 | ' LANGUAGE 'plpgsql';
15 |
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatbytea.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatbytea(bytea)
2 | RETURNS text AS
3 | '
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 | DECLARE
7 | pField ALIAS FOR $1;
8 | output_field TEXT;
9 |
10 | BEGIN
11 |
12 | output_field := pField;
13 |
14 | RETURN output_field;
15 |
16 | END;
17 | '
18 | LANGUAGE 'plpgsql';
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/replaceallvoidedapchecks.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION replaceAllVoidedAPChecks(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE ''replaceAllVoidedAPChecks() is deprecated - use replaceAllVoidedChecks() instead'';
6 | RETURN replaceAllVoidedChecks($1);
7 | END;
8 | ' LANGUAGE 'plpgsql';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/types/seqiss.sql:
--------------------------------------------------------------------------------
1 | CREATE FUNCTION tmpcreateTypeSeqiss() RETURNS VOID AS $$
2 | BEGIN
3 | BEGIN
4 | CREATE TYPE seqiss AS (
5 | seqiss_number INTEGER,
6 | seqiss_time TIMESTAMP WITH TIME ZONE
7 | );
8 | EXCEPTION WHEN OTHERS THEN
9 | RAISE NOTICE 'Type seqiss already exists';
10 | END;
11 | END;
12 | $$ LANGUAGE PLPGSQL;
13 |
14 | SELECT tmpcreateTypeSeqiss();
15 | DROP FUNCTION tmpcreateTypeSeqiss();
16 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_allocated_credit.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_allocated_credit(cohead) returns numeric stable as $$
2 | SELECT COALESCE(SUM(currToCurr(aropenalloc_curr_id, $1.cohead_curr_id,
3 | aropenalloc_amount, $1.cohead_orderdate)),0) AS amount
4 | FROM aropenalloc, aropen
5 | WHERE ( (aropenalloc_doctype='S')
6 | AND (aropenalloc_doc_id=$1.cohead_id)
7 | AND (aropenalloc_aropen_id=aropen_id) );
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/invc_allocated_credit.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.invc_allocated_credit(id integer, curr_id integer, order_date date) returns numeric stable as $$
2 | SELECT COALESCE(SUM(currToCurr(aropenalloc_curr_id, $2,
3 | aropenalloc_amount, $3)),0) AS amount
4 | FROM aropenalloc, aropen
5 | WHERE ( (aropenalloc_doctype='I')
6 | AND (aropenalloc_doc_id=$1)
7 | AND (aropenalloc_aropen_id=aropen_id) );
8 | $$ language sql;
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/clearpayment.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION clearPayment(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pApselectid ALIAS FOR $1;
7 |
8 | BEGIN
9 |
10 | DELETE FROM apselect
11 | WHERE (apselect_id=pApselectid);
12 |
13 | RETURN 1;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/noneg.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION noNeg(NUMERIC) RETURNS NUMERIC IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pValue ALIAS FOR $1;
7 |
8 | BEGIN
9 |
10 | IF (pValue < 0) THEN
11 | RETURN 0;
12 | ELSE
13 | RETURN pValue;
14 | END IF;
15 |
16 | END;
17 | ' LANGUAGE 'plpgsql';
18 |
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/nopos.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION noPos(NUMERIC) RETURNS NUMERIC IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pValue ALIAS FOR $1;
7 |
8 | BEGIN
9 |
10 | IF (pValue > 0) THEN
11 | RETURN 0;
12 | ELSE
13 | RETURN pValue;
14 | END IF;
15 |
16 | END;
17 | ' LANGUAGE 'plpgsql';
18 |
19 |
--------------------------------------------------------------------------------
/enyo-client/application/api/assets/manifest.json:
--------------------------------------------------------------------------------
1 | [
2 | {"name": "enyo", "path": "../enyo/source"},
3 | {"name": "layout/fittable", "path": "../lib/layout/fittable"},
4 | {"name": "layout/list", "path": "../lib/layout/list"},
5 | {"name": "layout/panels", "path": "../lib/layout/panels"},
6 | {"name": "layout/slideable", "path": "../lib/layout/slideable"},
7 | {"name": "layout/tree", "path": "../lib/layout/tree"},
8 | {"name": "onyx", "path": "../lib/onyx"}
9 | ]
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cntctrestore.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cntctrestore(contact_id integer) returns boolean as $$
2 | /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | See www.xtuple.com/CPAL for the full text of the software license. */
4 |
5 | XT.allowEditComments = true;
6 | plv8.execute('select public.cntctrestore($1);', [contact_id]);
7 | XT.allowEditComments = false;
8 | return true;
9 |
10 | $$ language plv8;
11 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/sessionstore.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('sessionstore');
4 | select xt.add_column('sessionstore','sessionstore_id', 'text', 'primary key');
5 | select xt.add_column('sessionstore','sessionstore_session', 'text');
6 |
7 | comment on table xt.sessionstore is 'These ARE NOT VALID SESSIONS, see xt.ession for that. node-datasource Express Session Store. By default, this is stored in memory, we persist it to db here.';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/adjustments.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION adjustments(TEXT) RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTransType ALIAS FOR $1;
6 |
7 | BEGIN
8 | IF (pTransType IN (''CC'', ''AD'')) THEN
9 | RETURN TRUE;
10 | ELSE
11 | RETURN FALSE;
12 | END IF;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/issues.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION issues(TEXT) RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTransType ALIAS FOR $1;
6 |
7 | BEGIN
8 | IF (pTransType IN (''IM'', ''IB'', ''IT'')) THEN
9 | RETURN TRUE;
10 | ELSE
11 | RETURN FALSE;
12 | END IF;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/scraps.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION scraps(TEXT) RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTransType ALIAS FOR $1;
6 |
7 | BEGIN
8 | IF (pTransType IN (''SI'', ''SM'', ''EX'')) THEN
9 | RETURN TRUE;
10 | ELSE
11 | RETURN FALSE;
12 | END IF;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/lib/backbone-x/source/core.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, trailing:true,
3 | white:true*/
4 | /*global XM:true, jsonpatch:true */
5 |
6 | (function () {
7 | /**
8 | XM is the global namespace for all the "xTuple Models" defined in
9 | backbone-x and elsewhere
10 |
11 | @namespace XM
12 | */
13 | XM = {};
14 | XM.jsonpatch = jsonpatch;
15 |
16 | }());
17 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/usrext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('usrext');
2 |
3 | select xt.add_column('usrext','usrext_id', 'serial', 'primary key');
4 | select xt.add_column('usrext','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'xt');
5 | select xt.add_column('usrext','usrext_usr_username', 'text');
6 | select xt.add_column('usrext','usrext_ext_id', 'integer', 'references xt.ext (ext_id)');
7 |
8 | comment on table xt.usrext is 'Associations of users with extensions';
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/createfile.sql:
--------------------------------------------------------------------------------
1 | create or replace function createFile(text, text, bytea) returns integer as $$
2 | declare
3 | pTitle ALIAS FOR $1;
4 | pDescription ALIAS FOR $2;
5 | pStream ALIAS FOR $3;
6 | _id integer;
7 | begin
8 | _id := nextval('file_file_id_seq');
9 | insert into file (file_id, file_title, file_descrip, file_stream) values (_id, pTitle, pDescription, pStream);
10 | return _id;
11 | end;
12 | $$ language 'plpgsql';
13 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletebudgetitems.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION deleteBudgetItems(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pBudgheadid ALIAS FOR $1;
7 |
8 | BEGIN
9 | DELETE FROM budgitem WHERE (budgitem_budghead_id=pBudgheadid);
10 |
11 | RETURN pBudgheadid;
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/detag.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION detag(TEXT) RETURNS TEXT IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pSource ALIAS FOR $1;
7 | _result TEXT := '';
8 |
9 | BEGIN
10 | SELECT regexp_replace(pSource, E'<[^>]*>', '', 'g') INTO _result;
11 | RETURN _result;
12 | END;
13 | $$ LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/custcustemlprofile.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('custcustemlprofile');
4 | select xt.add_column('custcustemlprofile','custcustemlprofile_cust_id', 'integer', 'primary key');
5 | select xt.add_column('custcustemlprofile','custcustemlprofile_custemlprofile_id', 'integer', 'references xt.custemlprofile (emlprofile_id)');
6 |
7 | comment on table xt.custcustemlprofile is 'Core table links customers to customer email profiles';
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/views/receivable.js:
--------------------------------------------------------------------------------
1 | XT.extensions.billing.initReceivableView = function () {
2 |
3 | var model = 'XM.Receivable';
4 |
5 | /**
6 | View of Receivable business object.
7 | @class XM.ReceivableView
8 | @extends XM.EnyoView
9 | @model XM.Receivable
10 | */
11 | XM.ReceivableView = XM.EnyoView.extend({
12 |
13 | events: {
14 | 'statusChange': 'onStatusChange'
15 | }
16 |
17 | });
18 | };
19 |
20 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/tables/poheadext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('poheadext');
2 |
3 | select xt.add_column('poheadext','poheadext_id', 'integer', 'primary key');
4 | select xt.add_column('poheadext','poheadext_potype_id', 'integer');
5 | select xt.add_constraint('poheadext', 'poheadext_potype_id_fkey', 'foreign key (poheadext_potype_id) references xt.potype (potype_id)');
6 |
7 | comment on table xt.poheadext is 'Purchase Order extension table';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/changeprqty.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION changePrQty(INTEGER, NUMERIC) RETURNS BOOL AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pPrid ALIAS FOR $1;
6 | pQty ALIAS FOR $2;
7 |
8 | BEGIN
9 |
10 | UPDATE pr
11 | SET pr_qtyreq=pQty
12 | WHERE (pr_id=pPrid);
13 |
14 | RETURN TRUE;
15 |
16 | END;
17 | ' LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/createrecurringinvoices.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION createRecurringInvoices() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 | RAISE NOTICE 'createRecurringInvoices() has been deprecated; use createRecurringItems(NULL, ''I'') instead.';
6 |
7 | RETURN createRecurringItems(NULL, 'I');
8 | END;
9 | $$ LANGUAGE 'plpgsql';
10 |
--------------------------------------------------------------------------------
/node-datasource/routes/vcfExport.js:
--------------------------------------------------------------------------------
1 | /*jshint node:true, indent:2, curly:false, eqeqeq:true, immed:true, latedef:true, newcap:true, noarg:true,
2 | regexp:true, undef:true, strict:true, trailing:true, white:true */
3 | /*global X:true */
4 |
5 |
6 | (function () {
7 | "use strict";
8 |
9 | exports.vcfExport = function (req, res) {
10 | var fs = require('fs');
11 |
12 | res.attachment("exportedContact.vcf");
13 | res.send(req.query.stringToSave);
14 | };
15 | }());
16 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/database/source/xt/views/cashrcpt.sql:
--------------------------------------------------------------------------------
1 | /**
2 | * @alias XM.CashReceiptLinePending
3 | *
4 | * Return only XM.CashReceiptLine items that are pending, i.e.
5 | * cashrcpt_posted = false.
6 | */
7 | select xt.create_view('xt.cashrcptitem_pending', $$
8 |
9 | select *
10 |
11 | from
12 | cashrcptitem
13 | inner join cashrcpt on (cashrcptitem_cashrcpt_id = cashrcpt_id)
14 |
15 | where
16 | not cashrcpt_posted;
17 |
18 | $$);
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteunusedfreightclasses.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteUnusedFreightClasses() RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | DELETE FROM freightclass
7 | WHERE (freightclass_id NOT IN (SELECT DISTINCT COALESCE(item_freightclass_id, 0) FROM item));
8 |
9 | RETURN 0;
10 |
11 | END;
12 | $$ LANGUAGE 'plpgsql';
13 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/explodewoeffective.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION explodeWoEffective() RETURNS TEXT AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _value TEXT;
6 |
7 | BEGIN
8 |
9 | SELECT metric_value INTO _value
10 | FROM metric
11 | WHERE (metric_name=''ExplodeWOEffective'');
12 |
13 | RETURN _value;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/hasevents.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION hasEvents() RETURNS BOOLEAN AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | BEGIN
6 |
7 | PERFORM evntlog_id
8 | FROM evntlog
9 | WHERE ( (evntlog_dispatched IS NULL)
10 | AND (evntlog_username=getEffectiveXtUser()) )
11 | LIMIT 1;
12 | RETURN FOUND;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/markcheckasposted.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION markCheckASPosted(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pCheckid ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | UPDATE checkhead
10 | SET checkhead_posted=TRUE
11 | WHERE (checkhead_id=pCheckid);
12 |
13 | RETURN 1;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/markcheckasprinted.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION markCheckAsPrinted(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pCheckid ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | UPDATE checkhead
10 | SET checkhead_printed=TRUE
11 | WHERE (checkhead_id=pCheckid);
12 |
13 | RETURN 1;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/shipments.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION shipments(TEXT) RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTransType ALIAS FOR $1;
6 |
7 | BEGIN
8 | IF (pTransType IN (''SC'', ''SV'', ''SH'', ''RS'', ''TS'')) THEN
9 | RETURN TRUE;
10 | ELSE
11 | RETURN FALSE;
12 | END IF;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-restore.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: restore
3 | -- Notes: Restore a contact that was previously merged
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT cntctrestore(cntctmrgd_cntct_id) AS result
8 | FROM cntctmrgd
9 | if exists("cntct_id") ?>
10 | WHERE (cntctmrgd_cntct_id= value("cntct_id") ?>)
11 | endif ?>
12 | ;
13 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/incdtcatemlprofile.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('incdtcatemlprofile');
4 | select xt.add_column('incdtcatemlprofile','incdtcatemlprofile_incdtcat_id', 'integer', 'primary key');
5 | select xt.add_column('incdtcatemlprofile','incdtcatemlprofile_incdtemlprofile_id', 'integer', 'references xt.incdtemlprofile (emlprofile_id)');
6 |
7 | comment on table xt.incdtcatemlprofile is 'Core table links incident categories to incident email profiles';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/receipts.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION receipts(TEXT) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTransType ALIAS FOR $1;
6 |
7 | BEGIN
8 | IF (pTransType IN ('RM', 'RB', 'RT', 'RP', 'RR', 'RX', 'TR')) THEN
9 | RETURN TRUE;
10 | ELSE
11 | RETURN FALSE;
12 | END IF;
13 |
14 | END;
15 | $$ LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/woeffectivedate.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION woEffectiveDate(DATE) RETURNS DATE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pStartDate ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | IF (explodeWoEffective() = ''E'') THEN
10 | RETURN CURRENT_DATE;
11 | ELSE
12 | RETURN pStartDate;
13 | END IF;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/grpext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('grpext');
2 |
3 | select xt.add_column('grpext','grpext_id', 'serial', 'primary key');
4 | select xt.add_column('grpext','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'xt');
5 | select xt.add_column('grpext','grpext_grp_id', 'integer', 'references grp (grp_id)');
6 | select xt.add_column('grpext','grpext_ext_id', 'integer', 'references xt.ext (ext_id)');
7 |
8 | comment on table xt.grpext is 'Associations of groups with extensions';
9 |
--------------------------------------------------------------------------------
/lib/tools/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Steve Hackbarth ",
3 | "name": "tools",
4 | "description": "Javascript tools for xTuple",
5 | "version": "1.0.0",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/xtuple/tools.git"
9 | },
10 | "dependencies": {},
11 | "devDependencies": {},
12 | "optionalDependencies": {},
13 | "engines": {
14 | "node": "*"
15 | },
16 | "main": "source/package.js",
17 | "scripts": {}
18 | }
19 |
--------------------------------------------------------------------------------
/enyo-client/database/source/delete_system_orms.sql:
--------------------------------------------------------------------------------
1 | do $$
2 | /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | See www.xtuple.com/CPAL for the full text of the software license. */
4 |
5 | plv8.execute("select xt.js_init();");
6 | plv8.execute("alter table xt.orm disable trigger orm_did_change;");
7 | plv8.execute("delete from xt.orm where orm_json ~ '\"isSystem\":true';");
8 | plv8.execute("alter table xt.orm enable trigger orm_did_change;");
9 |
10 | $$ language plv8;
11 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/co_line_tax.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.co_line_tax(coitem) returns numeric stable as $$
2 | select round(coalesce(sum(tax),0),6)
3 | from (
4 | select (calculatetaxdetail(
5 | cohead_taxzone_id,
6 | $1.coitem_taxtype_id,
7 | cohead_orderdate,
8 | cohead_curr_id,
9 | xt.co_line_extended_price($1))).taxdetail_tax as tax
10 | from cohead
11 | where cohead_id = $1.coitem_cohead_id) data;
12 | $$ language sql;
13 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/firstline.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION firstLine(TEXT) RETURNS TEXT IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pSource ALIAS FOR $1;
7 | _result TEXT := '';
8 |
9 | BEGIN
10 | SELECT regexp_replace(pSource, E'^(\r?\n)*([^\r\n]*)\r?\n.*', E'\\2') INTO _result;
11 | RETURN _result;
12 | END;
13 | $$ LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/getfreighttaxtypeid.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION getFreightTaxTypeId() RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _taxtypeid INTEGER;
6 | BEGIN
7 | SELECT taxtype_id
8 | INTO _taxtypeid
9 | FROM taxtype
10 | WHERE (taxtype_name=''Freight'');
11 |
12 | RETURN _taxtypeid;
13 | END;
14 | ' LANGUAGE 'plpgsql' IMMUTABLE;
15 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/taxpay.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('taxpay', 'public');
2 | select xt.add_column('taxpay','taxpay_id', 'SERIAL', 'PRIMARY KEY', 'public');
3 | select xt.add_column('taxpay','taxpay_taxhist_id', 'INTEGER', 'NOT NULL', 'public');
4 | select xt.add_column('taxpay','taxpay_apply_id', 'INTEGER', 'NOT NULL', 'public');
5 | select xt.add_column('taxpay','taxpay_distdate', 'DATE', 'NOT NULL', 'public');
6 | select xt.add_column('taxpay','taxpay_tax', 'NUMERIC', 'NOT NULL', 'public');
7 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/change_password.sql:
--------------------------------------------------------------------------------
1 | drop function if exists xt.change_password(text);
2 |
3 | create or replace function xt.change_password(creds text) returns boolean volatile as $$
4 | var parsedObj = JSON.parse(creds),
5 | username = parsedObj.username,
6 | password = parsedObj.password,
7 | escapedSql = XT.format('alter user %I with password %L', [username, password]);
8 |
9 | plv8.execute(escapedSql);
10 |
11 | return true;
12 |
13 | $$ language plv8;
14 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/quote_line_tax.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.quote_line_tax(quitem) returns numeric stable as $$
2 | select round(coalesce(sum(tax),0),6)
3 | from (
4 | select (calculatetaxdetail(
5 | quhead_taxzone_id,
6 | $1.quitem_taxtype_id,
7 | quhead_quotedate,
8 | quhead_curr_id,
9 | xt.quote_line_extended_price($1))).taxdetail_tax as tax
10 | from quhead
11 | where quhead_id = $1.quitem_quhead_id) data;
12 | $$ language sql;
--------------------------------------------------------------------------------
/enyo-client/extensions/source/billing/client/less/cash_receipt.less:
--------------------------------------------------------------------------------
1 | .xv-list .xv-model-decorator > .xv-list-item {
2 |
3 | .xv-list-column {
4 |
5 | &.xv-list-attr {
6 |
7 | &.xm-attribute-bankAccount-name {
8 | text-align: right;
9 | }
10 |
11 | &.xm-attribute-posted {
12 |
13 | font-weight: bold;
14 | color: blue;
15 |
16 | &.isPosted {
17 | color: #AAA;
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/trigger_functions/itemsrc_did_change.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.itemsrc_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. */
4 |
5 | if (!NEW.itemsrc_vend_item_number || NEW.itemsrc_vend_item_number.length === 0) {
6 | throw "Vendor Item Number is required."
7 | }
8 |
9 | return NEW;
10 |
11 | $$ language plv8;
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatsonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION formatSoNumber(INTEGER) RETURNS TEXT AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | SELECT COALESCE((SELECT (text(cohead_number) || '-' || formatSoLineNumber(coitem_id))
5 | FROM coitem JOIN cohead ON (coitem_cohead_id=cohead_id)
6 | WHERE (coitem_id=($1))),'DELETED');
7 | $$ LANGUAGE 'sql' STABLE;
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/getprjaccntid.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION getPrjAccntId(INTEGER, INTEGER) RETURNS INTEGER IMMUTABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pPrjid ALIAS FOR $1;
6 | pAccntid ALIAS FOR $2;
7 |
8 | BEGIN
9 | -- Project Accounting is required to fully implement this functionality
10 | RETURN pAccntId;
11 | END;
12 | $$ LANGUAGE 'plpgsql';
13 |
--------------------------------------------------------------------------------
/foundation-database/public/types/taxassign.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('FUNCTION', 'taxassignments(integer,integer)');
2 | SELECT dropIfExists('TYPE', 'taxassign');
3 |
4 | CREATE TYPE taxassign AS
5 | (taxassign_taxzone_id integer,
6 | taxassign_taxtype_id integer,
7 | taxassign_level integer,
8 | taxassign_zone_code "text",
9 | taxassign_type_descrip "text",
10 | taxassign_taxclass_code "text",
11 | taxassign_taxclass_sequence integer);
12 | ALTER TYPE taxassign OWNER TO "admin";
13 |
--------------------------------------------------------------------------------
/lib/orm/source/xt/tables/ext.sql:
--------------------------------------------------------------------------------
1 | -- table definition
2 |
3 | select xt.create_table('ext');
4 | select xt.add_column('ext','ext_id', 'serial', 'primary key');
5 | select xt.add_column('ext','ext_name', 'text');
6 | select xt.add_column('ext','ext_descrip', 'text');
7 | select xt.add_column('ext','ext_location', 'text');
8 | select xt.add_column('ext','ext_notes', 'text');
9 | select xt.add_column('ext','ext_load_order', 'integer', 'not null default 99999');
10 |
11 | comment on table xt.ext is 'Extensions';
12 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/attachcontact.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION attachContact(INTEGER, INTEGER) RETURNS INTEGER AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pcntctId ALIAS FOR $1;
7 | pcrmacctId ALIAS FOR $2;
8 | BEGIN
9 | UPDATE cntct SET cntct_crmacct_id = pcrmacctId
10 | WHERE cntct_id = pcntctId;
11 |
12 | RETURN 0;
13 | END;
14 | $$ LANGUAGE 'plpgsql';
15 |
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/calcpurchaseorderduedate.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION calcPurchaseOrderDueDate(pPoheadid INTEGER) RETURNS DATE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _result DATE;
6 | BEGIN
7 |
8 | SELECT MIN(poitem_duedate) INTO _result
9 | FROM poitem
10 | WHERE (poitem_pohead_id=pPoheadid);
11 |
12 | RETURN _result;
13 |
14 | END;
15 | $$ LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/fetchmetrictext.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION FetchMetricText(text) RETURNS TEXT STABLE AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _pMetricName ALIAS FOR $1;
6 | _returnVal TEXT;
7 | BEGIN
8 | SELECT metric_value::TEXT INTO _returnVal
9 | FROM metric
10 | WHERE metric_name = _pMetricName;
11 | RETURN _returnVal;
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatwonumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatWoNumber(integer) RETURNS TEXT IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pWoid ALIAS FOR $1;
7 |
8 | BEGIN
9 |
10 | RETURN ( SELECT (wo_number::TEXT || ''-'' || wo_subnumber::TEXT)
11 | FROM wo
12 | WHERE (wo_id=pWoid) );
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/getsostatus.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION getSoStatus(INTEGER) RETURNS CHAR(1) AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pCoheadid ALIAS FOR $1;
6 | _result char(1);
7 |
8 | BEGIN
9 |
10 | SELECT cohead_status INTO _result
11 | FROM cohead
12 | WHERE (cohead_id=pCoheadid);
13 |
14 | RETURN _result;
15 |
16 | END;
17 | $$ LANGUAGE 'plpgsql' STABLE;
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/intervaltominutes.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION intervalToMinutes(INTERVAL) RETURNS NUMERIC AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | SELECT (EXTRACT(DAY FROM $1) * 24 * 60 +
6 | EXTRACT(HOUR FROM $1) * 60 +
7 | EXTRACT(MINUTE FROM $1) +
8 | ROUND((EXTRACT(SECOND FROM $1) / 60)::NUMERIC, 4))::NUMERIC AS result
9 | $$ LANGUAGE 'sql';
10 |
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletefile.sql:
--------------------------------------------------------------------------------
1 | create or replace function deleteFile(integer) returns boolean as $$
2 | declare
3 | pId ALIAS FOR $1;
4 | begin
5 | delete from file
6 | where ( file_id in (
7 | select file_id
8 | from file
9 | join docass on (docass_target_id=file_id)
10 | and (docass_target_type='FILE')
11 | where ( docass_id = pId ) ) );
12 |
13 | delete from docass where docass_id = pId;
14 |
15 | return true;
16 | end;
17 | $$ language 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteqryhead.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteQryhead(INTEGER) RETURNS INTEGER AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pqryheadid ALIAS FOR $1;
6 |
7 | BEGIN
8 | DELETE FROM qryitem WHERE (qryitem_qryhead_id=pqryheadid);
9 | DELETE FROM qryhead WHERE (qryhead_id=pqryheadid);
10 |
11 | RETURN pqryheadid;
12 | END;
13 | $$
14 | LANGUAGE 'plpgsql';
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteurl.sql:
--------------------------------------------------------------------------------
1 | create or replace function deleteUrl(integer) returns boolean as $$
2 | declare
3 | pId ALIAS FOR $1;
4 | begin
5 | delete from urlinfo
6 | where ( url_id in (
7 | select url_id
8 | from urlinfo
9 | join docass on (docass_target_id=url_id)
10 | and (docass_target_type='URL')
11 | where ( docass_id = pId ) ) );
12 |
13 | delete from docass where docass_id = pId;
14 |
15 | return true;
16 | end;
17 | $$ language 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatcreditmemonumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatCreditMemoNumber(INTEGER) RETURNS TEXT IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pCmheadid ALIAS FOR $1;
7 |
8 | BEGIN
9 | RETURN ( SELECT COALESCE(cmhead_number::TEXT, '''')
10 | FROM cmhead
11 | WHERE (cmhead_id=pCmheadid) );
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatinvcnumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatInvcNumber(INTEGER) RETURNS TEXT IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pCobmiscid ALIAS FOR $1;
7 |
8 | BEGIN
9 | RETURN ( SELECT COALESCE(cobmisc_invcnumber::TEXT, '''')
10 | FROM cobmisc
11 | WHERE (cobmisc_id=pCobmiscid) );
12 | END;
13 | ' LANGUAGE 'plpgsql';
14 |
15 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/last_agg.sql:
--------------------------------------------------------------------------------
1 |
2 | -- Create a function that always returns the last non-NULL item
3 | CREATE OR REPLACE FUNCTION public.last_agg ( anyelement, anyelement )
4 | RETURNS anyelement AS $$
5 | SELECT $2;
6 | $$ LANGUAGE SQL STABLE;
7 |
8 | -- And then wrap an aggreagate around it
9 | DROP AGGREGATE public.last(anyelement);
10 | CREATE AGGREGATE public.last (
11 | sfunc = public.last_agg,
12 | basetype = anyelement,
13 | stype = anyelement
14 | );
15 |
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postpogltransactions.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postPoGLTransactions() RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | UPDATE gltrans
7 | SET gltrans_exported=TRUE
8 | WHERE ( (NOT gltrans_exported)
9 | AND (gltrans_source=''A/P'')
10 | AND (gltrans_doctype IN (''VO'')) );
11 |
12 | RETURN TRUE;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/cntctmerge.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.cntctmerge(source_id integer, target_id integer, purge boolean) returns boolean as $$
2 | /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | See www.xtuple.com/CPAL for the full text of the software license. */
4 |
5 | XT.allowEditComments = true;
6 | plv8.execute('select public.cntctmerge($1, $2, $3);', [source_id, target_id, purge]);
7 | XT.allowEditComments = false;
8 | return true;
9 |
10 | $$ language plv8;
11 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletebudget.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION deleteBudget(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pBudgheadid ALIAS FOR $1;
7 |
8 | BEGIN
9 | DELETE FROM budgitem WHERE (budgitem_budghead_id=pBudgheadid);
10 | DELETE FROM budghead WHERE (budghead_id=pBudgheadid);
11 |
12 | RETURN pBudgheadid;
13 | END;
14 | ' LANGUAGE 'plpgsql';
15 |
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/formatshipmentnumber.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION formatShipmentNumber(INTEGER) RETURNS TEXT IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pshipheadid ALIAS FOR $1;
7 | BEGIN
8 | RETURN ( SELECT COALESCE(shiphead_number::TEXT, '''')
9 | FROM shiphead
10 | WHERE (shiphead_id=pshipheadid) );
11 | END;
12 | ' LANGUAGE 'plpgsql';
13 |
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/getadjustmenttaxtypeid.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION getadjustmenttaxtypeid()
2 | RETURNS integer AS
3 | $$
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 | DECLARE
7 | _taxtypeid INTEGER;
8 | BEGIN
9 | SELECT taxtype_id
10 | INTO _taxtypeid
11 | FROM taxtype
12 | WHERE (taxtype_name='Adjustment');
13 |
14 | RETURN _taxtypeid;
15 | END;
16 | $$
17 | LANGUAGE 'plpgsql' IMMUTABLE;
18 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/contactmerge-merge.mql:
--------------------------------------------------------------------------------
1 | -- Group: contactmerge
2 | -- Name: merge
3 | -- Notes: Merge contact selections
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT cntctmerge(
8 | src.cntctsel_cntct_id,
9 | trgt.cntctsel_cntct_id,
10 | value("purge") ?>::boolean) AS result
11 | FROM cntctsel src, cntctsel trgt
12 | WHERE ((trgt.cntctsel_target)
13 | AND (NOT src.cntctsel_target));
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletecreditmemo.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteCreditMemo(INTEGER) RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pCmheadid ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | DELETE FROM cmitem
10 | WHERE (cmitem_cmhead_id=pCmheadid);
11 |
12 | DELETE FROM cmhead
13 | WHERE (cmhead_id=pCmheadid);
14 |
15 | RETURN TRUE;
16 |
17 | END;
18 | ' LANGUAGE 'plpgsql';
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/numofserverusers.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION numOfServerUsers() RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | _count INTEGER;
7 |
8 | BEGIN
9 |
10 | SELECT COUNT(*) INTO _count
11 | FROM pg_stat_activity;
12 | IF (_count IS NULL) THEN
13 | _count := 0;
14 | END IF;
15 |
16 | RETURN _count;
17 |
18 | END;
19 | ' LANGUAGE 'plpgsql';
20 |
21 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/postsogltransactions.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION postSoGLTransactions() RETURNS BOOLEAN AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | UPDATE gltrans
7 | SET gltrans_exported=TRUE
8 | WHERE ( (NOT gltrans_exported)
9 | AND (gltrans_source=''A/R'')
10 | AND (gltrans_doctype IN (''IN'', ''CM'')) );
11 |
12 | RETURN TRUE;
13 |
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/qtyreserved.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION qtyReserved(INTEGER) RETURNS NUMERIC AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/EULA for the full text of the software license.
4 | DECLARE
5 | pItemsiteid ALIAS FOR $1;
6 | _qty NUMERIC;
7 |
8 | BEGIN
9 |
10 | SELECT COALESCE(SUM(coitem_qtyreserved),0) INTO _qty
11 | FROM coitem
12 | WHERE(coitem_itemsite_id=pItemsiteid);
13 |
14 | RETURN _qty;
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/revokegroup.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION revokeGroup(TEXT, INTEGER) RETURNS BOOL AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pUsername ALIAS FOR $1;
6 | pGrpid ALIAS FOR $2;
7 |
8 | BEGIN
9 |
10 | DELETE FROM usrgrp
11 | WHERE ( (usrgrp_username=pUsername)
12 | AND (usrgrp_grp_id=pGrpid) );
13 |
14 | RETURN TRUE;
15 |
16 | END;
17 | ' LANGUAGE 'plpgsql';
18 |
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/wostarted.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION wostarted(pWoid INTEGER) RETURNS BOOLEAN AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _result BOOLEAN := FALSE;
6 |
7 | BEGIN
8 | -- is it really this simple?
9 | SELECT (wo_wipvalue > 0) INTO _result
10 | FROM wo
11 | WHERE wo_id=pWoid;
12 |
13 | RETURN COALESCE(_result, FALSE);
14 | END;
15 | $$ LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/cntct.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('cntct','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('cntct', 'xt.obj');
4 | select xt.add_constraint('cntct', 'cntct_obj_uuid_id','unique(obj_uuid)', 'public');
5 |
6 | -- trigger
7 | drop trigger if exists cntct_owner_change on cntct;
8 | create trigger cntct_owner_change after insert on cntct for each row execute procedure xt.owner_record_did_change();
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/calctotalslipqty.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION calcTotalSlipQty(INTEGER) RETURNS NUMERIC AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pTagid ALIAS FOR $1;
6 | _qty NUMERIC := 0;
7 |
8 | BEGIN
9 |
10 | SELECT SUM(COALESCE(cntslip_qty, 0.0)) INTO _qty
11 | FROM cntslip
12 | WHERE (cntslip_cnttag_id=pTagid);
13 |
14 | RETURN _qty;
15 |
16 | END;
17 | $$ LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletetodoitem.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION deleteTodoItem(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | ptodoItemId ALIAS FOR $1;
7 | BEGIN
8 | DELETE FROM alarm WHERE ( (alarm_source=''TODO'') AND (alarm_source_id=ptodoItemId) );
9 | DELETE FROM todoitem WHERE todoitem_id = ptodoItemId;
10 | RETURN 0;
11 | END;
12 | ' LANGUAGE 'plpgsql';
13 |
14 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deleteuom.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteUOM(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pUomid ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | DELETE FROM uomconv WHERE uomconv_from_uom_id=pUomid;
10 | DELETE FROM uomconv WHERE uomconv_to_uom_id=pUomid;
11 | DELETE FROM uom WHERE uom_id=pUomid;
12 |
13 | RETURN 0;
14 | END;
15 | ' LANGUAGE 'plpgsql';
16 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/updatelistprice.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION updateListPrice(INTEGER, NUMERIC) RETURNS NUMERIC AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemid ALIAS FOR $1;
6 | pUpdateBy ALIAS FOR $2;
7 |
8 | BEGIN
9 |
10 | UPDATE item
11 | SET item_listprice = (item_listprice * pUpdateBy)
12 | WHERE (item_id=pItemid);
13 |
14 | RETURN 1;
15 |
16 | END;
17 | ' LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/localeext.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('localeext');
2 |
3 | select xt.add_column('localeext','localeext_id', 'integer', 'primary key');
4 | select xt.add_column('localeext','localeext_hours_scale', 'integer', 'default 2', 'xt');
5 |
6 | comment on table xt.localeext is 'Extension of locale table';
7 |
8 | insert into xt.localeext
9 | select locale_id, 2
10 | from locale
11 | where not exists (
12 | select localeext_id
13 | from xt.localeext
14 | where localeext_id=locale_id
15 | );
16 |
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/snoozemessage.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION snoozeMessage(INTEGER) RETURNS BOOLEAN AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pMsgid ALIAS FOR $1;
7 | snooze INTERVAL := ''10 minutes'';
8 |
9 | BEGIN
10 |
11 | UPDATE msg
12 | SET msg_scheduled=(msg_scheduled + snooze)
13 | WHERE (msg_id=pMsgid);
14 |
15 | RETURN TRUE;
16 |
17 | END;
18 | ' LANGUAGE 'plpgsql';
19 |
20 |
--------------------------------------------------------------------------------
/enyo-client/extensions/tools/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # the folder this script is in (*/bootplate/tools)
4 | TOOLS=$(cd `dirname $0` && pwd)
5 |
6 | # enyo location
7 | ENYO="$TOOLS/../enyo"
8 |
9 | # deploy script location
10 | DEPLOY="$ENYO/tools/deploy.js"
11 |
12 | # check for node, but quietly
13 | if command -v node >/dev/null 2>&1; then
14 | # use node to invoke deploy with imported parameters
15 | echo "enyo/tools/minify.sh args: " $@
16 | node $DEPLOY $@
17 | else
18 | echo "No node found in path"
19 | exit 1
20 | fi
21 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletebomworkset.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION deleteBOMWorkset(INTEGER) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pWorksetid ALIAS FOR $1;
6 |
7 | BEGIN
8 |
9 | -- All done with the bomwork set indicated by pWorksetid, delete all of it
10 | DELETE FROM bomwork
11 | WHERE (bomwork_set_id=pWorksetid);
12 |
13 | RETURN 1;
14 |
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/tonumeric.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION toNumeric(TEXT, NUMERIC) RETURNS NUMERIC IMMUTABLE AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pText ALIAS FOR $1;
7 | pDefault ALIAS FOR $2;
8 |
9 | BEGIN
10 |
11 | IF (isNumeric(pText)) THEN
12 | RETURN TO_NUMBER(pText, ''999999999999'');
13 | ELSE
14 | RETURN pDefault;
15 | END IF;
16 |
17 | END;
18 | ' LANGUAGE plpgsql;
19 |
20 |
--------------------------------------------------------------------------------
/foundation-database/public/tables/metasql/summarizedBankrecHistory-detail.mql:
--------------------------------------------------------------------------------
1 | -- Group: summarizedBankrecHistory
2 | -- Name: detail
3 | -- Notes: used by dspSummarizedBankrecHistory
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 |
7 | SELECT *,
8 | 'curr' AS bankrec_openbal_xtnumericrole,
9 | 'curr' AS bankrec_endbal_xtnumericrole
10 | FROM bankrec
11 | WHERE (bankrec_bankaccnt_id= value("bankaccntid") ?>)
12 | ORDER BY bankrec_created;
13 |
--------------------------------------------------------------------------------
/lib/enyo-x/source/views/listboard.js:
--------------------------------------------------------------------------------
1 | /*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
2 | latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
3 | trailing:true, white:true*/
4 | /*global XT:true, XM:true, XV:true, _:true, window: true, enyo:true, nv:true, d3:true, console:true */
5 |
6 | (function () {
7 |
8 | /**
9 | Base class for all Dashboards.
10 | */
11 | enyo.kind(
12 | /** @lends XV.Listboard */{
13 | name: "XV.Listboard",
14 | kind: "FittableRows",
15 | });
16 |
17 | }());
18 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/mergecrmaccts.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.mergecrmaccts(target_id integer, purge boolean) returns integer as $$
2 | /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | See www.xtuple.com/CPAL for the full text of the software license. */
4 |
5 | var result;
6 | XT.allowEditComments = true;
7 | result = plv8.execute('select public.mergecrmaccts($1, $2) as result;', [target_id, purge])[0].result;
8 | XT.allowEditComments = false;
9 | return result;
10 |
11 | $$ language plv8;
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/project/database/source/xt/tables/prjwf.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('prjwf', 'xt', false, 'xt.wf');
2 |
3 | select xt.add_constraint('prjwf', 'prjwf_pkey', 'primary key (wf_id)');
4 | select xt.add_constraint('prjwf', 'prjwf_wf_priority_id_fkey', 'foreign key (wf_priority_id) references incdtpriority (incdtpriority_id)');
5 | select xt.add_constraint('prjwf', 'prjwf_wf_parent_uuid_fkey', 'foreign key (wf_parent_uuid) references prj (obj_uuid) on delete cascade');
6 |
7 | comment on table xt.prjwf is 'Project workflow table';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/changeprdate.sql:
--------------------------------------------------------------------------------
1 | DROP FUNCTION IF EXISTS changeprdate(integer, date);
2 | CREATE OR REPLACE FUNCTION changePrDate(INTEGER, DATE) RETURNS INTEGER AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pPrid ALIAS FOR $1;
7 | pDueDate ALIAS FOR $2;
8 |
9 | BEGIN
10 |
11 | UPDATE pr
12 | SET pr_duedate=pDueDate
13 | WHERE (pr_id=pPrid);
14 |
15 | RETURN 0;
16 |
17 | END;
18 | $$ LANGUAGE 'plpgsql';
19 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/getquotescheddate.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION getQuoteSchedDate(INTEGER) RETURNS DATE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pQuheadid ALIAS FOR $1;
6 | _minscheddate DATE;
7 |
8 | BEGIN
9 |
10 | SELECT MIN(quitem_scheddate) INTO _minscheddate
11 | FROM quitem
12 | WHERE (quitem_quhead_id=pQuheadid);
13 |
14 | RETURN _minscheddate;
15 |
16 | END;
17 | $$ LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/trigger_functions/report.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION _reportTrigger () RETURNS TRIGGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | BEGIN
5 |
6 | NEW.report_loaddate = CURRENT_TIMESTAMP;
7 | RETURN NEW;
8 |
9 | END;
10 | ' LANGUAGE 'plpgsql';
11 |
12 | DROP TRIGGER IF EXISTS reportTrigger ON report;
13 | CREATE TRIGGER reportTrigger BEFORE INSERT OR UPDATE ON report FOR EACH ROW EXECUTE PROCEDURE _reportTrigger();
14 |
--------------------------------------------------------------------------------
/enyo-client/application/source/models/remit_to.js:
--------------------------------------------------------------------------------
1 | /*jshint indent:2, curly:true, eqeqeq:true, immed:true, latedef:true,
2 | newcap:true, noarg:true, regexp:true, undef:true, strict:true, trailing:true,
3 | white:true*/
4 | /*global XT:true, XM:true, Backbone:true, _:true, console:true */
5 |
6 | (function () {
7 | "use strict";
8 |
9 | /**
10 | @class
11 |
12 | @extends XM.Model
13 | */
14 | XM.RemitTo = XM.Model.extend({
15 | /** @scope XM.RemitTo.prototype */
16 |
17 | recordType: 'XM.RemitTo'
18 |
19 | });
20 |
21 | }());
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/coitem.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('coitem','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('coitem', 'xt.obj');
4 | select xt.add_constraint('coitem', 'coitem_obj_uuid','unique(obj_uuid)', 'public');
5 |
6 | -- trigger
7 | drop trigger if exists coitem_taxtype_change on coitem;
8 | create trigger coitem_taxtype_change after insert or update on coitem for each row execute procedure xt.taxtype_record_did_change();
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/tables/coheadwf.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('coheadwf', 'xt', false, 'xt.wf');
2 |
3 | select xt.add_constraint('coheadwf', 'coheadwf_pkey', 'primary key (wf_id)');
4 | select xt.add_constraint('coheadwf', 'coheadwf_wf_priority_id_fkey', 'foreign key (wf_priority_id) references incdtpriority (incdtpriority_id)');
5 | select xt.add_constraint('coheadwf', 'coheadwf_wf_parent_uuid_fkey', 'foreign key (wf_parent_uuid) references cohead (obj_uuid) on delete cascade');
6 |
7 | comment on table xt.coheadwf is 'Sales order workflow table';
8 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/purchasing/database/source/xt/tables/powf.sql:
--------------------------------------------------------------------------------
1 | select xt.create_table('powf', 'xt', false, 'xt.wf');
2 |
3 | select xt.add_constraint('powf', 'powf_pkey', 'primary key (wf_id)');
4 | select xt.add_constraint('powf', 'powf_wf_priority_id_fkey', 'foreign key (wf_priority_id) references incdtpriority (incdtpriority_id)');
5 | select xt.add_constraint('powf', 'powf_wf_parent_uuid_fkey', 'foreign key (wf_parent_uuid) references pohead (obj_uuid) on delete cascade');
6 |
7 | comment on table xt.powf is 'Purchase Order workflow table';
8 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletebankreconciliation.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE OR REPLACE FUNCTION deleteBankReconciliation(INTEGER) RETURNS INTEGER AS '
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | pbankrecid ALIAS FOR $1;
7 | BEGIN
8 | DELETE FROM bankrecitem
9 | WHERE bankrecitem_bankrec_id=pbankrecid;
10 |
11 | DELETE FROM bankrec
12 | WHERE bankrec_id=pbankrecid;
13 |
14 | RETURN 0;
15 | END;
16 | ' LANGUAGE 'plpgsql';
17 |
18 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/ophead.sql:
--------------------------------------------------------------------------------
1 | -- trigger
2 | drop trigger if exists ophead_owner_change on ophead;
3 |
4 | -- add uuid column here because there are views that need this
5 | select xt.add_column('ophead','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
6 | select xt.add_inheritance('ophead', 'xt.obj');
7 | select xt.add_constraint('ophead', 'ophead_obj_uui_id','unique(obj_uuid)', 'public');
8 |
9 | create trigger ophead_owner_change after insert on ophead for each row execute procedure xt.owner_record_did_change();
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/quitem.sql:
--------------------------------------------------------------------------------
1 | -- add uuid column here because there are views that need this
2 | select xt.add_column('quitem','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
3 | select xt.add_inheritance('quitem', 'xt.obj');
4 | select xt.add_constraint('quitem', 'quitem_obj_uui_id','unique(obj_uuid)', 'public');
5 |
6 | -- trigger
7 | drop trigger if exists quitem_taxtype_change on quitem;
8 | create trigger quitem_taxtype_change after insert or update on quitem for each row execute procedure xt.taxtype_record_did_change();
9 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/todoitem.sql:
--------------------------------------------------------------------------------
1 | -- trigger
2 | drop trigger if exists todoitem_owner_change on todoitem;
3 | create trigger todoitem_owner_change after insert on todoitem for each row execute procedure xt.owner_record_did_change();
4 |
5 | -- add uuid column here because there are views that need this
6 | select xt.add_column('todoitem','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
7 | select xt.add_inheritance('todoitem', 'xt.obj');
8 | select xt.add_constraint('todoitem', 'todoitem_obj_uui_id','unique(obj_uuid)', 'public');
9 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/basecurrid.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION baseCurrID ()
2 | RETURNS INTEGER IMMUTABLE AS $$
3 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
4 | -- See www.xtuple.com/CPAL for the full text of the software license.
5 | DECLARE
6 | returnVal INTEGER;
7 | BEGIN
8 | SELECT curr_id INTO returnVal
9 | FROM curr_symbol
10 | WHERE curr_base = TRUE;
11 | IF NOT FOUND THEN
12 | RAISE EXCEPTION 'No base currency found';
13 | END IF;
14 | RETURN returnVal;
15 | END;
16 | $$ LANGUAGE plpgsql;
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/deletequoteitem.sql:
--------------------------------------------------------------------------------
1 | SELECT dropIfExists('FUNCTION', 'deleteQuoteItem(integer)', 'public');
2 |
3 | CREATE OR REPLACE FUNCTION deleteQuoteItem(INTEGER) RETURNS INTEGER AS $$
4 | DECLARE
5 | pQuitemid ALIAS FOR $1;
6 |
7 | _result INTEGER;
8 |
9 | BEGIN
10 |
11 | DELETE FROM charass
12 | WHERE (charass_target_type='QI')
13 | AND (charass_target_id=pQuitemid);
14 |
15 | DELETE FROM quitem
16 | WHERE (quitem_id=pQuitemid);
17 |
18 | RETURN 0;
19 |
20 | END;
21 | $$ LANGUAGE 'plpgsql';
22 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/detachccpayfromso.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION detachCCPayFromSO(INTEGER, INTEGER, INTEGER)
2 | RETURNS INTEGER AS
3 | '
4 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
5 | -- See www.xtuple.com/CPAL for the full text of the software license.
6 | DECLARE
7 | pcoheadid ALIAS FOR $1;
8 | pwarehousid ALIAS FOR $2;
9 | pcustid ALIAS FOR $3;
10 |
11 | BEGIN
12 | RAISE NOTICE ''detachCCPayFromSO(INTEGER, INTEGER, INTEGER): deprecated'';
13 | RETURN 0;
14 | END;
15 | '
16 | LANGUAGE 'plpgsql';
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/userid.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION userId(TEXT) RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pUsername ALIAS FOR $1;
6 | _userId INTEGER;
7 |
8 | BEGIN
9 |
10 | SELECT usesysid INTO _userId
11 | FROM pg_user
12 | WHERE (usename=pUsername);
13 |
14 | IF (FOUND) THEN
15 | RETURN _userId;
16 | ELSE
17 | RETURN -1;
18 | END IF;
19 |
20 | END;
21 | ' LANGUAGE 'plpgsql';
22 |
--------------------------------------------------------------------------------
/enyo-client/database/source/public/tables/prjtask.sql:
--------------------------------------------------------------------------------
1 | -- trigger
2 | drop trigger if exists prjtask_owner_change on prjtask;
3 |
4 | -- add uuid column here because there are views that need this
5 | select xt.add_column('prjtask','obj_uuid', 'uuid', 'default xt.uuid_generate_v4()', 'public');
6 | select xt.add_inheritance('prjtask', 'xt.obj');
7 | select xt.add_constraint('prjtask', 'prjtask_obj_uui_id','unique(obj_uuid)', 'public');
8 |
9 | create trigger prjtask_owner_change after insert on prjtask for each row execute procedure xt.owner_record_did_change();
10 |
--------------------------------------------------------------------------------
/enyo-client/database/source/xt/functions/undomerge.sql:
--------------------------------------------------------------------------------
1 | create or replace function xt.undomerge(schema_name text, table_name text, id integer) returns integer as $$
2 | /* Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | See www.xtuple.com/CPAL for the full text of the software license. */
4 |
5 | var result;
6 | XT.allowEditComments = true;
7 | result = plv8.execute('select public.undomerge($1, $2, $3) as result;', [schema_name, table_name, id])[0].result;
8 | XT.allowEditComments = false;
9 | return result;
10 |
11 | $$ language plv8;
12 |
--------------------------------------------------------------------------------
/enyo-client/extensions/source/sales/database/source/manifest.js:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sales",
3 | "comment": "Sales extension",
4 | "loadOrder": 20,
5 | "databaseScripts": [
6 | "xt/tables/acttype.sql",
7 | "xt/tables/rptdef.sql",
8 | "xt/views/share_users_cohead.sql",
9 | "xt/views/share_users_cust.sql",
10 | "xt/views/share_users_shipto.sql",
11 | "xt/views/share_users_shipto_cntct.sql",
12 | "xt/views/share_users_shipto_addr.sql",
13 | "xt/views/share_users_shipto_cust.sql",
14 | "xt/tables/sharetype.sql"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/asofinvnn.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION asofinvnn(INTEGER, DATE) RETURNS NUMERIC STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemsiteId ALIAS FOR $1;
6 | pAsofDate ALIAS FOR $2;
7 | _result NUMERIC;
8 |
9 | BEGIN
10 |
11 | SELECT invbal_nn_ending INTO _result
12 | FROM asofinvbal(pItemsiteId, pAsofDate);
13 |
14 | RETURN COALESCE(_result, 0);
15 |
16 | END;
17 | $$ LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/asofinvqty.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION asofinvqty(INTEGER, DATE) RETURNS NUMERIC STABLE AS $$
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | pItemsiteId ALIAS FOR $1;
6 | pAsofDate ALIAS FOR $2;
7 | _result NUMERIC;
8 |
9 | BEGIN
10 |
11 | SELECT invbal_qoh_ending INTO _result
12 | FROM asofinvbal(pItemsiteId, pAsofDate);
13 |
14 | RETURN COALESCE(_result, 0);
15 |
16 | END;
17 | $$ LANGUAGE 'plpgsql';
18 |
--------------------------------------------------------------------------------
/foundation-database/public/functions/currentapmemonumber.sql:
--------------------------------------------------------------------------------
1 | CREATE OR REPLACE FUNCTION currentAPMemoNumber() RETURNS INTEGER AS '
2 | -- Copyright (c) 1999-2014 by OpenMFG LLC, d/b/a xTuple.
3 | -- See www.xtuple.com/CPAL for the full text of the software license.
4 | DECLARE
5 | _number INTEGER;
6 |
7 | BEGIN
8 |
9 | SELECT orderseq_number INTO _number
10 | FROM orderseq
11 | WHERE (orderseq_name=''APMemoNumber'');
12 | IF (NOT FOUND) THEN
13 | _number := 0;
14 | END IF;
15 |
16 | RETURN _number;
17 |
18 | END;
19 | ' LANGUAGE 'plpgsql';
20 |
--------------------------------------------------------------------------------