Пример #1
0
 function load($id_name)
 {
     if (is_numeric($id_name)) {
         return parent::load($id_name);
     }
     $this->unload();
     $this->tryLoadBy('name', $id_name);
     if ($this->loaded()) {
         return $this;
     }
     foreach ($this->defaultGroups as $group) {
         if ($group['name'] == $id_name) {
             // balancesheet id set and parent id set if in array
             if ($group['parent_group']) {
                 $group['parent_group_id'] = $this->newInstance()->load($group['parent_group'])->get('id');
             }
             if ($group['root_group']) {
                 $group['root_group_id'] = $this->newInstance()->load($group['root_group'])->get('id');
             }
             $group['balance_sheet_id'] = $this->add('xepan\\accounts\\Model_BalanceSheet')->load($group['balance_sheet'])->get('id');
             $this->set($group)->save();
             return $this;
         }
     }
     throw $this->exception('Could Not Load Group');
 }
Пример #2
0
 function load($id_name)
 {
     if (is_numeric($id_name)) {
         return parent::load($id_name);
     }
     $this->unload();
     $this->tryLoadBy('name', $id_name);
     if ($this->loaded()) {
         return $this;
     }
     foreach ($this->defaultHeads as $acc) {
         if ($acc['name'] == $id_name) {
             $this->set($acc)->save();
             return $this;
         }
     }
     throw $this->exception('Could Not Load Balancesheet Head');
 }
Пример #3
0
 function load($id_name)
 {
     if (is_numeric($id_name)) {
         return parent::load($id_name);
     }
     $this->unload();
     $this->tryLoadBy('name', $id_name);
     if ($this->loaded()) {
         return $this;
     }
     foreach ($this->defaultLedger as $ledger) {
         if ($ledger['name'] == $id_name) {
             // group id set
             $ledger['group_id'] = $this->add('xepan\\accounts\\Model_Group')->load($ledger['group'])->get('id');
             $this->set($ledger)->save();
             return $this;
         }
     }
     throw $this->exception('Could Not Load Ledger');
 }