function licensing_customerscontent_licensing_BeforeUpdate(&$sender) { $licensing_customerscontent_licensing_BeforeUpdate = true; $Component =& $sender; $Container =& CCGetParentContainer($sender); global $licensing_customerscontent; //Compatibility //End licensing_customerscontent_licensing_BeforeUpdate //Custom Code @190-2A29BDB7 // ------------------------- // Write your own code here. $licensing_customerscontent->licensing->modified_iduser->SetValue(CCGetUserID()); //Changing license status to active when inactive and grant,expdate,expirdate are present $grantNo = trim($licensing_customerscontent->licensing->grant_number->GetValue()); $expDate = $licensing_customerscontent->licensing->expedition_date->GetValue(); $expirDate = $licensing_customerscontent->licensing->expiration_date->GetValue(); $licenseStatus = (int) $licensing_customerscontent->licensing->hidlicensestatus->GetValue(); $licenseType = (int) $licensing_customerscontent->licensing->id_license_type->GetValue(); if ($licenseStatus == 1 && strlen($grantNo) > 0 && count($expDate) > 1 && count($expirDate) > 1) { if ($licenseType == 7 || $licenseType == 12) { $licensing_customerscontent->licensing->expiration_date->SetValue(""); } $licensing_customerscontent->licensing->hidlicensestatus->SetValue("2"); //If the renewal was not activated when created, then will use the expired_license_guid to identify //a renewal not activeated yet and the expired license was not archived as well. $expiredLicenseGuid = trim($licensing_customerscontent->licensing->hidexpired_license_guid->GetValue()); if (strlen($expiredLicenseGuid) > 0) { $params = array(); $params["guid"] = $expiredLicenseGuid; //A renewal not activeated yet and the expired license was not archived as well, //sets expired license as archived $products = new Alm\Products(); $products->setLicenseArchivedByGuid($params); } } else { //if ( ($licenseStatus == 1) && (strlen($grantNo) > 0) && (count($expDate) > 1) && if ($licenseStatus == 1 && ($licenseType == 7 || $licenseType == 12)) { $licensing_customerscontent->licensing->expiration_date->SetValue(""); $licensing_customerscontent->licensing->hidlicensestatus->SetValue("2"); } } //Setting expired license to archived when archive_only operation takes place $o = $licensing_customerscontent->licensing->hido->GetValue(); if ($licenseStatus == 3 && $o == "archive_only") { $params = array(); $params["guid"] = $licensing_customerscontent->licensing->hidguid->GetValue(); $products = new Alm\Products(); $products->setLicenseArchivedByGuid($params); } // ------------------------- //End Custom Code //Close licensing_customerscontent_licensing_BeforeUpdate @154-43A03213 return $licensing_customerscontent_licensing_BeforeUpdate; }