Changeset 581

Show
Ignore:
Timestamp:
02/05/08 03:58:56 (1 year ago)
Author:
areski
Message:

UPDATE : New voucher Search & Batch Update

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/A2Billing_UI/Public/A2B_entity_voucher.php

    r1 r581  
    77 
    88 
     9 
    910if (! has_rights (ACX_BILLING)){  
    1011        Header ("HTTP/1.0 401 Unauthorized"); 
     
    1314} 
    1415 
    15  
    16  
    1716/***********************************************************************************/ 
    1817 
    1918$HD_Form -> setDBHandler (DbConnect()); 
    20  
    21  
    2219$HD_Form -> init(); 
     20 
     21 
     22/********************************* BATCH UPDATE ***********************************/ 
     23getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname', 'upd_tag', 'upd_currency', 'upd_credit', 'upd_activated', 'upd_used', 'upd_credittype', 'batchupdate', 'check', 'type', 'mode')); 
     24// CHECK IF REQUEST OF BATCH UPDATE 
     25if ($batchupdate == 1 && is_array($check)) { 
     26         
     27        $HD_Form->prepare_list_subselection('list'); 
     28         
     29        // Array ( [upd_simultaccess] => on [upd_currency] => on )       
     30        $loop_pass=0; 
     31        $SQL_UPDATE = ''; 
     32        foreach ($check as $ind_field => $ind_val){ 
     33                //echo "<br>::> $ind_field -"; 
     34                $myfield = substr($ind_field,4); 
     35                if ($loop_pass!=0) $SQL_UPDATE.=','; 
     36                 
     37                // Standard update mode 
     38                if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1){              
     39                        if (!isset($type["$ind_field"])){                
     40                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     41                        }else{ 
     42                                $SQL_UPDATE .= " $myfield='".$type["$ind_field"]."'"; 
     43                        } 
     44                // Mode 2 - Equal - Add - Subtract 
     45                }elseif($mode["$ind_field"]==2){ 
     46                        if (!isset($type["$ind_field"])){                
     47                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     48                        }else{ 
     49                                if ($type["$ind_field"] == 1){ 
     50                                        $SQL_UPDATE .= " $myfield='".$$ind_field."'";                                    
     51                                }elseif ($type["$ind_field"] == 2){ 
     52                                        $SQL_UPDATE .= " $myfield = $myfield +'".$$ind_field."'"; 
     53                                }else{ 
     54                                        $SQL_UPDATE .= " $myfield = $myfield -'".$$ind_field."'"; 
     55                                }                                
     56                        } 
     57                } 
     58                $loop_pass++; 
     59        } 
     60         
     61        $SQL_UPDATE = "UPDATE $HD_Form->FG_TABLE_NAME SET $SQL_UPDATE"; 
     62        if (strlen($HD_Form->FG_TABLE_CLAUSE)>1) { 
     63                $SQL_UPDATE .= ' WHERE '; 
     64                $SQL_UPDATE .= $HD_Form->FG_TABLE_CLAUSE; 
     65        } 
     66        if (! $res = $HD_Form -> DBHandle -> Execute($SQL_UPDATE)) { 
     67                $update_msg = '<center><font color="red"><b>'.gettext('Could not perform the batch update!').'</b></font></center>'; 
     68        } else { 
     69                $update_msg = '<center><font color="green"><b>'.gettext('The batch update has been successfully perform!').'</b></font></center>'; 
     70        } 
     71         
     72} 
     73/********************************* END BATCH UPDATE ***********************************/ 
    2374 
    2475 
     
    4293if ($form_action=='list') echo $CC_help_list_voucher; 
    4394else echo $CC_help_create_voucher; 
     95 
     96 
     97 
     98?> 
     99<script language="JavaScript" src="javascript/card.js"></script> 
     100 
     101 
     102<div class="toggle_hide2show"> 
     103<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("SEARCH VOUCHERS");?> </font></a></center> 
     104        <div class="tohide" style="display:none;"> 
     105 
     106<?php 
     107// #### CREATE SEARCH FORM 
     108if ($form_action == "list"){ 
     109        $HD_Form -> create_search_form(); 
     110} 
     111?> 
     112 
     113        </div> 
     114</div> 
     115 
     116<?php 
     117 
     118/********************************* BATCH UPDATE ***********************************/ 
     119if ($form_action == "list" && (!($popup_select>=1))     ){ 
     120         
     121        $instance_table_tariff = new Table("cc_tariffgroup", "id, tariffgroupname"); 
     122        $FG_TABLE_CLAUSE = ""; 
     123        $list_tariff = $instance_table_tariff -> Get_list ($HD_Form -> DBHandle, $FG_TABLE_CLAUSE, "tariffgroupname", "ASC", null, null, null, null); 
     124        $nb_tariff = count($list_tariff); 
     125         
     126?> 
     127<!-- ** ** ** ** ** Part for the Update ** ** ** ** ** --> 
     128<div class="toggle_hide2show"> 
     129<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("BATCH UPDATE");?> </font></a></center> 
     130        <div class="tohide" style="display:none;"> 
     131 
     132<center> 
     133<b>&nbsp;<?php echo $HD_Form -> FG_NB_RECORD ?> <?php echo gettext("vouchers selected!"); ?>&nbsp;<?php echo gettext("Use the options below to batch update the selected vouchers.");?></b> 
     134           <table align="center" border="0" width="65%"  cellspacing="1" cellpadding="2"> 
     135        <tbody> 
     136                <form name="updateForm" action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> 
     137                <INPUT type="hidden" name="batchupdate" value="1"> 
     138                <tr>             
     139          <td align="left" class="bgcolor_001" > 
     140                                <input name="check[upd_used]" type="checkbox" <?php if ($check["upd_used"]=="on") echo "checked"?>> 
     141                  </td> 
     142                  <td align="left"  class="bgcolor_001"> 
     143                                1)&nbsp;<?php echo gettext("USED"); ?>&nbsp;:  
     144                                <select NAME="upd_used" size="1" class="form_input_select"> 
     145                                <?php  
     146                                        foreach($used_list as $key => $cur_value) {                                                                                      
     147                                ?> 
     148                                        <option value='<?php echo $cur_value[1] ?>'  <?php if ($upd_inuse==$cur_value[1]) echo 'selected="selected"'?>><?php echo $cur_value[0] ?></option> 
     149                                <?php } ?>                       
     150                    </select> 
     151                  </td> 
     152                </tr> 
     153                <tr>             
     154          <td align="left"  class="bgcolor_001"> 
     155                        <input name="check[upd_activated]" type="checkbox" <?php if ($check["upd_activated"]=="on") echo "checked"?> > 
     156                  </td> 
     157                  <td align="left" class="bgcolor_001"> 
     158                                2)&nbsp;<?php echo gettext("ACTIVATED");?>&nbsp;: 
     159                                <select NAME="upd_activated" size="1" class="form_input_select"> 
     160                                        <?php                                     
     161                                         foreach ($actived_list as $key => $cur_value){                                                   
     162                                        ?> 
     163                                                <option value='<?php echo $cur_value[1] ?>' <?php if ($upd_status==$cur_value[1]) echo 'selected="selected"'?>><?php echo $cur_value[0] ?></option> 
     164                                        <?php } ?> 
     165                                </select><br/> 
     166                  </td> 
     167                </tr> 
     168                <tr>             
     169          <td align="left" class="bgcolor_001"> 
     170                                <input name="check[upd_credit]" type="checkbox" <?php if ($check["upd_credit"]=="on") echo "checked"?>> 
     171                                <input name="mode[upd_credit]" type="hidden" value="2"> 
     172                  </td> 
     173                  <td align="left"  class="bgcolor_001">         
     174                                3)&nbsp;<?php echo gettext("CREDIT");?>&nbsp;: 
     175                                        <input class="form_input_text" name="upd_credit" size="10" maxlength="10"  value="<?php if (isset($upd_credit)) echo $upd_credit; else echo '0';?>"> 
     176                                <font class="version"> 
     177                                <input type="radio" NAME="type[upd_credit]" value="1" <?php if((!isset($type["upd_credit"]))|| ($type["upd_credit"]==1) ){?>checked<?php }?>><?php echo gettext("Equals");?> 
     178                                <input type="radio" NAME="type[upd_credit]" value="2" <?php if($type["upd_credit"]==2){?>checked<?php }?>> <?php echo gettext("Add");?> 
     179                                <input type="radio" NAME="type[upd_credit]" value="3" <?php if($type["upd_credit"]==3){?>checked<?php }?>> <?php echo gettext("Subtract");?> 
     180                                </font> 
     181                  </td> 
     182                </tr> 
     183                <tr>             
     184          <td align="left" class="bgcolor_001"> 
     185                                <input name="check[upd_currency]" type="checkbox" <?php if ($check["upd_currency"]=="on") echo "checked"?>> 
     186                  </td> 
     187                  <td align="left"  class="bgcolor_001"> 
     188                                4)&nbsp;<?php echo gettext("CURRENCY");?>&nbsp;: 
     189                                <select NAME="upd_currency" size="1" class="form_input_select"> 
     190                                <?php  
     191                                        foreach($currencies_list as $key => $cur_value) {                                                                                        
     192                                ?> 
     193                                        <option value='<?php echo $key ?>'  <?php if ($upd_currency==$key) echo 'selected="selected"'?>><?php echo $cur_value[1].' ('.$cur_value[2].')' ?></option> 
     194                                <?php } ?>                       
     195                    </select> 
     196                  </td> 
     197                </tr> 
     198                <tr>             
     199          <td align="left" class="bgcolor_001"> 
     200                                <input name="check[upd_tag]" type="checkbox" <?php if ($check["upd_tag"]=="on") echo "checked"?>> 
     201                  </td> 
     202                  <td align="left"  class="bgcolor_001"> 
     203                                5)&nbsp;<?php echo gettext("TAG");?>&nbsp;:  
     204                                <input class="form_input_text"  name="upd_tag" size="10" maxlength="6" value="<?php echo $upd_tag; ?>"> 
     205                                <br/> 
     206                </td> 
     207                </tr> 
     208                <tr>             
     209                        <td align="right" class="bgcolor_001"></td> 
     210                        <td align="right"  class="bgcolor_001"> 
     211                                <input class="form_input_button"  value=" <?php echo gettext("BATCH UPDATE VOUCHER");?>  " type="submit"> 
     212                </td> 
     213                </tr> 
     214                </form> 
     215                </table> 
     216</center> 
     217        </div> 
     218</div> 
     219<!-- ** ** ** ** ** Part for the Update ** ** ** ** ** --> 
     220<?php 
     221} // END if ($form_action == "list") 
     222 
     223 
     224 
     225if (isset($update_msg) && strlen($update_msg)>0) echo $update_msg;  
    44226 
    45227 
  • branches/1.3/A2Billing_UI/Public/form_data/FG_var_voucher.inc

    r409 r581  
    2323 
    2424$actived_list = array();  
    25 $actived_list["t"] = array( gettext("Active"), "t"); 
    26 $actived_list["f"] = array( gettext("Inactive"), "f"); 
     25$actived_list["t"] = array( gettext("Active"), "t" ); 
     26$actived_list["f"] = array( gettext("Inactive"), "f" ); 
     27 
     28$actived_list_r = array();  
     29$actived_list_r["t"] = array( "t", gettext("Active") ); 
     30$actived_list_r["f"] = array( "f", gettext("Inactive") ); 
     31 
     32$used_list = array(); 
     33$used_list["0"] = array( gettext("NO USED"), "0"); 
     34$used_list["1"] = array( gettext("USED"), "1"); 
     35 
     36$used_list_r = array(); 
     37$used_list_r["0"] = array( "0", gettext("NO USED")); 
     38$used_list_r["1"] = array( "1", gettext("USED")); 
    2739 
    2840$yesno = array(); 
     
    3951 
    4052$HD_Form -> AddViewElement(gettext("ID"), "id", "4%", "center", "sort"); 
    41 $HD_Form -> AddViewElement(gettext("VOUCHER"), "voucher", "13%", "center", "sort"); 
    42 $HD_Form -> AddViewElement(gettext("CREDIT"), "credit", "7%", "center", "sort"); 
    43 $HD_Form -> AddViewElement(gettext("TAG"), "tag", "15%", "center", "sort", "30"); 
    44 $HD_Form -> AddViewElement(gettext("ACTIVATED"), "activated", "7%", "center", "sort", "", "list", $actived_list); 
    45 $HD_Form -> AddViewElement(gettext("USEDCARDNUMBER"), "usedcardnumber", "13%", "center", "sort"); 
    46 $HD_Form -> AddViewElement(gettext("USEDATE"), "usedate", "13%", "center", "sort", "16"); 
    47 $HD_Form -> AddViewElement(gettext("CURRENCY"), "currency", "7%", "center", "sort", "", "list", $currency_list_key); 
    48  
    49  
    50 $HD_Form -> FieldViewElement ('id, voucher, credit, tag, activated, usedcardnumber, usedate, currency'); 
     53$HD_Form -> AddViewElement(gettext("VOUCHER"), "voucher", "12%", "center", "sort"); 
     54$HD_Form -> AddViewElement(gettext("CREDIT"), "credit", "6%", "center", "sort"); 
     55$HD_Form -> AddViewElement(gettext("TAG"), "tag", "13%", "center", "sort", "30"); 
     56$HD_Form -> AddViewElement(gettext("ACTIVATED"), "activated", "6%", "center", "sort", "", "list", $actived_list); 
     57$HD_Form -> AddViewElement(gettext("USED"), "used", "6%", "center", "sort", "", "list", $used_list); 
     58$HD_Form -> AddViewElement(gettext("USEDCARDNUMBER"), "usedcardnumber", "12%", "center", "sort"); 
     59$HD_Form -> AddViewElement(gettext("CREATED DATE"), "creationdate", "12%", "center", "sort", "16"); 
     60$HD_Form -> AddViewElement(gettext("USED DATE"), "usedate", "13%", "center", "sort", "16"); 
     61$HD_Form -> AddViewElement(gettext("CURRENCY"), "currency", "6%", "center", "sort", "", "list", $currency_list_key); 
     62 
     63 
     64$HD_Form -> FieldViewElement ('id, voucher, credit, tag, activated, used, usedcardnumber, creationdate, usedate, currency'); 
     65 
     66 
     67 
     68// Search form 
     69if (!($popup_select>=1))         $HD_Form -> FG_FILTER_SEARCH_FORM = true; 
     70$HD_Form -> FG_FILTER_SEARCH_TOP_TEXT = gettext('Define specific criteria to search for vouchers created.'); 
     71$HD_Form -> FG_FILTER_SEARCH_1_TIME_TEXT = gettext('Creation date / Month'); 
     72$HD_Form -> FG_FILTER_SEARCH_2_TIME_TEXT = gettext('Creation date / Day'); 
     73$HD_Form -> FG_FILTER_SEARCH_2_TIME_FIELD = 'creationdate'; 
     74$HD_Form -> AddSearchElement_C1 (gettext("VOUCHER"), 'voucher','vouchertype'); 
     75$HD_Form -> AddSearchElement_C1 (gettext("CARDNUMBER"),'usedcardnumber','usedcardnumbertype'); 
     76$HD_Form -> AddSearchElement_C1 (gettext("TAG"),'tag','tagtype'); 
     77$HD_Form -> AddSearchElement_C2 (gettext("CREDIT"),'credit1','credit1type','credit2','credit2type','credit'); 
     78 
     79$HD_Form -> FG_FILTER_SEARCH_FORM_SELECT_TEXT = ''; 
     80$HD_Form -> AddSearchElement_Select (gettext("SELECT STATUS"), null, null, null, null,null , "activated", 0, $actived_list_r); 
     81$HD_Form -> AddSearchElement_Select (gettext("SELECT USED"), null, null, null, null,null , "used", 0, $used_list_r); 
     82$HD_Form -> AddSearchElement_Select (gettext("SELECT CURRENCY"), null, null, null, null, null, "currency", 0, $currency_list_r); 
     83 
     84 
    5185 
    5286 
  • trunk/A2Billing_UI/Public/A2B_entity_voucher.php

    r570 r581  
    77 
    88 
     9 
    910if (! has_rights (ACX_BILLING)){  
    1011        Header ("HTTP/1.0 401 Unauthorized"); 
     
    1314} 
    1415 
    15  
    16  
    1716/***********************************************************************************/ 
    1817 
    1918$HD_Form -> setDBHandler (DbConnect()); 
    20  
    21  
    2219$HD_Form -> init(); 
     20 
     21 
     22/********************************* BATCH UPDATE ***********************************/ 
     23getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname', 'upd_tag', 'upd_currency', 'upd_credit', 'upd_activated', 'upd_used', 'upd_credittype', 'batchupdate', 'check', 'type', 'mode')); 
     24// CHECK IF REQUEST OF BATCH UPDATE 
     25if ($batchupdate == 1 && is_array($check)) { 
     26         
     27        $HD_Form->prepare_list_subselection('list'); 
     28         
     29        // Array ( [upd_simultaccess] => on [upd_currency] => on )       
     30        $loop_pass=0; 
     31        $SQL_UPDATE = ''; 
     32        foreach ($check as $ind_field => $ind_val){ 
     33                //echo "<br>::> $ind_field -"; 
     34                $myfield = substr($ind_field,4); 
     35                if ($loop_pass!=0) $SQL_UPDATE.=','; 
     36                 
     37                // Standard update mode 
     38                if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1){              
     39                        if (!isset($type["$ind_field"])){                
     40                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     41                        }else{ 
     42                                $SQL_UPDATE .= " $myfield='".$type["$ind_field"]."'"; 
     43                        } 
     44                // Mode 2 - Equal - Add - Subtract 
     45                }elseif($mode["$ind_field"]==2){ 
     46                        if (!isset($type["$ind_field"])){                
     47                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     48                        }else{ 
     49                                if ($type["$ind_field"] == 1){ 
     50                                        $SQL_UPDATE .= " $myfield='".$$ind_field."'";                                    
     51                                }elseif ($type["$ind_field"] == 2){ 
     52                                        $SQL_UPDATE .= " $myfield = $myfield +'".$$ind_field."'"; 
     53                                }else{ 
     54                                        $SQL_UPDATE .= " $myfield = $myfield -'".$$ind_field."'"; 
     55                                }                                
     56                        } 
     57                } 
     58                $loop_pass++; 
     59        } 
     60         
     61        $SQL_UPDATE = "UPDATE $HD_Form->FG_TABLE_NAME SET $SQL_UPDATE"; 
     62        if (strlen($HD_Form->FG_TABLE_CLAUSE)>1) { 
     63                $SQL_UPDATE .= ' WHERE '; 
     64                $SQL_UPDATE .= $HD_Form->FG_TABLE_CLAUSE; 
     65        } 
     66        if (! $res = $HD_Form -> DBHandle -> Execute($SQL_UPDATE)) { 
     67                $update_msg = '<center><font color="red"><b>'.gettext('Could not perform the batch update!').'</b></font></center>'; 
     68        } else { 
     69                $update_msg = '<center><font color="green"><b>'.gettext('The batch update has been successfully perform!').'</b></font></center>'; 
     70        } 
     71         
     72} 
     73/********************************* END BATCH UPDATE ***********************************/ 
    2374 
    2475 
     
    4293if ($form_action=='list') echo $CC_help_list_voucher; 
    4394else echo $CC_help_create_voucher; 
     95 
     96 
     97 
     98?> 
     99<script language="JavaScript" src="javascript/card.js"></script> 
     100 
     101 
     102<div class="toggle_hide2show"> 
     103<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("SEARCH VOUCHERS");?> </font></a></center> 
     104        <div class="tohide" style="display:none;"> 
     105 
     106<?php 
     107// #### CREATE SEARCH FORM 
     108if ($form_action == "list"){ 
     109        $HD_Form -> create_search_form(); 
     110} 
     111?> 
     112 
     113        </div> 
     114</div> 
     115 
     116<?php 
     117 
     118/********************************* BATCH UPDATE ***********************************/ 
     119if ($form_action == "list" && (!($popup_select>=1))     ){ 
     120         
     121        $instance_table_tariff = new Table("cc_tariffgroup", "id, tariffgroupname"); 
     122        $FG_TABLE_CLAUSE = ""; 
     123        $list_tariff = $instance_table_tariff -> Get_list ($HD_Form -> DBHandle, $FG_TABLE_CLAUSE, "tariffgroupname", "ASC", null, null, null, null); 
     124        $nb_tariff = count($list_tariff); 
     125         
     126?> 
     127<!-- ** ** ** ** ** Part for the Update ** ** ** ** ** --> 
     128<div class="toggle_hide2show"> 
     129<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("BATCH UPDATE");?> </font></a></center> 
     130        <div class="tohide" style="display:none;"> 
     131 
     132<center> 
     133<b>&nbsp;<?php echo $HD_Form -> FG_NB_RECORD ?> <?php echo gettext("vouchers selected!"); ?>&nbsp;<?php echo gettext("Use the options below to batch update the selected vouchers.");?></b> 
     134           <table align="center" border="0" width="65%"  cellspacing="1" cellpadding="2"> 
     135        <tbody> 
     136                <form name="updateForm" action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> 
     137                <INPUT type="hidden" name="batchupdate" value="1"> 
     138                <tr>             
     139          <td align="left" class="bgcolor_001" > 
     140                                <input name="check[upd_used]" type="checkbox" <?php if ($check["upd_used"]=="on") echo "checked"?>> 
     141                  </td> 
     142                  <td align="left"  class="bgcolor_001"> 
     143                                1)&nbsp;<?php echo gettext("USED"); ?>&nbsp;:  
     144                                <select NAME="upd_used" size="1" class="form_input_select"> 
     145                                <?php  
     146                                        foreach($used_list as $key => $cur_value) {                                                                                      
     147                                ?> 
     148                                        <option value='<?php echo $cur_value[1] ?>'  <?php if ($upd_inuse==$cur_value[1]) echo 'selected="selected"'?>><?php echo $cur_value[0] ?></option> 
     149                                <?php } ?>                       
     150                    </select> 
     151                  </td> 
     152                </tr> 
     153                <tr>             
     154          <td align="left"  class="bgcolor_001"> 
     155                        <input name="check[upd_activated]" type="checkbox" <?php if ($check["upd_activated"]=="on") echo "checked"?> > 
     156                  </td> 
     157                  <td align="left" class="bgcolor_001"> 
     158                                2)&nbsp;<?php echo gettext("ACTIVATED");?>&nbsp;: 
     159                                <select NAME="upd_activated" size="1" class="form_input_select"> 
     160                                        <?php                                     
     161                                         foreach ($actived_list as $key => $cur_value){                                                   
     162                                        ?> 
     163                                                <option value='<?php echo $cur_value[1] ?>' <?php if ($upd_status==$cur_value[1]) echo 'selected="selected"'?>><?php echo $cur_value[0] ?></option> 
     164                                        <?php } ?> 
     165                                </select><br/> 
     166                  </td> 
     167                </tr> 
     168                <tr>             
     169          <td align="left" class="bgcolor_001"> 
     170                                <input name="check[upd_credit]" type="checkbox" <?php if ($check["upd_credit"]=="on") echo "checked"?>> 
     171                                <input name="mode[upd_credit]" type="hidden" value="2"> 
     172                  </td> 
     173                  <td align="left"  class="bgcolor_001">         
     174                                3)&nbsp;<?php echo gettext("CREDIT");?>&nbsp;: 
     175                                        <input class="form_input_text" name="upd_credit" size="10" maxlength="10"  value="<?php if (isset($upd_credit)) echo $upd_credit; else echo '0';?>"> 
     176                                <font class="version"> 
     177                                <input type="radio" NAME="type[upd_credit]" value="1" <?php if((!isset($type["upd_credit"]))|| ($type["upd_credit"]==1) ){?>checked<?php }?>><?php echo gettext("Equals");?> 
     178                                <input type="radio" NAME="type[upd_credit]" value="2" <?php if($type["upd_credit"]==2){?>checked<?php }?>> <?php echo gettext("Add");?> 
     179                                <input type="radio" NAME="type[upd_credit]" value="3" <?php if($type["upd_credit"]==3){?>checked<?php }?>> <?php echo gettext("Subtract");?> 
     180                                </font> 
     181                  </td> 
     182                </tr> 
     183                <tr>             
     184          <td align="left" class="bgcolor_001"> 
     185                                <input name="check[upd_currency]" type="checkbox" <?php if ($check["upd_currency"]=="on") echo "checked"?>> 
     186                  </td> 
     187                  <td align="left"  class="bgcolor_001"> 
     188                                4)&nbsp;<?php echo gettext("CURRENCY");?>&nbsp;: 
     189                                <select NAME="upd_currency" size="1" class="form_input_select"> 
     190                                <?php  
     191                                        foreach($currencies_list as $key => $cur_value) {                                                                                        
     192                                ?> 
     193                                        <option value='<?php echo $key ?>'  <?php if ($upd_currency==$key) echo 'selected="selected"'?>><?php echo $cur_value[1].' ('.$cur_value[2].')' ?></option> 
     194                                <?php } ?>                       
     195                    </select> 
     196                  </td> 
     197                </tr> 
     198                <tr>             
     199          <td align="left" class="bgcolor_001"> 
     200                                <input name="check[upd_tag]" type="checkbox" <?php if ($check["upd_tag"]=="on") echo "checked"?>> 
     201                  </td> 
     202                  <td align="left"  class="bgcolor_001"> 
     203                                5)&nbsp;<?php echo gettext("TAG");?>&nbsp;:  
     204                                <input class="form_input_text"  name="upd_tag" size="10" maxlength="6" value="<?php echo $upd_tag; ?>"> 
     205                                <br/> 
     206                </td> 
     207                </tr> 
     208                <tr>             
     209                        <td align="right" class="bgcolor_001"></td> 
     210                        <td align="right"  class="bgcolor_001"> 
     211                                <input class="form_input_button"  value=" <?php echo gettext("BATCH UPDATE VOUCHER");?>  " type="submit"> 
     212                </td> 
     213                </tr> 
     214                </form> 
     215                </table> 
     216</center> 
     217        </div> 
     218</div> 
     219<!-- ** ** ** ** ** Part for the Update ** ** ** ** ** --> 
     220<?php 
     221} // END if ($form_action == "list") 
     222 
     223 
     224 
     225if (isset($update_msg) && strlen($update_msg)>0) echo $update_msg;  
    44226 
    45227 
  • trunk/A2Billing_UI/Public/form_data/FG_var_voucher.inc

    r408 r581  
    2323 
    2424$actived_list = array();  
    25 $actived_list["t"] = array( gettext("Active"), "t"); 
    26 $actived_list["f"] = array( gettext("Inactive"), "f"); 
     25$actived_list["t"] = array( gettext("Active"), "t" ); 
     26$actived_list["f"] = array( gettext("Inactive"), "f" ); 
     27 
     28$actived_list_r = array();  
     29$actived_list_r["t"] = array( "t", gettext("Active") ); 
     30$actived_list_r["f"] = array( "f", gettext("Inactive") ); 
     31 
     32$used_list = array(); 
     33$used_list["0"] = array( gettext("NO USED"), "0"); 
     34$used_list["1"] = array( gettext("USED"), "1"); 
     35 
     36$used_list_r = array(); 
     37$used_list_r["0"] = array( "0", gettext("NO USED")); 
     38$used_list_r["1"] = array( "1", gettext("USED")); 
    2739 
    2840$yesno = array(); 
     
    3951 
    4052$HD_Form -> AddViewElement(gettext("ID"), "id", "4%", "center", "sort"); 
    41 $HD_Form -> AddViewElement(gettext("VOUCHER"), "voucher", "13%", "center", "sort"); 
    42 $HD_Form -> AddViewElement(gettext("CREDIT"), "credit", "7%", "center", "sort"); 
    43 $HD_Form -> AddViewElement(gettext("TAG"), "tag", "15%", "center", "sort", "30"); 
    44 $HD_Form -> AddViewElement(gettext("ACTIVATED"), "activated", "7%", "center", "sort", "", "list", $actived_list); 
    45 $HD_Form -> AddViewElement(gettext("USEDCARDNUMBER"), "usedcardnumber", "13%", "center", "sort"); 
    46 $HD_Form -> AddViewElement(gettext("USEDATE"), "usedate", "13%", "center", "sort", "16"); 
    47 $HD_Form -> AddViewElement(gettext("CURRENCY"), "currency", "7%", "center", "sort", "", "list", $currency_list_key); 
    48  
    49  
    50 $HD_Form -> FieldViewElement ('id, voucher, credit, tag, activated, usedcardnumber, usedate, currency'); 
     53$HD_Form -> AddViewElement(gettext("VOUCHER"), "voucher", "12%", "center", "sort"); 
     54$HD_Form -> AddViewElement(gettext("CREDIT"), "credit", "6%", "center", "sort"); 
     55$HD_Form -> AddViewElement(gettext("TAG"), "tag", "13%", "center", "sort", "30"); 
     56$HD_Form -> AddViewElement(gettext("ACTIVATED"), "activated", "6%", "center", "sort", "", "list", $actived_list); 
     57$HD_Form -> AddViewElement(gettext("USED"), "used", "6%", "center", "sort", "", "list", $used_list); 
     58$HD_Form -> AddViewElement(gettext("USEDCARDNUMBER"), "usedcardnumber", "12%", "center", "sort"); 
     59$HD_Form -> AddViewElement(gettext("CREATED DATE"), "creationdate", "12%", "center", "sort", "16"); 
     60$HD_Form -> AddViewElement(gettext("USED DATE"), "usedate", "13%", "center", "sort", "16"); 
     61$HD_Form -> AddViewElement(gettext("CURRENCY"), "currency", "6%", "center", "sort", "", "list", $currency_list_key); 
     62 
     63 
     64$HD_Form -> FieldViewElement ('id, voucher, credit, tag, activated, used, usedcardnumber, creationdate, usedate, currency'); 
     65 
     66 
     67 
     68// Search form 
     69if (!($popup_select>=1))         $HD_Form -> FG_FILTER_SEARCH_FORM = true; 
     70$HD_Form -> FG_FILTER_SEARCH_TOP_TEXT = gettext('Define specific criteria to search for vouchers created.'); 
     71$HD_Form -> FG_FILTER_SEARCH_1_TIME_TEXT = gettext('Creation date / Month'); 
     72$HD_Form -> FG_FILTER_SEARCH_2_TIME_TEXT = gettext('Creation date / Day'); 
     73$HD_Form -> FG_FILTER_SEARCH_2_TIME_FIELD = 'creationdate'; 
     74$HD_Form -> AddSearchElement_C1 (gettext("VOUCHER"), 'voucher','vouchertype'); 
     75$HD_Form -> AddSearchElement_C1 (gettext("CARDNUMBER"),'usedcardnumber','usedcardnumbertype'); 
     76$HD_Form -> AddSearchElement_C1 (gettext("TAG"),'tag','tagtype'); 
     77$HD_Form -> AddSearchElement_C2 (gettext("CREDIT"),'credit1','credit1type','credit2','credit2type','credit'); 
     78 
     79$HD_Form -> FG_FILTER_SEARCH_FORM_SELECT_TEXT = ''; 
     80$HD_Form -> AddSearchElement_Select (gettext("SELECT STATUS"), null, null, null, null,null , "activated", 0, $actived_list_r); 
     81$HD_Form -> AddSearchElement_Select (gettext("SELECT USED"), null, null, null, null,null , "used", 0, $used_list_r); 
     82$HD_Form -> AddSearchElement_Select (gettext("SELECT CURRENCY"), null, null, null, null, null, "currency", 0, $currency_list_r); 
     83 
     84 
    5185 
    5286 
  • trunk_v2/A2Billing_UI/Public/A2B_entity_voucher.php

    r569 r581  
    77 
    88 
     9 
    910if (! has_rights (ACX_BILLING)){  
    1011        Header ("HTTP/1.0 401 Unauthorized"); 
     
    1314} 
    1415 
    15  
    16  
    1716/***********************************************************************************/ 
    1817 
    1918$HD_Form -> setDBHandler (DbConnect()); 
    20  
    21  
    2219$HD_Form -> init(); 
     20 
     21 
     22/********************************* BATCH UPDATE ***********************************/ 
     23getpost_ifset(array('popup_select', 'popup_formname', 'popup_fieldname', 'upd_tag', 'upd_currency', 'upd_credit', 'upd_activated', 'upd_used', 'upd_credittype', 'batchupdate', 'check', 'type', 'mode')); 
     24// CHECK IF REQUEST OF BATCH UPDATE 
     25if ($batchupdate == 1 && is_array($check)) { 
     26         
     27        $HD_Form->prepare_list_subselection('list'); 
     28         
     29        // Array ( [upd_simultaccess] => on [upd_currency] => on )       
     30        $loop_pass=0; 
     31        $SQL_UPDATE = ''; 
     32        foreach ($check as $ind_field => $ind_val){ 
     33                //echo "<br>::> $ind_field -"; 
     34                $myfield = substr($ind_field,4); 
     35                if ($loop_pass!=0) $SQL_UPDATE.=','; 
     36                 
     37                // Standard update mode 
     38                if (!isset($mode["$ind_field"]) || $mode["$ind_field"]==1){              
     39                        if (!isset($type["$ind_field"])){                
     40                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     41                        }else{ 
     42                                $SQL_UPDATE .= " $myfield='".$type["$ind_field"]."'"; 
     43                        } 
     44                // Mode 2 - Equal - Add - Subtract 
     45                }elseif($mode["$ind_field"]==2){ 
     46                        if (!isset($type["$ind_field"])){                
     47                                $SQL_UPDATE .= " $myfield='".$$ind_field."'"; 
     48                        }else{ 
     49                                if ($type["$ind_field"] == 1){ 
     50                                        $SQL_UPDATE .= " $myfield='".$$ind_field."'";                                    
     51                                }elseif ($type["$ind_field"] == 2){ 
     52                                        $SQL_UPDATE .= " $myfield = $myfield +'".$$ind_field."'"; 
     53                                }else{ 
     54                                        $SQL_UPDATE .= " $myfield = $myfield -'".$$ind_field."'"; 
     55                                }                                
     56                        } 
     57                } 
     58                $loop_pass++; 
     59        } 
     60         
     61        $SQL_UPDATE = "UPDATE $HD_Form->FG_TABLE_NAME SET $SQL_UPDATE"; 
     62        if (strlen($HD_Form->FG_TABLE_CLAUSE)>1) { 
     63                $SQL_UPDATE .= ' WHERE '; 
     64                $SQL_UPDATE .= $HD_Form->FG_TABLE_CLAUSE; 
     65        } 
     66        if (! $res = $HD_Form -> DBHandle -> Execute($SQL_UPDATE)) { 
     67                $update_msg = '<center><font color="red"><b>'.gettext('Could not perform the batch update!').'</b></font></center>'; 
     68        } else { 
     69                $update_msg = '<center><font color="green"><b>'.gettext('The batch update has been successfully perform!').'</b></font></center>'; 
     70        } 
     71         
     72} 
     73/********************************* END BATCH UPDATE ***********************************/ 
    2374 
    2475 
     
    4293if ($form_action=='list') echo $CC_help_list_voucher; 
    4394else echo $CC_help_create_voucher; 
     95 
     96 
     97 
     98?> 
     99<script language="JavaScript" src="javascript/card.js"></script> 
     100 
     101 
     102<div class="toggle_hide2show"> 
     103<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("SEARCH VOUCHERS");?> </font></a></center> 
    &n