Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build/*
validation_data.json

# content of settings.php is autogenerated
www/settings.php
# www/settings.php

# Mysql Volume
/mysql-data/*
Expand Down Expand Up @@ -46,4 +46,5 @@ Desktop.ini
!*.secret
random_seed
junit-report.html
junit-report.xml
junit-report.xml
.env
10 changes: 5 additions & 5 deletions api/contrib/clave/clave.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ function getClave($tipoDocumento = "", $tipoCedula = "", $cedula = "", $situacio
}

if (!ctype_digit($consecutivo)) {
return "El parametro sucursal no es numeral";
return "El parametro consecutivo no es numeral";
} else if (strlen($consecutivo) < 10) {
$consecutivo = str_pad($consecutivo, 10, "0", STR_PAD_LEFT);
} else if (strlen($consecutivo) > 10) {
return "El parametro consecutivo debe ser de 10 digitos";
}

if (!ctype_digit($codigoSeguridad)) {
return "El parametro sucursal no es numeral";
return "El parametro codigoSeguridad no es numeral";
} else if (strlen($codigoSeguridad) < 8) {
$codigoSeguridad = str_pad($codigoSeguridad, 8, "0", STR_PAD_LEFT);
} else if (strlen($codigoSeguridad) > 8) {
Expand Down Expand Up @@ -180,14 +180,14 @@ function getClave($tipoDocumento = "", $tipoCedula = "", $cedula = "", $situacio
"sininternet" => 3
);

$situacion = $situaciones[strtolower($situacion)] ?? null;
$codSituacion = $situaciones[strtolower($situacion)] ?? null;

if ($situacion === null) {
if ($codSituacion === null) {
return "No se encuentra el tipo de situacion [$situacion]";
}

// Crea la clave
$clave = $codigoPais . $dia . $mes . $ano . $identificacion . $consecutivoFinal . $situacion . $codigoSeguridad;
$clave = $codigoPais . $dia . $mes . $ano . $identificacion . $consecutivoFinal . $codSituacion . $codigoSeguridad;
$arrayResp = array(
"clave" => "$clave",
"consecutivo" => "$consecutivoFinal",
Expand Down
7 changes: 1 addition & 6 deletions api/contrib/genXML/genXML.php
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function genXMLFe()
$l = 1;

foreach ($detalles as $d) {

foreach (["codigoCABYS","subTotal","impuestoAsumidoEmisorFabrica","impuestoNeto"] as $requiredField) {
if (!isset($d->{$requiredField}) || $d->{$requiredField} === '') {
tools_reply("Se requiere el campo $requiredField en el detalle #$l", true);
Expand All @@ -445,11 +445,6 @@ function genXMLFe()
<LineaDetalle>
<NumeroLinea>' . $l . '</NumeroLinea>';

if(!isset($d->codigoCABYS) || $d->codigoCABYS == "") {
error_log("codigoCABYS is required in LineaDetalle");
tools_reply("Se requiere el codigoCABYS en el detalle #$l", true);
continue; // Skip this line if codigoCABYS is not set
}
$xmlString .= '
<CodigoCABYS>' . $d->codigoCABYS . '</CodigoCABYS>';

Expand Down
23 changes: 14 additions & 9 deletions www/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@
global $config;

# Cargar config del .env
$env = file_get_contents(__DIR__."/../.env");
$lines = explode("\n",$env);

foreach($lines as $line){
preg_match("/([^#]+)\=(.*)/",$line,$matches);
if(isset($matches[2])){ putenv(trim($line)); }
}
$envFilePath = __DIR__ . "/../.env";
if (file_exists($envFilePath)) {
$env = file_get_contents($envFilePath);
$lines = explode("\n", $env);

foreach ($lines as $line) {
preg_match("/^\s*([^#][^=]*)=(.*)$/", $line, $matches);
if (isset($matches[2])) {
putenv(trim($line));
}
}
}

#####################################################################################
#
Expand Down Expand Up @@ -111,11 +116,11 @@
/*******************************************************************************
* You should not need to touch anything beyond this point
*/



# List of core modules
$config['modules']['core'] = array('cala','db', 'users', 'files', 'geoloc', 'wirez', 'crypto');
$config['modules']['core'] = array('cala', 'db', 'users', 'files', 'geoloc', 'wirez', 'crypto');
# List of core modules to load always, you can overide this list
$config['modules']['coreLoad'] = array('cala', 'db', 'users', 'crypto');

Expand Down