Changeset 764 for trunk/phpbms
- Timestamp:
- 01/15/10 15:01:40 (2 years ago)
- Location:
- trunk/phpbms/modules
- Files:
-
- 2 modified
-
api/apiwrapper.php (modified) (10 diffs)
-
bms/include/products.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/api/apiwrapper.php
r762 r764 263 263 * function getDefaults 264 264 * 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){ 268 274 269 275 $params["request"][0]["command"] = "getDefaults"; … … 383 389 * function searchClientByEmail 384 390 * @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. 386 392 * 387 393 * @return array An associative array response for the get 388 394 * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 389 395 * @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) { 394 400 395 401 $method = "api_searchByEmail"; … … 397 403 $data["email"] = (string)$email; 398 404 399 if($ useUuid !== true)400 $ useUuid = false;405 if($returnUuid !== true) 406 $returnUuid = false; 401 407 402 408 $options = array( 403 "useUuid" => $ useUuid409 "useUuid" => $returnUuid 404 410 ); 405 411 … … 418 424 * @param name $lastname The last name to search for in the client's table 419 425 * @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. 421 427 * 422 428 * @return array An associative array response for the get 423 429 * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 424 430 * @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) { 429 435 430 436 $method = "api_searchByNameAndPostalcode"; … … 434 440 $data["postalcode"] = (string)$postalcode; 435 441 436 if($ useUuid !== true)437 $ useUuid = false;442 if($returnUuid !== true) 443 $returnUuid = false; 438 444 439 445 $options = array( 440 "useUuid" => $ useUuid446 "useUuid" => $returnUuid 441 447 ); 442 448 … … 455 461 * @param string $username The username to search for in the client's table 456 462 * @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. 458 464 * 459 465 * @return array An associative array response for the get 460 466 * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 461 467 * @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) { 466 472 467 473 $method = "api_searchByUsernameAndPassword"; … … 470 476 $data["password"] = (string)$password; 471 477 472 if($ useUuid !== true)473 $ useUuid = false;478 if($returnUuid !== true) 479 $returnUuid = false; 474 480 475 481 $options = array( 476 "useUuid" => $ useUuid482 "useUuid" => $returnUuid 477 483 ); 478 484 … … 493 499 * @param string $startdate The sql encoded DATETIME lower range of creation dates. 494 500 * @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. 496 502 * 497 503 * @return array An associative array response for the get 498 504 * @returnf string type The result of the get (either 'result' if successful, or 'error' if not). 499 505 * @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) { 504 510 505 511 $method = "api_searchByClientUuid"; … … 513 519 $data["enddate"] = $enddate; 514 520 515 if($ useUuid !== true)516 $ useUuid = false;521 if($returnUuid !== true) 522 $returnUuid = false; 517 523 518 524 $options = array( 519 "useUuid" => $ useUuid525 "useUuid" => $returnUuid 520 526 ); 521 527 … … 527 533 return false; 528 534 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 529 572 }//end function 530 573 -
trunk/phpbms/modules/bms/include/products.php
r703 r764 534 534 /* 535 535 * function api_searchByPartNumber 536 * 536 537 * @param array $requestData Array containing the "partnumber" key. 537 538 * @param bool $returnUuid If true, returns result's uuid , if 538 539 * false, the id. 540 * 539 541 * @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 / result542 * @returnf array details Either the array of uuid / ids if no errors542 * @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 543 545 * were encountered, or the original $requestData if there was an error 544 546 */ … … 547 549 548 550 /** 549 * do error search551 * verify data integrity. 550 552 */ 553 554 $response["type"] = ""; 555 $response["message"] = ""; 551 556 if(!isset($requestData["partnumber"])){ 552 557 $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") 555 580 return $response; 556 }//end if581 557 582 558 583 /** … … 567 592 WHERE 568 593 `partnumber` = '".mysql_real_escape_string($requestData["partnumber"])."' 594 AND 595 `webenabled` = '".(int)$response["webenabled"]."' 596 AND 597 `inactive` = '".(int)$response["inactive"]."' 569 598 "; 570 599 … … 576 605 $thereturn["message"] = "The function api_searchByPartNumber has been run successfully."; 577 606 $thereturn["type"] = ""; 578 $thereturn[" details"] = array();607 $thereturn["extras"] = array(); 579 608 while($therecord = $this->db->fetchArray($queryresult)){ 580 609 581 610 if($returnUuid) 582 $thereturn[" details"][] = $therecord["uuid"];611 $thereturn["extras"][] = $therecord["uuid"]; 583 612 else 584 $thereturn[" details"][] = $therecord["id"];613 $thereturn["extras"][] = $therecord["id"]; 585 614 586 615 }//end while