コード例 #1
0
 /**
  *
  * @param integer $user_id - Id del usuario para obtener los folios correspondientes
  * @return boolean
  *      true  - si se ha actualizado el folio <br>
  *      false - Si no se actualizó el folio
  */
 public function updateFolio()
 {
     $folio = $this->createQuery()->from('folio')->where('user_id = ?', sfCOntext::getInstance()->getUser()->getGuardUser()->getId())->andWhere('status = ?', 'active')->execute()->getFirst();
     if ($folio->count() > 0) {
         if ($folio['start'] >= $folio['end']) {
             $folio['status'] = "suspended";
             $folio['available'] = 0;
             $folio->save();
         } else {
             $folio['start'] = $folio['start'] + 1;
             $folio['used'] = $folio['used'] + 1;
             $folio['available'] = $folio['end'] - $folio['used'];
             $folio->save();
         }
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
 public function getInvoiceByUser($folio)
 {
     $result = $this->createQuery()->from('invoice')->where('user_id = ?', sfCOntext::getInstance()->getUser()->getGuardUser()->getId())->andWhere('folio = ?', $folio)->execute();
     return $result->getFirst();
 }
コード例 #3
0
 public function getConceptsbyuser()
 {
     $result = Doctrine_query::create()->from('concept')->where('user_id = ?', sfCOntext::getInstance()->getUser()->getGuardUser()->getId())->addWhere('status = "1"')->execute();
     return $result;
 }