Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function __construct($the_o_database, $the_sz_AccountID)
- {
- $this->my_o_database = $the_o_database;
- static $children_cache = NULL;
- static $params_cache = array();
- $a_sz_query = "SELECT \"AC_AccountID\", \"AC_AC_AccountParentID\", \"AC_Code\", ";
- $a_sz_query .= "\"AC_Name\", \"AC_IsActive\", \"AC_IsRetired\", \"AC_RetiredDate\", ";
- $a_sz_query .= "\"AC_CreateDate\", \"AC_DeactivateOnDate\", \"AC_CompleteName\", ";
- $a_sz_query .= "\"AC_PINCode\", \"AC_AccountInfo\" FROM \"Accounts\" ";
- $a_sz_query .= "WHERE \"AC_AccountID\" = '".$the_sz_AccountID."';";
- $a_o_result = db_query($the_o_database, $a_sz_query);
- while ($a_o_row = db_fetch_row($a_o_result))
- {
- $the_ar_IDParentName = Account::GetParentAccountList($the_o_database);
- $this->my_sz_ID = $the_sz_AccountID;
- $this->my_sz_ParentID = $a_o_row[1];
- $this->my_sz_Code = $a_o_row[2];
- $this->my_sz_Name = $a_o_row[3];
- $this->my_b_IsActive = $a_o_row[4];
- $this->my_b_IsRetired = $a_o_row[5];
- $this->my_dt_RetiredDate = $a_o_row[6];
- $this->my_dt_CreateDate = $a_o_row[7];
- $this->my_dt_DeactivateOnDate = $a_o_row[8];
- $this->my_sz_Info = $a_o_row[11];
- if ($a_o_row[9] == "")
- {
- $this->my_sz_FullName = $this->ConstructFullName($the_ar_IDParentName, $the_sz_AccountID, "");
- $this->SetCompleteName($the_o_database, $this->my_sz_FullName, $this->my_sz_ID);
- }
- else
- {
- $this->my_sz_FullName = $a_o_row[9];
- }
- $this->my_sz_PinCode = $a_o_row[10];
- $this->my_sz_Ascent = Account::ConstructListOfParents($the_ar_IDParentName, $the_sz_AccountID, "");
- // Memoize list of children
- $params_array = array($the_ar_IDParentName, $the_sz_AccountID, "");
- if ($children_cache !== NULL and ($params_array == $params_cache))
- {
- // Create cache
- $this->my_sz_Descent = $children_cache;
- }
- else
- {
- // Cache hit
- $this->my_sz_Descent = $children_cache = Account::ConstructListOfChildren($the_ar_IDParentName, $the_sz_AccountID, "");
- $params_cache = $params_array;
- }
- $this->my_sz_Children = Account::GetChildren($the_o_database);
- $this->my_b_HasChild = (bool) ($this->my_sz_Children != "");
- }
- }
Add Comment
Please, Sign In to add comment