{"action":"created","issue":{"url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/260","repository_url":"https://api.github.com/repos/difi/vefa-ehf-postaward","labels_url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/260/labels{/name}","comments_url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/260/comments","events_url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/260/events","html_url":"https://github.com/difi/vefa-ehf-postaward/issues/260","id":295165456,"number":260,"title":"NONAT-UBL-T10.xsl result in 'FOAR0001: Division by zero' exception","user":{"login":"monze","id":6543684,"avatar_url":"https://avatars0.githubusercontent.com/u/6543684?v=4","gravatar_id":"","url":"https://api.github.com/users/monze","html_url":"https://github.com/monze","followers_url":"https://api.github.com/users/monze/followers","following_url":"https://api.github.com/users/monze/following{/other_user}","gists_url":"https://api.github.com/users/monze/gists{/gist_id}","starred_url":"https://api.github.com/users/monze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monze/subscriptions","organizations_url":"https://api.github.com/users/monze/orgs","repos_url":"https://api.github.com/users/monze/repos","events_url":"https://api.github.com/users/monze/events{/privacy}","received_events_url":"https://api.github.com/users/monze/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-07T14:50:13Z","updated_at":"2018-02-08T13:10:49Z","closed_at":null,"author_association":"NONE","body":"Please make sure this box is checked before submitting your issue - thank you!\r\n\r\n- [x ] Issue is related to guides or validation part of EHF in post-award.\r\n\r\nIssues related to PEPPOL BIS or rules part of PEPPOL BIS must be sent to rfc@peppol.eu.\r\n\r\nYour issue here:\r\nReported the issue in 244, but the work performed did not resolved the problem. Have just confirmed it used the validator for the upcomming version: \r\nhttps://vefa.difi.no/ehf/standard/ehf-invoice-and-creditnote-2.0.13/\r\n\r\nIt can be validated by taking a Invoice, and set the value of the xPath to 0\r\nInvoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity\r\n\r\nThe issue can be seen in this file\r\nhttps://github.com/difi/vefa-ehf-postaward/blob/master/rules/ehf-invoice-2.0/sch/NONAT-UBL-T10.sch\r\n\r\nline 107 and 108\r\n\r\n```\r\n<let name=\"baseQuantity\" value=\"xs:decimal(if (cac:Price/cbc:BaseQuantity) then cac:Price/cbc:BaseQuantity else 1)\"/>\r\n<let name=\"pricePerUnit\" value=\"xs:decimal(cac:Price/cbc:PriceAmount) div $baseQuantity\"/>\r\n```\r\n\r\nThe problem is, that in line 107 the variable 'baseQuantity' get the value of the cbc:BaseQuantity from the document, which is 0.\r\nOn the next line, the variable 'baseQuantity' (which is 0) is used in a division, which result in a 'Division by zero' exception.\r\n\r\nTo correct the problem line 107 must be change to something like this:\r\n```\r\n<let name=\"baseQuantity\" value=\"xs:decimal(if (cac:Price/cbc:BaseQuantity and xs:decimal(cac:Price/cbc:BaseQuantity) != 0 ) then cac:Price/cbc:BaseQuantity else 1)\"/>\r\n```\r\n\r\nThe problem might also exist for CreditNote.\r\n\r\nJacob Mogensen\r\nmySupply ApS\r\nDenmark\r\n"},"comment":{"url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/comments/364106951","html_url":"https://github.com/difi/vefa-ehf-postaward/issues/260#issuecomment-364106951","issue_url":"https://api.github.com/repos/difi/vefa-ehf-postaward/issues/260","id":364106951,"user":{"login":"klakegg","id":126939,"avatar_url":"https://avatars0.githubusercontent.com/u/126939?v=4","gravatar_id":"","url":"https://api.github.com/users/klakegg","html_url":"https://github.com/klakegg","followers_url":"https://api.github.com/users/klakegg/followers","following_url":"https://api.github.com/users/klakegg/following{/other_user}","gists_url":"https://api.github.com/users/klakegg/gists{/gist_id}","starred_url":"https://api.github.com/users/klakegg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klakegg/subscriptions","organizations_url":"https://api.github.com/users/klakegg/orgs","repos_url":"https://api.github.com/users/klakegg/repos","events_url":"https://api.github.com/users/klakegg/events{/privacy}","received_events_url":"https://api.github.com/users/klakegg/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T13:10:49Z","updated_at":"2018-02-08T13:10:49Z","author_association":"OWNER","body":"Please provide a use case where cbc:BaseQuantity is expected to be \"0\"."}}
{"actor":{"display_login":"klakegg"}}