function licensing_customerscontent_alm_customers_BeforeShow(&$sender) { $licensing_customerscontent_alm_customers_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $licensing_customerscontent; //Compatibility //End licensing_customerscontent_alm_customers_BeforeShow //Custom Code @150-2A29BDB7 // ------------------------- // Write your own code here. $guid = CCGetFromGet("guid", ""); $license_guid = CCGetFromGet("license_guid", ""); $tab = CCGetFromGet("tab", ""); $o = CCGetFromGet("o", ""); $params = array(); $params["customer_guid"] = $guid; $params["license_guid"] = $license_guid; if (strlen($guid) > 0) { global $Tpl; global $FileName; $customers = new Customers(); $contacts = $customers->getCustomerContacts($params); $contacts = $contacts["contacts"]; $querystring = CCGetQueryString("QueryString", array()); $db = new clsDBdbConnection(); foreach ($contacts as $contact) { //$editurl = $FileName."?$querystring&contact_guid=".$contact["guid"]."&tab=addcontact"; //$deleteurl = $FileName."?$querystring&contact_guid=".$contact["guid"]."&tab=addcontact&o=delcontact"; //$Tpl->setvar("lbedit",""); //$Tpl->setvar("lbdelete",""); $Tpl->setvar("lbcontact", $contact["contact"]); if ($contact["maincontact"] == "1") { $Tpl->setvar("lbmaincontact", ""); } else { $Tpl->setvar("lbmaincontact", "hide"); } $jobposition = $contact["jobposition"]; $jobposition = CCDLookup("jobposition", "alm_jobpositions", "id = {$jobposition}", $db); $Tpl->setvar("lbcontact_jobposition", $jobposition); $Tpl->setvar("lbcontact_phone", $contact["phone"]); $Tpl->setvar("lbcontact_extension", $contact["extension"]); $Tpl->setvar("lbcontact_mobile", $contact["mobile"]); $Tpl->setvar("lbcontact_workemail", $contact["workemail"]); $Tpl->setvar("lbcontact_personalemail", $contact["personalemail"]); $dateupdated = $contact["dateupdated"]; if (strlen($dateupdated) > 0) { $dateupdated_array = CCParseDate($dateupdated, array("yyyy", "-", "mm", "-", "dd", " ", "H", ":", "n", ":", "s")); $format = array("mm", "/", "dd", "/", "yyyy", " ", "hh", ":", "nn", " ", "AM/PM"); $dateupdated = CCFormatDate($dateupdated_array, $format); $Tpl->setvar("lbcontact_dateupdated", $dateupdated); } $Tpl->parse("contact_list", true); } $db->close(); } // ------------------------- //End Custom Code //Close licensing_customerscontent_alm_customers_BeforeShow @2-4616A461 return $licensing_customerscontent_alm_customers_BeforeShow; }
function customers_maintcontent_alm_customers_BeforeShow(&$sender) { $customers_maintcontent_alm_customers_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $customers_maintcontent; //Compatibility //End customers_maintcontent_alm_customers_BeforeShow //Custom Code @140-2A29BDB7 // ------------------------- // Write your own code here. $guid = CCGetFromGet("guid", ""); $contact_guid = CCGetFromGet("contact_guid", ""); $tab = CCGetFromGet("tab", ""); $o = CCGetFromGet("o", ""); $params = array(); $params["customer_guid"] = $guid; $params["contact_guid"] = $contact_guid; if (strlen($guid) > 0) { global $Tpl; global $FileName; $customers = new Customers(); $contacts = $customers->getCustomerContacts($params); $contacts = $contacts["contacts"]; $querystring = CCGetQueryString("QueryString", array("contact_guid")); $db = new clsDBdbConnection(); foreach ($contacts as $contact) { $editurl = $FileName . "?{$querystring}&contact_guid=" . $contact["guid"] . "&tab=addcontact"; $Tpl->setvar("lbedit", $editurl); if ($contact["maincontact"] == "1") { $Tpl->setvar("lbmaincontact", ""); } else { $Tpl->setvar("lbmaincontact", "hide"); } $Tpl->setvar("lbcontact", $contact["contact"]); $jobposition = $contact["jobposition"]; $jobposition = CCDLookup("jobposition", "alm_jobpositions", "id = {$jobposition}", $db); $Tpl->setvar("lbcontact_jobposition", $jobposition); $Tpl->setvar("lbcontact_phone", $contact["phone"]); $Tpl->setvar("lbcontact_extension", $contact["extension"]); $Tpl->setvar("lbcontact_mobile", $contact["mobile"]); $Tpl->setvar("lbcontact_workemail", $contact["workemail"]); $Tpl->setvar("lbcontact_personalemail", $contact["personalemail"]); $dateupdated = $contact["dateupdated"]; if (strlen($dateupdated) > 0) { $dateupdated_array = CCParseDate($dateupdated, array("yyyy", "-", "mm", "-", "dd", " ", "H", ":", "n", ":", "s")); $format = array("mm", "/", "dd", "/", "yyyy", " ", "hh", ":", "nn", " ", "AM/PM"); $dateupdated = CCFormatDate($dateupdated_array, $format); $Tpl->setvar("lbcontact_dateupdated", $dateupdated); } $Tpl->parse("contact_list", true); } $db->close(); } //Filling up contact info for updates if (strlen($contact_guid) > 0 && $o != "delcontact") { $customers = new Customers(); $contacts = $customers->getCustomerContactByGuid($params); $contacts = $contacts["contacts"]; if (is_array($contacts[0])) { $customers_maintcontent->alm_customers->contact->SetValue($contacts[0]["contact"]); $customers_maintcontent->alm_customers->contact_jobposition->SetValue($contacts[0]["jobposition"]); $customers_maintcontent->alm_customers->contact_phone->SetValue($contacts[0]["phone"]); $customers_maintcontent->alm_customers->contact_extension->SetValue($contacts[0]["extension"]); $customers_maintcontent->alm_customers->contact_mobile->SetValue($contacts[0]["mobile"]); $customers_maintcontent->alm_customers->contact_workemail->SetValue($contacts[0]["workemail"]); $customers_maintcontent->alm_customers->contact_personalemail->SetValue($contacts[0]["personalemail"]); $customers_maintcontent->alm_customers->contact_maincontact->SetValue($contacts[0]["maincontact"]); $contact_dob = $contacts[0]["contact_dob"]; $contact_dob_array = CCParseDate($contact_dob, array("yyyy", "-", "mm", "-", "dd")); if ($contact_dob_array[1] == "0000") { $contact_dob_array = null; } $customers_maintcontent->alm_customers->contact_dob->SetValue($contact_dob_array); $contact_preferred_color = explode(",", $contacts[0]["preferred_color"]); $customers_maintcontent->alm_customers->contact_preferred_color->Multiple = true; $customers_maintcontent->alm_customers->contact_preferred_color->SetValue($contact_preferred_color); $contact_hobbies = explode(",", $contacts[0]["hobbies"]); $customers_maintcontent->alm_customers->contact_hobbies->Multiple = true; $customers_maintcontent->alm_customers->contact_hobbies->SetValue($contact_hobbies); $contact_holidays = explode(",", $contacts[0]["notify_holidays"]); $customers_maintcontent->alm_customers->contact_notify_holidays->Multiple = true; $customers_maintcontent->alm_customers->contact_notify_holidays->SetValue($contact_holidays); } } // ------------------------- //End Custom Code //Close customers_maintcontent_alm_customers_BeforeShow @8-32D525B2 return $customers_maintcontent_alm_customers_BeforeShow; }