/** * Filter the query by a related Expedientehistorial object * * @param Expedientehistorial|PropelObjectCollection $expedientehistorial the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ExpedienteservicioQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByExpedientehistorial($expedientehistorial, $comparison = null) { if ($expedientehistorial instanceof Expedientehistorial) { return $this->addUsingAlias(ExpedienteservicioPeer::IDEXPEDIENTESERVICIO, $expedientehistorial->getIdexpedienteservicio(), $comparison); } elseif ($expedientehistorial instanceof PropelObjectCollection) { return $this->useExpedientehistorialQuery()->filterByPrimaryKeys($expedientehistorial->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByExpedientehistorial() only accepts arguments of type Expedientehistorial or PropelCollection'); } }
/** * @param Expedientehistorial $expedientehistorial The expedientehistorial object to add. */ protected function doAddExpedientehistorial($expedientehistorial) { $this->collExpedientehistorials[] = $expedientehistorial; $expedientehistorial->setServicioestado($this); }
public function agregarhistorialAction() { $request = $this->getRequest(); if ($request->isPost()) { $post_data = $request->getPost(); $entity = new \Expedientehistorial(); foreach ($post_data as $key => $value) { if (\ExpedientehistorialPeer::getTableMap()->hasColumn($key) && !empty($value)) { $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME); } } //La fecha $entity->setExpedientehistorialFecha(new \DateTime()); $entity->save(); //Validamos si se va enviar por correo al cliente if (isset($post_data['sendemail'])) { $cliente = $entity->getExpedienteservicio()->getExpediente()->getCliente(); $new_status = $entity->getServicioestado()->getServicioestadoNombre(); $folio = $entity->getExpedienteservicio()->getExpediente()->getExpedienteFolio(); $mailer = new \Shared\GeneralFunction\Itrademailer(); if ($mailer->changeStatusEmail($cliente, $folio, $new_status)) { $this->flashMessenger()->addSuccessMessage('Correo electronico enviado exitosamente!'); } } $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!'); //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR return $this->redirect()->toUrl('/clientes/ver/' . $entity->getExpedienteservicio()->getExpediente()->getIdcliente() . '/expedientes/ver/' . $entity->getExpedienteservicio()->getIdexpediente()); } $idexpedienteservicio = $this->params()->fromQuery('idexpedienteservicio'); $expedienteservicio = \ExpedienteservicioQuery::create()->findPk($idexpedienteservicio); $expediente = $expedienteservicio->getExpediente(); //Obtenemos los estatus disponibles dependiendo del servicio seleccionado $servicio_estatus = array(); $servicioestatus = \ServicioestadoQuery::create()->filterByIdservicio($expedienteservicio->getIdservicio())->find(); $estatus = new \Servicioestado(); foreach ($servicioestatus as $estatus) { $id = $estatus->getIdservicioestado(); $servicio_estatus[$id] = $estatus->getServicioestadoNombre(); } //Instanciamos nuestro formurmalario $form = new \Admin\Clientes\Form\HistorialForm($idexpedienteservicio, $servicio_estatus); //Enviamos a la vista $view_model = new ViewModel(); $view_model->setTerminal(true)->setVariable('form', $form)->setVariable('entity', $expediente)->setTemplate('/clientes/expedientes/modal/agregarhistorial'); return $view_model; }
/** * Exclude object from result * * @param Expedientehistorial $expedientehistorial Object to remove from the list of results * * @return ExpedientehistorialQuery The current query, for fluid interface */ public function prune($expedientehistorial = null) { if ($expedientehistorial) { $this->addUsingAlias(ExpedientehistorialPeer::IDEXPEDIENTEHISTORIAL, $expedientehistorial->getIdexpedientehistorial(), Criteria::NOT_EQUAL); } return $this; }
/** * 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 Expedientehistorial $obj A Expedientehistorial 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->getIdexpedientehistorial(); } // if key === null ExpedientehistorialPeer::$instances[$key] = $obj; } }