Example #1
0
File: Shops.php Project: valizr/MMA
 public function save(Default_Model_Shops $value)
 {
     $auth = Zend_Auth::getInstance();
     $authAccount = $auth->getStorage()->read();
     if (null != $authAccount) {
         if (null != $authAccount->getId()) {
             $user = new Default_Model_Users();
             $user->find($authAccount->getId());
             $data = array('name' => $value->getName(), 'address' => $value->getAddress(), 'phoneNumber' => $value->getPhoneNumber(), 'company' => $value->getCompany(), 'cashBank' => $value->getCashBank(), 'creditCardBank' => $value->getCreditCardBank(), 'cashRegistry' => $value->getCashRegistry(), 'status' => $value->getStatus(), 'deleted' => '0');
             if (null === ($id = $value->getId())) {
                 $id = $this->getDbTable()->insert($data);
                 //logs	action done
                 //					$user_name = $user->name.' '.$user->surname;
                 //					$shop_name = $value->getName();
                 //					$action_done = ' '.$user_name.' a adaugat shop-ul '.$shop_name.' ';
                 //end logs action done
             } else {
                 $this->getDbTable()->update($data, array('id = ?' => $id));
                 //logs	action done
                 //					$user_name = $user->name.' '.$user->surname;
                 //					$shop_name = $value->getName();
                 //					$action_done = ' '.$user_name.' a editat shop-ul '.$shop_name.' ';
                 //end logs action done
             }
             return $id;
         }
     }
 }