function licensing_bulkrenewalcontent_BeforeShow(&$sender) { $licensing_bulkrenewalcontent_BeforeShow = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $licensing_bulkrenewalcontent; //Compatibility //End licensing_bulkrenewalcontent_BeforeShow //Custom Code @2-2A29BDB7 // ------------------------- // Write your own code here. //*******************************// //Licensing active // //*******************************// $guid = CCGetFromGet("guid", ""); $grantNumber = CCGetFromGet("grant_number", ""); $tab = CCGetFromGet("tab", ""); $o = CCGetFromGet("o", ""); $params = array(); $params["grant_number"] = $grantNumber; //Settingup saved message popup global $MainPage; global $Tpl; global $FileName; $showalert = CCGetSession("showalert", "hide"); $MainPage->Attributes->SetValue("showalert", $showalert); if ($showalert == "show") { CCSetSession("showalert", "hide"); } $showerror = CCGetSession("showerror", "hide"); $MainPage->Attributes->SetValue("showerror", $showerror); if ($showerror == "show") { CCSetSession("showerror", "hide"); } $o_post = CCGetFromPost("hido", ""); $grant_post = CCGetFromPost("hidgrant_number", ""); $newgrant_post = CCGetFromPost("grantnumber", ""); $tab_post = CCGetFromPost("hidtab", "licenselist"); $guid_post = CCGetFromPost("hidguid", ""); $exped_post = CCGetFromPost("expedition_date", ""); $expir_post = CCGetFromPost("expiration_date", ""); if ($o_post == "bulkrenewal") { if (strlen($grant_post) > 0 && strlen($newgrant_post) > 0 && strlen($exped_post) > 0 && strlen($expir_post) > 0) { //Reformating the dates $exped_array = CCParseDate($exped_post, array("mm", "/", "dd", "/", "yyyy")); $format = array("yyyy", "-", "mm", "-", "dd"); $exped_post = CCFormatDate($exped_array, $format); //Reformating the dates $expir_array = CCParseDate($expir_post, array("mm", "/", "dd", "/", "yyyy")); $format = array("yyyy", "-", "mm", "-", "dd"); $expir_post = CCFormatDate($expir_array, $format); $params["newgrant_number"] = $newgrant_post; $params["grant_number"] = $grant_post; $params["expedition_date"] = $exped_post; $params["expiration_date"] = $expir_post; $params["user_id"] = CCGetUserID(); $products = new \Alm\Products(); $result = $products->bulkRenew($params); if ($result["status"]) { CCSetSession("showalert", "show"); header("Location: licensing_customers.php?guid={$guid_post}&tab={$tab_post}"); } else { CCSetSession("showerror", "show"); header("Location: {$FileName}?guid={$guid_post}&o={$o_post}&grant_number={$grant_post}&tab={$tab_post}"); } } else { CCSetSession("showerror", "show"); header("Location: {$FileName}?guid={$guid_post}&o={$o_post}&grant_number={$grant_post}&tab={$tab_post}"); } } //endif o_post if (strlen($grantNumber) > 0 && $o == "bulkrenewal") { global $Tpl; global $FileName; //Filling up licenses grid $products = new \Alm\Products(); $licenses = $products->getLicensesByGrantNumber($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); $Tpl->parse("license_list", true); } } // Licensing active // ------------------------- //End Custom Code //Close licensing_bulkrenewalcontent_BeforeShow @1-AC2FBD05 return $licensing_bulkrenewalcontent_BeforeShow; }