original_string: public function validateAdminOrderAddressSave(Varien_Event_Observer $observer)
      {
          /** @var Fontis_Australia_Helper_Address $helper */
          $helper = Mage::helper('australia/address');
          if (!$helper->isValidationOrderSaveEnabled()) {
              return;
          }
  
          /** @var Mage_Adminhtml_Model_Session $session */
          $session = Mage::getSingleton('adminhtml/session');
          $errors = $session->getMessages()->getErrors();
  
          if (count($errors) > 0) {
              // We had an error when saving the address, so we'll skip validation
              $session->addWarning('Address validation has been skipped.');
              return;
          }
  
          try {
              /** @var Mage_Adminhtml_Controller_Action $controller */
              $controller = $observer->getControllerAction();
              if (!$controller) {
                  return;
              }
  
              $addressId = $controller->getRequest()->getParam('address_id');
              /** @var Mage_Sales_Model_Order_Address $address */
              $address = Mage::getModel('sales/order_address')->load($addressId);
              if ($address->getAddressType() !== Mage_Sales_Model_Order_Address::TYPE_SHIPPING) {
                  return;
              }
              $order = $address->getOrder();
              if (!$order) {
                  return;
              }
  
              $ignoreValidation = $controller->getRequest()->getParam('override_validation');
  
              if ($ignoreValidation) {
                  $result = array(
                      Fontis_Australia_Helper_Address::ADDRESS_OVERRIDE_FLAG => true
                  );
                  $order->setAddressValidated(Fontis_Australia_Helper_Address::ADDRESS_OVERRIDE);
              } else {
                  // Validate the address and store the result on the order.
                  $result = $helper->validateOrderAddress($order);
              }
  
              $order->save();
  
              // Use the result to add a message to the session telling the
              // admin about the validation status.
              $helper->addValidationMessageToSession($result, $session);
          } catch (Exception $err) {
              Mage::logException($err);
          }
      }
code: public function validateAdminOrderAddressSave(Varien_Event_Observer $observer)
      {
          /** @var Fontis_Australia_Helper_Address $helper */
          $helper = Mage::helper('australia/address');
          if (!$helper->isValidationOrderSaveEnabled()) {
              return;
          }
  
          /** @var Mage_Adminhtml_Model_Session $session */
          $session = Mage::getSingleton('adminhtml/session');
          $errors = $session->getMessages()->getErrors();
  
          if (count($errors) > 0) {
              // We had an error when saving the address, so we'll skip validation
              $session->addWarning('Address validation has been skipped.');
              return;
          }
  
          try {
              /** @var Mage_Adminhtml_Controller_Action $controller */
              $controller = $observer->getControllerAction();
              if (!$controller) {
                  return;
              }
  
              $addressId = $controller->getRequest()->getParam('address_id');
              /** @var Mage_Sales_Model_Order_Address $address */
              $address = Mage::getModel('sales/order_address')->load($addressId);
              if ($address->getAddressType() !== Mage_Sales_Model_Order_Address::TYPE_SHIPPING) {
                  return;
              }
              $order = $address->getOrder();
              if (!$order) {
                  return;
              }
  
              $ignoreValidation = $controller->getRequest()->getParam('override_validation');
  
              if ($ignoreValidation) {
                  $result = array(
                      Fontis_Australia_Helper_Address::ADDRESS_OVERRIDE_FLAG => true
                  );
                  $order->setAddressValidated(Fontis_Australia_Helper_Address::ADDRESS_OVERRIDE);
              } else {
                  // Validate the address and store the result on the order.
                  $result = $helper->validateOrderAddress($order);
              }
  
              $order->save();
  
              // Use the result to add a message to the session telling the
              // admin about the validation status.
              $helper->addValidationMessageToSession($result, $session);
          } catch (Exception $err) {
              Mage::logException($err);
          }
      }
code_tokens: public function validateAdminOrderAddressSave ( Varien_Event_Observer $ observer ) { /** @var Fontis_Australia_Helper_Address $helper */ $ helper = Mage :: helper ( 'australia/address' ) ; if ( ! $ helper -> isValidationOrderSaveEnabled ( ) ) { return ; } /** @var Mage_Adminhtml_Model_Session $session */ $ session = Mage :: getSingleton ( 'adminhtml/session' ) ; $ errors = $ session -> getMessages ( ) -> getErrors ( ) ; if ( count ( $ errors ) > 0 ) { // We had an error when saving the address, so we'll skip validation $ session -> addWarning ( 'Address validation has been skipped.' ) ; return ; } try { /** @var Mage_Adminhtml_Controller_Action $controller */ $ controller = $ observer -> getControllerAction ( ) ; if ( ! $ controller ) { return ; } $ addressId = $ controller -> getRequest ( ) -> getParam ( 'address_id' ) ; /** @var Mage_Sales_Model_Order_Address $address */ $ address = Mage :: getModel ( 'sales/order_address' ) -> load ( $ addressId ) ; if ( $ address -> getAddressType ( ) !== Mage_Sales_Model_Order_Address :: TYPE_SHIPPING ) { return ; } $ order = $ address -> getOrder ( ) ; if ( ! $ order ) { return ; } $ ignoreValidation = $ controller -> getRequest ( ) -> getParam ( 'override_validation' ) ; if ( $ ignoreValidation ) { $ result = array ( Fontis_Australia_Helper_Address :: ADDRESS_OVERRIDE_FLAG => true ) ; $ order -> setAddressValidated ( Fontis_Australia_Helper_Address :: ADDRESS_OVERRIDE ) ; } else { // Validate the address and store the result on the order. $ result = $ helper -> validateOrderAddress ( $ order ) ; } $ order -> save ( ) ; // Use the result to add a message to the session telling the // admin about the validation status. $ helper -> addValidationMessageToSession ( $ result , $ session ) ; } catch ( Exception $ err ) { Mage :: logException ( $ err ) ; } }
docstring: After a shipping address is edited, validate it and store the result.
  
  @listen controller_action_postdispatch_adminhtml_sales_order_addressSave
  @param Varien_Event_Observer $observer
docstring_tokens: After a shipping address is edited validate it and store the result .