phpcfdi / cfdi-cleaner Goto Github PK
View Code? Open in Web Editor NEWHerramienta para limpiar Comprobantes Fiscales Digitales 3.2, 3.3 y 4.0
License: MIT License
Herramienta para limpiar Comprobantes Fiscales Digitales 3.2, 3.3 y 4.0
License: MIT License
The build process is broken, apparently the new version of php-cs-fixer
check don't pass.
Please, fix the code base and make the build process pass again.
Hola, tengo un caso donde estamos leyendo XML con la addenda de susuki y el cleaner esta tirando TypeError.
<cfdi:Addenda>
<Suzuki xsi:schemaLocation="http://repository.edicomnet.com/schemas/mx/cfd/addenda/Suzuki http://repository.edicomnet.com/schemas/mx/cfd/addenda/Suzuki.xsd" xmlns="http://repository.edicomnet.com/schemas/mx/cfd/addenda/Suzuki">
<Header Email="[email protected]" FechaVencimiento="MIÉRCOLES, 19 DE JULIO DE 2023" Telefono="11111111" Web="www.suzuki.com.mx" fecDocumento="0000000000" numAlmacen="0" numCliente="1111111" numDocumento="121212_C142536" numPedidoCliente="0" tipoDocumento="05" xmlns="">
<Detalles>
<Detalle cantFacturada="1.000" codLinea="AUT-VTA-07" montoLinea="100000.26" numLinea="1" precioUnitario="100000.26" uMedidaFacturada="Pza" descripcion="description.">
<Subdetalle Anio="0" marcaVehiculo="SUZUKI" />
</Detalle>
</Detalles>
<Totales importeLetra="importe en letra." subTotalFact="100000.26" totaFactura="100000.26" totalFactPesos="100000.26" totalImpTrasPesos="100.64" />
</Header>
</Suzuki>
</cfdi:Addenda>
El error es el siguiente:
PHP Fatal error: Uncaught TypeError: PhpCfdi\CfdiCleaner\XmlDocumentCleaners\RemoveNonSatNamespacesNodes::isNamespaceRelatedToSat(): Argument #1 ($namespace) must be of type string, null given
Creo que esto sucede por que en el método iterateNonReservedNamespaces
de XmlNamespaceMethodsTrait
solo esta filtrando los URIs nulos y no los vacíos y para los vacíos el nodeValue es null
Este error se produce cuando se tiene la siguiente estructura en el XML
<cfdi:Comprobante
xmlns:cfdi="http://www.sat.gob.mx/cfd/3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"
xmlns:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"
Version="3.3"
/>
Cuando el proceso limpia el XML, el resultado que se obtiene presenta una segunda definición de xsi:schemaLocation
<?xml version="1.0" encoding="utf-8"?>
<cfdi:Comprobante
xmlns:cfdi="http://www.sat.gob.mx/cfd/3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"
xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"
/>
Este error se produce cuando se tiene un cfdi 4.0 que contiene addendas
<cfdi:Comprobante xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cfdi="http://www.sat.gob.mx/cfd/4"
xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 cfdi44.xsd"
Version="4.0">
<cfdi:Addenda>
<o:OtherData xmlns:o="http://tempuri.org/other" foo="bar" />
</cfdi:Addenda>
</cfdi:Comprobante>
Cuando el proceso limpie el xml, lo esperado es que sea un cfdi sin addendas pero se sigue recibiendo tal cual con addendas
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.