(SOLVE) Posible Bug when passing 0 value from Field Element to php

jmoises

Active Member
is somthing very strange happen and just cant figure out

Field Element - Tax
Field Element - Subtotal
Calc Element - Total

i am using a php function to calc the total using the subtotal and tax this is very easy and working my problem is when the user typo 0 tax (cero)

what i am doing in my total calc i use something like this to get the tax
$tax = (int)'{invoice___tax}';

if i do this in the calculation area of the total calc elelement

// simple function to validate
if($tax == '' && $tax == 0) {
echo 'empty';
var_dump($tax);exit;
}

this work great

but if i send the $tax variable to and funtion on external php file the //simple function to validate, dosent work

if i send anything other than 0 works ok but no on 0 (cero)

i how i clear and somebody can guide me.
 
Wrap your comment in /* ... */ instead.
From the context, I reckon you want
Code:
if($tax == '' || $tax == 0) {
(Note the "||" for "or".)
Also, consider using "return" instead of "echo" in calc elements.
 
Wrap your comment in /* ... */ instead.
From the context, I reckon you want
Code:
if($tax == '' || $tax == 0) {
(Note the "||" for "or".)
Also, consider using "return" instead of "echo" in calc elements.

Thank you for your reply i was using echo for testing porpouse only, i can explain but i probably write small php to show where the bug, in the calc element i call a php function from external file, when i type 0 (*cero) i dont get any value in my function, but if i type 1 yes.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top