Esempio n. 1
0
 function afterUpdate()
 {
     $session = SessionWrapper::getInstance();
     # check if user is being invited during update
     if (!isEmptyString($this->getDefaultUserID()) && isEmptyString($this->getDefaultUser()->getCompanyID())) {
         $this->getDefaultUser()->setCompanyID($this->getID());
         $startdate = DEFAULT_DATETIME;
         $expirydate = date("Y-m-d", strtotime(date("Y-m-d", strtotime($startdate)) . " +" . getTrialDays() . " days "));
         if (isEmptyString($this->getStartDate()) && $this->getID() != DEFAULT_COMPANYID) {
             $this->setStartDate($startdate);
         }
         if (isEmptyString($this->getEndDate()) && $this->getID() != DEFAULT_COMPANYID) {
             $this->setEndDate($expirydate);
         }
         $this->save();
     }
     // invite via email
     if ($this->getIsBeinginvited() == 1) {
         $this->getDefaultUser()->inviteViaEmail();
     }
     if ($this->getID() == DEFAULT_ID) {
         $config_collection = new Doctrine_Collection(Doctrine_Core::getTable("AppConfig"));
         $appconfig = new AppConfig();
         $appconfig->populate(61);
         $appconfig->setOptionValue($this->getAppName());
         $config_collection->add($appconfig);
         $appconfig = new AppConfig();
         $appconfig->populate(62);
         $appconfig->setOptionValue($this->getName());
         $config_collection->add($appconfig);
         if ($config_collection->count() > 0) {
             $config_collection->save();
         }
     }
     return true;
 }