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/api/apiwrapper.php

    r762 r764  
    263263     * function getDefaults 
    264264     * 
    265      */ 
    266  
    267     function getDefaults($tabledefuuid){ 
     265     * @param string $tabledefuuid The uuid of the tabledefinition that you wish to get defaults. 
     266     * 
     267     * @return array An associative array response for the get 
     268     * @returnf string type The result of the procedure (either 'retrieved' if successful, or 'error' if not). 
     269     * @returnf string message The detailed message describing the result 
     270     * @returnf array extras The associative array containing the default record.  <em>Note:</em> This field only exists if type is not 'error'. 
     271     */ 
     272 
     273    public function getDefaults($tabledefuuid){ 
    268274 
    269275        $params["request"][0]["command"] = "getDefaults"; 
     
    383389     * function searchClientByEmail 
    384390     * @param string $email The email to be searched for 
    385      * @param bool $useUuid Whether to return uuids or ids. 
     391     * @param bool $returnUuid Whether to return uuids or ids. 
    386392     * 
    387393     * @return array An associative array response for the get 
    388394     * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 
    389395     * @returnf string message The detailed message describing the result 
    390      * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'useUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
    391      */ 
    392  
    393     public function searchClientByEmail($email, $useUuid = true) { 
     396     * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'returnUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
     397     */ 
     398 
     399    public function searchClientByEmail($email, $returnUuid = true) { 
    394400 
    395401        $method = "api_searchByEmail"; 
     
    397403        $data["email"] = (string)$email; 
    398404 
    399         if($useUuid !== true) 
    400             $useUuid = false; 
     405        if($returnUuid !== true) 
     406            $returnUuid = false; 
    401407 
    402408        $options = array( 
    403                           "useUuid" => $useUuid 
     409                          "useUuid" => $returnUuid 
    404410                        ); 
    405411 
     
    418424     * @param name $lastname The last name to search for in the client's table 
    419425     * @param name $postalcode The postal code to search for in the client's table 
    420      * @param bool $useUuid Whether to return uuids or ids. 
     426     * @param bool $returnUuid Whether to return uuids or ids. 
    421427     * 
    422428     * @return array An associative array response for the get 
    423429     * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 
    424430     * @returnf string message The detailed message describing the result 
    425      * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'useUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
    426      */ 
    427  
    428     public function searchClientByNameAndPostalcode($firstname, $lastname, $postalcode, $useUuid = true) { 
     431     * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'returnUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
     432     */ 
     433 
     434    public function searchClientByNameAndPostalcode($firstname, $lastname, $postalcode, $returnUuid = true) { 
    429435 
    430436        $method = "api_searchByNameAndPostalcode"; 
     
    434440        $data["postalcode"] = (string)$postalcode; 
    435441 
    436         if($useUuid !== true) 
    437             $useUuid = false; 
     442        if($returnUuid !== true) 
     443            $returnUuid = false; 
    438444 
    439445        $options = array( 
    440                           "useUuid" => $useUuid 
     446                          "useUuid" => $returnUuid 
    441447                        ); 
    442448 
     
    455461     * @param string $username The username to search for in the client's table 
    456462     * @param string $password The password to search for in the client's table 
    457      * @param bool $useUuid Whether to return uuids or ids. 
     463     * @param bool $returnUuid Whether to return uuids or ids. 
    458464     * 
    459465     * @return array An associative array response for the get 
    460466     * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 
    461467     * @returnf string message The detailed message describing the result 
    462      * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'useUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
    463      */ 
    464  
    465     public function searchClientByUsernameAndPassword($username, $password, $useUuid = true) { 
     468     * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'returnUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
     469     */ 
     470 
     471    public function searchClientByUsernameAndPassword($username, $password, $returnUuid = true) { 
    466472 
    467473        $method = "api_searchByUsernameAndPassword"; 
     
    470476        $data["password"] = (string)$password; 
    471477 
    472         if($useUuid !== true) 
    473             $useUuid = false; 
     478        if($returnUuid !== true) 
     479            $returnUuid = false; 
    474480 
    475481        $options = array( 
    476                           "useUuid" => $useUuid 
     482                          "useUuid" => $returnUuid 
    477483                        ); 
    478484 
     
    493499     * @param string $startdate The sql encoded DATETIME lower range of creation dates. 
    494500     * @param string $enddate The sql encoded DATETIME upper range of creation dates. 
    495      * @param bool $useUuid Whether to return uuids or ids. 
     501     * @param bool $returnUuid Whether to return uuids or ids. 
    496502     * 
    497503     * @return array An associative array response for the get 
    498504     * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 
    499505     * @returnf string message The detailed message describing the result 
    500      * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'useUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
    501      */ 
    502  
    503     function searchSalesOrdersByClientUuid($clientuuid, $ordertype = NULL, $startdate = NULL, $enddate = NULL, $useUuid = true) { 
     506     * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'returnUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
     507     */ 
     508 
     509    function searchSalesOrdersByClientUuid($clientuuid, $ordertype = NULL, $startdate = NULL, $enddate = NULL, $returnUuid = true) { 
    504510 
    505511        $method = "api_searchByClientUuid"; 
     
    513519            $data["enddate"] = $enddate; 
    514520 
    515         if($useUuid !== true) 
    516             $useUuid = false; 
     521        if($returnUuid !== true) 
     522            $returnUuid = false; 
    517523 
    518524        $options = array( 
    519                           "useUuid" => $useUuid 
     525                          "useUuid" => $returnUuid 
    520526                        ); 
    521527 
     
    527533            return false; 
    528534 
     535    }//end function 
     536     
     537     
     538    /* 
     539     * function searchProductsByPartnumber 
     540     * @param $partnumber 
     541     * @param $webenabled 
     542     * @param $inactive 
     543     * @param $returnUuid 
     544     * 
     545     * @return array An associative array response for the get 
     546     * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 
     547     * @returnf string message The detailed message describing the result 
     548     * @returnf array extras If the type is 'result', this will be a (possibly empty) array of uuids (or ids if the 'returnUuid' option is false).  <em>Note:</em> This field only exists if type is not 'error'. 
     549     */ 
     550     
     551    public function searchProductsByPartnumber($partnumber, $webenabled = true, $inactive = false, $returnUuid = true) { 
     552         
     553        $method = "api_searchByPartNumber"; 
     554        $tabledefuuid = "tbld:7a9e87ed-d165-c4a4-d9b9-0a4adc3c5a34"; 
     555        $data["partnumber"] = (string)$partnumber; 
     556        $data["webenabled"] = (bool)$webenabled; 
     557        $data["inactive"] = (bool)$inactive; 
     558         
     559        $returnUuid = (bool)$returnUuid; 
     560         
     561        $options = array( 
     562                          "useUuid" => $returnUuid 
     563                        ); 
     564 
     565        $response = $this->runApiMethod($method, $tabledefuuid, $data, $options); 
     566 
     567        if($response !== false) 
     568            return $response[0]; 
     569        else 
     570            return false; 
     571         
    529572    }//end function 
    530573 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.