phpBMS

Show
Ignore:
Timestamp:
04/07/09 11:44:18 (3 years ago)
Author:
nate
Message:
  • Merged Nathan branch back into trunk.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/bms/include/invoicestatuses.php

    r285 r485  
    4040if(class_exists("phpbmsTable")){ 
    4141        class invoiceStatus extends phpbmsTable { 
    42          
     42 
     43                var $availableUserIDs = array(); 
     44 
     45                function populateUserArray(){ 
     46 
     47                        $querystatement = " 
     48                                SELECT 
     49                                        `id` 
     50                                FROM 
     51                                        `users`; 
     52                                "; 
     53 
     54                        $queryresult = $this->db->query($querystatement); 
     55 
     56                        $this->availableUserIDs[] = 0;//for everyone 
     57 
     58                        while($therecord = $this->db->fetchArray($queryresult)) 
     59                                $this->availableUserIDs[] = $therecord["id"]; 
     60 
     61                }//end method --populateUserArray-- 
     62 
     63 
     64                function verifyVariables($variables){ 
     65 
     66                        if(isset($variables["setreadytopost"])) 
     67                                if($variables["setreadytopost"] && $variables["setreadytopost"] != 1) 
     68                                        $this->verifyErrors[] = "The `setreadytopost` field must be a boolean (equivalent to 0 or exactly 1)."; 
     69 
     70                        if(isset($variables["invoicedefault"])) 
     71                                if($variables["invoicedefault"] && $variables["invoicedefault"] != 1) 
     72                                        $this->verifyErrors[] = "The `invoicedefault` field must be a boolean (equivalent to 0 or exactly 1)."; 
     73 
     74                        if(isset($variables["defaultassignedtoid"])){ 
     75 
     76                                if( !$variables["defaultassignedtoid"] || ((int)$variables["defaultassignedtoid"]) > 0 ){ 
     77 
     78                                        if(!count($this->availableUserIDs)) 
     79                                                $this->populateUserArray(); 
     80 
     81                                        if(!in_array(((int)$variables["defaultassignedtoid"]), $this->availableUserIDs)) 
     82                                                $this->verifyErrors[] = "The `defaultassignedtoid` field does not give an existing/acceptable user id number."; 
     83 
     84                                }else 
     85                                        $this->verifyErrors[] = "The `defaultassignedtoid` field must be a non-negative number or equivalent to 0."; 
     86 
     87                        }//end if 
     88 
     89                        return parent::verifyVariables($variables); 
     90 
     91                }//end method --verifyVariables-- 
     92 
     93 
    4394                function updateRecord($variables, $modifiedby = NULL){ 
    4495                        if(isset($variables["invoicedefault"])) 
    4596                                $this->updateInvoiceDefault(); 
    46                  
     97 
    4798                        parent::updateRecord($variables, $modifiedby = NULL); 
    48                 }  
    49                  
     99                } 
     100 
    50101                function updateInvoiceDefault(){ 
    51102                        $querystatement="UPDATE `".$this->maintable."` SET `invoicedefault` = 0"; 
     
    59110 
    60111                function delete_record(){ 
    61                  
     112 
    62113                        $whereclause = $this->buildWhereClause($theids,"invoicestatuses.id"); 
    63                          
     114 
    64115                        $querystatement = "UPDATE invoicestatuses SET inactive=1,modifiedby=".$_SESSION["userinfo"]["id"]." WHERE (".$whereclause.") AND invoicedefault=0;"; 
    65116                        $queryresult = $this->db->query($querystatement); 
    66                          
     117 
    67118                        $message = $this->buildStatusMessage(); 
    68119                        $message.=" marked inactive."; 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.