コード例 #1
0
ファイル: BaseOrdencompra.php プロジェクト: jalvarez14/hva
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Ordencompra is new, it will return
  * an empty collection; or if this Ordencompra has previously
  * been saved, it will retrieve related Traspasos from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Ordencompra.
  *
  * @param Criteria $criteria optional Criteria object to narrow the query
  * @param PropelPDO $con optional connection object
  * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
  * @return PropelObjectCollection|Traspaso[] List of Traspaso objects
  */
 public function getTraspasosJoinLugarRelatedByIdlugarremitente($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $query = TraspasoQuery::create(null, $criteria);
     $query->joinWith('LugarRelatedByIdlugarremitente', $join_behavior);
     return $this->getTraspasos($query, $con);
 }
コード例 #2
0
 /**
  * Get the associated Traspaso object
  *
  * @param PropelPDO $con Optional Connection object.
  * @param $doQuery Executes a query to get the object if required
  * @return Traspaso The associated Traspaso object.
  * @throws PropelException
  */
 public function getTraspaso(PropelPDO $con = null, $doQuery = true)
 {
     if ($this->aTraspaso === null && $this->idtraspaso !== null && $doQuery) {
         $this->aTraspaso = TraspasoQuery::create()->filterByTraspasodetalles($this)->findOne($con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aTraspaso->addTraspasodetalless($this);
            */
     }
     return $this->aTraspaso;
 }
コード例 #3
0
 public function transferenciadetallesAction()
 {
     $id = $this->params()->fromQuery('id');
     $modalName = 'modal-preview-' . $id;
     $modal = array();
     $entity = \TraspasoQuery::create()->findOneByIdinventariolugar($id);
     $modal['id'] = $entity->getIdinventariolugar();
     $modal['fecha'] = $entity->getTraspasoFecha('d-m-Y');
     $modal['remitente'] = $entity->getLugarRelatedByIdlugarremitente()->getLugarNombre();
     $modal['receptor'] = $entity->getLugarRelatedByIdlugardestinatario()->getLugarNombre();
     $modal['detalles'] = array();
     $traspaso_detalles = $entity->getTraspasodetalless();
     foreach ($traspaso_detalles as $detalle) {
         $tmp['cantidad'] = (int) $detalle->getTraspasoCantidad();
         $tmp['descripcion'] = '';
         $idarticulovariante = $detalle->getLugarinventario()->getOrdencompradetalle()->getIdarticulovariante();
         $articulovariante = \ArticulovarianteQuery::create()->findPk($idarticulovariante);
         $articulovariantevalor = \ArticulovariantevalorQuery::create()->filterByIdarticulovariante($idarticulovariante)->find();
         $tmp['descripcion'] .= $articulovariante->getArticulo()->getArticuloNombre() . ' ';
         foreach ($articulovariantevalor as $key => $value) {
             $propiedadCount++;
             $tmp['descripcion'] .= \PropiedadQuery::create()->findOneByIdpropiedad($value->getIdpropiedad())->getPropiedadNombre();
             //Propiedad
             $tmp['descripcion'] .= ':' . \PropiedadvalorQuery::create()->findOneByIdpropiedadvalor($value->getIdpropiedadvalor())->getPropiedadvalorNombre();
             //PropiedadValor
             if ($propiedadCount < $articulovariantevalor->count()) {
                 $tmp['descripcion'] .= ' - ';
             }
         }
         $tmp['caducidad'] = !is_null($detalle->getLugarinventario()->getOrdencompradetalle()->getOrdencompradetalleCaducidad('m/Y')) ? $detalle->getLugarinventario()->getOrdencompradetalle()->getOrdencompradetalleCaducidad('m/Y') : 'N/D';
         array_push($modal['detalles'], $tmp);
     }
     $viewModel = new ViewModel();
     $viewModel->setTerminal(true);
     $viewModel->setVariables(array('modalName' => $modalName, 'modal' => $modal));
     return $viewModel;
 }
コード例 #4
0
ファイル: BaseTraspaso.php プロジェクト: jalvarez14/hva
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(TraspasoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = TraspasoQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }