phpBMS

Show
Ignore:
Timestamp:
01/15/10 15:01:40 (2 years ago)
Author:
nate
Message:
  • Product api functions now have responses consitent with the api / other table api functions.
  • api_searchByPartNumber can now distinguish between webenabled and non-webenabled records as well as inactive and non-inactive records.
  • Further described the getDefaults apiwrapper function.
  • Added a searchProductsByPartnumber function in the apiwrapper.
Files:
1 modified

Legend:

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

    r703 r764  
    534534                /* 
    535535                 * function api_searchByPartNumber 
     536                 *  
    536537                 * @param array $requestData Array containing the "partnumber" key. 
    537538                 * @param bool $returnUuid If true, returns result's uuid , if 
    538539                 * false, the id. 
     540                 *  
    539541                 * @return array An array containing response information 
    540                  * @returnf string 'type' The type of response (e.g. 'error' or 'result') 
    541                  * @returnf string 'message' Message explaining the type / result 
    542                  * @returnf array details Either the array of uuid / ids if no errors 
     542                 * @returnf string type The type of response (e.g. 'error' or 'result') 
     543                 * @returnf string message Message explaining the type / result 
     544                 * @returnf array extras Either the array of uuid / ids if no errors 
    543545                 * were encountered, or the original $requestData if there was an error 
    544546                 */ 
     
    547549                         
    548550                        /** 
    549                           *  do error search  
     551                          *  verify data integrity.  
    550552                          */ 
     553                         
     554                        $response["type"] = ""; 
     555                        $response["message"] = ""; 
    551556                        if(!isset($requestData["partnumber"])){ 
    552557                                $response["type"] = "error"; 
    553                                 $response["message"] = "Data does not contain a key of 'partnumber'."; 
    554                                 $response["details"] = $requestData; 
     558                                $response["message"] = "Data does not contain a key of 'partnumber'"; 
     559                        }//end if 
     560                         
     561                        if(!isset($requestData["webenabled"])){ 
     562                                $response["type"] = "error"; 
     563                                if($response["message"]) 
     564                                        $response["message"] .= " or 'webenabled'."; 
     565                                else 
     566                                        $response["message"] = "Data does not contain a key of 'webenabled'."; 
     567                                 
     568                        }//end if 
     569                         
     570                        if(!isset($requestData["inactive"])){ 
     571                                $response["type"] = "error"; 
     572                                if($response["message"]) 
     573                                        $response["message"] .= " or 'inactive'."; 
     574                                else 
     575                                        $response["message"] = "Data does not contain a key of 'inactive'."; 
     576                                 
     577                        }//end if 
     578                         
     579                        if($response["type"] == "error") 
    555580                                return $response; 
    556                         }//end if 
     581                         
    557582                         
    558583                        /** 
     
    567592                                WHERE 
    568593                                        `partnumber` = '".mysql_real_escape_string($requestData["partnumber"])."' 
     594                                        AND 
     595                                        `webenabled` = '".(int)$response["webenabled"]."' 
     596                                        AND 
     597                                        `inactive` = '".(int)$response["inactive"]."' 
    569598                        "; 
    570599                         
     
    576605                        $thereturn["message"] = "The function api_searchByPartNumber has been run successfully."; 
    577606                        $thereturn["type"] = ""; 
    578                         $thereturn["details"] = array(); 
     607                        $thereturn["extras"] = array(); 
    579608                        while($therecord = $this->db->fetchArray($queryresult)){ 
    580609                                 
    581610                                if($returnUuid) 
    582                                         $thereturn["details"][] = $therecord["uuid"]; 
     611                                        $thereturn["extras"][] = $therecord["uuid"]; 
    583612                                else 
    584                                         $thereturn["details"][] = $therecord["id"]; 
     613                                        $thereturn["extras"][] = $therecord["id"]; 
    585614                                         
    586615                        }//end while 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.