FIX: transacciones, tipocambio and headers

This commit is contained in:
2022-01-06 15:19:36 -03:00
parent b17225549c
commit 3cb2a877de
3 changed files with 6 additions and 1 deletions

View File

@ -69,6 +69,9 @@ class TiposCambios {
return $cambio->valor; return $cambio->valor;
} }
$valor = $this->getValor($fecha, $moneda->codigo); $valor = $this->getValor($fecha, $moneda->codigo);
if ($valor === null) {
return 1;
}
$data = [ $data = [
'fecha' => $fecha->format('Y-m-d H:i:s'), 'fecha' => $fecha->format('Y-m-d H:i:s'),
'desde_id' => $moneda->id, 'desde_id' => $moneda->id,

View File

@ -12,11 +12,12 @@ server {
} }
location ~ \.php$ { location ~ \.php$ {
if ($request_method = 'OPTIONS') { if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'application/json'; add_header 'Content-Type' 'application/json';
add_header 'Content-Length' 0; add_header 'Content-Length' 0;
return 204; return 204;

View File

@ -56,6 +56,7 @@ class Cuenta extends Model {
public function transacciones($limit = null, $start = 0) { public function transacciones($limit = null, $start = 0) {
if ($this->transacciones === null) { if ($this->transacciones === null) {
$transacciones = Model::factory(Transaccion::class) $transacciones = Model::factory(Transaccion::class)
->select('transacciones.*')
->join('cuentas', 'cuentas.id = transacciones.debito_id OR cuentas.id = transacciones.credito_id') ->join('cuentas', 'cuentas.id = transacciones.debito_id OR cuentas.id = transacciones.credito_id')
->whereEqual('cuentas.id', $this->id) ->whereEqual('cuentas.id', $this->id)
->orderByAsc('transacciones.fecha'); ->orderByAsc('transacciones.fecha');