| @@ -0,0 +1,38 @@ | |||||
| <?php | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_addActiveStateToProfile() | |||||
| { | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = 'SELECT * FROM profile'; | |||||
| $stmt = $db->query( $sql ); | |||||
| $res = $stmt->fetchAll(); | |||||
| $db->beginTransaction(); | |||||
| foreach( $res as $row ) | |||||
| { | |||||
| if ( is_array( $row ) && isset( $row[ 'id' ] ) ) | |||||
| { | |||||
| $entProfile = TB_Shared_Ent_TeamData_Profile::get( $row[ 'id' ] ); | |||||
| $resTeam = []; | |||||
| foreach ($entProfile->teams_js as $team) { | |||||
| $tmpTeam = $team; | |||||
| $tmpTeam['status'] = 'active'; | |||||
| $resTeam[] = $tmpTeam; | |||||
| } | |||||
| $entProfile->teams_js = $resTeam; | |||||
| $entProfile->save(); | |||||
| unset($team); | |||||
| unset( $entProfile ); | |||||
| } | |||||
| } | |||||
| $db->commit(); | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_addActiveStateToProfile(); | |||||
| @@ -0,0 +1,19 @@ | |||||
| <?php | |||||
| require_once __DIR__ . '/../server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../server/config/boot_local.php'; | |||||
| function patch() | |||||
| { | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = "ALTER TABLE team | |||||
| ADD COLUMN terms_conditions VARCHAR(1024) NULL AFTER contact_information, | |||||
| ADD COLUMN terms_conditions_active TINYINT(1) NOT NULL DEFAULT 0 AFTER terms_conditions;"; | |||||
| $stmt = $db->query( $sql ); | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch(); | |||||
| @@ -0,0 +1,38 @@ | |||||
| <?php | |||||
| require_once __DIR__ . '/../server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../server/config/boot_local.php'; | |||||
| function patch_addTermsAcceptedToProfile() | |||||
| { | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = 'SELECT * FROM profile'; | |||||
| $stmt = $db->query( $sql ); | |||||
| $res = $stmt->fetchAll(); | |||||
| $db->beginTransaction(); | |||||
| foreach( $res as $row ) | |||||
| { | |||||
| if ( is_array( $row ) && isset( $row[ 'id' ] ) ) | |||||
| { | |||||
| $entProfile = TB_Shared_Ent_TeamData_Profile::get( $row[ 'id' ] ); | |||||
| $resTeam = []; | |||||
| foreach ($entProfile->teams_js as $team) { | |||||
| $tmpTeam = $team; | |||||
| $tmpTeam['terms_accepted'] = 0; | |||||
| $resTeam[] = $tmpTeam; | |||||
| } | |||||
| $entProfile->teams_js = $resTeam; | |||||
| $entProfile->save(); | |||||
| unset($team); | |||||
| unset( $entProfile ); | |||||
| } | |||||
| } | |||||
| $db->commit(); | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_addTermsAcceptedToProfile(); | |||||
| @@ -0,0 +1,20 @@ | |||||
| <?php | |||||
| require_once __DIR__ . '/../server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../server/config/boot_local.php'; | |||||
| function patch() | |||||
| { | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = "ALTER TABLE team | |||||
| ADD COLUMN new_users_inactive TINYINT(1) NOT NULL DEFAULT 0 AFTER terms_conditions_active;"; | |||||
| $stmt = $db->query( $sql ); | |||||
| $sql = "UPDATE team SET new_users_inactive = 0 WHERE 1"; | |||||
| $stmt = $db->query( $sql ); | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch(); | |||||
| @@ -0,0 +1,44 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_addCategoryIdsJsToAppointments() | |||||
| { | |||||
| return NULL; | |||||
| /* | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = 'SELECT * FROM appointment'; | |||||
| $stmt = $db->query( $sql ); | |||||
| $res = $stmt->fetchAll(); | |||||
| foreach( $res as $row ) | |||||
| { | |||||
| if ( is_array( $row ) && isset( $row[ 'id' ] ) ) | |||||
| { | |||||
| $db->beginTransaction(); | |||||
| $entApp = TB_Shared_Ent_TeamData_Appointment::get( $row[ 'id' ] ); | |||||
| if ( $entApp instanceof TB_Shared_Ent_TeamData_Appointment ) | |||||
| { | |||||
| if ( !is_null( $entApp->category_id ) ) | |||||
| { | |||||
| $entApp->category_ids_js = array( $entApp->category_id ); | |||||
| $entApp->save(); | |||||
| } | |||||
| } | |||||
| $db->commit(); | |||||
| } | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_addCategoryIdsJsToAppointments(); | |||||
| @@ -0,0 +1,39 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_addDateTimeRejectToExistingAppointments() | |||||
| { | |||||
| /* | |||||
| // Set DB configuration for live teamdata access | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = 'SELECT * FROM appointment'; | |||||
| $stmt = $db->query( $sql ); | |||||
| $res = $stmt->fetchAll(); | |||||
| foreach( $res as $row ) | |||||
| { | |||||
| if ( is_array( $row ) && isset( $row[ 'id' ] ) ) | |||||
| { | |||||
| $db->beginTransaction(); | |||||
| $entAppointment = TB_Shared_Ent_TeamData_Appointment::get( $row[ 'id' ] ); | |||||
| $entAppointment->deadline_reject_dt = $entAppointment->start_dt; | |||||
| $entAppointment->save(); | |||||
| $db->commit(); | |||||
| unset( $entAppointment ); | |||||
| } | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_addDateTimeRejectToExistingAppointments(); | |||||
| @@ -0,0 +1,41 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_addGeneralCourseCategoryToTeam() | |||||
| { | |||||
| return NULL; | |||||
| /* | |||||
| // Set DB configuration for live teamdata access | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $sql = 'SELECT * FROM ' . TB_Shared_Ent_TeamData_Team::getTable(); | |||||
| $teams = TB_Shared_Ent_TeamData_Team::findMany( $sql ); | |||||
| /** @var TB_Shared_Ent_TeamData_Team $team */ | |||||
| foreach ( $teams as $team ) | |||||
| { | |||||
| $generalCategoryId = $team->id . '-0'; | |||||
| $generalCategory = $team->getCourseCategoryDataById( $generalCategoryId ); | |||||
| if ( is_null( $generalCategory ) ) | |||||
| { | |||||
| $team->addCourseCategory( [ 'id' => $generalCategoryId, 'name' => 'Allgemein' ] ); | |||||
| $team->save(); | |||||
| } | |||||
| unset( $team ); | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_addGeneralCourseCategoryToTeam(); | |||||
| @@ -0,0 +1,51 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_AddPublicIdToProfiles() | |||||
| { | |||||
| return 'DO NOTHING'; | |||||
| // Set DB configuration for live teamdata access | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| /* | |||||
| * | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $db = TB_Shared_Db_TeamData::get(); | |||||
| $sql = 'SELECT * FROM profile'; | |||||
| $stmt = $db->query( $sql ); | |||||
| $res = $stmt->fetchAll(); | |||||
| foreach( $res as $row ) | |||||
| { | |||||
| if ( is_array( $row ) && isset( $row[ 'id' ] ) ) | |||||
| { | |||||
| $db->beginTransaction(); | |||||
| $entProfile = TB_Shared_Ent_TeamData_Profile::get( $row[ 'id' ] ); | |||||
| if ( $entProfile instanceof TB_Shared_Ent_TeamData_Profile ) | |||||
| { | |||||
| $entProfile->public_id = TB_Server_Utils_Helper::getToken(64); | |||||
| $entProfile->save(); | |||||
| } | |||||
| $db->commit(); | |||||
| } | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_AddPublicIdToProfiles(); | |||||
| @@ -0,0 +1,50 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_AddTeamCategoriesToAdminProfiles() | |||||
| { | |||||
| return NULL; | |||||
| /* | |||||
| * | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'XXXXXXXXXXXX' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $adminProfiles = TB_Shared_Ent_TeamData_Profile::getProfilesByRole( TB_Shared_Ent_TeamData_Profile::ROLE_COTRAINER ); | |||||
| /** @var TB_Shared_Ent_TeamData_Profile $ap */ | |||||
| foreach ( $adminProfiles as $ap ) | |||||
| { | |||||
| $tIds = $ap->getTeamIds(); | |||||
| foreach( $tIds as $tId ) | |||||
| { | |||||
| if ( $ap->isAdminOfTeam( $tId ) ) | |||||
| { | |||||
| /** @var TB_Shared_Ent_TeamData_Team $team */ | |||||
| $team = TB_Shared_Ent_TeamData_Team::get( $tId ); | |||||
| if ( is_array( $team->course_categories_js ) ) | |||||
| { | |||||
| $teamCategoryIds = $ap->getTeamIds(); | |||||
| foreach( $team->course_categories_js as $courseCategory ) | |||||
| { | |||||
| $ap->addToCategoryId( $courseCategory[ 'id' ] ); | |||||
| } | |||||
| $ap->save(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_AddTeamCategoriesToAdminProfiles(); | |||||
| @@ -0,0 +1,51 @@ | |||||
| <?php | |||||
| /******************************************************************************** | |||||
| * (c)1337 aheadware.com - All rights reserved | |||||
| ********************************************************************************/ | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_global.php'; | |||||
| require_once __DIR__ . '/../../src/server/server/config/boot_local.php'; | |||||
| function patch_replaceCategoryByCategoryIdInAppointment() | |||||
| { | |||||
| /* | |||||
| // Set DB configuration for live teamdata access | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.host', 'v034011.kasserver.com' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.name', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.user', 'd02e620f' ); | |||||
| Francis_Utils_Config::set( 'db.tbteamdata.pass', 'NT7uSbtaebV9Gedq' ); | |||||
| */ | |||||
| $sql = 'SELECT * FROM appointment'; | |||||
| $appointments = TB_Shared_Ent_TeamData_Appointment::findMany( $sql ); | |||||
| /** @var TB_Shared_Ent_TeamData_Appointment $a */ | |||||
| foreach( $appointments as $a ) | |||||
| { | |||||
| $team = TB_Shared_Ent_TeamData_Team::get( $a->team_id ); | |||||
| if ( $team ) | |||||
| { | |||||
| $categoryId = $team->id . '-0'; | |||||
| foreach( $team->course_categories_js as $category ) | |||||
| { | |||||
| if ( $category[ 'name' ] === $a->category ) | |||||
| { | |||||
| $categoryId = $category[ 'id' ]; | |||||
| break; | |||||
| } | |||||
| } | |||||
| if ( $categoryId ) | |||||
| { | |||||
| //$a->category = NULL; | |||||
| $a->category_id = $categoryId; | |||||
| $a->save(); | |||||
| } | |||||
| unset( $team ); | |||||
| } | |||||
| } | |||||
| echo "DONE..."; | |||||
| } | |||||
| patch_replaceCategoryByCategoryIdInAppointment(); | |||||