protected function renderAfterFormLayout($form)
 {
     parent::renderAfterFormLayout($form);
     $automaticMappingDisabled = OpportunitiesModule::isAutomaticProbabilityMappingDisabled();
     if ($automaticMappingDisabled === false) {
         $this->registerStageToProbabilityMappingScript($form);
     }
 }
 protected function processUpdate($id, $data)
 {
     $automaticMappingDisabled = OpportunitiesModule::isAutomaticProbabilityMappingDisabled();
     if ($automaticMappingDisabled === false) {
         // discard probability from $data
         unset($data['probability']);
     }
     return parent::processUpdate($id, $data);
 }
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         $automaticMappingDisabled = OpportunitiesModule::isAutomaticProbabilityMappingDisabled();
         if (!isset($this->originalAttributeValues['probability']) && $automaticMappingDisabled === false) {
             $this->resolveStageToProbability();
         }
         return true;
     } else {
         return false;
     }
 }