Merge branch 'unstable' into pre-stable
* unstable: OTP : get options XML : improve invoice appearance XMLReader : correct VAT order Bug 2458: Si on envoie un email depuis Linux , le return-path doit être spécifié
This commit is contained in:
commit
5e94c72180
5 changed files with 69 additions and 49 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ['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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]")
|
||||
|
|
|
|||
|
|
@ -164,5 +164,8 @@ class Authenticator{
|
|||
|
||||
return sprintf('otpauth://%s/%s?%s', $this->mode, rawurlencode($label), $values);
|
||||
}
|
||||
|
||||
function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue