WeBid Bug Tracking

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000486WeBidAuctionspublic2014-10-07 16:202015-03-19 23:00
Reporterathera 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version1.1.1 
Target VersionFixed in Version1.1.2 
Summary0000486: Bugs in Taxed and Tax Included
DescriptionI am not sure what is the development history of Taxed and Tax Included but in 1.1.1 are not functioning. They have some serious logic and execution booboos.



OK let's start from the database



they are defined as enum('y','n')



  [PHP]`tax` enum('y','n') NOT NULL default 'n',

  `taxinc` enum('y','n') NOT NULL default 'y',[/PHP]



(personally I think they should an int(1) or a char(1) but that's for a different discussion)



In the template we have this



[PHP] <!-- IF B_CAN_TAX -->

                    <tr>

                        <td align="right" width="25%" valign="top" class="leftpan">

                            {L_1102}

                        </td>

                        <td class="rightpan">

                            <input type="radio" name="is_taxed" value="y" {TAX_Y}> {L_030}


                            <input type="radio" name="is_taxed" value="n" {TAX_N}> {L_029}

                        </td>

                    </tr>

                    <tr>

                        <td align="right" width="25%" valign="top" class="leftpan">

                            {L_1103}

                        </td>

                        <td class="rightpan">

                            <input type="radio" name="tax_included" value="y" {TAXINC_Y}> {L_030}


                            <input type="radio" name="tax_included" value="n" {TAXINC_N}> {L_029}

                        </td>

                    </tr>

    <!-- ENDIF -->[/PHP]



So far so good. So they are radio buttons.



Now here is where the problems are starting



1. in /includes|functions_sell.php in function setvars() near line 93 there is this



[PHP] $is_taxed = (isset($_POST['is_taxed'])) ? 'y' : $_SESSION['SELL_is_taxed'];

    $tax_included = (isset($_POST['tax_included'])) ? 'y' : $_SESSION['SELL_tax_included'];

[/PHP]



Well what this means is that no matter what the poor user does both $is_taxed and $tax_included are always gonna be 'y' because a radio button by definition is always set.



2. in /sell.php near line 675 there is this



[PHP] 'TAX_Y' => (intval($is_taxed) == 'y') ? 'checked' : '',

                'TAX_N' => (intval($is_taxed) == 'n' || empty($is_taxed)) ? 'checked' : '',

                'TAXINC_Y' => (intval($tax_included) == 1 || empty($tax_included)) ? 'checked' : '',

                'TAXINC_N' => (intval($tax_included) == 2) ? 'checked' : '',

[/PHP]





A. So what is the meaning of using intval here?? It will not return an error but it will always return 0 so we have if (0=='y') and if (0=='n') which means that it will never be set to 'checked' .



B. || empty($is_taxed) $is_taxed is never gonna be empty is a radio button except when we loose it as in A above.



C. intval($tax_included) == 1 and intval($tax_included) == 2 What is 1 and 2 doing here??

here again we have if (0==1) and if (0==2) which means that it will never be set to 'checked' .





Hmmmmmmmmmmmm





OK Going to fix them and I'll post code changes.
TagsNo tags attached.
import_id502
Thread
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2015-04-01 13:17 renlok New Issue
2015-04-01 13:17 renlok import_id => 502
2015-04-01 13:17 renlok Date Submitted 2015-04-01 13:17 => 2014-10-07 16:20
2015-04-01 13:17 renlok Last Update 2015-04-01 13:17 => 2015-03-19 23:00


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker