✏️ 正在编辑: Gerente.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/DbTable/Gerente.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_DbTable_Gerente extends Zend_Db_Table_Abstract { protected $_primary = 'id'; protected $_name = 'tb_gerentes'; protected static $_viewName = 'vw_gerentes'; protected $_dependentTables = array( 'Model_DbTable_GerenteRota' ); protected $_referenceMap = array( 'BancoFebraban' => array( 'columns' => array( 'banco' ), 'refTableClass' => 'Model_DbTable_BancoFebraban', 'refColumns' => array( 'codigo' ) ) ); public static function getViewName() { return self::$_viewName; } public function insert(array $data) { $data['tipo'] = "EMPRESA"; if( isset($data['senha']) ){ if( (empty($data['senha']) || $data['senha'] == null ) ){ unset($data['senha']); } else { $data['senha'] = md5($data['senha']); } } $id = parent::insert($data); //grava inserção no log if( $id > 0 ){ $log = new Model_DbTable_Log(); $log->save($this, $data, 'insert', $id); } return $id; } public function fetchAll($where = null, $order = null, $count = null, $offset = null) { if( ($where instanceof Zend_Db_Table_Select ) ){ $strWhere = "excluido<>1 AND tipo='EMPRESA'"; foreach ( $where->getPart(Zend_Db_Table_Select::WHERE) as $w ) { $strWhere .= " AND " . $w; } $where->where($strWhere); } elseif( $where != null ){ $where = $where . " AND excluido<>1 AND tipo='EMPRESA'"; } else { $where = "excluido<>1 AND tipo='EMPRESA'"; } return parent::fetchAll($where, $order, $count, $offset); } public function fetchRow($where = null, $order = null, $offset = null) { if (($where instanceof Zend_Db_Table_Select )) { $strWhere = "excluido<>1 AND tipo='EMPRESA'"; foreach ( $where->getPart(Zend_Db_Table_Select::WHERE) as $w ) { $strWhere .= " AND " . $w; } $where->where($strWhere); } elseif (is_array($where)) { $where[] = "tipo = 'EMPRESA'"; $where[] = "excluido<>1"; } elseif ($where != null){ $where = $where . " AND excluido<>1 AND tipo='EMPRESA'"; } else { $where = "excluido<>1 AND tipo='EMPRESA'"; } return parent::fetchRow($where, $order, $offset); } public function update(array $data, $where) { if( isset($data['senha']) ){ if( (empty($data['senha']) || $data['senha'] == null ) ){ unset($data['senha']); } else { $data['senha'] = md5($data['senha']); } } $result = parent::update($data, $where); if( $result > 0 ){ $log = new Model_DbTable_Log(); $log->save($this, $data, $where, $this->_primary[1]); } return $result; } public function delete($where) { $result = parent::update(array( 'excluido' => 1 ), $where); if( $result > 0 ){ $log = new Model_DbTable_Log(); $log->save($this, $data, $where, $this->_primary[1]); } return $result; } }
💾 保存文件
← 返回文件管理器