Last active
May 23, 2017 12:25
-
-
Save TimoSolo/84600f7908f3406cbfa4178ad653e897 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Dear Validation | |
// @namespace http://tampermonkey.net/ | |
// @version 0.6 | |
// @description Improve DEAR validation | |
// @author timosolo.me | |
// @match https://inventory.dearsystems.com/* | |
// @grant unsafeWindow | |
// ==/UserScript== | |
// Request #1 | |
var __Sale_Order_Complete = unsafeWindow.Sale_Order_Complete; // authorise action | |
var __Sale_Index_Submit = unsafeWindow.Sale_Index_Submit; // on save action | |
unsafeWindow.Sale_Order_Complete = function() { | |
if ($("#tabQuote.TabCompleted").length && $("#cmbCustomerReference").val() === "") | |
Ext.MessageBox.alert(WarningCaption, "Please add a Customer Reference"); | |
else | |
__Sale_Order_Complete(); | |
}; | |
unsafeWindow.Sale_Index_Submit = function() { | |
if ($("#tabQuote.TabCompleted").length && $("#cmbCustomerReference").val() === "") | |
Ext.MessageBox.alert(WarningCaption, "Please add a Customer Reference"); | |
else | |
__Sale_Index_Submit(); | |
}; | |
// Request #2 | |
// On PO screen: Regardless of the status of the PO, when you save the order, If the “Inventory Account” field is "1708" and the | |
// location is “Greenville, SC”, issue Javascript alert() saying | |
// “The inventory account you’ve selected is not commonly used at the Greenville, SC location. Please review the SOP and correct this if necessary." | |
var __Purchase_Index_Save = unsafeWindow.Purchase_Index_Save; // save PO | |
var __Purchase_Order_Complete = unsafeWindow.Purchase_Order_Complete; // authorise PO | |
unsafeWindow.Purchase_Index_Save = function() { | |
if ($("#Purchase_Index_DefaultAccount").val().indexOf("1708") === 0 && $("#cmbLocation").val().indexOf("Greenville, SC") === 0) | |
//if ($("#Purchase_Index_DefaultAccount").val().indexOf("718") === 0 && $("#cmbLocation").val().indexOf("Main") === 0) | |
Ext.MessageBox.alert(WarningCaption, "The inventory account you’ve selected is not commonly used at the Greenville, SC location. Please review the SOP and correct this if necessary."); | |
else | |
__Purchase_Index_Save(); | |
}; | |
unsafeWindow.Purchase_Order_Complete = function() { | |
if ($("#Purchase_Index_DefaultAccount").val().indexOf("1708") === 0 && $("#cmbLocation").val().indexOf("Greenville, SC") === 0) | |
Ext.MessageBox.alert(WarningCaption, "The inventory account you’ve selected is not commonly used at the Greenville, SC location. Please review the SOP and correct this if necessary."); | |
else | |
__Purchase_Order_Complete(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment