AnsweredAssumed Answered

Create custom Campaign.php

Question asked by Brad Foster on Apr 7, 2017
Latest reply on Apr 10, 2017 by Brad Foster

Using 7.8.0.  I am trying to create a custom campaign bean file but it's just not working. I created

a beanfile in custom/extension/application/Ext/Include/custom.php i have

$beanFiles['Campaign']          = 'custom/modules/Campaigns/CustomCampaign.php';

(I tried adding this also but that just gives me an ACL error.)

$beanList['Campaigns']          = 'CustomCampaign';

Here is my custom/modules/Campaign.php which I also renamed to CustomCampaign.php but neither works.

require_once("modules/Campaigns/Campaign.php");

class CustomCampaign extends Campaign {
   public function __construct()
   {
      $GLOBALS['log']->fatal("test custom");
      parent::__construct();
   }
   function save($check_notify = FALSE) {
      $this->unformat_all_fields();

      // Bug53301
      if($this->campaign_type != 'NewsLetter'&&$this->campaign_type != 'Email') {
         $this->frequency = '';
      }

      return SugarBean::save($check_notify);

   }
}
?>

I have had to change the core Campaign.php for now, but I would really like to override the save method with a custom file.

 

Can anyone tell me whats wrong?

Outcomes