diff --git a/src/client/app/js/app/core/Dict.js b/src/client/app/js/app/core/Dict.js
index 4a2f4cd..bf75dee 100644
--- a/src/client/app/js/app/core/Dict.js
+++ b/src/client/app/js/app/core/Dict.js
@@ -433,7 +433,7 @@ app.core.Dict = {
"LOGIN_FIRSTNAME" : "Vorname",
"LOGIN_LASTNAME" : "Nachname",
"DELETION_NOT_POSSIBLE_INFO_HEADLINE" : "Informationen zur Löschung deines Profils",
- "DELETION_NOT_POSSIBLE_INFO" : "Du hast noch {0} Teilnahme(n) für zukünftige Termine. Bitte sage alle Teilnahmen ab, bevor Du Deinen Account löschen kannst.",
+ "DELETION_NOT_POSSIBLE_INFO" : "Du hast noch {0} Teilnahme(n) für zukünftige Termine, bei denen die Absagefrist noch nicht verstrichen ist. Bitte sage alle Teilnahmen ab, bevor Du Deinen Account löschen kannst.",
"DELETION_GROUP_OWNER_INFO_HEADLINE" : "Informationen zur Löschung deines Profils",
"DELETION_GROUP_OWNER_INFO" : "Bitte schreibe eine Mail an support@probuddy.de um die Löschung deines Profile bei Probuddy zu veranlassen. Da du Gruppeninhaber mindestens einer Gruppe bei ProBuddy bist, wird diese Gruppe/Gruppen automatisch mitgelöscht.",
"BTN_BACK" : "Zurück",
@@ -574,6 +574,7 @@ app.core.Dict = {
"GROUP_MANAGEMENT_MEMBERS_ACTIVE" : "Aktiv",
"GROUP_MANAGEMENT_MEMBERS_INACTIVE" : "Inaktiv",
"GROUP_MANAGEMENT_MEMBERS_NOT_APPROVED" : "Unbestätigt",
+ "GROUP_MANAGEMENT_MEMBERS_DELETED" : "Gelöscht",
"GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS" : "Gruppenstatus ändern",
"GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS_INFO" : "Du kannst deinen eigenen Gruppenstatus nicht verändern.",
"BTN_GROUP_MANAGEMENT_MEMBERS_SAVE_STATUS" : "Status speichern",
diff --git a/src/client/app/js/app/state/GroupMemberManagement.js b/src/client/app/js/app/state/GroupMemberManagement.js
index b0128a1..05c3e6f 100644
--- a/src/client/app/js/app/state/GroupMemberManagement.js
+++ b/src/client/app/js/app/state/GroupMemberManagement.js
@@ -19,6 +19,7 @@ app.state.GroupMemberManagement = function()
membersActive = [],
membersInactive = [],
membersNotApproved = [],
+ membersDeleted = [],
groupId = p.groupId,
memberId = p.hasOwnProperty( 'memberId' ) ? p.memberId : null,
activeTab = 'active';
@@ -66,6 +67,10 @@ app.state.GroupMemberManagement = function()
case 'not_approved':
membersNotApproved.push(member);
break;
+ case 'deleted':
+ membersDeleted.push(member);
+ console.log(member.isAccessible())
+ break;
}
}
@@ -77,6 +82,7 @@ app.state.GroupMemberManagement = function()
membersActive: membersActive,
membersInactive: membersInactive,
membersNotApproved: membersNotApproved,
+ membersDeleted: membersDeleted,
group : group,
groups : app.model.SessionUser.getAdminGroups(),
currentProfile : currentProfile,
diff --git a/src/client/app/js/app/state/GroupMemberManagementMember.js b/src/client/app/js/app/state/GroupMemberManagementMember.js
index abc130e..f027071 100644
--- a/src/client/app/js/app/state/GroupMemberManagementMember.js
+++ b/src/client/app/js/app/state/GroupMemberManagementMember.js
@@ -27,6 +27,11 @@ app.state.GroupMemberManagementMember = function()
fnRenderMemberForm = function( profile )
{
+ let statusDeleted = false;
+ if (profile) {
+ statusDeleted = profile.getGroupData(groupId).status === 'deleted';
+ }
+
$memberContainer = $content.find( '[data-id="member-container"]' ).first();
$memberContainer.html(
app.core.View.getTemplate(
@@ -34,6 +39,7 @@ app.state.GroupMemberManagementMember = function()
{
p : profile,
g : group,
+ statusDeleted: statusDeleted
}
)
);
diff --git a/src/client/app/tmpl/group-member-management-member-body.html b/src/client/app/tmpl/group-member-management-member-body.html
index 4b3f798..c84c55f 100644
--- a/src/client/app/tmpl/group-member-management-member-body.html
+++ b/src/client/app/tmpl/group-member-management-member-body.html
@@ -1,289 +1,288 @@
<% if ( p ) { %>
-<% var currentUser = app.model.SessionUser.getUserProfile(); %>
-
-
-
-
-
-
-
-
- <%=raw p.getName() %>
-
- <% if ( p.isInGroupCategory( 'DOGSCHOOL' ) ) { %>
-
-
- <%= p.getCustomGroupProperty( 'DOGSCHOOL', 'dogname' ) ? p.getCustomGroupProperty( 'DOGSCHOOL', 'dogname' ) : '---' %>
-
- <% } %>
-
-
- <%= p.getStatus() %>
+ <% var currentUser = app.model.SessionUser.getUserProfile(); %>
+
+
+
-
-
- <%= p.getStreet() ? p.getStreet() : '---' %>
-
- <%= p.getZipCode() ? p.getZipCode() : '' %> <%= p.getCity() ? p.getCity() : '' %>
-
-
-
- <% if ( p.getMobile() ) { %>
-
<%= p.getMobile() %>
- <% } else { %>
- ---
- <% } %>
-
- <% if ( p.getPhone() ) { %>
-
<%= p.getPhone() %>
- <% } else { %>
- ---
+
+
+
+
+ <%=raw p.getName() %>
+
+ <% if ( p.isInGroupCategory( 'DOGSCHOOL' ) ) { %>
+
+
+ <%= p.getCustomGroupProperty( 'DOGSCHOOL', 'dogname' ) ? p.getCustomGroupProperty( 'DOGSCHOOL', 'dogname' ) : '---' %>
+
<% } %>
-
-
-
- <% if ( p.getEmail() ) { %>
-
<%= p.getEmail() %>
- <% if ( p.getEmailValidated() === true ) { %>
-
( <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_EMAIL_VALIDATED' ) %> )
+
+
+ <%= p.getStatus() %>
+
+
+
+ <%= p.getStreet() ? p.getStreet() : '---' %>
+
+ <%= p.getZipCode() ? p.getZipCode() : '' %> <%= p.getCity() ? p.getCity() : '' %>
+
+
+
+ <% if ( p.getMobile() ) { %>
+
<%= p.getMobile() %>
+ <% } else { %>
+ ---
+ <% } %>
+
+ <% if ( p.getPhone() ) { %>
+
<%= p.getPhone() %>
+ <% } else { %>
+ ---
+ <% } %>
+
+
+
+ <% if ( p.getEmail() ) { %>
+
<%= p.getEmail() %>
+ <% if ( p.getEmailValidated() === true ) { %>
+
( <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_EMAIL_VALIDATED' ) %> )
+ <% } else { %>
+
( <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_EMAIL_NOT_VALIDATED' ) %> )
+ <% } %>
<% } else { %>
-
( <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_EMAIL_NOT_VALIDATED' ) %> )
+ ---
<% } %>
- <% } else { %>
- ---
- <% } %>
-
-
-
- <%= ( null != p.getMomentBirthday() ) ? p.getMomentBirthday().format( 'DD.MM.YYYY' ) : '---' %>
-
-
-
- <% var momentJoin = p.getMomentJoinInGroup( g.getId() ); %>
- <%= ( null != momentJoin ) ? momentJoin.format( 'DD.MM.YYYY' ) : '---' %>
+
+
+
+ <%= ( null != p.getMomentBirthday() ) ? p.getMomentBirthday().format( 'DD.MM.YYYY' ) : '---' %>
+
+
+
+ <% var momentJoin = p.getMomentJoinInGroup( g.getId() ); %>
+ <%= ( null != momentJoin ) ? momentJoin.format( 'DD.MM.YYYY' ) : '---' %>
+
-
-
-
-
- <%= _lc( 'CHANGE_ROLE' ) %>
-
-
-
-
-
- data-id="select-member-role">
- >
- <%= _lc( 'GROUP_MEMBER' ) %>
-
- >
- <%= _lc( 'GROUP_ADMIN' ) %>
-
- <% if ( 'trainer' === p.getRoleInGroup( g.getId() ) ) { %>
- >
- <%= _lc( 'GROUP_OWNER' ) %>
-
- <% } %>
-
-
-
-
- <%= _lc( 'BTN_SAVE_NEW_ROLE' ) %>
-
-
- <% if ( 'trainer' === p.getRoleInGroup( g.getId() ) ) { %>
-
- <%= _lc( 'CANNOT_CHANGE_GROUP_OWNER_ROLE_INFO' ) %>
-
- <% } %>
-
-
-
-
- <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS' ) %>
-
-
-
-
-
- >
- >
- <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_ACTIVE' ) %>
-
- >
- <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_INACTIVE' ) %>
-
- >
- <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_NOT_APPROVED' ) %>
-
-
-
-
-
- <%= _lc( 'BTN_GROUP_MANAGEMENT_MEMBERS_SAVE_STATUS' ) %>
-
-
- <% if ( p.getId() === currentUser.getId() ) { %>
-
- <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS_INFO' ) %>
-
- <% } %>
-
-
-
-
- <%= _lc( 'ASSIGNED_MEMBER_GROUP_CATEGORIES' ) %>
-
-
-
-
- <% var cgs = g.getCourseCategoriesForProfile( p ); %>
- <% for ( var cgsi = 0; cgsi < cgs.length; cgsi++ ) { %>
- <% if ( cgsi > 0 ) { %>
- <%= ' ' %>
- <% } %>
-
<%= cgs[ cgsi ].name %>
+
+ <% if ( statusDeleted === false ) { %>
+
+
+ <%= _lc( 'CHANGE_ROLE' ) %>
+
+
+
+
+
+ data-id="select-member-role">
+ >
+ <%= _lc( 'GROUP_MEMBER' ) %>
+
+ >
+ <%= _lc( 'GROUP_ADMIN' ) %>
+
+ <% if ( 'trainer' === p.getRoleInGroup( g.getId() ) ) { %>
+ >
+ <%= _lc( 'GROUP_OWNER' ) %>
+
+ <% } %>
+
+
+
+
+ <%= _lc( 'BTN_SAVE_NEW_ROLE' ) %>
+
+
+ <% if ( 'trainer' === p.getRoleInGroup( g.getId() ) ) { %>
+
+ <%= _lc( 'CANNOT_CHANGE_GROUP_OWNER_ROLE_INFO' ) %>
+
+ <% } %>
+
+
+
+
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS' ) %>
+
+
+
+
+
+ >
+ >
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_ACTIVE' ) %>
+
+ >
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_INACTIVE' ) %>
+
+ >
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_NOT_APPROVED' ) %>
+
+
+
+
+
+ <%= _lc( 'BTN_GROUP_MANAGEMENT_MEMBERS_SAVE_STATUS' ) %>
+
+
+ <% if ( p.getId() === currentUser.getId() ) { %>
+
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_CHANGE_STATUS_INFO' ) %>
+
+ <% } %>
+
+
+
+
+ <%= _lc( 'ASSIGNED_MEMBER_GROUP_CATEGORIES' ) %>
+
+
+
+
+ <% var cgs = g.getCourseCategoriesForProfile( p ); %>
+ <% for ( var cgsi = 0; cgsi < cgs.length; cgsi++ ) { %>
+ <% if ( cgsi > 0 ) { %>
+ <%= ' ' %>
+ <% } %>
+ <%= cgs[ cgsi ].name %>
+ <% } %>
+
+
+ <%= _lc( 'ASSIGNED_MEMBER_CATEOGORY_INFO' ) %>
+
+
+
+
+
+
+ <%= _lc( 'MEMBER_CONTRACT' ) %>
+
+
+
+
+
+
+ <%= _lc( 'CONTRACT_NAME' ) %>
+
+
+
+
+
+
+
+ <%= _lc( 'CONTRACT_DATE' ) %>
+
+
+
+
+
+
+ <%= _lc( 'BTN_SAVE_MEMBER_CONTRACT' ) %>
+
+
+
+
+
+
+ <%= _lc( 'APPOINTMENT_LOG' ) %>
+
+
+
+
+
+
+ <%= _lc( 'FROM' ) %>
+
+
+
+
+
+
+
+ <%= _lc( 'UNTIL' ) %>
+
+
+
+
+
+
+ <%= _lc( 'BTN_UPDATE_APPOINTMENT_LOG' ) %>
+
+
+
+
+
+
+
+ <%= _lc( 'ADMIN_NOTES' ) %> - <%= _lc( 'ADMIN_NOTES_INFO' ) %>
+
+
+
+
+
+
+ <%= _lc( 'BTN_SAVE_ADMIN_NOTE' ) %>
+
+
+
<% } %>
-
-
- <%= _lc( 'ASSIGNED_MEMBER_CATEOGORY_INFO' ) %>
-
-
-
-
-
-
- <%= _lc( 'MEMBER_CONTRACT' ) %>
-
-
-
-
-
-
- <%= _lc( 'CONTRACT_NAME' ) %>
-
-
-
-
-
-
-
- <%= _lc( 'CONTRACT_DATE' ) %>
-
-
-
-
-
-
- <%= _lc( 'BTN_SAVE_MEMBER_CONTRACT' ) %>
-
-
-
-
-
-
- <%= _lc( 'APPOINTMENT_LOG' ) %>
-
-
-
-
-
-
- <%= _lc( 'FROM' ) %>
-
-
-
-
-
-
-
- <%= _lc( 'UNTIL' ) %>
-
-
-
-
-
-
- <%= _lc( 'BTN_UPDATE_APPOINTMENT_LOG' ) %>
-
-
-
-
-
-
-
- <%= _lc( 'ADMIN_NOTES' ) %> - <%= _lc( 'ADMIN_NOTES_INFO' ) %>
-
-
-
-
-
-
- <%= _lc( 'BTN_SAVE_ADMIN_NOTE' ) %>
-
-
-
-
<% } else { %>
-
-
-
- <%= _lc( 'SELECT_MEMBER_TO_EDIT' ) %>
+
+
+ <%= _lc( 'SELECT_MEMBER_TO_EDIT' ) %>
+
-
-
<% } %>
\ No newline at end of file
diff --git a/src/client/app/tmpl/group-member-management.html b/src/client/app/tmpl/group-member-management.html
index 4448256..63557dc 100644
--- a/src/client/app/tmpl/group-member-management.html
+++ b/src/client/app/tmpl/group-member-management.html
@@ -46,6 +46,12 @@
<%= _lc( 'GROUP_MANAGEMENT_MEMBERS_NOT_APPROVED' ) %> (<%= membersNotApproved.length %>)
+
+
+
+ <%= _lc( 'GROUP_MANAGEMENT_MEMBERS_DELETED' ) %> (<%= membersDeleted.length %>)
+
+
@@ -86,6 +92,18 @@
+
+
+
+
+ <% for ( var mi = 0; mi < membersDeleted.length; mi++ ) { %>
+ <%=raw app.core.View.getTemplate( 'group-member-management-row', { m : membersDeleted[ mi ], g : group } ) %>
+ <% } %>
+
+
+
+
+
diff --git a/src/server/server/control/TB_Server_Control_Account.php b/src/server/server/control/TB_Server_Control_Account.php
index 7db41b6..9d107e0 100644
--- a/src/server/server/control/TB_Server_Control_Account.php
+++ b/src/server/server/control/TB_Server_Control_Account.php
@@ -29,7 +29,11 @@ class TB_Server_Control_Account
$resp->addData( 'own_teams', TB_Shared_Ent_TeamData_Team::getByProfile( $session->getProfile() ) );
if ($params->get('includeNumFutureAttendances')) {
- $appointmentsAccepted = TB_Shared_Ent_TeamData_Appointment::getAcceptedByProfile( $session->getProfile()->id );
+ $appointmentsAccepted = TB_Shared_Ent_TeamData_Appointment::getAcceptedByProfile(
+ $session->getProfile()->id,
+ false,
+ true
+ );
$resp->addData( 'numFutureAttendances', count($appointmentsAccepted) );
}
@@ -60,84 +64,31 @@ class TB_Server_Control_Account
throw new \Exception( 'Cannot delete a profile who owns a team' );
}
- $appointmentsAccepted = TB_Shared_Ent_TeamData_Appointment::getAcceptedByProfile( $profile->id );
+ $appointmentsAccepted =
+ TB_Shared_Ent_TeamData_Appointment::getAcceptedByProfile(
+ $profile->id, false, true
+ );
if ( $appointmentsAccepted && count( $appointmentsAccepted ) > 0 )
{
throw new \Exception( 'User has accepted appointments in the future' );
}
- $uuid = \Ramsey\Uuid\Uuid::uuid4()->toString();
- throw new \Exception( 'Does not work anymore.' );
- return $resp;
-
-
-
-// $dbCore = TB_Shared_Db_Core::get();
-// $dbTeam = TB_Shared_Db_TeamData::get();
-//
-//
-// if ( $appointmentsAccepted && count( $appointmentsAccepted ) > 0 )
-// {
-//
-// foreach( $appointmentsAccepted as $app )
-// {
-// TB_Server_Control_Appointment::processWaitingList( $app );
-// }
-// }
-//
-// return $resp;
-
-
-
- /*
- $resp = new TB_Server_Core_Response();
-
- $session = TB_Server_Core_Session::get();
-
- $account = $session->getAccount();
- if ( is_null( $account ) ) throw new Exception( "No account in session. Deletion failed." );
-
- $profile = $session->getProfile();
-
- $appointmentsToUpdate = TB_Shared_Ent_TeamData_Appointment::getAcceptedByProfile( $profile->id );
-
- $dbCore = TB_Shared_Db_Core::get();
- $dbTeam = TB_Shared_Db_TeamData::get();
+ $a = $profile->teams_js;
- if ( $profile->ownsATeam() )
- {
- throw new \Exception( 'Cannot delete a profile who owns a team' );
- }
-
- try
- {
- $dbCore->beginTransaction();
- $dbTeam->beginTransaction();
-
- $account->delete();
- $profile->delete();
-
- $dbCore->commit();
- $dbTeam->commit();
+ $resTeam = [];
+ foreach ($profile->teams_js as $team) {
+ $tmpTeam = $team;
+ $tmpTeam['status'] = TB_Shared_Ent_TeamData_Profile::STATUS_DELETED;
+ $resTeam[] = $tmpTeam;
}
- catch( Exception $e )
- {
- $dbCore->rollBack();
- $dbTeam->rollBack();
- throw $e;
- }
-
- if ( $appointmentsToUpdate && count( $appointmentsToUpdate ) > 0 )
- {
+ $profile->teams_js = $resTeam;
- foreach( $appointmentsToUpdate as $app )
- {
- TB_Server_Control_Appointment::processWaitingList( $app );
- }
- }
+ $uuid = \Ramsey\Uuid\Uuid::uuid4()->toString();
+ $account->email = $account->email . $uuid;
+ $account->save();
+ $profile->save();
return $resp;
- */
}
/**
diff --git a/src/server/server/control/TB_Server_Control_Team.php b/src/server/server/control/TB_Server_Control_Team.php
index de6130f..3579985 100644
--- a/src/server/server/control/TB_Server_Control_Team.php
+++ b/src/server/server/control/TB_Server_Control_Team.php
@@ -114,12 +114,25 @@ class TB_Server_Control_Team {
$filteredMembers[] = $member;
}
} else {
+ $teamData = $member->getTeamsData($teamId);
if ($activeOnly === true) {
- $teamData = $member->getTeamsData($teamId);
if ($teamData['status'] === TB_Shared_Ent_TeamData_Profile::STATUS_ACTIVE) {
$filteredMembers[] = $member;
}
} else {
+ if ($teamData['status'] === TB_Shared_Ent_TeamData_Profile::STATUS_DELETED) {
+ $member->street = "";
+ $member->zip_code = "";
+ $member->city = "";
+ $member->country = "";
+ $member->mobile = "";
+ $member->phone = "";
+ $member->gender = "";
+ $member->pic_url = "";
+ $member->birthday_dt = "";
+ $member->misc = "";
+ $member->status = "";
+ }
$filteredMembers[] = $member;
}
}
@@ -135,7 +148,10 @@ class TB_Server_Control_Team {
/** @var TB_Shared_Ent_TeamData_Profile $member */
foreach ( $members as $member )
{
- array_push( $accountIds, $member->account_id );
+ $teamData = $member->getTeamsData($teamId);
+ if ($teamData['status'] !== TB_Shared_Ent_TeamData_Profile::STATUS_DELETED) {
+ array_push( $accountIds, $member->account_id );
+ }
}
$emails = TB_Shared_Ent_Core_Account::getEmailsForAccountIds( $accountIds );
diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php
index a9e1ca4..800f2ec 100644
--- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php
+++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Appointment.php
@@ -140,8 +140,11 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row
* @param $profileId
* @param bool $includePastAppointments
*/
- public static function getAcceptedByProfile( $profileId, $includePastAppointments = false )
- {
+ public static function getAcceptedByProfile(
+ $profileId,
+ $includePastAppointments = false,
+ $excludeRejectDeadlineExpired = false
+ ) {
$sql = 'SELECT appointment.* FROM appointment ';
$sql .= 'LEFT JOIN attendee ON appointment.id = attendee.appointment_id ';
$sql .= 'WHERE ';
@@ -153,6 +156,11 @@ class TB_Shared_Ent_TeamData_Appointment extends Francis_Db_Row
$sql .= 'AND appointment.start_dt > UTC_TIMESTAMP()';
}
+ if ( true === $excludeRejectDeadlineExpired ) {
+ // By this we do not include appointments where reject deadline has passed expired
+ $sql .= 'AND appointment.deadline_reject_dt > UTC_TIMESTAMP()';
+ }
+
//SELECT appointment.* FROM appointment LEFT JOIN attendee ON appointment.id = attendee.appointment_id WHERE appointment.state = "open" AND attendee.profile_id = 16772 AND attendee.status = "accepted";
return self::findMany( $sql, array( ':profile_id' => $profileId ) );
diff --git a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php
index 1badaa7..55a27e2 100644
--- a/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php
+++ b/src/server/shared/ent/teamdata/TB_Shared_Ent_TeamData_Profile.php
@@ -75,7 +75,8 @@ class TB_Shared_Ent_TeamData_Profile extends Francis_Db_Row {
return array(
self::STATUS_ACTIVE,
self::STATUS_INACTIVE,
- self::STATUS_NOT_APPROVED
+ self::STATUS_NOT_APPROVED,
+ self::STATUS_DELETED
);
}