protected function processForm(sfWebRequest $request, sfForm $form, $accion)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $cliente = ClientePeer::retrieveByPk($form->getValue('cliente_id'));
         $this->forward404Unless($cliente, sprintf('Cliente no encontrado (%s).', $form->getValue('cliente_id')));
         $contacto = $form->save();
         $this->messageBox = new MessageBox("success", "El contacto ha sido {$accion} correctamente", $this->getUser());
         $this->redirect('cliente/show?id=' . $contacto->getCliente()->getId());
     } else {
         $this->messageBox = new MessageBox("error", "Verifique los datos ingresados", $this->getUser());
     }
 }
 public function executeDelete(sfWebRequest $request)
 {
     //    $request->checkCSRFProtection();
     $this->forward404Unless($cliente = ClientePeer::retrieveByPk($request->getParameter('id')), sprintf('Object cliente does not exist (%s).', $request->getParameter('id')));
     // Baja logica
     $cliente->setActivo(false);
     $cliente->save();
     // Eliminar los contactos
     foreach ($cliente->getContactos() as $contacto) {
         $contacto->delete();
     }
     $this->messageBox = new MessageBox("success", "Su cliente fue borrado correctamente", $this->getUser());
     $this->redirect('cliente/index');
 }
Exemple #3
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's BasePeer::TYPE_PHPNAME
  *
  * @param array  $arr     An array to populate the object from.
  * @param string $keyType The type of keys the array uses.
  * @return void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ClientePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setNombre($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCorreo($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDireccion($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setTelefono($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setCiudad($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setObservacion($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setPuntos($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setNit($arr[$keys[8]]);
     }
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ClientePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdClie($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setApellido($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setNombre($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTelefono($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setDireccion($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setIdProv($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setIdCiudad($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setEmail($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setUser($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setPass($arr[$keys[9]]);
     }
 }
 protected function saveDocumento($documento)
 {
     //Ana: 03-11-09 Por defecto se añaden al documento los usuarios que pertenecen al proyecto que tiene asignado el documento.
     if ($documento->isNew()) {
         $nuevo = 1;
     }
     $documento->save();
     if (isset($_FILES["resume_degraded"]) && is_uploaded_file($_FILES["resume_degraded"]["tmp_name"]) && $_FILES["resume_degraded"]["error"] == 0) {
         $fileName = $_FILES["resume_degraded"]["name"];
         $used_degraded = true;
     }
     if (isset($_REQUEST["hidFileID"]) && $_REQUEST["hidFileID"] != "") {
         $fileName = $_REQUEST["hidFileID"];
     }
     if ($used_degraded) {
         $fileSize = $this->getRequest()->getFileSize($fileName);
         $fileType = $this->getRequest()->getFileType($fileName);
     } else {
         $filePath = sfConfig::get('sf_web_dir') . "/temp/" . $fileName;
         $fileSize = filesize($filePath);
         $fileType = mime_content_type($filePath);
     }
     //if ($_FILES['fichero']['error'] == 0)
     //{
     $usuario = Usuario::getUsuarioActual();
     $historico = new HistoricoDocumento();
     $historico->setIdEmpresa(sfContext::getInstance()->getUser()->getAttribute('idempresa'));
     $historico->setIdDocumento($documento->getIdDocumento());
     $historico->setVersion(HistoricoDocumentoPeer::getUltimaVersion($this->documento->getPrimaryKey()));
     $historico->setFecha(date('Y-m-d H:i:s'));
     $historico->setTamano($fileSize);
     $historico->setNombreFich($fileName);
     $historico->setMime($fileType);
     $historico->setIdUsuario($usuario ? $usuario->getPrimaryKey() : null);
     //Rober 28-dic-2009
     $nombre_base_nuevo = $this->renombrarDocumento($historico, $documento->getIdProyecto(), $documento->getIdFase());
     $historico->setNombreFich($nombre_base_nuevo);
     $historico->save();
     $cookie_cliente = sfContext::getInstance()->getUser()->getAttribute('empresa', '', 'usuarios');
     if ($cookie_cliente != 0 && $cookie_cliente != '') {
         $cliente = ClientePeer::retrieveByPk($cookie_cliente);
         //if ($cliente->getEmail() != '' && $cliente->getQuieremail())
         //{
         // Rober 23-oct-2009: la funcion de envío no está definida...
         //DocumentoPeer::mandarEmail($historico, $cliente->getEmail(), $cliente->getNombre());
         //}
     }
     //}
     if ($nuevo) {
         // Ana: 03-11-09 Por defecto se añaden al documento los usuarios que
         // pertenecen al proyecto que tiene asignado el documento.
         // Rober 26-abr-2010: código comentado.
         $fase = $documento->getFase();
         $trabajadores = $fase instanceof Fase ? $fase->getListaTrabajadores() : array();
         if (sizeof($trabajadores) == 0) {
             $c = new Criteria();
             $c->add(RelProyectoTrabajadorPeer::ID_PROYECTO, $documento->getIdProyecto());
             $trabajadores = RelProyectoTrabajadorPeer::doSelect($c);
         }
         //Rober 26-abr-2010
         foreach ($trabajadores as $trabajador) {
             $c = new Criteria();
             $new_rpt = new RelDocumentoTrabajador();
             $new_rpt->setIdTrabajador($trabajador->getIdTrabajador());
             $documento->addRelDocumentoTrabajador($new_rpt);
         }
         $documento->save();
     }
     //BORRAMOS EL FICHERO TEMPORAL SI EXISTE
     if (isset($filePath) && file_exists($filePath)) {
         @unlink($filePath);
     }
 }
 public function editarAction()
 {
     $id = $this->params()->fromRoute('id');
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = $request->getPost();
         //INSTANCIAMOS NUESTRA ENTIDAD
         $entity = \ClienteQuery::create()->findPk($id);
         //SETIAMOS NUESTROS DATOS CON EXCEPCIONES
         foreach ($post_data as $key => $value) {
             if (\ClientePeer::getTableMap()->hasColumn($key) && !empty($value) && $key != 'cliente_cumpleanios') {
                 $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME);
             }
         }
         if (!empty($post_data['cliente_cumpleanios'])) {
             $cliente_cumpleanios = date_create_from_format('d/m/Y', $post_data['cliente_cumpleanios']);
             $entity->setClienteCumpleanios($cliente_cumpleanios);
         }
         $entity->save();
         //Agregamos un mensaje
         $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!');
         //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR
         return $this->redirect()->toRoute('admin/clientes/editar', array('id' => $entity->getIdcliente()));
     }
     $exist = \ClienteQuery::create()->filterByIdcliente($id)->exists();
     if ($exist) {
         $entity = \ClienteQuery::create()->findPk($id);
         $empleados = \EmpleadoQuery::create()->filterByIdempleado(1, \Criteria::NOT_EQUAL)->find();
         $empleados_array = array();
         $empleado = new \Empleado();
         foreach ($empleados as $empleado) {
             $id = $empleado->getIdempleado();
             $empleados_array[$id] = $empleado->getEmpleadoNombre() . ' ' . $empleado->getEmpleadoApellidopaterno() . ' ' . $empleado->getEmpleadoApallidomaterno();
         }
         $form = new \Admin\Clientes\Form\ClientesForm($empleados_array);
         $form->setData($entity->toArray(\BasePeer::TYPE_FIELDNAME));
         //LOS ARCHIVOS
         $files = \ClientearchivoQuery::create()->filterByIdcliente($entity->getIdcliente())->find();
         $files_array = array();
         $file = new \Clientearchivo();
         foreach ($files as $file) {
             $file_path = $file->getClientearchivoArchivo();
             $file_name = explode('files/clientes/' . $entity->getIdcliente() . '/', $file->getClientearchivoArchivo());
             $tmp['id'] = $file->getIdclientearchivo();
             $tmp['name'] = $file_name[1];
             $tmp['size'] = $file->getClientearchivoSize();
             $tmp['type'] = mime_content_type($_SERVER['DOCUMENT_ROOT'] . '/' . $file->getClientearchivoArchivo());
             $files_array[] = $tmp;
         }
         //RETORNAMOS A NUESTRA VISTA
         $view_model = new ViewModel();
         $view_model->setTemplate('admin/clientes/clientes/editar');
         $view_model->setVariables(array('entity' => json_encode($entity->toArray(\BasePeer::TYPE_FIELDNAME)), 'successMessages' => json_encode($this->flashMessenger()->getSuccessMessages()), 'form' => $form, 'files' => json_encode($files_array)));
         return $view_model;
     } else {
         return $this->redirect()->toRoute('admin/clientes', array('action' => 'index'));
     }
 }
 /**
  * Selects a collection of Expediente objects pre-filled with all related objects except Proveedorcliente.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return array           Array of Expediente objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptProveedorcliente(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(ExpedientePeer::DATABASE_NAME);
     }
     ExpedientePeer::addSelectColumns($criteria);
     $startcol2 = ExpedientePeer::NUM_HYDRATE_COLUMNS;
     ClientePeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + ClientePeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(ExpedientePeer::IDCLIENTE, ClientePeer::IDCLIENTE, $join_behavior);
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = ExpedientePeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = ExpedientePeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = ExpedientePeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             ExpedientePeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Cliente rows
         $key2 = ClientePeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ClientePeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = ClientePeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ClientePeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Expediente) to the collection in $obj2 (Cliente)
             $obj2->addExpediente($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return    Cliente A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID_CLIE`, `APELLIDO`, `NOMBRE`, `TELEFONO`, `DIRECCION`, `ID_PROV`, `ID_CIUDAD`, `EMAIL`, `USER`, `PASS` FROM `cliente` WHERE `ID_CLIE` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Cliente();
         $obj->hydrate($row);
         ClientePeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(ClientePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(ClientePeer::DATABASE_NAME);
         $criteria->add(ClientePeer::ID_CLIE, $pks, Criteria::IN);
         $objs = ClientePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #10
0
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = EmpleadoPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Cliente objects
         $criteria = new Criteria(ClientePeer::DATABASE_NAME);
         $criteria->add(ClientePeer::IDEMPLEADOCOMERCIAL, $obj->getIdempleado());
         $affectedRows += ClientePeer::doDelete($criteria, $con);
         // delete related Cliente objects
         $criteria = new Criteria(ClientePeer::DATABASE_NAME);
         $criteria->add(ClientePeer::IDEMPLEADOOPERACIONES, $obj->getIdempleado());
         $affectedRows += ClientePeer::doDelete($criteria, $con);
         // delete related Expedientearchivo objects
         $criteria = new Criteria(ExpedientearchivoPeer::DATABASE_NAME);
         $criteria->add(ExpedientearchivoPeer::IDEMPLEADO, $obj->getIdempleado());
         $affectedRows += ExpedientearchivoPeer::doDelete($criteria, $con);
         // delete related Expedientegasto objects
         $criteria = new Criteria(ExpedientegastoPeer::DATABASE_NAME);
         $criteria->add(ExpedientegastoPeer::IDEMPLEADO, $obj->getIdempleado());
         $affectedRows += ExpedientegastoPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
Exemple #11
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return                 Cliente A model object, or null if the key is not found
  * @throws PropelException
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `idcliente`, `cliente_email`, `cliente_password`, `cliente_razonsocial`, `cliente_rfc`, `cliente_calle`, `cliente_numero`, `cliente_interior`, `cliente_colonia`, `cliente_codigopostal`, `cliente_ciudad`, `cliente_estado`, `cliente_pais`, `cliente_telefono`, `cliente_celular`, `cliente_nombrecontacto`, `cliente_cumpleanios`, `cliente_callefiscal`, `cliente_numerofiscal`, `cliente_interiorfiscal`, `cliente_coloniafiscal`, `cliente_codigopostalfiscal`, `cliente_ciudadfiscal`, `cliente_estadofiscal`, `cliente_paisfiscal`, `cliente_padronimportador`, `cliente_encargadoconferido`, `cliente_r1`, `cliente_r2`, `cliente_identificacionrepresentantelegal`, `cliente_rfcrepresentantelegal`, `cliente_actaconstitutiva`, `cliente_podernotarial`, `cliente_cartaencomienda`, `cliente_comprobantedomicilio`, `cliente_comprobanteclabe`, `cliente_clabe`, `cliente_archivoszip`, `idempleadocomercial`, `idempleadooperaciones`, `cliente_ultimologin`, `cliente_fotografiasdomicilio` FROM `cliente` WHERE `idcliente` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Cliente();
         $obj->hydrate($row);
         ClientePeer::addInstanceToPool($obj, (string) $key);
     }
     $stmt->closeCursor();
     return $obj;
 }
 protected function getClienteOrNull($id_cliente = 'id_cliente')
 {
     if (!$this->getRequestParameter($id_cliente) || $this->getRequestParameter($id_cliente) == '') {
         $cliente = null;
     } else {
         $c = Cliente::getCriterioAlcance();
         $c->add($c->getNewCriterion(ClientePeer::ID_CLIENTE, $this->getRequestParameter($id_cliente)));
         $cliente = ClientePeer::doSelectOne($c);
     }
     return $cliente;
 }
 public static function findAllActivos()
 {
     $c = new Criteria();
     $c->add(ClientePeer::ACTIVO, 1);
     return ClientePeer::doSelect($c);
 }
Exemple #14
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's BasePeer::TYPE_PHPNAME
  *
  * @param array  $arr     An array to populate the object from.
  * @param string $keyType The type of keys the array uses.
  * @return void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ClientePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdcliente($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setClienteEmail($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setClientePassword($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setClienteRazonsocial($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setClienteRfc($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setClienteCalle($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setClienteNumero($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setClienteInterior($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setClienteColonia($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setClienteCodigopostal($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setClienteCiudad($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setClienteEstado($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setClientePais($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setClienteTelefono($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setClienteCelular($arr[$keys[14]]);
     }
     if (array_key_exists($keys[15], $arr)) {
         $this->setClienteNombrecontacto($arr[$keys[15]]);
     }
     if (array_key_exists($keys[16], $arr)) {
         $this->setClienteCumpleanios($arr[$keys[16]]);
     }
     if (array_key_exists($keys[17], $arr)) {
         $this->setClienteCallefiscal($arr[$keys[17]]);
     }
     if (array_key_exists($keys[18], $arr)) {
         $this->setClienteNumerofiscal($arr[$keys[18]]);
     }
     if (array_key_exists($keys[19], $arr)) {
         $this->setClienteInteriorfiscal($arr[$keys[19]]);
     }
     if (array_key_exists($keys[20], $arr)) {
         $this->setClienteColoniafiscal($arr[$keys[20]]);
     }
     if (array_key_exists($keys[21], $arr)) {
         $this->setClienteCodigopostalfiscal($arr[$keys[21]]);
     }
     if (array_key_exists($keys[22], $arr)) {
         $this->setClienteCiudadfiscal($arr[$keys[22]]);
     }
     if (array_key_exists($keys[23], $arr)) {
         $this->setClienteEstadofiscal($arr[$keys[23]]);
     }
     if (array_key_exists($keys[24], $arr)) {
         $this->setClientePaisfiscal($arr[$keys[24]]);
     }
     if (array_key_exists($keys[25], $arr)) {
         $this->setClientePadronimportador($arr[$keys[25]]);
     }
     if (array_key_exists($keys[26], $arr)) {
         $this->setClienteEncargadoconferido($arr[$keys[26]]);
     }
     if (array_key_exists($keys[27], $arr)) {
         $this->setClienteR1($arr[$keys[27]]);
     }
     if (array_key_exists($keys[28], $arr)) {
         $this->setClienteR2($arr[$keys[28]]);
     }
     if (array_key_exists($keys[29], $arr)) {
         $this->setClienteIdentificacionrepresentantelegal($arr[$keys[29]]);
     }
     if (array_key_exists($keys[30], $arr)) {
         $this->setClienteRfcrepresentantelegal($arr[$keys[30]]);
     }
     if (array_key_exists($keys[31], $arr)) {
         $this->setClienteActaconstitutiva($arr[$keys[31]]);
     }
     if (array_key_exists($keys[32], $arr)) {
         $this->setClientePodernotarial($arr[$keys[32]]);
     }
     if (array_key_exists($keys[33], $arr)) {
         $this->setClienteCartaencomienda($arr[$keys[33]]);
     }
     if (array_key_exists($keys[34], $arr)) {
         $this->setClienteComprobantedomicilio($arr[$keys[34]]);
     }
     if (array_key_exists($keys[35], $arr)) {
         $this->setClienteComprobanteclabe($arr[$keys[35]]);
     }
     if (array_key_exists($keys[36], $arr)) {
         $this->setClienteClabe($arr[$keys[36]]);
     }
     if (array_key_exists($keys[37], $arr)) {
         $this->setClienteArchivoszip($arr[$keys[37]]);
     }
     if (array_key_exists($keys[38], $arr)) {
         $this->setIdempleadocomercial($arr[$keys[38]]);
     }
     if (array_key_exists($keys[39], $arr)) {
         $this->setIdempleadooperaciones($arr[$keys[39]]);
     }
     if (array_key_exists($keys[40], $arr)) {
         $this->setClienteUltimologin($arr[$keys[40]]);
     }
     if (array_key_exists($keys[41], $arr)) {
         $this->setClienteFotografiasdomicilio($arr[$keys[41]]);
     }
 }
Exemple #15
0
 /**
  * Selects a collection of Movimiento objects pre-filled with all related objects except Producto.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return array           Array of Movimiento objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptProducto(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(MovimientoPeer::DATABASE_NAME);
     }
     MovimientoPeer::addSelectColumns($criteria);
     $startcol2 = MovimientoPeer::NUM_HYDRATE_COLUMNS;
     ProveedorPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + ProveedorPeer::NUM_HYDRATE_COLUMNS;
     ClientePeer::addSelectColumns($criteria);
     $startcol4 = $startcol3 + ClientePeer::NUM_HYDRATE_COLUMNS;
     $criteria->addJoin(MovimientoPeer::PROVEEDOR_ID, ProveedorPeer::ID, $join_behavior);
     $criteria->addJoin(MovimientoPeer::CLIENTE_ID, ClientePeer::ID, $join_behavior);
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BaseMovimientoPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MovimientoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MovimientoPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://www.propelorm.org/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = MovimientoPeer::getOMClass();
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MovimientoPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Proveedor rows
         $key2 = ProveedorPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = ProveedorPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = ProveedorPeer::getOMClass();
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 ProveedorPeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (Movimiento) to the collection in $obj2 (Proveedor)
             $obj2->addMovimiento($obj1);
         }
         // if joined row is not null
         // Add objects for joined Cliente rows
         $key3 = ClientePeer::getPrimaryKeyHashFromRow($row, $startcol3);
         if ($key3 !== null) {
             $obj3 = ClientePeer::getInstanceFromPool($key3);
             if (!$obj3) {
                 $cls = ClientePeer::getOMClass();
                 $obj3 = new $cls();
                 $obj3->hydrate($row, $startcol3);
                 ClientePeer::addInstanceToPool($obj3, $key3);
             }
             // if $obj3 already loaded
             // Add the $obj1 (Movimiento) to the collection in $obj3 (Cliente)
             $obj3->addMovimiento($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = CiudadPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Cliente objects
         $criteria = new Criteria(ClientePeer::DATABASE_NAME);
         $criteria->add(ClientePeer::ID_PROV, $obj->getIdProvincia());
         $affectedRows += ClientePeer::doDelete($criteria, $con);
         // delete related Cliente objects
         $criteria = new Criteria(ClientePeer::DATABASE_NAME);
         $criteria->add(ClientePeer::ID_CIUDAD, $obj->getIdciudad());
         $affectedRows += ClientePeer::doDelete($criteria, $con);
         // delete related Empleado objects
         $criteria = new Criteria(EmpleadoPeer::DATABASE_NAME);
         $criteria->add(EmpleadoPeer::ID_CIUDAD, $obj->getIdciudad());
         $affectedRows += EmpleadoPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }