Example #1
0
 static function updateFaq($faq, $transaction)
 {
     GenericDao::update($faq, $transaction);
 }
 static function getDiaBloqueoList()
 {
     return GenericDao::find("DiaBloqueo", array());
 }
Example #3
0
 static function addFormEntryMessage($messageDto)
 {
     $transaction = NULL;
     $result = array();
     $dwoo = new Core();
     try {
         $transaction = GenericDao::beginTransaction();
         $message = new FormEntryMessage(null, date("Y-m-d H:i:s", time()), true, $messageDto->proveedorId, $messageDto->entryId, $messageDto->formId, $messageDto->message, $messageDto->sender);
         FormDao::addFormEntryMessage($message, $transaction);
         $entry = FormAdmin::getFormEntryDetailById($messageDto->formId, $messageDto->entryId);
         if ($messageDto->sender == MessageSender::cliente) {
             FormAdmin::changeProveedorEntryState($messageDto->proveedorId, $messageDto->formId, $messageDto->entryId, \entities\ClienteState::enviada, \entities\ProveedorState::recibida);
             $transaction->commit();
             $proveedor = ProveedorDao::getProveedorById($messageDto->proveedorId);
             $user = SecurityDao::getUserById($proveedor->usuarioId);
             $dest = 'proveedor';
         } else {
             FormAdmin::changeProveedorEntryState($messageDto->proveedorId, $messageDto->formId, $messageDto->entryId, \entities\ClienteState::enProceso, \entities\ProveedorState::enProceso);
             $transaction->commit();
             $user = SecurityDao::getUserById($entry->userId);
             $dest = 'cliente';
         }
         $user->logo = AppConfig::logoUrl;
         $user->producto = $entry->producto;
         $code = base64_encode($user->id . '|' . $user->createDate . '|' . $user->mail . '|' . $dest . '|' . date("Y-m-d H:i:s", time()));
         $link = 'http://' . getenv('HTTP_HOST') . APP_FOLDER . '/views/client/AutoLoginManager.php?c=' . $code;
         $user->link = $link;
         $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/newMessage.tpl', (array) $user);
         Mail::Send($user->mail, 'Aladinnus, nuevo mensaje', $template);
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result = array($ex->getMessage());
     }
     return $result;
 }
 static function deleteDiaBloqueo($diaBloqueoId)
 {
     $diaBloqueo = SolicitudesEntregaDao::getDiaBLoqueoById($diaBloqueoId);
     $result = new Result();
     try {
         $transaction = GenericDao::beginTransaction();
         SolicitudesEntregaDao::deleteDiaBloqueo($diaBloqueo, $transaction);
         $transaction->commit();
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result->hasErrors = true;
         $result->messages = array($ex->getMessage());
     }
     $response = new Response($result, NULL);
     return json_encode($response);
 }
Example #5
0
 static function deleteReserva($id)
 {
     $reserva = SecurityDao::getReservaById($id);
     $result = new Result();
     try {
         $transaction = GenericDao::beginTransaction();
         $reserva->deleted = true;
         SecurityDao::updateReserva($reserva, $transaction);
         $transaction->commit();
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result->hasErrors = true;
         $result->messages = array($ex->getMessage());
     }
     $response = new Response($result, NULL);
     return json_encode($response);
 }
Example #6
0
 static function updateReserva($reserva, $transaction)
 {
     GenericDao::update($reserva, $transaction);
 }
Example #7
0
 static function deleteFaq($faqId)
 {
     $faq = BaseDao::getFaqById($faqId);
     $result = new Result();
     try {
         $transaction = GenericDao::beginTransaction();
         $faq->deleted = true;
         BaseDao::updateFaq($faq, $transaction);
         $transaction->commit();
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result->hasErrors = true;
         $result->messages = array($ex->getMessage());
     }
     $response = new Response($result, NULL);
     return json_encode($response);
 }