Beispiel #1
0
 public function create($appaccount_id)
 {
     if (Agana_Acl_Service::isAllowed(Zend_Auth::getInstance()->getIdentity()->acl_role_id, Busunit_Module_Acl::ACL_RESOURCE_BUSUNIT_BRANCH, Busunit_Module_Acl::ACL_RESOURCE_BUSUNIT_BRANCH_PRIVILEGE_CREATE)) {
         try {
             $user = Zend_Auth::getInstance()->getIdentity();
             $this->getBusunit()->defineasBranch(0);
             $this->getBusunit()->setAppaccount_id($user->appaccount_id);
             if (!$appaccount_id) {
                 $appaccount_id = $user->appaccount_id;
             }
             return parent::create($appaccount_id);
         } catch (Exception $e) {
             throw $e;
         }
     }
 }
 public function create($accountapp_id)
 {
     try {
         $dao = new Busunit_Persist_Dao_Busunit();
         // test if already exist an headquarters for this account app
         // if so ignore create and return
         // else create one default
         $obj = $dao->getByAppAccount($accountapp_id, 1);
         if (!$obj) {
             $this->getBusunit()->defineasHead();
             $this->getBusunit()->setAppaccount_id($appaccount_id);
             return parent::create($accountapp_id);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }