Changeset 886

Show
Ignore:
Timestamp:
07/13/08 00:08:02 (2 months ago)
Author:
asiby
Message:

Bug fix: The card refill logic has been moved to a separate file to prevent unwanted refills when the page is refreshed after a refill.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
    • Property svn:ignore set to
      My Patches
  • branches/1.3/A2Billing_UI/Public/A2B_entity_card.php

    r7 r886  
    7474/********************************* END BATCH UPDATE ***********************************/ 
    7575 
    76  
    77 if (($form_action == "addcredit") && ($addcredit>0 || $addcredit<0) && ($id>0 || $cardnumber>0)){ 
    78  
    79         $instance_table = new Table("cc_card", "username, id"); 
    80          
    81         if ($cardnumber>0){ 
    82                 /* CHECK IF THE CARDNUMBER IS ON THE DATABASE */                         
    83                 $FG_TABLE_CLAUSE_card = "username='".$cardnumber."'"; 
    84                 $list_tariff_card = $instance_table -> Get_list ($HD_Form -> DBHandle, $FG_TABLE_CLAUSE_card, null, null, null, null, null, null);                       
    85                 if ($cardnumber == $list_tariff_card[0][0]) $id = $list_tariff_card[0][1]; 
    86         } 
    87  
    88         if ($id>0){ 
    89                  
    90                 $param_update .= "credit = credit + '".$addcredit."'"; 
    91                 if ($HD_Form->FG_DEBUG == 1)  echo "<br><hr> $param_update";     
    92                  
    93                 $FG_EDITION_CLAUSE = " id='$id'"; 
    94                  
    95                 if ($HD_Form->FG_DEBUG == 1)  echo "<br>-----<br>$param_update<br>$FG_EDITION_CLAUSE";                   
    96                 $instance_table -> Update_table ($HD_Form -> DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null); 
    97                  
    98                 $field_insert = "date, credit, card_id"; 
    99                 $value_insert = "now(), '$addcredit', '$id'"; 
    100                 $instance_sub_table = new Table("cc_logrefill", $field_insert); 
    101                 $result_query = $instance_sub_table -> Add_table ($HD_Form -> DBHandle, $value_insert, null, null);      
    102                  
    103                 if (!$result_query ){            
    104                         $update_msg ="<b>".$instance_sub_table -> errstr."</b>";         
    105                 } 
    106         } 
    107 } 
    108  
    109 if ($form_action == "addcredit")        $form_action='list'; 
    110  
    111  
    11276if ($id!="" || !is_null($id)){   
    11377        $HD_Form -> FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form -> FG_EDITION_CLAUSE);        
     
    169133                                <input class="form_enter" name="addcredit" size="18" maxlength="6" value=""> 
    170134                                <input class="form_input_button"  
    171                                 TYPE="button" VALUE="<?php echo gettext("ADD CREDIT TO THE SELECTED CARD");?>" onClick="openURL('<?php echo $_SERVER['PHP_SELF']?>?form_action=addcredit&stitle=Card_Refilled&current_page=<?php echo $current_page?>&order=<?php echo $order?>&sens=<?php echo $sens?>&id=')"> 
     135                                TYPE="button" VALUE="<?php echo gettext("ADD CREDIT TO THE SELECTED CARD");?>" onClick="openURL('process_refill.php?form_action=addcredit&stitle=Card_Refilled&current_page=<?php echo $current_page?>&order=<?php echo $order?>&sens=<?php echo $sens?>&id=')"> 
    172136        </td></form> 
    173137        </tr> 
  • trunk/admin/Public/A2B_entity_card.php

    r882 r886  
    7575/********************************* END BATCH UPDATE ***********************************/ 
    7676 
    77  
    78 if (($form_action == "addcredit") && ($addcredit>0 || $addcredit<0) && ($id>0 || $cardnumber>0)) { 
    79          
    80         $instance_table = new Table("cc_card", "username, id"); 
    81          
    82         if ($cardnumber>0){ 
    83                 /* CHECK IF THE CARDNUMBER IS ON THE DATABASE */                         
    84                 $FG_TABLE_CLAUSE_card = "username='".$cardnumber."'"; 
    85                 $list_tariff_card = $instance_table -> Get_list ($HD_Form -> DBHandle, $FG_TABLE_CLAUSE_card, null, null, null, null, null, null);                       
    86                 if ($cardnumber == $list_tariff_card[0][0]) $id = $list_tariff_card[0][1]; 
    87         } 
    88          
    89         if ($id>0){ 
    90                  
    91                 $param_update .= "credit = credit + '".$addcredit."'"; 
    92                 if ($HD_Form->FG_DEBUG == 1)  echo "<br><hr> $param_update";     
    93                  
    94                 $FG_EDITION_CLAUSE = " id='$id'"; 
    95                  
    96                 if ($HD_Form->FG_DEBUG == 1)  echo "<br>-----<br>$param_update<br>$FG_EDITION_CLAUSE";                   
    97                 $instance_table -> Update_table ($HD_Form -> DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null); 
    98                  
    99                 $field_insert = "date, credit, card_id , description"; 
    100                 $value_insert = "now(), '$addcredit', '$id', '$description' "; 
    101                 $instance_sub_table = new Table("cc_logrefill", $field_insert); 
    102                 $result_query = $instance_sub_table -> Add_table ($HD_Form -> DBHandle, $value_insert, null, null);      
    103                  
    104                 if (!$result_query ){            
    105                         $update_msg ="<b>".$instance_sub_table -> errstr."</b>";         
    106                 } 
    107         } 
    108 } 
    109  
    110 if ($form_action == "addcredit")        $form_action='list'; 
    111  
    112  
    11377if ($id!="" || !is_null($id)){   
    11478        $HD_Form -> FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form -> FG_EDITION_CLAUSE);        
     
    192156                                        <td colspan="2" align="center"> 
    193157                                        <input class="form_input_button"  
    194                                 TYPE="button" VALUE="<?php echo gettext("ADD CREDIT TO THE SELECTED CARD");?>" onClick="openURL('<?php echo $_SERVER['PHP_SELF']?>?form_action=addcredit&stitle=Card_Refilled&current_page=<?php echo $current_page?>&order=<?php echo $order?>&sens=<?php echo $sens?>&id=')"> 
     158                                TYPE="button" VALUE="<?php echo gettext("ADD CREDIT TO THE SELECTED CARD");?>" onClick="openURL('process_refill.php?form_action=addcredit&stitle=Card_Refilled&current_page=<?php echo $current_page?>&order=<?php echo $order?>&sens=<?php echo $sens?>&id=')"> 
    195159                 
    196160                                        </td> 


Google