Customer Search

<<Back to Main Menu

Description:
Processes a Customer Search Form to find Customer details.

Accessible by:
Managers

Accessed from:
Customer Search Form

Input parameters:
Username
First Name
Surname
Email
City
Country

Output
Customer Search Form
List of all customers matched with links to View Profile and Edit Profile Form.
Error message if there are no matches

Pseudo Code:
get/create session
if ('usertype' param in session == 'm') {
   validate form
   if (form params are in the correct format) {
      display a Customer Search Form
      if ('username' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      if ('First Name' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      if ('Surname' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      if ('Email' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      if ('City' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      if ('Country' param in the form isn't blank) {
         add this condition to the SQL statement
      }
      get the Customer data from the database that matches the form criteria
      display list of customers with links to View Profile and Edit Profile Form

      if (there are no matches) {
         display error message
      }
   }
   else {
      display a Customer Search Form with an error message
   }
}
else {
   error message to say user must be a manager
}