phpBMS

Changeset 634 for trunk/phpbms/include

Show
Ignore:
Timestamp:
08/06/09 15:48:24 (3 years ago)
Author:
nate
Message:
  • Fixed invoicestatus insert statement when creating credit memos from the search page (was erroneously using ids instead of uuids).
  • Fixes to search functions to use uuids where they should have been before. (These still need testing).
  • Added the ability for search functions' idsArray to be uuids and not just ids (where applicable). This is mostly just useful for api calls.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/include/common_functions.php

    r622 r634  
    319319 
    320320/** 
     321 * function getUuidArray 
     322 * Gets an array of uuids for a given tabledefuuid and list of ids.  Will not 
     323 * give a uuid more than once and may not return an array of the same count 
     324 * as the count of the $ids array. 
     325 * 
     326 * @param object $db 
     327 * @param string $tabledefuuid 
     328 * @param array $ids 
     329 * 
     330 * @return array Array of Uuids for the $ids in no particular order.  Count 
     331 * (length) of this array is less than or equal to the $ids array.  Returns false 
     332 * if $ids is of length 0. 
     333 */ 
     334 
     335function getUuidArray($db, $tabledefuuid, $ids){ 
     336 
     337        if(!count($ids)) 
     338                return false; 
     339 
     340        $querystatement = " 
     341                        SELECT 
     342                                        `maintable` 
     343                        FROM 
     344                                        `tabledefs` 
     345                        WHERE 
     346                                        `uuid` = '".$tabledefuuid."'"; 
     347 
     348        $queryresult = $db->query($querystatement); 
     349 
     350        $tablerecord = $db->fetchArray($queryresult); 
     351 
     352        $whereclause = ""; 
     353        foreach($ids as $id) 
     354                $whereclause .= " OR `id` = '".(int)$id."'"; 
     355 
     356        $whereclause = substr($whereclause, 4); 
     357 
     358        $querystatement = " 
     359                        SELECT 
     360                                        `uuid` 
     361                        FROM 
     362                                        `".$tablerecord["maintable"]."` 
     363                        WHERE 
     364                                        ".$whereclause; 
     365 
     366        $queryresult = $db->query($querystatement); 
     367 
     368        $thereturn = array(); 
     369        if($db->numRows($queryresult)) 
     370                while($therecord = $db->fetchArray($queryresult)) 
     371                        $thereturn[] = $therecord["uuid"]; 
     372 
     373        return $thereturn; 
     374 
     375}//end function --getUuidArray-- 
     376 
     377 
     378/** 
    321379  * retrieves an id given a uuid and a table definition's uuid 
    322380  * 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.