Exemplo n.º 1
0
 public static function get_list($_FORM)
 {
     global $TPL;
     $filter = clientContact::get_list_filter($_FORM);
     if (is_array($filter) && count($filter)) {
         $filter = " WHERE " . implode(" AND ", $filter);
     }
     $q = "SELECT clientContact.*, client.*\n            FROM clientContact\n       LEFT JOIN client ON client.clientID = clientContact.clientID\n                 " . $filter . " \n        GROUP BY clientContact.clientContactID \n        ORDER BY clientContactName,clientContact.primaryContact asc";
     $db = new db_alloc();
     $db->query($q);
     while ($row = $db->next_record()) {
         $c = new client();
         $c->read_db_record($db);
         $row["clientLink"] = $c->get_client_link($_FORM);
         $row["clientContactEmail"] and $row["clientContactEmail"] = "<a href=\"mailto:" . page::htmlentities($row["clientContactName"] . " <" . $row["clientContactEmail"] . ">") . "\">" . page::htmlentities($row["clientContactEmail"]) . "</a>";
         $rows[] = $row;
     }
     return $rows;
 }
Exemplo n.º 2
0
     $parent_types = array("client" => "Client", "project" => "Project", "task" => "Task", "general" => "General");
     $TPL["parentTypeOptions"] = page::select_options($parent_types);
     include_template("templates/reminderSelectParentTypeM.tpl");
     break;
 case 2:
     // Which project,task,client. (skip for general)
     // get personID
     $personID = $current_user->get_id();
     $parent_names = array();
     $db = new db_alloc();
     if ($parentType == "client") {
         $query = "SELECT * FROM client WHERE clientStatus!='Archived' ORDER BY clientName";
         $db->query($query);
         while ($db->next_record()) {
             $client = new client();
             $client->read_db_record($db);
             $parent_names[$client->get_id()] = $client->get_value('clientName');
         }
     } else {
         if ($parentType == "project") {
             if ($current_user->have_role("admin")) {
                 $query = "SELECT * FROM project WHERE projectStatus != 'Archived' ORDER BY projectName";
             } else {
                 $query = prepare("SELECT * \n                          FROM project \n                     LEFT JOIN projectPerson ON project.projectID=projectPerson.projectID \n                         WHERE personID='%d' \n                           AND projectStatus != 'Archived'\n                      ORDER BY projectName", $personID);
             }
             $db->query($query);
             while ($db->next_record()) {
                 $project = new project();
                 $project->read_db_record($db);
                 $parent_names[$project->get_id()] = $project->get_value('projectName');
             }
Exemplo n.º 3
0
 public static function get_list($_FORM)
 {
     /*
      * This is the definitive method of getting a list of clients that need a sophisticated level of filtering
      *
      */
     global $TPL;
     $filter = client::get_list_filter($_FORM);
     $debug = $_FORM["debug"];
     $debug and print "<pre>_FORM: " . print_r($_FORM, 1) . "</pre>";
     $debug and print "<pre>filter: " . print_r($filter, 1) . "</pre>";
     $_FORM["return"] or $_FORM["return"] = "html";
     if (is_array($filter) && count($filter)) {
         $filter = " WHERE " . implode(" AND ", $filter);
     }
     $cc = config::get_config_item("clientCategories");
     foreach ($cc as $k => $v) {
         $clientCategories[$v["value"]] = $v["label"];
     }
     $q = "SELECT client.*,clientContactName, clientContactEmail, clientContactPhone, clientContactMobile\n            FROM client \n       LEFT JOIN clientContact ON client.clientID = clientContact.clientID AND clientContact.clientContactActive = 1\n                 " . $filter . " \n        GROUP BY client.clientID \n        ORDER BY clientName,clientContact.primaryContact asc";
     $debug and print "Query: " . $q;
     $db = new db_alloc();
     $db2 = new db_alloc();
     $db->query($q);
     while ($row = $db->next_record()) {
         $print = true;
         $c = new client();
         $c->read_db_record($db);
         $row["clientCategoryLabel"] = $clientCategories[$c->get_value("clientCategory")];
         $row["clientLink"] = $c->get_client_link($_FORM);
         $row["clientContactEmail"] and $row["clientContactEmail"] = "<a href=\"mailto:" . page::htmlentities($row["clientContactName"] . " <" . $row["clientContactEmail"] . ">") . "\">" . page::htmlentities($row["clientContactEmail"]) . "</a>";
         $rows[$c->get_id()] = $row;
     }
     return (array) $rows;
 }