function products_suite_list_v_alm_product_suites_pndeletebutton_BeforeShow(&$sender)
{
    $products_suite_list_v_alm_product_suites_pndeletebutton_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $products_suite_list;
    //Compatibility
    //End products_suite_list_v_alm_product_suites_pndeletebutton_BeforeShow
    //Custom Code @46-2A29BDB7
    // -------------------------
    // Write your own code here.
    switch (CCGetGroupID()) {
        case 3:
        case 4:
            $products_suite_list->v_alm_product_suites->pndeletebutton->Visible = true;
            break;
        default:
            $products_suite_list->v_alm_product_suites->pndeletebutton->Visible = false;
            break;
    }
    // -------------------------
    //End Custom Code
    //Close products_suite_list_v_alm_product_suites_pndeletebutton_BeforeShow @45-BCA49E6F
    return $products_suite_list_v_alm_product_suites_pndeletebutton_BeforeShow;
}
Esempio n. 2
0
function Login_DoLogin_OnClick()
{
    //Login_DoLogin_OnClick @3-AFF8EBF1
    //Login @4-1C5B8B18
    global $Login;
    if (!CCLoginUser($Login->login->Value, $Login->password->Value)) {
        $Login->Errors->addError("Login or Password is incorrect.");
        $Login->password->SetValue("");
        return false;
    } else {
        global $Redirect;
        if (CCGetGroupID() == 0) {
            $Login->Errors->addError("Your account is currently on hold.");
            $Login->password->SetValue("");
            CCLogoutUser();
            return false;
        } elseif (CCGetGroupID() == 3) {
            $Login->Errors->addError("Your account has been suspended.");
            $Login->password->SetValue("");
            CCLogoutUser();
            return false;
        } else {
            $Redirect = CCGetParam("ret_link", $Redirect);
            return true;
        }
    }
    //End Login
}
function resellers_list_alm_resellers_pndeletebutton_BeforeShow(&$sender)
{
    $resellers_list_alm_resellers_pndeletebutton_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $resellers_list;
    //Compatibility
    //End resellers_list_alm_resellers_pndeletebutton_BeforeShow
    //Custom Code @22-2A29BDB7
    // -------------------------
    // Write your own code here.
    switch (CCGetGroupID()) {
        case 3:
        case 4:
            $resellers_list->alm_resellers->pndeletebutton->Visible = true;
            break;
        default:
            $resellers_list->alm_resellers->pndeletebutton->Visible = false;
            break;
    }
    // -------------------------
    //End Custom Code
    //Close resellers_list_alm_resellers_pndeletebutton_BeforeShow @20-3C9880A1
    return $resellers_list_alm_resellers_pndeletebutton_BeforeShow;
}
function contacts_holidays_list_alm_customers_contacts_ho_pndeletebutton_BeforeShow(&$sender)
{
    $contacts_holidays_list_alm_customers_contacts_ho_pndeletebutton_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $contacts_holidays_list;
    //Compatibility
    //End contacts_holidays_list_alm_customers_contacts_ho_pndeletebutton_BeforeShow
    //Custom Code @20-2A29BDB7
    // -------------------------
    // Write your own code here.
    switch (CCGetGroupID()) {
        case 3:
        case 4:
            $contacts_holidays_list->alm_customers_contacts_ho->pndeletebutton->Visible = true;
            break;
        default:
            $contacts_holidays_list->alm_customers_contacts_ho->pndeletebutton->Visible = false;
            break;
    }
    // -------------------------
    //End Custom Code
    //Close contacts_holidays_list_alm_customers_contacts_ho_pndeletebutton_BeforeShow @18-E4DE0546
    return $contacts_holidays_list_alm_customers_contacts_ho_pndeletebutton_BeforeShow;
}
function licensing_customerscontent_BeforeShow(&$sender)
{
    $licensing_customerscontent_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $licensing_customerscontent;
    //Compatibility
    //End licensing_customerscontent_BeforeShow
    //Custom Code @152-2A29BDB7
    // -------------------------
    // Write your own code here.
    global $Tpl;
    $tab = CCGetFromGet("tab", "tab1_active");
    switch ($tab) {
        default:
        case "details":
            $Tpl->setvar("tab1_active", "active");
            break;
        case "licensing":
            $Tpl->setvar("tab2_active", "active");
            break;
        case "licenselist":
            $Tpl->setvar("tab3_active", "active");
            break;
        case "licensearchive":
            $Tpl->setvar("tab4_active", "active");
            break;
        case "competitor_renewals":
            $Tpl->setvar("tab5_active", "active");
            break;
        case "product_displacement":
            $Tpl->setvar("tab6_active", "active");
            break;
    }
    //Setting the active tab for licensing when the cssForm is present and has licensing as the form submitted
    $cssForm = trim(CCGetFromGet("ccsForm", ""));
    if ($cssForm == "licensing") {
        //Whichever tab set will be reset to avoid more than 1 tab active
        $Tpl->setvar("tab1_active", "");
        $Tpl->setvar("tab2_active", "active");
        $Tpl->setvar("tab3_active", "");
        $Tpl->setvar("tab4_active", "");
        $Tpl->setvar("tab5_active", "");
        $Tpl->setvar("tab6_active", "");
    }
    //Settingup saved message popup
    global $MainPage;
    $showalert = CCGetSession("showalert", "hide");
    $MainPage->Attributes->SetValue("showalert", $showalert);
    if ($showalert == "show") {
        CCSetSession("showalert", "hide");
    }
    //Setting up alerts to let user know the customer has not contacts yet
    $customers = new Customers();
    $customer_guid = CCGetFromGet("guid", "");
    $params = array();
    $params["customer_guid"] = $customer_guid;
    $hasContacts = $customers->customerHasContacts($params);
    if ($hasContacts["hasContacts"] == "1") {
        $MainPage->Attributes->SetValue("showalert_contacterror", "hide");
    } else {
        $MainPage->Attributes->SetValue("showalert_contacterror", "show");
    }
    //Setting up alerts to let user know the license may need support
    $license_guid = trim(CCGetFromGet("license_guid", ""));
    if (strlen($license_guid) > 0) {
        $products = new Alm\Products();
        $params = array();
        $params["license_guid"] = $license_guid;
        $hasSupport = $products->licenseHasSupport($params);
        if ($hasSupport["hasSupport"] == "1") {
            $MainPage->Attributes->SetValue("showalert_addsupport", "hide");
        } else {
            $MainPage->Attributes->SetValue("showalert_addsupport", "show");
        }
    } else {
        $MainPage->Attributes->SetValue("showalert_addsupport", "hide");
    }
    //Check if session variable showalert_addsupport has a show value
    $showalert_addsupport = CCGetSession("showalert_addsupport", "");
    if ($showalert_addsupport == "show") {
        CCSetSession("showalert_addsupport", "hide");
        $MainPage->Attributes->SetValue("showalert_addsupport", $showalert);
    }
    //Procesing file uploading
    $hidlicense_guid = trim(CCGetFromPost("hidlicense_guid", ""));
    if (!empty($_FILES) && strlen($hidlicense_guid) > 0) {
        $params = array();
        $params["license_guid"] = $hidlicense_guid;
        $products = new \Alm\Products();
        $products->uploadLicenseFile($_FILES, $params);
        //Finishing script execution for file uploads because its asyncronous
        exit;
    }
    $license_guid = trim(CCGetFromGet("license_guid", ""));
    $licensefile_guid = trim(CCGetFromGet("licensefile_guid", ""));
    $o = trim(CCGetFromGet("o", ""));
    //Delete licensing operation
    if (strlen($licensefile_guid) > 0 && $o == "dellicense") {
        $params = array();
        $params["licensefile_guid"] = $licensefile_guid;
        $products = new \Alm\Products();
        $products->deleteLicenseFileByGuid($params);
        $querystring = CCGetQueryString("QueryString", array("licensefile_guid", "o"));
        global $FileName;
        $urlRedirect = $FileName . "?{$querystring}";
        header("Location: {$urlRedirect}");
    }
    //Delete full licensing operation
    if (strlen($license_guid) > 0 && $o == "delfulllicense") {
        $params = array();
        $params["license_guid"] = $license_guid;
        $products = new \Alm\Products();
        $products->deleteFullLicenseByGuid($params);
        $querystring = CCGetQueryString("QueryString", array("license_guid", "o"));
        global $FileName;
        $urlRedirect = $FileName . "?{$querystring}";
        header("Location: {$urlRedirect}");
    }
    if (strlen($license_guid) > 0) {
        //License files grid
        $params = array();
        $params["license_guid"] = $license_guid;
        $products = new \Alm\Products();
        $licenseFiles = $products->getLicenseFiles($params);
        $licenseFiles = $licenseFiles["licensefiles"];
        $querystring = CCGetQueryString("QueryString", array("o", "licensefile_guid", "tab"));
        foreach ($licenseFiles as $licenseFile) {
            $licensefile_guid = $licenseFile["guid"];
            $linkdelete = "";
            if (CCGetGroupID() == "4") {
                //Moved linkdelete to code because issues displaying panels inside custom template blocks
                $linkdelete = "<a href='licensing_customers.php?o=dellicense&licensefile_guid={$licensefile_guid}&tab=licenselist&{$querystring}' class='dellicense' ><li class='icon-trash bigger-150 red'></li></a>";
            }
            $Tpl->setvar("linkdelete", $linkdelete);
            $Tpl->setvar("licensefile_guid", $licensefile_guid);
            $Tpl->setvar("getparams", "&" . $querystring);
            $Tpl->Parse("licensefile_list", true);
        }
    }
    // -------------------------
    //End Custom Code
    //Close licensing_customerscontent_BeforeShow @1-0B488567
    return $licensing_customerscontent_BeforeShow;
}
Esempio n. 6
0
function CCSecurityAccessCheck($GroupsAccess)
{
    $ErrorType = "success";
    if (!strlen(CCGetUserID())) {
        $ErrorType = "notLogged";
    } else {
        $GroupID = CCGetGroupID();
        if (!strlen($GroupID)) {
            $ErrorType = "groupIDNotSet";
        } else {
            if (!CCUserInGroups($GroupID, $GroupsAccess)) {
                $ErrorType = "illegalGroup";
            }
        }
    }
    return $ErrorType;
}
function licensing_competitor_renewals_BeforeShow(&$sender)
{
    $licensing_competitor_renewals_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $licensing_competitor_renewals;
    //Compatibility
    //End licensing_competitor_renewals_BeforeShow
    //Custom Code @2-2A29BDB7
    // -------------------------
    // Write your own code here.
    //********************************
    //Displaying the competitor renewal licenses
    //Code was copied from archived tab as a template, thats why variables has archived on it
    //********************************
    $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;
        $products = new \Alm\Products();
        //Will make the method return only the archived ones
        $params["isCompetitor"] = 1;
        $licenses = $products->getCustomerUniqueLicenses($params);
        $allLicenses = $licenses["licenses"];
        foreach ($allLicenses as $license) {
            $Tpl->setvar("lbguid_archived", $guid);
            $Tpl->setvar("lblicense_guid_archived", $license["guid"]);
            $Tpl->setvar("lbsuite_code_archived", $license["suite_code"]);
            $Tpl->setvar("lbsuite_description_archived", $license["suite_description"]);
            $Tpl->setvar("lbdescription_archived", $license["description"]);
            $Tpl->setvar("lbproduct_typeicon_archived", $license["type_icon_name"]);
            $Tpl->setvar("lblicense_name_archived", $license["license_name"]);
            $Tpl->setvar("lblicensedby_name_archived", $license["licensedby_name"]);
            $Tpl->setvar("lblicense_status_archived", $license["license_status_name"]);
            $Tpl->setvar("lblicense_status_css_archived", $license["alm_license_status_css_color"]);
            $Tpl->setvar("renewlicense_competitor_show_archived", "hide");
            $Tpl->setvar("renewlicense_competitordate_show_archived", "hide");
            if (strlen($license["renew_businesspartner"]) > 0) {
                $Tpl->setvar("renewlicense_competitor_archived", $license["renew_businesspartner"]);
                $Tpl->setvar("renewlicense_competitordate_archived", date("m/d/Y", strtotime($license["renew_businesspartner_date"])));
                $Tpl->setvar("renewlicense_competitor_show_archived", "show");
                $Tpl->setvar("renewlicense_competitordate_show_archived", "show");
            }
            if ($license["id_licensed_by"] == "1") {
                $Tpl->setvar("lbnodes_qty_archived", $license["nodes"]);
            } else {
                $Tpl->setvar("lbnodes_qty_archived", $license["licensed_amount"]);
            }
            //Total cost of license
            $price = $license["msrp_price"];
            $licenseBy = $license["id_licensed_by"];
            $nodes = $license["nodes"];
            $licenseAmount = $license["licensed_amount"];
            //Hides the granttype info if not value present
            if (strlen(trim($license["grant_number"])) <= 0) {
                $Tpl->setvar("lbgranttype_archived_class", "hide");
            } else {
                $Tpl->setvar("lbgranttype_archived_class", "");
                $Tpl->setvar("lbgranttype_archived", $license["granttype_name"]);
                $Tpl->setvar("lbgrantnumber_archived", $license["grant_number"]);
            }
            if (strlen(trim($license["serial_number"])) <= 0) {
                $Tpl->setvar("lbserial_archived_class", "hide");
            } else {
                $Tpl->setvar("lbserial_archived_class", "");
                $Tpl->setvar("lbserialnumber_archived", $license["serial_number"]);
            }
            $Tpl->setvar("lblicense_for_archived", $license["sector_name"]);
            if (strlen($license["expedition_date"]) <= 0) {
                $expDate = "";
            } else {
                $expDate = date("m/d/Y", strtotime($license["expedition_date"]));
            }
            $Tpl->setvar("lbexpedition_archived", $expDate);
            if (strlen($license["expiration_date"]) <= 0) {
                $expirDate = "";
            } else {
                $expirDate = date("m/d/Y", strtotime($license["expiration_date"]));
            }
            $Tpl->setvar("lbexpiration_archived", $expirDate);
            //Generate link to delete license only for admins
            $linkdelete_license = "";
            if (CCGetGroupID() == "4") {
                $licenseGuid = $license["guid"];
                global $CCSLocales;
                $deleteCaption = $CCSLocales->GetText("deletelicense");
                $linkdelete_license = "<a href='licensing_customers.php?guid={$guid}&o=delfulllicense&license_guid={$licenseGuid}&tab=licenselist' class='dellicense'>{$deleteCaption}</a>";
            }
            $Tpl->setvar("linkdelete_license_archived", $linkdelete_license);
            $parentPath = $Tpl->block_path;
            $Tpl->block_path = $Tpl->block_path . "/licensearchived_list";
            $Tpl->SetBlockVar("license_popup_archived", "");
            //Displaying popup table for licenses with the same grant number
            $grantNumber = $license["grant_number"];
            $licenseID = $license["id"];
            $params["grant_number"] = $grantNumber;
            $params["license_id"] = $licenseID;
            //Will make the method return only the archived ones
            $params["isArchived"] = 1;
            $licensesPopup = $products->getCustomerRelatedLicenses($params);
            $allLicensesPopup = $licensesPopup["licenses"];
            $totalShared = 0;
            foreach ($allLicensesPopup as $licensePopup) {
                $Tpl->setvar("lbguid_popup_archived", $guid);
                $Tpl->setvar("lblicense_guid_popup_archived", $licensePopup["guid"]);
                $Tpl->setvar("lbsuite_code_popup_archived", $licensePopup["suite_code"]);
                $Tpl->setvar("lbsuite_description_popup_archived", $licensePopup["suite_description"]);
                $Tpl->setvar("lbdescription_popup_archived", $licensePopup["description"]);
                $Tpl->setvar("lbproduct_typeicon_popup_archived", $licensePopup["type_icon_name"]);
                $Tpl->setvar("lblicense_name_popup_archived", $licensePopup["license_name"]);
                $Tpl->setvar("lblicensedby_name_popup_archived", $licensePopup["licensedby_name"]);
                $Tpl->setvar("lblicense_status_popup_archived", $licensePopup["license_status_name"]);
                $Tpl->setvar("lblicense_status_css_popup_archived", $licensePopup["alm_license_status_css_color"]);
                $Tpl->setvar("renewlicense_competitor_show_popup_archived", "hide");
                $Tpl->setvar("renewlicense_competitordate_show_popup_archived", "hide");
                if (strlen($licensePopup["renew_businesspartner"]) > 0) {
                    $Tpl->setvar("renewlicense_competitor_popup_archived", $licensePopup["renew_businesspartner"]);
                    $Tpl->setvar("renewlicense_competitordate_popup_archived", $licensePopup["renew_businesspartner_date"]);
                    $Tpl->setvar("renewlicense_competitor_show_popup_archived", "show");
                    $Tpl->setvar("renewlicense_competitordate_show_popup_archived", "show");
                }
                if ($licensePopup["id_licensed_by"] == "1") {
                    $Tpl->setvar("lbnodes_qty_popup_archived", $licensePopup["nodes"]);
                } else {
                    $Tpl->setvar("lbnodes_qty_popup_archived", $licensePopup["licensed_amount"]);
                }
                //Total cost of license
                $price = $licensePopup["msrp_price"];
                $licenseBy = $licensePopup["id_licensed_by"];
                $nodes = $licensePopup["nodes"];
                $licenseAmount = $licensePopup["licensed_amount"];
                //Hides the granttype info if not value present
                if (strlen(trim($licensePopup["grant_number"])) <= 0) {
                    $Tpl->setvar("lbgranttype_popup_archived_class", "hide");
                } else {
                    $Tpl->setvar("lbgranttype_popup_archived_class", "");
                    $Tpl->setvar("lbgranttype_popup_archived", $licensePopup["granttype_name"]);
                    $Tpl->setvar("lbgrantnumber_popup_archived", $licensePopup["grant_number"]);
                }
                if (strlen(trim($licensePopup["serial_number"])) <= 0) {
                    $Tpl->setvar("lbserial_popup_archived_class", "hide");
                } else {
                    $Tpl->setvar("lbserial_popup_archived_class", "");
                    $Tpl->setvar("lbserialnumber_popup_archived", $licensePopup["serial_number"]);
                }
                $Tpl->setvar("lblicense_for_popup_archived", $licensePopup["sector_name"]);
                if (strlen($licensePopup["expedition_date"]) <= 0) {
                    $expDate = "";
                } else {
                    $expDate = date("m/d/Y", strtotime($licensePopup["expedition_date"]));
                }
                $Tpl->setvar("lbexpedition_popup_archived", $expDate);
                if (strlen($licensePopup["expiration_date"]) <= 0) {
                    $expirDate = "";
                } else {
                    $expirDate = date("m/d/Y", strtotime($licensePopup["expiration_date"]));
                }
                $Tpl->setvar("lbexpiration_popup_archived", $expirDate);
                //Generate link to delete license only for admins
                $linkdelete_license = "";
                if (CCGetGroupID() == "4") {
                    $licenseGuid = $licensePopup["guid"];
                    $linkdelete_license = "<a href='licensing_customers.php?guid={$guid}&o=delfulllicense&license_guid={$licenseGuid}&tab=licenselist' class='dellicense'><li class='icon-trash bigger-150 red'></li></a>";
                }
                $Tpl->setvar("linkdelete_license_popup_archived", $linkdelete_license);
                $Tpl->parse("license_popup_archived", true);
                $totalShared++;
            }
            //foreach licenses group into a popup for those with same grant number
            $table_detail = $Tpl->GetVar("license_popup_archived");
            $Tpl->block_path = $parentPath;
            $Tpl->SetBlockVar("license_popup_archived", $table_detail);
            //Displaying total licenses sharing grant number
            $Tpl->setvar("lbtotalshared_archived", "+{$totalShared}");
            $Tpl->parse("licensearchived_list", true);
        }
    }
    // -------------------------
    //End Custom Code
    //Close licensing_competitor_renewals_BeforeShow @1-6FCB42C9
    return $licensing_competitor_renewals_BeforeShow;
}
Esempio n. 8
0
function Login_Button_DoLogin_OnClick(&$sender)
{
    $Login_Button_DoLogin_OnClick = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $Login;
    //Compatibility
    //End Login_Button_DoLogin_OnClick
    //Login @9-79F6EB3D
    global $CCSLocales;
    global $Redirect;
    if ($Container->autoLogin->Value != $Container->autoLogin->CheckedValue) {
        CCSetCookie("iRadiologyLogin", "");
    }
    if (!CCLoginUser($Container->login1->Value, $Container->password->Value)) {
        $Container->Errors->addError($CCSLocales->GetText("CCS_LoginError"));
        $Container->password->SetValue("");
        $Login_Button_DoLogin_OnClick = 0;
        CCSetCookie("iRadiologyLogin", "");
    } else {
        global $Redirect;
        if (getUst() == 1) {
            $Login->Errors->addError("You have not been activated!");
            return;
        } else {
            if (getUst() == 3) {
                $Login->Errors->addError("Sorry! You have been Deactivated!");
                return;
            } else {
                if (getUst() == 2) {
                    if ($Container->autoLogin->Value == $Container->autoLogin->CheckedValue) {
                        $ALLogin = $Container->login1->Value;
                        $ALPassword = $Container->password->Value;
                        CCSetALCookie($ALLogin, $ALPassword);
                    }
                    switch (CCGetGroupID()) {
                        case 1:
                            $Redirect = "../reception";
                            break;
                        case 2:
                            $Redirect = "../doctors";
                            break;
                        case 3:
                            $Redirect = "../typist";
                            break;
                        case 4:
                            $Redirect = "../admin";
                            break;
                        default:
                            $Redirect = "access_denied.php";
                    }
                    $Redirect = CCGetParam("ret_link", $Redirect);
                    $Login_Button_DoLogin_OnClick = 1;
                }
            }
        }
    }
    //End Login
    //Close Login_Button_DoLogin_OnClick @6-0EB5DCFE
    return $Login_Button_DoLogin_OnClick;
}
function licensing_activelicense_tab_BeforeShow(&$sender)
{
    $licensing_activelicense_tab_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $licensing_activelicense_tab;
    //Compatibility
    //End licensing_activelicense_tab_BeforeShow
    //Custom Code @2-2A29BDB7
    // -------------------------
    // Write your own code here.
    //*******************************//
    //Licensing active //
    //*******************************//
    $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;
        //Filling up licenses grid
        $products = new \Alm\Products();
        $licenses = $products->getCustomerUniqueLicenses($params);
        $allLicenses = $licenses["licenses"];
        foreach ($allLicenses as $license) {
            $Tpl->setvar("lbguid", $guid);
            $Tpl->setvar("lblicense_guid", $license["guid"]);
            $Tpl->setvar("lbsuite_code", $license["suite_code"]);
            $Tpl->setvar("lbsuite_description", $license["suite_description"]);
            $Tpl->setvar("lbdescription", $license["description"]);
            $Tpl->setvar("lbproduct_typeicon", $license["type_icon_name"]);
            $Tpl->setvar("lblicense_name", $license["license_name"]);
            $Tpl->setvar("lblicensedby_name", $license["licensedby_name"]);
            $Tpl->setvar("lblicense_status", $license["license_status_name"]);
            $Tpl->setvar("lblicense_status_css", $license["alm_license_status_css_color"]);
            if ($license["id_licensed_by"] == "1") {
                $Tpl->setvar("lbnodes_qty", $license["nodes"]);
            } else {
                $Tpl->setvar("lbnodes_qty", $license["licensed_amount"]);
            }
            //Total cost of license
            $price = $license["msrp_price"];
            $licenseBy = $license["id_licensed_by"];
            $nodes = $license["nodes"];
            $licenseAmount = $license["licensed_amount"];
            //Hides the granttype info if not value present
            if (strlen(trim($license["grant_number"])) <= 0) {
                $Tpl->setvar("lbgranttype_class", "hide");
            } else {
                $Tpl->setvar("lbgranttype_class", "");
                $Tpl->setvar("lbgranttype", $license["granttype_name"]);
                $Tpl->setvar("lbgrantnumber", $license["grant_number"]);
            }
            if (strlen(trim($license["serial_number"])) <= 0) {
                $Tpl->setvar("lbserial_class", "hide");
            } else {
                $Tpl->setvar("lbserial_class", "");
                $Tpl->setvar("lbserialnumber", $license["serial_number"]);
            }
            $Tpl->setvar("lblicense_for", $license["sector_name"]);
            if (strlen($license["expedition_date"]) <= 0) {
                $expDate = "";
            } else {
                $expDate = date("m/d/Y", strtotime($license["expedition_date"]));
            }
            $Tpl->setvar("lbexpedition", $expDate);
            if (strlen($license["expiration_date"]) <= 0) {
                $expirDate = "";
            } else {
                $expirDate = date("m/d/Y", strtotime($license["expiration_date"]));
            }
            $Tpl->setvar("lbexpiration", $expirDate);
            //Generate renew link only when license has status of expired (3).
            $linkrenew_license = "";
            if ($license["id_license_status"] == "3" && $license["isarchived"] == "0") {
                $licenseGuid = $license["guid"];
                global $CCSLocales;
                $renewCaption = $CCSLocales->GetText("renewlicense");
                $linkrenew_license = "<li class='divider'></li><li><a href='licensing_customers.php?o=renew&guid={$guid}&dguid={$licenseGuid}&tab=licensing'>{$renewCaption}</a></li>";
            }
            $Tpl->setvar("linkrenew_license", $linkrenew_license);
            $linkrenew_license_competitor = "";
            $linkarchive_only = "";
            $linkupgrade_license = "";
            $linkproduct_displacement = "";
            if ($license["id_license_status"] == "3" && $license["isarchived"] == "0") {
                $licenseGuid = $license["guid"];
                global $CCSLocales;
                $renewCaption_competitor = $CCSLocales->GetText("renewlicense_competitor");
                $linkrenew_license_competitor = "<li><a href='licensing_customers.php?o=renew_competitor&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$renewCaption_competitor}</a></li>";
                //Add archive only link used when the license is upgraded which just add a new license.
                $archiveOnlyCaption = $CCSLocales->GetText("archive_only");
                $linkarchive_only = "<li class='divider'></li><li><a href='licensing_customers.php?o=archive_only&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$archiveOnlyCaption}</a></li>";
                //Upgrade to new license which is a new license but will archive the expired one.
                $upgradeLicenseCaption = $CCSLocales->GetText("upgrade_license");
                $linkupgrade_license = "<li class='divider'></li><li><a href='licensing_customers.php?o=upgrade_license&guid={$guid}&dguid={$licenseGuid}&tab=licensing'>{$upgradeLicenseCaption}</a></li>";
                //Product Displacement
                $productDisplacementCaption = $CCSLocales->GetText("product_displacement");
                $linkproduct_displacement = "<li><a href='licensing_customers.php?o=product_displacement&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$productDisplacementCaption}</a></li>";
            }
            $Tpl->setvar("linkarchive_only", $linkarchive_only);
            $Tpl->setvar("linkupgrade_license", $linkupgrade_license);
            $Tpl->setvar("linkproduct_displacement", $linkproduct_displacement);
            $Tpl->setvar("linkrenew_license_competitor", $linkrenew_license_competitor);
            //Generate link to delete license only for admins
            $linkdelete_license = "";
            if (CCGetGroupID() == "4") {
                $licenseGuid = $license["guid"];
                global $CCSLocales;
                $deleteCaption = $CCSLocales->GetText("deletelicense");
                $linkdelete_license = "<a href='licensing_customers.php?guid={$guid}&o=delfulllicense&license_guid={$licenseGuid}&tab=licenselist' class='dellicense'>{$deleteCaption}</a>";
            }
            $Tpl->setvar("linkdelete_license", $linkdelete_license);
            //Generating block renewal when 2 or more groupped licenses are expired.
            $params["grant_number"] = $license["grant_number"];
            $countLicenses = $products->isBlockRenewal($params);
            $countLicenses = (int) $countLicenses["count"];
            if ($countLicenses >= 2) {
                global $CCSLocales;
                $bulkrenewalCaption = $CCSLocales->GetText("bulkrenewal");
                $grantNumber = $license["grant_number"];
                $linkrenew_bulk = "<li><a href='licensing_bulkrenewal.php?guid={$guid}&o=bulkrenewal&grant_number={$grantNumber}&tab=licenselist' class=''>{$bulkrenewalCaption}</a></li>";
                $Tpl->setvar("linkrenew_bulk", $linkrenew_bulk);
            }
            $parentPath = $Tpl->block_path;
            $Tpl->block_path = $Tpl->block_path . "/license_list";
            $Tpl->SetBlockVar("license_popup", "");
            //Displaying popup table for licenses with the same grant number
            $grantNumber = $license["grant_number"];
            $licenseID = $license["id"];
            $params["grant_number"] = $grantNumber;
            $params["license_id"] = $licenseID;
            $licensesPopup = $products->getCustomerRelatedLicenses($params);
            $allLicensesPopup = $licensesPopup["licenses"];
            $totalShared = 0;
            foreach ($allLicensesPopup as $licensePopup) {
                $Tpl->setvar("lbguid_popup", $guid);
                $Tpl->setvar("lblicense_guid_popup", $licensePopup["guid"]);
                $Tpl->setvar("lbsuite_code_popup", $licensePopup["suite_code"]);
                $Tpl->setvar("lbsuite_description_popup", $licensePopup["suite_description"]);
                $Tpl->setvar("lbdescription_popup", $licensePopup["description"]);
                $Tpl->setvar("lbproduct_typeicon_popup", $licensePopup["type_icon_name"]);
                $Tpl->setvar("lblicense_name_popup", $licensePopup["license_name"]);
                $Tpl->setvar("lblicensedby_name_popup", $licensePopup["licensedby_name"]);
                $Tpl->setvar("lblicense_status_popup", $licensePopup["license_status_name"]);
                $Tpl->setvar("lblicense_status_css_popup", $licensePopup["alm_license_status_css_color"]);
                if ($licensePopup["id_licensed_by"] == "1") {
                    $Tpl->setvar("lbnodes_qty_popup", $licensePopup["nodes"]);
                } else {
                    $Tpl->setvar("lbnodes_qty_popup", $licensePopup["licensed_amount"]);
                }
                //Total cost of license
                $price = $licensePopup["msrp_price"];
                $licenseBy = $licensePopup["id_licensed_by"];
                $nodes = $licensePopup["nodes"];
                $licenseAmount = $licensePopup["licensed_amount"];
                //Hides the granttype info if not value present
                if (strlen(trim($licensePopup["grant_number"])) <= 0) {
                    $Tpl->setvar("lbgranttype_popup_class", "hide");
                } else {
                    $Tpl->setvar("lbgranttype_popup_class", "");
                    $Tpl->setvar("lbgranttype_popup", $licensePopup["granttype_name"]);
                    $Tpl->setvar("lbgrantnumber_popup", $licensePopup["grant_number"]);
                }
                if (strlen(trim($licensePopup["serial_number"])) <= 0) {
                    $Tpl->setvar("lbserial_popup_class", "hide");
                } else {
                    $Tpl->setvar("lbserial_popup_class", "");
                    $Tpl->setvar("lbserialnumber_popup", $licensePopup["serial_number"]);
                }
                $Tpl->setvar("lblicense_for_popup", $licensePopup["sector_name"]);
                if (strlen($licensePopup["expedition_date"]) <= 0) {
                    $expDate = "";
                } else {
                    $expDate = date("m/d/Y", strtotime($licensePopup["expedition_date"]));
                }
                $Tpl->setvar("lbexpedition_popup", $expDate);
                if (strlen($licensePopup["expiration_date"]) <= 0) {
                    $expirDate = "";
                } else {
                    $expirDate = date("m/d/Y", strtotime($licensePopup["expiration_date"]));
                }
                $Tpl->setvar("lbexpiration_popup", $expirDate);
                //Generate renew link only when license has status of expired (3).
                $linkrenew_license = "";
                if ($licensePopup["id_license_status"] == "3" && $licensePopup["isarchived"] == "0") {
                    $licenseGuid = $licensePopup["guid"];
                    global $CCSLocales;
                    $renewCaption = $CCSLocales->GetText("renewlicense");
                    $linkrenew_license = "<li class='divider'></li><li><a href='licensing_customers.php?o=renew&guid={$guid}&dguid={$licenseGuid}&tab=licensing'>{$renewCaption}</a></li>";
                }
                $Tpl->setvar("linkrenew_license_popup", $linkrenew_license);
                $linkrenew_license = "";
                $linkarchive_only_popup = "";
                $linkupgrade_license_popup = "";
                $linkproduct_displacement_popup = "";
                if ($licensePopup["id_license_status"] == "3" && $licensePopup["isarchived"] == "0") {
                    $licenseGuid = $licensePopup["guid"];
                    global $CCSLocales;
                    $renewCaption = $CCSLocales->GetText("renewlicense_competitor");
                    $linkrenew_license = "<li><a href='licensing_customers.php?o=renew_competitor&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$renewCaption}</a></li>";
                    //Add archive only link used when the license is upgraded which just add a new license.
                    $archiveOnlyCaption = $CCSLocales->GetText("archive_only");
                    $linkarchive_only_popup = "<li class='divider'></li><li><a href='licensing_customers.php?o=archive_only&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$archiveOnlyCaption}</a></li>";
                    //Upgrade to new license which is a new license but will archive the expired one.
                    $upgradeLicenseCaption = $CCSLocales->GetText("upgrade_license");
                    $linkupgrade_license_popup = "<li class='divider'></li><li><a href='licensing_customers.php?o=upgrade_license&guid={$guid}&dguid={$licenseGuid}&tab=licensing'>{$upgradeLicenseCaption}</a></li>";
                    //Product Displacement
                    $productDisplacementCaption = $CCSLocales->GetText("product_displacement");
                    $linkproduct_displacement_popup = "<li><a href='licensing_customers.php?o=product_displacement&guid={$guid}&license_guid={$licenseGuid}&tab=licensing'>{$productDisplacementCaption}</a></li>";
                }
                $Tpl->setvar("linkarchive_only_popup", $linkarchive_only_popup);
                $Tpl->setvar("linkupgrade_license_popup", $linkupgrade_license_popup);
                $Tpl->setvar("linkproduct_displacement_popup", $linkproduct_displacement_popup);
                $Tpl->setvar("linkrenew_license_competitor_popup", $linkrenew_license);
                //Generate link to delete license only for admins
                $linkdelete_license = "";
                if (CCGetGroupID() == "4") {
                    $licenseGuid = $licensePopup["guid"];
                    global $CCSLocales;
                    $deleteCaption = $CCSLocales->GetText("deletelicense");
                    $linkdelete_license = "<a href='licensing_customers.php?guid={$guid}&o=delfulllicense&license_guid={$licenseGuid}&tab=licenselist' class='dellicense'>{$deleteCaption}</a>";
                }
                $Tpl->setvar("linkdelete_license_popup", $linkdelete_license);
                $Tpl->parse("license_popup", true);
                $totalShared++;
            }
            //foreach licenses group into a popup for those with same grant number
            $table_detail = $Tpl->GetVar("license_popup");
            $Tpl->block_path = $parentPath;
            $Tpl->SetBlockVar("license_popup", $table_detail);
            //Displaying total licenses sharing grant number
            $Tpl->setvar("lbtotalshared", "+{$totalShared}");
            $Tpl->parse("license_list", true);
        }
    }
    // Licensing active
    // -------------------------
    //End Custom Code
    //Close licensing_activelicense_tab_BeforeShow @1-E648715B
    return $licensing_activelicense_tab_BeforeShow;
}
function companies_list_alm_customers_ds_BeforeExecuteSelect(&$sender)
{
    $companies_list_alm_customers_ds_BeforeExecuteSelect = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $companies_list;
    //Compatibility
    //End companies_list_alm_customers_ds_BeforeExecuteSelect
    //Custom Code @26-2A29BDB7
    // -------------------------
    // Write your own code here.
    //Special search for contacts since its stored on a separate table
    $where = trim($companies_list->alm_customers->ds->Where);
    $search = trim(CCGetFromGet("s_search", ""));
    if (strlen($search) > 0) {
        $sql = "select customer_id from alm_customers_contacts where contact like '%{$search}%' ";
        $db = new clsDBdbConnection();
        $db->query($sql);
        $id = "0";
        while ($db->next_record()) {
            $id .= $db->f("customer_id") . ",";
        }
        $id = trim($id, ",");
        $db->close();
        if (strlen($where) > 0) {
            //The parenthesis is needed to properly filter the search and users own customers
            $where = "( {$where} ";
            $where .= " or id in ({$id}) ) ";
        } else {
            $where .= " id in ({$id}) ";
        }
        $companies_list->alm_customers->ds->Where = $where;
    }
    //Filtering grid content for users group
    if (CCGetGroupID() == 1) {
        $userid = CCGetUserID();
        if (strlen($where) > 0) {
            $where .= " and assigned_to = {$userid} ";
        } else {
            $where .= " assigned_to = {$userid} ";
        }
        $companies_list->alm_customers->ds->Where = $where;
    }
    // -------------------------
    //End Custom Code
    //Close companies_list_alm_customers_ds_BeforeExecuteSelect @5-F8608223
    return $companies_list_alm_customers_ds_BeforeExecuteSelect;
}
function groupHasAccess()
{
    $groupid = (int) CCGetGroupID();
    switch ($groupid) {
        case 2:
        case 3:
        case 4:
            return true;
            break;
        case 0:
        case 1:
        default:
            return false;
            break;
    }
}
Esempio n. 12
0
 function clsRecordemails1()
 {
     global $FileName;
     $this->Visible = true;
     $this->Errors = new clsErrors();
     $this->ds = new clsemails1DataSource();
     $this->ReadAllowed = false;
     $this->InsertAllowed = false;
     $this->UpdateAllowed = false;
     $this->DeleteAllowed = false;
     $this->Visible = CCSecurityAccessCheck("1;2") == "success";
     if ($this->Visible) {
         $this->ReadAllowed = CCUserInGroups(CCGetGroupID(), "1;2");
         $this->InsertAllowed = CCUserInGroups(CCGetGroupID(), "1;2");
         $this->ComponentName = "emails1";
         $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $this->ComponentName);
         $CCSForm = CCGetFromGet("ccsForm", "");
         $this->FormSubmitted = $CCSForm == $this->ComponentName;
         $Method = $this->FormSubmitted ? ccsPost : ccsGet;
         $this->subject = new clsControl(ccsTextBox, "subject", "Amount", ccsText, "", CCGetRequestParam("subject", $Method));
         $this->subject->Required = true;
         $this->message = new clsControl(ccsTextArea, "message", "Message", ccsMemo, "", CCGetRequestParam("message", $Method));
         $this->Insert = new clsButton("Insert");
         $this->item_id = new clsControl(ccsHidden, "item_id", "Item Id", ccsInteger, "", CCGetRequestParam("item_id", $Method));
         $this->to_user_id = new clsControl(ccsHidden, "to_user_id", "To User Id", ccsInteger, "", CCGetRequestParam("to_user_id", $Method));
         $this->from_user_id = new clsControl(ccsHidden, "from_user_id", "From User Id", ccsInteger, "", CCGetRequestParam("from_user_id", $Method));
         $this->emaildate = new clsControl(ccsHidden, "emaildate", "date", ccsInteger, "", CCGetRequestParam("emaildate", $Method));
         if (!$this->FormSubmitted) {
             if (!strlen($this->subject->GetValue())) {
                 $this->subject->SetValue(0.0);
             }
         }
     }
 }