/**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aProveedoritrade instanceof Persistent) {
             $this->aProveedoritrade->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aProveedoritrade = null;
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Proveedoritrade $obj A Proveedoritrade object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getIdproveedoritrade();
         }
         // if key === null
         ProveedoritradePeer::$instances[$key] = $obj;
     }
 }
 /**
  * Filter the query by a related Proveedoritrade object
  *
  * @param   Proveedoritrade|PropelObjectCollection $proveedoritrade The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 ExpedientegastoQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByProveedoritrade($proveedoritrade, $comparison = null)
 {
     if ($proveedoritrade instanceof Proveedoritrade) {
         return $this->addUsingAlias(ExpedientegastoPeer::IDPROVEEDORITRADE, $proveedoritrade->getIdproveedoritrade(), $comparison);
     } elseif ($proveedoritrade instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ExpedientegastoPeer::IDPROVEEDORITRADE, $proveedoritrade->toKeyValue('PrimaryKey', 'Idproveedoritrade'), $comparison);
     } else {
         throw new PropelException('filterByProveedoritrade() only accepts arguments of type Proveedoritrade or PropelCollection');
     }
 }
Example #4
0
 public function serversideAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         //EL MAPEO DE NUESTRA TABALA
         $table_map = array(0 => 'proveedoritrade_nombre', 1 => 'proveedor_nombrecontacto', 2 => 'proveedoritrade_telefono');
         $post_data = $request->getPost();
         //NUESTRA QUERY
         $query = new \ProveedoritradeQuery();
         $query->filterByIdproveedoritrade(1, \Criteria::NOT_EQUAL);
         //ORDER
         if (isset($post_data['order'])) {
             $order = $table_map[$post_data['order'][0]['column']];
             $dir = $post_data['order'][0]['dir'];
             $query->orderBy($order, $dir);
         } else {
             $query->orderByIdproveedoritrade(\Criteria::DESC);
         }
         if (!empty($post_data['search']['value'])) {
             $search = $post_data['search']['value'];
             $c = new \Criteria();
             $c1 = $c->getNewCriterion('proveedoritrade.proveedoritrade_nombre', '%' . $search . '%', \Criteria::LIKE);
             $c2 = $c->getNewCriterion('proveedoritrade.proveedoritrade_nombrecontacto', '%' . $search . '%', \Criteria::LIKE);
             $c3 = $c->getNewCriterion('proveedoritrade.proveedoritrade_telefono', '%' . $search . '%', \Criteria::LIKE);
             $c1->addOr($c2)->addOr($c3);
             $query->addAnd($c1);
         }
         //EL TOTAL DE LA BUSQUEDA
         $recordsFiltered = $query->count();
         //LIMIT
         $query->setOffset((int) $post_data['start']);
         $query->setLimit((int) $post_data['length']);
         //DAMOS EL FORMATO CORRECTO
         $data = array();
         $value = new \Proveedoritrade();
         foreach ($query->find() as $value) {
             $tmp['DT_RowId'] = $value->getIdproveedoritrade();
             $tmp['proveedoritrade_nombre'] = $value->getProveedoritradeNombre();
             $tmp['proveedor_nombrecontacto'] = $value->getProveedoritradeNombrecontacto();
             $tmp['proveedoritrade_telefono'] = $value->getProveedoritradeTelefono();
             $tmp['empleado_options'] = '<a data-toggle="tooltip" data-placement="left" title="Editar" href="/catalogo/proveedores/editar/' . $value->getIdproveedoritrade() . '"><i class="fa fa-pencil"></i></a><a class="delete" data-toggle="tooltip" data-placement="left" title="Eliminar" href="javascript:void(0)"><i class="fa fa-trash-o"></i></a>';
             $data[] = $tmp;
         }
         //El arreglo que regresamos
         $json_data = array("draw" => (int) $post_data['draw'], "recordsFiltered" => $recordsFiltered, "data" => $data, "page" => $post_data['url_params']['page']);
         return $this->getResponse()->setContent(json_encode($json_data));
     }
 }
 /**
  * Exclude object from result
  *
  * @param   Proveedoritrade $proveedoritrade Object to remove from the list of results
  *
  * @return ProveedoritradeQuery The current query, for fluid interface
  */
 public function prune($proveedoritrade = null)
 {
     if ($proveedoritrade) {
         $this->addUsingAlias(ProveedoritradePeer::IDPROVEEDORITRADE, $proveedoritrade->getIdproveedoritrade(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 public function nuevocargoAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = $request->getPost();
         $post_files = $request->getFiles();
         $auth = new \Shared\Session\AouthSession();
         $auth = $auth->getData();
         $entity = new \Expedientegasto();
         foreach ($post_data as $key => $value) {
             if (\ExpedientegastoPeer::getTableMap()->hasColumn($key) && !empty($value) && $key != 'expedientegasto_fecha') {
                 $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME);
             }
         }
         //LA FECHA
         $expedientegasto_fecha = \DateTime::createFromFormat('d/m/Y', $post_data['expedientegasto_fecha']);
         $entity->setExpedientegastoFecha($expedientegasto_fecha);
         $entity->setIdempleado($auth['idempleado']);
         $entity->save();
         //El comprobante
         if (!empty($post_files['expedientegasto_comprobante']['name'])) {
             $target_path = "/files/expedientesgastos/";
             $target_path = $target_path . $entity->getIdexpedientegasto() . '_' . basename($post_files['expedientegasto_comprobante']['name']);
             if (move_uploaded_file($_FILES['expedientegasto_comprobante']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . $target_path)) {
                 $entity->setExpedientegastoComprobante($target_path);
                 $entity->save();
             }
         }
         $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!');
         //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR
         return $this->redirect()->toUrl('/clientes/ver/' . $entity->getExpediente()->getIdcliente() . '/expedientes/ver/' . $entity->getIdexpediente());
     }
     $idexpediente = $this->params()->fromQuery('id');
     $moneda = $this->params()->fromQuery('moneda');
     $entity = \ExpedienteQuery::create()->findPk($idexpediente);
     //LAS CATEGORIAS DE NUESTROS GASTOS
     $categoriasgasto = \CategoriagastoQuery::create()->find();
     $categoriasgasto_array = array();
     foreach ($categoriasgasto as $categoriagastos) {
         $id = $categoriagastos->getIdcategoriagasto();
         $categoriasgasto_array[$id] = $categoriagastos->getCategoriagastoNombre();
     }
     //LOS PROVEEDORES
     $proveedores = \ProveedoritradeQuery::create()->filterByIdproveedoritrade(1, \Criteria::NOT_EQUAL)->find();
     $proveedores_array = array();
     $proveedor = new \Proveedoritrade();
     foreach ($proveedores as $proveedor) {
         $id = $proveedor->getIdproveedoritrade();
         $proveedores_array[$id] = $proveedor->getProveedoritradeNombre();
     }
     //INSTANCIAMOS NUESTRO FORMULARIO
     $form = new \Admin\Clientes\Form\ExpedientegastoForm($idexpediente, $categoriasgasto_array, $proveedores_array, $moneda);
     //Enviamos a la vista
     $view_model = new ViewModel();
     $view_model->setTerminal(true)->setVariable('form', $form)->setVariable('entity', $entity)->setTemplate('/clientes/expedientes/modal/nuevocargo');
     return $view_model;
 }
Example #7
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aEmpleado instanceof Persistent) {
             $this->aEmpleado->clearAllReferences($deep);
         }
         if ($this->aExpediente instanceof Persistent) {
             $this->aExpediente->clearAllReferences($deep);
         }
         if ($this->aGastofacturacion instanceof Persistent) {
             $this->aGastofacturacion->clearAllReferences($deep);
         }
         if ($this->aProveedoritrade instanceof Persistent) {
             $this->aProveedoritrade->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aEmpleado = null;
     $this->aExpediente = null;
     $this->aGastofacturacion = null;
     $this->aProveedoritrade = null;
 }