# HG changeset patch # User Asa Ayers # Date 1279600964 25200 # Node ID 1ff3b83b104c746c4bd2b002b0d1cb9485f2c1f7 # Parent 36eb72329d69437efd1030b1047d3a5a24b87cfa Added a dialog to allow the user to send COD mail without a tracking number diff -r 36eb72329d69 -r 1ff3b83b104c CHANGELOG.txt --- a/CHANGELOG.txt Mon Jul 19 20:56:05 2010 -0700 +++ b/CHANGELOG.txt Mon Jul 19 21:42:44 2010 -0700 @@ -1,6 +1,7 @@ 2010-07-18 Asa Ayers - Implemented COD mail (Ticket #1) and updated the way postage was counted so that if you mail multiple items at once, they will all have the postage counted. I also removed the 30c for postage from how QA thresholds are calculated now that they will be counted every time. +- Added a dialog to allow the user to send COD mail without a tracking number. 2010-07-18 Asa Ayers diff -r 36eb72329d69 -r 1ff3b83b104c Modules/Events.lua --- a/Modules/Events.lua Mon Jul 19 20:56:05 2010 -0700 +++ b/Modules/Events.lua Mon Jul 19 21:42:44 2010 -0700 @@ -50,6 +50,19 @@ local attachedItems = {} local Orig_SendMail = SendMail +local skipCODTracking = false + +StaticPopupDialogs["ItemAuditor_Send_COD_without_tracking_number"] = { + text = "ItemAuditor cannot track COD mail with multiple item types attached. Do you want to send this mail without tracking?", + button1 = "Yes", + button2 = "No", + OnAccept = function() + skipCODTracking = true + end, + timeout = 0, + whileDead = true, + hideOnEscape = true, +} function SendMail(recipient, subject, body, ...) local self = ItemAuditor @@ -80,11 +93,18 @@ data.price = pricePerStack * data.stacks end - if self.mailOutbox.COD > 0 then + if self.mailOutbox.COD > 0 and skipCODTracking then + + elseif self.mailOutbox.COD > 0 then if self:tcount(attachedItems) > 1 then - self:Print("ERROR: ItemAuditor can't track COD mail with more than one item type.") self:GenerateBlankOutbox() - -- I need to make a prompt so the user can send the mail without interference + local vararg = ... + StaticPopupDialogs["ItemAuditor_Send_COD_without_tracking_number"].OnAccept = function() + skipCODTracking = true + SendMail(recipient, subject, body, vararg) + skipCODTracking = false + end + StaticPopup_Show ("ItemAuditor_Send_COD_without_tracking_number"); return end self:Debug("COD mail") @@ -106,6 +126,7 @@ end function addon:MAIL_SUCCESS(event) + skipCODTracking = false for link, data in pairs(attachedItems) do self:SaveValue(link, data.price, data.count) end