#------------------------------------------------------------------------------- $License = BillManager_Find_Free_License($ISPswScheme); if (Is_Error($License)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if ($License) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/ISPswCreate]: found free license, elid = %s', $License['elid'])); #------------------------------------------------------------------------------- $ISPswScheme['elid'] = $License['elid']; #------------------------------------------------------------------------------- $ISPswScheme['LicenseID'] = $License['LicenseID']; #------------------------------------------------------------------------------- # меняем IP лицензии $Change_IP = BillManager_Change_IP($Server, $ISPswScheme); #------------------------------------------------------------------------------- if (Is_Error($Change_IP)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IUpdate = array('StatusDate' => Time(), 'ip_change_date' => Time(), 'IsUsed' => 'yes', 'ip' => $ISPswScheme['IP']); #------------------------------------------------------------------------------- $IUpdate['IsInternal'] = $ISPswScheme['IsInternal'] ? TRUE : FALSE; #------------------------------------------------------------------------------- $IsUpdate = DB_Update('ISPswLicenses', $IUpdate, array('ID' => $License['LicenseID'])); #------------------------------------------------------------------------------- if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------------
} #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- # если лицензия внешняя, проверяем новый IP, и меняем адресок if (!BillManager_Check_ISPsystem_IP($Settings, $ISPswScheme)) { if (!$remoteip) { return new gException('ISPsw_IP_ADDRESS_IN_USE', SPrintF('Для указанного IP адреса [%s] уже есть лицензия такого типа. За более подробной информацией, обратитесь в службу поддержки пользователей', $IP)); } } #------------------------------------------------------------------------------- $ISPswScheme['elid'] = $ISPswLicense['elid']; #------------------------------------------------------------------------------- $IsCreate = BillManager_Change_IP($Settings, $ISPswScheme); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- switch (ValueOf($IsCreate)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CANNOT_ORDER_LICENSE', 'При смене IP произошла непредвиденная ошибка. При повторении данного сообщения, обратитесь в службу поддержки пользователей, указав последовательность ваших действий.'); case 'true': break; case 'array': break; default: return ERROR | @Trigger_Error(101); }