diff --git a/include/XMLDocument/xml_reader.class.php b/include/XMLDocument/xml_reader.class.php index 6e291df2f..31c1ce03b 100644 --- a/include/XMLDocument/xml_reader.class.php +++ b/include/XMLDocument/xml_reader.class.php @@ -31,7 +31,6 @@ namespace Noalyss\XMLDocument; */ abstract class XML_Reader { - protected \DOMDocument $domDocument; protected readonly \DOMXPath $xpath; @@ -578,12 +577,16 @@ abstract class XML_Reader $pdf->write_cell(50, 4, _("Total Hors Taxe")); $pdf->write_cell(50, 4, nbm($result['TaxExclusiveAmount']),align:'R'); $pdf->line_new(); - $pdf->write_cell(50, 4, _("Total avec Taxe")); - $pdf->write_cell(50, 4, nbm($result['TaxInclusiveAmount']),align:'R'); + $pdf->setFont("DejaVu", "B", 7); + $pdf->write_cell(50, 4, _("Total avec Taxe"),border:1); + $pdf->write_cell(50, 4, nbm($result['TaxInclusiveAmount']),border:1,align:'R'); $pdf->line_new(); - $pdf->write_cell(50, 4, _("Total à payer")); - $pdf->write_cell(50, 4, nbm($result['PayableAmount']),align:'R'); + + $pdf->setFont("DejaVu", "B", 7); + $pdf->write_cell(50, 4, _("Total à payer"),border:1); + $pdf->write_cell(50, 4, nbm($result['PayableAmount']),border:1,align:'R'); $pdf->line_new(); + $pdf->setFont("DejaVu", "", 7); $pdf->write_cell(50, 4, _("Total réduction")); $pdf->write_cell(50, 4, nbm($result['AllowanceTotalAmount']),align:'R'); $pdf->line_new(); @@ -633,20 +636,22 @@ abstract class XML_Reader $pdf->setFont("DejaVu", "", 7); $result = $this->get_taxes(); $pdf->write_cell(25, 4, _("% Taxe"), align: 'R', border: 'B'); - $pdf->write_cell(30, 4, _("Code taxe"), border: 'B'); - $pdf->write_cell(50, 4, _("Base"), align: 'R', border: 'B'); - $pdf->write_cell(50, 4, _("Taxe"), align: 'R', border: 'B'); + $pdf->write_cell(100, 4, _("Code taxe"), border: 'B'); + $pdf->write_cell(30, 4, _("Base"), align: 'R', border: 'B'); + $pdf->write_cell(30, 4, _("Taxe"), align: 'R', border: 'B'); $pdf->line_new(); $nb_inline = count($result); for ($i = 0; $i < $nb_inline; $i++) { - $pdf->write_cell(25, 4, $result[$i]['tax_percent'], align: 'R'); + $pdf->write_cell(20, 4, $result[$i]['tax_percent'], align: 'R'); $pdf->write_cell(5, 4, $result[$i]['tax_id']); - $pdf->write_multi(25, 4, $result[$i]['vatex']); - $pdf->write_cell(50, 4, nbm($result[$i]['taxable_amount']), align: 'R'); - $pdf->write_cell(50, 4, nbm($result[$i]['tax']), align: 'R'); + $pdf->write_multi(100, 4, $result[$i]['vatex']); + $pdf->write_cell(30, 4, nbm($result[$i]['taxable_amount']),border:'R',align: 'R'); + $pdf->write_cell(30, 4, nbm($result[$i]['tax']), border:'R',align: 'R'); $pdf->line_new(); + $pdf->write_cell(185,0,'',border:'T'); + $pdf->line_new(); } $pdf->line_new(10); diff --git a/include/XMLDocument/xmlcreditnote_reader.class.php b/include/XMLDocument/xmlcreditnote_reader.class.php index 848ca78de..ba3d3b803 100644 --- a/include/XMLDocument/xmlcreditnote_reader.class.php +++ b/include/XMLDocument/xmlcreditnote_reader.class.php @@ -188,28 +188,37 @@ class XMLCreditNote_Reader extends XML_Reader { $result = []; $node = $this->get_node("//cac:TaxTotal/cac:TaxSubtotal"); - for ($e = 0; $e < $node->length; $e++) { $row = []; + $xml = simplexml_import_dom($node->item($e)); - // /Invoice/cac:TaxTotal[1]/cac:TaxSubtotal[1]/cbc:TaxableAmount[1] $this->registerNS($xml); - - $row ['taxable_amount'] = $xml->xpath("//cbc:TaxableAmount")[$e] . ""; - $row ['tax'] = $xml->xpath("//cbc:TaxAmount")[$e] . ""; - $row ['tax_id'] = $xml->xpath("//cac:TaxCategory/cbc:ID")[$e] . ""; - $row ['tax_percent'] = $xml->xpath("//cac:TaxCategory/cbc:Percent")[$e] . ""; - if (isset($xml->xpath("//cac:CreditNoteLine/cac:Item/cbc:Name")[$e])) - $row ['name'] =$xml->xpath("//cac:CreditNoteLine/cac:Item/cbc:Name")[$e].""; - else - $row['name']=""; - - if ( isset ($xml->xpath("//cbc:TaxExemptionReasonCode")[$e])) + + + $row ['taxable_amount'] = $xml->xpath("cbc:TaxableAmount")[0] . ""; + $row ['tax'] = $xml->xpath("cbc:TaxAmount")[0] . ""; + $row['tax_currency']=$xml->xpath("cbc:TaxAmount")[0]->attributes()['currencyID'].""; + $row ['tax_id'] = $xml->xpath("cac:TaxCategory/cbc:ID")[0]. ""; + $row ['tax_percent'] =0; + $r=$xml->xpath("//cac:TaxCategory/cbc:Percent"); + if ( isset($r[$e]) ) { - $row['vatex']=$xml->xpath("//cbc:TaxExemptionReasonCode")[$e]; - }else { - $row['vatex']=""; + $row ['tax_percent'] = $xml->xpath("cac:TaxCategory/cbc:Percent")[0] . ""; + } + $row ['name'] =""; + if ( $xml->xpath("cac:TaxCategory/cbc:Name") != null) + { + $row['name']=$xml->xpath("cac:TaxCategory/cbc:Name")[0].''; + } + $row['vatex']=""; + if ( $xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason") != null) + { + $row['vatex']=$xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason")[0].''; + } + if ( $xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason") != null) + { + $row['vatex'].=$xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason")[0].''; } $result[] = $row; } diff --git a/include/XMLDocument/xmlinvoice_reader.class.php b/include/XMLDocument/xmlinvoice_reader.class.php index eafb539cc..66cc6f6cd 100644 --- a/include/XMLDocument/xmlinvoice_reader.class.php +++ b/include/XMLDocument/xmlinvoice_reader.class.php @@ -149,40 +149,43 @@ class XMLInvoice_Reader extends XML_Reader * @brief get the Taxes info from XML * @return array */ - function get_taxes(): array + function get_taxes(): array { $result = []; $node = $this->get_node("//cac:TaxTotal/cac:TaxSubtotal"); - for ($e = 0; $e < $node->length; $e++) { $row = []; - $xml = simplexml_import_dom($node->item($e)); - // /Invoice/cac:TaxTotal[1]/cac:TaxSubtotal[1]/cbc:TaxableAmount[1] - $this->registerNS($xml); - $row ['taxable_amount'] = $xml->xpath("//cbc:TaxableAmount")[$e] . ""; - $row ['tax'] = $xml->xpath("//cbc:TaxAmount")[$e] . ""; - $row ['tax_id'] = $xml->xpath("//cac:TaxCategory/cbc:ID")[$e] . ""; - $row ['tax_percent'] =0; + $xml = simplexml_import_dom($node->item($e)); + $this->registerNS($xml); + + + $row ['taxable_amount'] = $xml->xpath("cbc:TaxableAmount")[0] . ""; + $row ['tax'] = $xml->xpath("cbc:TaxAmount")[0] . ""; + $row['tax_currency']=$xml->xpath("cbc:TaxAmount")[0]->attributes()['currencyID'].""; + $row ['tax_id'] = $xml->xpath("cac:TaxCategory/cbc:ID")[0]. ""; + $row ['tax_percent'] =0; $r=$xml->xpath("//cac:TaxCategory/cbc:Percent"); if ( isset($r[$e]) ) { - $row ['tax_percent'] = $xml->xpath("//cac:TaxCategory/cbc:Percent")[$e] . ""; + $row ['tax_percent'] = $xml->xpath("cac:TaxCategory/cbc:Percent")[0] . ""; } - if (isset($xml->xpath("//cac:InvoiceLine/cac:Item/cbc:Name")[$e])) + $row ['name'] =""; + if ( $xml->xpath("cac:TaxCategory/cbc:Name") != null) { - $row ['name'] =$xml->xpath("//cac:InvoiceLine/cac:Item/cbc:Name")[$e].""; - }else { - $row ['name'] =""; + $row['name']=$xml->xpath("cac:TaxCategory/cbc:Name")[0].''; } - if ( isset ($xml->xpath("//cbc:TaxExemptionReasonCode")[$e])) + $row['vatex']=""; + if ( $xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason") != null) { - $row['vatex']=$xml->xpath("//cbc:TaxExemptionReasonCode")[$e]; - }else { - $row['vatex']=""; + $row['vatex']=$xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason")[0].''; } - $result[] = $row; + if ( $xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason") != null) + { + $row['vatex'].=$xml->xpath("cac:TaxCategory/cbc:TaxExemptionReason")[0].''; + } + $result[] = $row; } return $result; } diff --git a/include/config.inc.example b/include/config.inc.example index d0deec652..405a4f46a 100644 --- a/include/config.inc.example +++ b/include/config.inc.example @@ -99,5 +99,5 @@ define ("DEBUGNOALYSS",0); // your installation, example with https://demo.noalyss.eu // define ("NOALYSS_URL","https://demo.noalyss.eu"); // For POSTFIX, when sending email from NOALYSS via sendmail an extra parameter is needed -// for the Return-Path, the FROM will be replaced by the Sendmail_Core->from value +// for the Return-Path, the [FROM] will be replaced by the Sendmail_Core->from value //define("MAIL_EXTRA_PARAM","-f [FROM]") diff --git a/vendor/chillerlan/php-authenticator/src/Authenticator.php b/vendor/chillerlan/php-authenticator/src/Authenticator.php index b36af9cdc..22105b464 100644 --- a/vendor/chillerlan/php-authenticator/src/Authenticator.php +++ b/vendor/chillerlan/php-authenticator/src/Authenticator.php @@ -164,5 +164,8 @@ class Authenticator{ return sprintf('otpauth://%s/%s?%s', $this->mode, rawurlencode($label), $values); } - + function getOptions() + { + return $this->options; + } }