Ejemplo n.º 1
0
 /**
  * 初始化数据库配置
  * @param string $table
  * @param boolean $isMaster
  * @param boolean $isPersistent
  * @return Base_Db
  */
 public function prepare($table, $isMaster = false, $isPersistent = false)
 {
     $t = explode(".", $table);
     $table = $t[count($t) - 1];
     if (!isset($this->tableConf[$table])) {
         echo $table . "<br>";
         print_R($this->tableConf);
         die($table . ' to database config error');
     }
     $dbKey = $this->tableConf[$table]['db'];
     $db_count = count($this->dbConf[$dbKey]);
     $writeConf = array('host' => $this->dbConf[$dbKey][0]['host'], 'user' => $this->dbConf[$dbKey][0]['user'], 'password' => $this->dbConf[$dbKey][0]['password'], 'port' => empty($this->dbConf[$dbKey][0]['port']) ? 3306 : $this->dbConf[$dbKey][0]['port'], 'database' => $this->dbConf[$dbKey][0]['database']);
     //if (isset($this->dbConf[$dbKey][1]))
     if ($db_count >= 2) {
         $rand = rand(1, $db_count - 1);
         $readConf = array('host' => $this->dbConf[$dbKey][$rand]['host'], 'user' => $this->dbConf[$dbKey][$rand]['user'], 'password' => $this->dbConf[$dbKey][$rand]['password'], 'port' => empty($this->dbConf[$dbKey][$rand]['port']) ? 3306 : $this->dbConf[$dbKey][$rand]['port'], 'database' => $this->dbConf[$dbKey][$rand]['database']);
     } else {
         $readConf = $writeConf;
     }
     $key = md5($writeConf['host'] . ':' . $writeConf['port'] . ';' . $writeConf['user'] . ':' . $writeConf['password']);
     if (isset($this->oDbArr[$key]) && is_object($this->oDbArr[$key])) {
         if ($isMaster) {
             $this->oDbArr[$key]->setIsMaster($isMaster);
         }
     } else {
         $oDb = new Base_Db();
         $oDb->setReadConf($readConf);
         $oDb->setWriteConf($writeConf);
         $oDb->setIsMaster($isMaster);
         $isPersistent = $isPersistent || $this->dbConf['isPersistent'];
         $oDb->setIsPersistent($isPersistent);
         $this->oDbArr[$key] = $oDb;
     }
     return $this->oDbArr[$key];
 }
Ejemplo n.º 2
0
 /**
  * 初始化函数
  * 1、时区设置
  * 2、数据库连接配置
  */
 public function init()
 {
     //360配置信息
     $this->_qihooparam = array('media_id' => 23, 'redirect_uri' => 'http://denglu.soquair.com/Media_Qihoo/callback');
     //获取数据库连接信息
     $this->_db = Base_Db::getInstance(Yaf_Application::app()->getConfig()->application->db->toArray());
     $this->_basemodel = new BasedbModel($this->_db);
 }
Ejemplo n.º 3
0
 /**
  * 初始化函数
  * 1、时区设置
  * 2、数据库连接配置
  */
 public function init()
 {
     header("Content-type: application/json; charset=utf-8");
     ini_set('date.timezone', 'Asia/Shanghai');
     //获取数据库连接信息
     $this->_db = Base_Db::getInstance(Yaf_Application::app()->getConfig()->application->db->toArray());
     $this->_basemodel = new BasedbModel($this->_db);
 }
Ejemplo n.º 4
0
 /**
  * 初始化函数
  * 1、时区设置
  * 2、数据库连接配置
  */
 public function init()
 {
     //QQweibo的配置信息
     $this->_qqweiboparam = array('media_id' => 4, 'login_url' => '', 'redirect_uri' => 'http://denglu.soquair.com/media_qqweibo/callback/', 'state' => 'test');
     //获取数据库连接信息
     $this->_db = Base_Db::getInstance(Yaf_Application::app()->getConfig()->application->db->toArray());
     $this->_basemodel = new BasedbModel($this->_db);
 }
Ejemplo n.º 5
0
 /**
  * 初始化函数
  * 1、时区设置
  * 2、数据库连接配置
  */
 public function init()
 {
     //QQ的配置信息
     $this->_qqparam = array('media_id' => 13, 'login_url' => 'https://graph.qq.com/oauth2.0/authorize?response_type=code', 'redirect_uri' => 'http://denglu.soquair.com/media_qq/callback/', 'state' => 'test');
     //获取数据库连接信息
     $this->_db = Base_Db::getInstance(Yaf_Application::app()->getConfig()->application->db->toArray());
     $this->_basemodel = new BasedbModel($this->_db);
 }
Ejemplo n.º 6
0
 /**
  * 初始化函数
  * 1、时区设置
  * 2、数据库连接配置
  */
 public function init()
 {
     header("Content-type: text/html; charset=utf-8");
     //Renren的配置信息
     $this->_renrenparam = array('media_id' => 7, 'redirect_uri' => 'http://denglu.soquair.com/media_renren/callback/');
     //获取数据库连接信息
     $this->_db = Base_Db::getInstance(Yaf_Application::app()->getConfig()->application->db->toArray());
     $this->_basemodel = new BasedbModel($this->_db);
 }
Ejemplo n.º 7
0
 public function ajaxGetSavePrintRawProductAction()
 {
     $request = $this->getRequest();
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $Db = new Base_Db();
     $transaction_nid = $Db->genCodeId('transaction_id');
     $options = $request->getPost();
     $options['transactionId'] = $transaction_nid;
     $options['status'] = 1;
     $i = 0;
     while ($options['num_cows']) {
         $options['sequenceNo'] = $Db->genCodeId('sequence_num');
         $options['tagNo'] = $Db->genCodeId('tag_num');
         $options['processStatus'] = 'Incoming';
         $options['incomingDate'] = date("Y-m-d");
         $model = new Mps_Model_RawProduct($options);
         $id = $model->save();
         $options['num_cows']--;
         $i++;
     }
     echo Zend_Json::encode($id);
 }
 public function killCowAction()
 {
     $request = $this->getRequest();
     $options = $request->getPost();
     if ($options['supplier_id']) {
         $Db = new Base_Db();
         $transaction_nid = $Db->genCodeId('transaction_id_' . $options[supplier_id]);
         $options1['transactionId'] = $transaction_nid;
         $options1['status'] = 1;
         $options1['breed'] = $options['map_id1'];
         $options1['type'] = $options['map_id2'];
         $options1['color'] = $options['map_id3'];
         $options1['supplierId'] = $options['supplier_id'];
         $options1['sequenceNo'] = $Db->genCodeId('sequence_num');
         $options1['tagNo'] = $Db->genCodeId('tag_num');
         $options1['processStatus'] = 'Knocked';
         $options1['knockedDate'] = date("Y-m-d");
         $model = new Mps_Model_RawProduct($options1);
         $id = $model->save();
     } else {
         $model1 = new Mps_Model_RawProduct();
         $model = $model1->fetchRow("id='{$options['cow_id']}'");
         $model->setBreed($options['map_id1']);
         $model->setType($options['map_id2']);
         $model->setColor($options['map_id3']);
         $model->setProcessStatus('Knocked');
         $model->setKnockedDate(date("Y-m-d"));
         $id = $model->save();
     }
     if ($id) {
         $this->_flashMessenger->addMessage(array('success' => 'Cow Knocked successfully!'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/mps/knocking'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to KNock Cow!'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/admin/knocking'));
     }
 }
Ejemplo n.º 9
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('title' => $this->getTitle(), 'description' => $this->getDescription(), 'weight' => $this->getWeight(), 'status' => $this->getStatus());
     $id = $this->getId();
     //echo "id==".$id;
     if ($id === null) {
         $Db = new Base_Db();
         $id = $Db->genId("location", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * 单例模式
  *
  * @access public
  * @param array $params 数据库连接参数,如数据库服务器名,用户名,密码等
  * @return object
  */
 public static function getInstance($params)
 {
     if (!self::$instance) {
         self::$instance = new self($params);
     }
     return self::$instance;
 }
Ejemplo n.º 11
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $usersNs - userId;
     $data = array('category_id' => $this->getCategoryId(), 'severity_id' => $this->getSeverityId(), 'type_id' => $this->getTypeId(), 'user_message' => $this->getUserMessage(), 'sys_message' => $this->getSysMessage());
     if (null === ($id = $this->getMessageId())) {
         $Db = new Base_Db();
         $id = $Db->genId("sys_message", 'message_id');
         if ($id !== false) {
             $data['message_id'] = $id;
             $data['created_on'] = time();
             $data['created_by'] = $usersNs - userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         }
     } else {
         $data['updated_by'] = $usersNs - userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         return $this->getMapper()->getDbTable()->update($data, array('message_id = ?' => $id));
     }
 }
Ejemplo n.º 12
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('email' => $this->getEmail(), 'username' => $this->getUsername(), 'password' => $this->getPassword(), 'first_name' => $this->getFirstName(), 'middle_name' => $this->getMiddleName(), 'last_name' => $this->getLastName(), 'dob' => $this->getDob(), 'sex' => $this->getSex(), 'profile_picture' => $this->getProfilePicture(), 'mobile' => $this->getMobile(), 'status' => $this->getStatus(), 'correspondence_address' => $this->getCorrespondenceAddress(), 'organization_name' => $this->getOrganizationName(), 'address1' => $this->getAddress1(), 'address2' => $this->getAddress2(), 'city' => $this->getCity(), 'state' => $this->getState(), 'zip' => $this->getZip(), 'phone' => $this->getPhone(), 'fax' => $this->getFax(), 'supervisor_id' => $this->getSupervisorId(), 'group_id' => $this->getGroupId(), 'sub_group_id' => $this->getSubGroupId(), 'role_id' => $this->getRoleId());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("user", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 13
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('case_format' => $this->getCaseFormat(), 'label_case' => $this->getLabelCase(), 'product_identifier' => $this->getProductIdentifier(), 'pack_location' => $this->getPackLocation(), 'part_number' => $this->getPartNumber(), 'sell_by_days' => $this->getSellByDays(), 'price_lb' => $this->getPriceLb(), 'pallet_id' => $this->getPalletId(), 'des_line_1' => $this->getDesLine1(), 'des_line_2' => $this->getDesLine2(), 'des_line_3' => $this->getDesLine3(), 'des_line_4' => $this->getDesLine4(), 'lower_weight' => $this->getLowerWeight(), 'fixed_weight' => $this->getFixedWeight(), 'heigh_weight' => $this->getHeighWeight(), 'tare_weight' => $this->getTareWeight(), 'required_application' => $this->getRequiredApp(), 'status' => $this->getStatus());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("product", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 14
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('sequence_no' => $this->getSequenceNo(), 'type' => $this->getType(), 'breed' => $this->getBreed(), 'color' => $this->getColor(), 'supplier_id' => $this->getSupplierId(), 'description' => $this->getDescription(), 'tag_no' => $this->getTagNo(), 'transaction_id' => $this->getTransactionId(), 'incoming_date' => $this->getIncomingDate(), 'knocked_date' => $this->getKnockedDate(), 'weighing_date' => $this->getWeighingDate(), 'auction_tag' => $this->getAuctionTag(), 'ear_tag' => $this->getEarTag(), 'trich' => $this->getTrich(), 'back_tag' => $this->getBackTag(), 'defects' => $this->getDefects(), 'grade' => $this->getGrade(), 'weight' => $this->getWeight(), 'condumn_sub_status' => $this->getCondumnSubStatus(), 'status_on' => $this->getStatusOn(), 'status' => $this->getStatus(), 'process_status' => $this->getProcessStatus());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("raw_product", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             echo 'aaahere';
             die;
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 15
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('org_name' => $this->getOrgName(), 'first_name' => $this->getFirstName(), 'last_name' => $this->getLastName(), 'address' => $this->getAddress(), 'city' => $this->getCity(), 'state' => $this->getState(), 'zip' => $this->getZip(), 'bfirst_name' => $this->getBFirstName(), 'blast_name' => $this->getBLastName(), 'baddress' => $this->getBAddress(), 'bcity' => $this->getBCity(), 'bstate' => $this->getBState(), 'bzip' => $this->getBZip(), 'phone' => $this->getPhone(), 'fax' => $this->getFax(), 'email' => $this->getEmail(), 'status' => $this->getStatus());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("customer", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 16
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('name' => $this->getName(), 'value' => $this->getValue(), 'status' => $this->getStatus());
     $id = $this->getId();
     if ($id === null) {
         $Db = new Base_Db();
         $id = $Db->genId("control_type", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 17
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $usersNs - userId;
     $data = array('parent_config_id' => $this->getParentConfigId(), 'config_name' => $this->getConfigName(), 'config_desc' => $this->getConfigDesc(), 'param1' => $this->getParam1(), 'param2' => $this->getParam2(), 'param3' => $this->getParam3(), 'param4' => $this->getParam4(), 'param5' => $this->getParam5());
     if (null === ($id = $this->getConfigId())) {
         $Db = new Base_Db();
         $id = $Db->genId("sys_config", 'config_id');
         if ($id !== false) {
             $data['config_id'] = $id;
             $data['created_on'] = time();
             $data['created_by'] = $usersNs - userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['row_version'] = 0;
             if ($this->getParentConfigId() == 0) {
                 $data['parent_config_id'] = $id;
             }
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         }
     } else {
         $data['updated_by'] = $usersNs - userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         return $this->getMapper()->getDbTable()->update($data, array('config_id = ?' => $id));
     }
 }
Ejemplo n.º 18
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('code_name' => $this->getCodeName(), 'code_value' => $this->getCodeValue(), 'status' => $this->getStatus());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("code_table", 'id');
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             echo 'aaahere';
             die;
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 19
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('workflow_id' => $this->getWorkflowId(), 'group_id' => $this->getGroupId(), 'subgroup_id' => $this->getSubgroupId(), 'role_id' => $this->getRoleId(), 'process_id' => $this->getProcessId(), 'preceeding_process_id' => $this->getPreceedingProcessId(), 'start_status' => $this->getStartStatus(), 'end_status' => $this->getEndStatus(), 'is_deleted' => $this->getIsDeleted());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("workflow_detail", "id");
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion();
         $res = $this->getMapper()->getDbTable()->update($data, array("id='{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 20
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $usersNs - userId;
     $data = array('dbcnf_id' => $this->getDbcnfId(), 'config_id' => $this->getConfigId(), 'db_server_name' => $this->getDbServerName(), 'db_server_port' => $this->getDbServerPort(), 'db_name' => $this->getDbName(), 'db_user' => $this->getDbUser(), 'db_password' => $this->getDbPassword(), 'db_trans_type' => $this->getDbTransType(), 'status' => $this->getStatus());
     if (null === ($id = $this->getDbcnfId())) {
         $Db = new Base_Db();
         $id = $Db->genId("dbconfiguration", 'dbcnf_id');
         if (false !== $id) {
             $data['dbcnf_id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("dbcnf_id = '{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 21
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('master_code' => $this->getMasterCode(), 'master_value' => $this->getMasterValue(), 'status' => $this->getStatus(), 'intval1' => $this->getIntval1(), 'intval2' => $this->getIntval2(), 'strval1' => $this->getStrval1(), 'strval2' => $this->getStrval2(), 'blnval1' => $this->getBlnval1(), 'blnval2' => $this->getBlnval2(), 'dblval1' => $this->getDblval1(), 'dblval2' => $this->getDblval2());
     if (null === ($master_id = $this->getMasterId())) {
         $Db = new Base_Db();
         $master_id = $Db->genSystemMasterId($this->getMasterCode());
         if (false !== $master_id) {
             $data['master_id'] = $master_id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $master_id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion() + 1;
         $res = $this->getMapper()->getDbTable()->update($data, array("master_code='{$this->getMasterCode()}' and master_id = '{$master_id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }
Ejemplo n.º 22
0
 public function save()
 {
     $usersNs = new Zend_Session_Namespace("members");
     $data = array('workflow_name' => $this->getWorkflowName(), 'is_deleted' => $this->getIsDeleted());
     if (null === ($id = $this->getId())) {
         $Db = new Base_Db();
         $id = $Db->genId("workflow_master", "id");
         if (false !== $id) {
             $data['id'] = $id;
             $data['created_by'] = $usersNs->userId;
             $data['row_guid'] = Base_Uuid::guid();
             $data['created_on'] = time();
             $data['row_version'] = 0;
             if ($this->getMapper()->getDbTable()->insert($data)) {
                 return $id;
             }
         } else {
             return false;
         }
     } else {
         $data['updated_by'] = $usersNs->userId;
         $data['updated_on'] = time();
         $data['row_version'] = $this->getRowVersion();
         $res = $this->getMapper()->getDbTable()->update($data, array("id='{$id}' and row_version = '{$this->getRowVersion()}'"));
         if (1 == $res) {
             return true;
         } else {
             return false;
         }
     }
 }