phpBMS

Changeset 610 for trunk/phpbms/install

Show
Ignore:
Timestamp:
06/15/09 18:13:44 (3 years ago)
Author:
nate
Message:
  • Receipts, recieptitems, and aritems now uses uuid fields.
  • Added updates and uuid generation to support the above.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/install/generateuuids.php

    r602 r610  
    111111            $this->createUUIDs("tbld:3342a3d4-c6a2-3a38-6576-419299859561"); //product categories 
    112112            $this->createUUIDs("tbld:27b99bda-7bec-b152-8397-a3b09c74cb23"); //addresses 
    113  
     113            $this->createUUIDs("tbld:c595dbe7-6c77-1e02-5e81-c2e215736e9c"); //aritems 
     114            $this->createUUIDs("tbld:43678406-be25-909b-c715-7e2afc7db601"); //receipts 
     115 
     116            $this->aritemList = $this->generateUUIDList("aritems"); 
     117            $this->recieptList = $this->generateUUIDList("reciepts"); 
    114118            $this->productsList = $this->generateUUIDList("products"); 
    115119            $this->addressList = $this->generateUUIDList("addresses"); 
     
    188192            $this->updateFields("invoicestatushistory", array("invoiceid"=>$this->invoiceList, "invoicestatusid"=>$this->invoiceStatsList, "assignedtoid"=>$this->userList)); 
    189193            $this->updateFields("addresstorecord", array("tabledefid"=>$this->tabledefList, "recordid"=>$this->clientList, "addressid"=>$this->addressList)); 
     194            $this->updateFields("receiptitems", array("receiptid"=>$this->recieptList, "aritemid"=>$this->aritemList)); 
     195            $this->updateFields("receipts", array("clientid"=>$this->clientList, "payementmethodid"=>$this->paymentList)); 
     196            $this->updateFields("aritems", array("clientid"=>$this->clientList)); 
    190197 
    191198            //we would have to run this if their were addresses associated with other records 
    192199            //$this->updateVariableUUIDs("addresstorecord", "tabledefid", "recordid"); 
    193200 
     201            $this->updateAritems(); // need receipt list to work 
    194202            $this->updateBMSSettings(); 
    195203 
     
    369377    }//end function updateMenuLinks 
    370378 
     379 
     380    /** 
     381     * function updateAritems 
     382     */ 
     383 
     384    function updateAritems() { 
     385 
     386        $querystatment = " 
     387            SELECT 
     388                `type`, 
     389                `relatedid` 
     390            FROM 
     391                `aritems` 
     392            GROUP BY 
     393                `type`, 
     394                `relatedid` 
     395        "; 
     396 
     397        $queryresult = $this->db->query($querystatment); 
     398 
     399        while($therecord = $this->db->fetchArray($queryresult)){ 
     400 
     401            switch($therecord["type"]){ 
     402 
     403                case "credit": 
     404 
     405                    $oldRelatedid = $therecord["relatedid"]; 
     406                    $updatestatement = " 
     407                        UPDATE 
     408                            `aritems` 
     409                        SET 
     410                            `relatedid`='".$this->recieptList[$oldRelatedid]."' 
     411                        WHERE 
     412                            `relatedid` = '".$oldRelatedid."' 
     413                            AND 
     414                            `type`='credit' 
     415                    "; 
     416 
     417                    $this->db->query($updatestatement); 
     418                    break; 
     419 
     420                default: 
     421                    $oldRelatedid = $therecord["relatedid"]; 
     422 
     423                    $updatestatement = " 
     424                        UPDATE 
     425                            `aritems` 
     426                        SET 
     427                            `relatedid`='".$this->recieptList[$oldRelatedid]."' 
     428                        WHERE 
     429                            `relatedid` = '".$oldRelatedid."' 
     430                            AND 
     431                            `type`!='credit' 
     432                    "; 
     433 
     434                    $this->db->query($updatestatement); 
     435                    break; 
     436 
     437            }//end switch 
     438 
     439        }//end if 
     440 
     441    }//end method 
     442 
    371443    /** 
    372444     * Updates specific settings that reference ids 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.