Changeset 706 for trunk/phpbms/modules/bms/include/clients.php
- Timestamp:
- 01/03/10 21:33:53 (2 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/bms/include/clients.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/bms/include/clients.php
r703 r706 434 434 435 435 }//end method - insertRecord 436 436 437 437 /* 438 438 * function api_searchByEmail … … 446 446 * were encountered, or the original $requestData if there was an error 447 447 */ 448 448 449 449 function api_searchByEmail($requestData, $returnUuid = true) { 450 450 451 451 /** 452 452 * Check for required fields and return error if not there. … … 458 458 return $response; 459 459 }//end if 460 460 461 461 /** 462 * Do sql search 462 * Do sql search 463 463 */ 464 464 $querystatement = " … … 471 471 `email` = '".mysql_real_escape_string($requestData["email"])."' 472 472 "; 473 473 474 474 $queryresult = $this->db->query($querystatement); 475 475 476 476 /** 477 * Construct return array 477 * Construct return array 478 478 */ 479 479 $thereturn["type"] = "result"; … … 481 481 $thereturn["details"] = array(); 482 482 while($therecord = $this->db->fetchArray($queryresult)){ 483 483 484 484 if($returnUuid) 485 485 $thereturn["details"][] = $therecord["uuid"]; 486 486 else 487 487 $thereturn["details"][] = $therecord["id"]; 488 488 489 489 }//end while 490 490 491 491 return $thereturn; 492 492 493 493 }//end function --api_serchByEmail-- 494 494 495 495 /* 496 496 * function api_searchByNameAndPostalcode … … 505 505 * were encountered, or the original $requestData if there was an error 506 506 */ 507 507 508 508 function api_searchByNameAndPostalcode($requestData, $returnUuid = true) { 509 509 510 510 /** 511 * check for required fields 511 * check for required fields 512 512 */ 513 513 $requiredArray = array( … … 516 516 "lastname" 517 517 ); 518 518 519 519 $missingArray = array(); 520 520 521 521 foreach($requiredArray as $requiredField) 522 522 if(!isset($requestData[$requiredField])) 523 523 $missingArray[] = $requiredField; 524 524 525 525 $count = count($missingArray); 526 526 if($count){ 527 527 528 528 $response["type"] = "error"; 529 529 $response["details"] = $requestData; 530 530 $response["message"] = ""; 531 531 532 532 $i=0; 533 533 foreach($missingArray as $missingField){ 534 534 535 535 if(++$i == $count){ 536 536 if($response["message"]) … … 540 540 }else 541 541 $response["message"] .= "'".$missingField."', "; 542 542 543 543 }//end foreach 544 544 545 545 $response["messsage"] = "Data does not contain the key(s): ".$response["message"]; 546 546 547 547 return $response; 548 548 549 549 }//end if 550 550 551 551 /** 552 * do sql search 552 * do sql search 553 553 */ 554 554 $querystatement = " … … 568 568 `addresses`.`postalcode` = '".mysql_real_escape_string($requestData["postalcode"])."' 569 569 "; 570 570 571 571 $queryresult = $this->db->query($querystatement); 572 572 573 573 /** 574 * report findings 574 * report findings 575 575 */ 576 576 $thereturn["details"] = array(); … … 578 578 $thereturn["message"] = "The function api_searchByNameAndPostalcode has been run successfully."; 579 579 while($therecord = $this->db->fetchArray($queryresult)){ 580 580 581 581 if($returnUuid) 582 582 $thereturn["details"][] = $therecord["uuid"]; 583 583 else 584 584 $thereturn["details"][] = $therecord["id"]; 585 585 586 586 }//end while 587 587 588 588 return $thereturn; 589 589 590 590 }//end function --api_searchByNameAndPostalcode 591 591 592 592 /* 593 593 * function api_searchByUsernameAndPassword … … 602 602 * were encountered, or the original $requestData if there was an error 603 603 */ 604 604 605 605 function api_searchByUsernameAndPassword($requestData, $returnUuid = true) { 606 606 607 607 /** 608 * check for required fields 608 * check for required fields 609 609 */ 610 610 $requiredArray = array( … … 612 612 "password" 613 613 ); 614 614 615 615 $missingArray = array(); 616 616 617 617 foreach($requiredArray as $requiredField) 618 618 if(!isset($requestData[$requiredField])) 619 619 $missingArray[] = $requiredField; 620 620 621 621 $count = count($missingArray); 622 622 if($count){ 623 623 624 624 $response["type"] = "error"; 625 625 $response["details"] = $requestData; 626 626 $response["message"] = ""; 627 627 628 628 $i=0; 629 629 foreach($missingArray as $missingField){ 630 630 631 631 if(++$i == $count){ 632 632 if($response["message"]) … … 636 636 }else 637 637 $response["message"] .= "'".$missingField."', "; 638 638 639 639 }//end foreach 640 640 641 641 $response["messsage"] = "Data does not contain the key(s): ".$response["message"]; 642 642 643 643 return $response; 644 644 645 645 }//end if 646 646 647 647 /** 648 * do sql search 648 * do sql search 649 649 */ 650 650 $querystatement = " … … 659 659 `password` = '".mysql_real_escape_string($requestData["password"])."' 660 660 "; 661 661 662 662 $queryresult = $this->db->query($querystatement); 663 663 664 664 /** 665 * report findings 665 * report findings 666 666 */ 667 667 $thereturn["details"] = array(); … … 669 669 $thereturn["message"] = "The function api_searchByUsernameAndPassword has been run successfully."; 670 670 while($therecord = $this->db->fetchArray($queryresult)){ 671 671 672 672 if($returnUuid) 673 673 $thereturn["details"][] = $therecord["uuid"]; 674 674 else 675 675 $thereturn["details"][] = $threturn["id"]; 676 676 677 677 }//end while 678 678 679 679 return $thereturn; 680 680 681 681 }//end function --api_searchByUsernameAndPassword-- 682 682 … … 688 688 if(class_exists("searchFunctions")){ 689 689 class clientsSearchFunctions extends searchFunctions{ 690 691 function consolidate_clients($useUuid = false){ 692 693 $noOutput = true; 694 include("modules/bms/clients_consolidate.php"); 695 696 $consolidator = new clientConsolidator($this->db); 697 698 $consolidator->showPicker($this->idsArray, $useUuid); 699 exit(); 700 701 702 }//end function consolidate_clients 690 703 691 704 function mark_asclient($useUuid = false){ … … 941 954 }//end class 942 955 }//end if 956 943 957 if(class_exists("phpbmsImport")){ 944 958 class clientsImport extends phpbmsImport{