| 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 | |