Fixing Shipcalc Module Bug is an Example of Overriding Drupal Forms.
A customer on a newly launched Drupal e-commerce site I produced reported the following error:
Please enter a valid ZIP Code for the sender. (error -2147219498) usps configuration error. Please notify the site administrator.
Which occurred during the checkout process and only happened when a zip code contained a “+ 4″ code at the end.
Of course, I often find Google to be the best debugging tool of all, and I quickly found this post containing a workaround by Kenneth Bartlett that not only made it so I didn’t have to untangle the shipcalc module’s code, which would likely mean debugging Web Services calls to USPS, but is actually a pretty good solution in its own right I think.
The only thing I didn’t like about it was that it directly patched an e-commerce module file at modules/ecommerce/address/address.module. Whenever I use a piece of customizable software like Drupal (or Wordpress, osCommerce, etc.) I avoid directly patching both the core code and any third party modules, because this creates a maintenance burden for me when I want to upgrade the core software or an affected module, which could potentially wipe out these kinds of patches. I have my hands maintaining my own code, I don’t want to worry about modules I didn’t write.
