Fix issues related with #80 ticket assignment
This commit is contained in:
parent
6383b52fd0
commit
25117074a0
|
@ -93,20 +93,36 @@ class TicketEvent extends React.Component {
|
|||
}
|
||||
|
||||
renderAssignment() {
|
||||
let assignedTo = this.props.content;
|
||||
let authorName = this.props.author.name;
|
||||
|
||||
if(!assignedTo || assignedTo == authorName) {
|
||||
assignedTo = i18n('HIMSELF');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="ticket-event__circled">
|
||||
<span className="ticket-event__circled-author">{this.props.author.name}</span>
|
||||
<span className="ticket-event__circled-author">{authorName}</span>
|
||||
<span className="ticket-event__circled-text"> {i18n('ACTIVITY_ASSIGN_THIS')}</span>
|
||||
<span className="ticket-event__circled-text"> {assignedTo}</span>
|
||||
<span className="ticket-event__circled-date"> {i18n('DATE_PREFIX')} {DateTransformer.transformToString(this.props.date)}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
renderUnAssignment() {
|
||||
let unAssignedTo = this.props.content;
|
||||
let authorName = this.props.author.name;
|
||||
|
||||
if(!unAssignedTo || unAssignedTo == authorName) {
|
||||
unAssignedTo = i18n('HIMSELF');
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="ticket-event__circled">
|
||||
<span className="ticket-event__circled-author">{this.props.author.name}</span>
|
||||
<span className="ticket-event__circled-author">{authorName}</span>
|
||||
<span className="ticket-event__circled-text"> {i18n('ACTIVITY_UN_ASSIGN_THIS')}</span>
|
||||
<span className="ticket-event__circled-text"> {unAssignedTo}</span>
|
||||
<span className="ticket-event__circled-date"> {i18n('DATE_PREFIX')} {DateTransformer.transformToString(this.props.date)}</span>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -29,6 +29,9 @@ class TicketViewer extends React.Component {
|
|||
assignmentAllowed: React.PropTypes.bool,
|
||||
staffMembers: React.PropTypes.array,
|
||||
staffMembersLoaded: React.PropTypes.bool,
|
||||
userId: React.PropTypes.number,
|
||||
userStaff: React.PropTypes.bool,
|
||||
userDepartments: React.PropTypes.array,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
|
@ -47,7 +50,7 @@ class TicketViewer extends React.Component {
|
|||
};
|
||||
|
||||
componentDidMount() {
|
||||
if(!this.props.staffMembersLoaded && this.props.editable) {
|
||||
if(!this.props.staffMembersLoaded && this.props.userStaff) {
|
||||
this.props.dispatch(AdminDataActions.retrieveStaffMembers());
|
||||
}
|
||||
}
|
||||
|
@ -186,12 +189,8 @@ class TicketViewer extends React.Component {
|
|||
renderOwnerNode() {
|
||||
let ownerNode = null;
|
||||
|
||||
if (this.props.assignmentAllowed && _.isEmpty(this.props.ticket.owner)) {
|
||||
ownerNode = (
|
||||
<Button type="secondary" size="extra-small" onClick={this.onAssignClick.bind(this)}>
|
||||
{i18n('ASSIGN_TO_ME')}
|
||||
</Button>
|
||||
);
|
||||
if (this.props.assignmentAllowed) {
|
||||
ownerNode = this.renderAssignStaffList();
|
||||
} else {
|
||||
ownerNode = (this.props.ticket.owner) ? this.props.ticket.owner.name : i18n('NONE')
|
||||
}
|
||||
|
@ -202,10 +201,16 @@ class TicketViewer extends React.Component {
|
|||
renderAssignStaffList() {
|
||||
const items = this.getStaffAssignmentItems();
|
||||
const ownerId = this.props.ticket.owner && this.props.ticket.owner.id;
|
||||
|
||||
let selectedIndex = _.findIndex(items, {id: ownerId});
|
||||
selectedIndex = (selectedIndex !== -1) ? selectedIndex : 0;
|
||||
|
||||
console.log(selectedIndex);
|
||||
|
||||
return (
|
||||
<DropDown
|
||||
className="ticket-viewer__editable-dropdown" items={items}
|
||||
selectedIndex={ownerId && _.findIndex(items, {id: ownerId})}
|
||||
selectedIndex={selectedIndex}
|
||||
onChange={this.onAssignmentChange.bind(this)}
|
||||
/>
|
||||
);
|
||||
|
@ -283,23 +288,6 @@ class TicketViewer extends React.Component {
|
|||
};
|
||||
}
|
||||
|
||||
getStaffAssignmentItems() {
|
||||
const {staffMembers, userId} = this.props;
|
||||
let staffAssignmentItems = [
|
||||
{content: 'None', id: 0},
|
||||
{content: 'Assign to me', id: userId}
|
||||
];
|
||||
|
||||
staffAssignmentItems = staffAssignmentItems.concat(
|
||||
_.map(
|
||||
_.filter(staffMembers, ({id}) => (id != userId)),
|
||||
({id, name}) => ({content: name, id})
|
||||
)
|
||||
);
|
||||
|
||||
return staffAssignmentItems;
|
||||
}
|
||||
|
||||
onDepartmentDropdownChanged(event) {
|
||||
AreYouSure.openModal(null, this.changeDepartment.bind(this, event.index));
|
||||
}
|
||||
|
@ -314,12 +302,25 @@ class TicketViewer extends React.Component {
|
|||
|
||||
assingTo(index) {
|
||||
const id = this.getStaffAssignmentItems()[index].id;
|
||||
const {ticketNumber} = this.props.ticket;
|
||||
const {ticketNumber, owner} = this.props.ticket;
|
||||
|
||||
API.call({
|
||||
path: (index == 0) ? '/staff/un-assign-ticket' : '/staff/assign-ticket',
|
||||
data: { ticketNumber, staffId: id }
|
||||
}).then(this.onTicketModification.bind(this));
|
||||
let APICallPromise = new Promise(resolve => resolve());
|
||||
|
||||
if(owner) {
|
||||
APICallPromise.then(() => API.call({
|
||||
path: '/staff/un-assign-ticket',
|
||||
data: { ticketNumber }
|
||||
}));
|
||||
}
|
||||
|
||||
if(id !== 0) {
|
||||
APICallPromise.then(() => API.call({
|
||||
path: '/staff/assign-ticket',
|
||||
data: { ticketNumber, staffId: id }
|
||||
}));
|
||||
}
|
||||
|
||||
APICallPromise.then(this.onTicketModification.bind(this));
|
||||
}
|
||||
|
||||
onCloseClick() {
|
||||
|
@ -422,11 +423,36 @@ class TicketViewer extends React.Component {
|
|||
}
|
||||
}).then(this.onTicketModification.bind(this));
|
||||
}
|
||||
|
||||
getStaffAssignmentItems() {
|
||||
const {staffMembers, userDepartments, userId, ticket} = this.props;
|
||||
const ticketDepartmentId = ticket.department.id;
|
||||
let staffAssignmentItems = [
|
||||
{content: 'None', id: 0}
|
||||
];
|
||||
|
||||
if(_.any(userDepartments, {id: ticketDepartmentId})) {
|
||||
staffAssignmentItems.push({content: i18n('ASSIGN_TO_ME'), id: userId});
|
||||
}
|
||||
|
||||
staffAssignmentItems = staffAssignmentItems.concat(
|
||||
_.map(
|
||||
_.filter(staffMembers, ({id, departments}) => {
|
||||
return (id != userId) && _.any(departments, {id: ticketDepartmentId});
|
||||
}),
|
||||
({id, name}) => ({content: name, id})
|
||||
)
|
||||
);
|
||||
|
||||
return staffAssignmentItems;
|
||||
}
|
||||
}
|
||||
|
||||
export default connect((store) => {
|
||||
return {
|
||||
userId: store.session.userId,
|
||||
userStaff: store.session.staff,
|
||||
userDepartments: store.session.userDepartments,
|
||||
staffMembers: store.adminData.staffMembers,
|
||||
staffMembersLoaded: store.adminData.staffMembersLoaded,
|
||||
allowAttachments: store.config['allow-attachments'],
|
||||
|
|
|
@ -180,6 +180,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Membro da equipe atualizado',
|
||||
'UPDATE': 'Atualizar',
|
||||
'NEVER': 'Nunca',
|
||||
'HIMSELF': 'ele mesmo',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Chamados criados',
|
||||
'CHART_CLOSE': 'Chamados fechados',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Últimos 365 dias',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'comentou este chamado',
|
||||
'ACTIVITY_ASSIGN_THIS': 'atribuiu este chamado',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'desatribuiu este chamado',
|
||||
'ACTIVITY_ASSIGN_THIS': 'atribuiu este chamado para',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'desatribuiu este chamado para',
|
||||
'ACTIVITY_CLOSE_THIS': 'fechou este chamado',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'criou este chamado',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'reabriu este chamado',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': '工作人员已更新',
|
||||
'UPDATE': '更新',
|
||||
'NEVER': '从来没有',
|
||||
'HIMSELF': '他自己',
|
||||
|
||||
'CHART_CREATE_TICKET': '已創建門票',
|
||||
'CHART_CLOSE': '門票已關閉',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS':'過去365天',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': '評論了這張票',
|
||||
'ACTIVITY_ASSIGN_THIS': '分配這張票',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': '取消分配此票',
|
||||
'ACTIVITY_ASSIGN_THIS': '将此票证分配给',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': '未分配此票给',
|
||||
'ACTIVITY_CLOSE_THIS': '關閉這張票',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': '創建了這張票',
|
||||
'ACTIVITY_RE_OPEN_THIS': '重新打開這張票',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Mitarbeiter wurde aktualisiert',
|
||||
'UPDATE': 'Aktualisierung',
|
||||
'NEVER': 'Niemals',
|
||||
'HIMSELF': 'selbst',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Tickets erstellt',
|
||||
'CHART_CLOSE': 'Tickets geschlossen',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Letzte 365 Tage',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'hat dieses Ticket kommentiert',
|
||||
'ACTIVITY_ASSIGN_THIS': 'hat dieses Ticket zugewiesen',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'hat dieses Ticket nicht zugewiesen',
|
||||
'ACTIVITY_ASSIGN_THIS': 'hat dieses Ticket zugewiesen zu',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'hat dieses Ticket nicht zugewiesen zu',
|
||||
"ACTIVITY_CLOSE_THIS": 'hat dieses Ticket geschlossen',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'hat dieses Ticket erstellt',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'hat dieses Ticket wieder geöffnet',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Staff member has been updated',
|
||||
'UPDATE': 'Update',
|
||||
'NEVER': 'Never',
|
||||
'HIMSELF': 'himself',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Tickets created',
|
||||
'CHART_CLOSE': 'Tickets closed',
|
||||
|
@ -353,8 +354,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Last 365 days',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'commented this ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'assigned this ticket',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'unassigned this ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'assigned this ticket to',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'unassigned this ticket to',
|
||||
'ACTIVITY_CLOSE_THIS': 'closed this ticket',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'created this ticket',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'reopened this ticket',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Miembro de Staff actualizado',
|
||||
'UPDATE': 'Actualizar',
|
||||
'NEVER': 'Nunca',
|
||||
'HIMSELF': 'si mismo',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Tickets creados',
|
||||
'CHART_CLOSE': 'Tickets cerrados',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Últimos 365 dias',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'comentó este ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'se asignó este ticket',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'se desasignó este ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'se asignó este ticket para',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'se desasignó este ticket para',
|
||||
'ACTIVITY_CLOSE_THIS': 'cerró este ticket',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'creó este ticket',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'reabrió este ticket',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Le membre du personnel a été mis à jour',
|
||||
'UPDATE': 'Mettre à jour',
|
||||
'NEVER': 'Jamais',
|
||||
'HIMSELF': 'lui-même',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Tickets créés',
|
||||
'CHART_CLOSE': 'Tickets fermés',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Les 365 derniers jours',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'a commenté ce ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'a assigné ce ticket',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'a supprimé l\'assignation de ce ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'a assigné ce ticket à',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'a supprimé l\'assignation de ce ticket à',
|
||||
'ACTIVITY_CLOSE_THIS': 'a fermé ce ticket',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'a créé ce ticket',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'a réouvert ce ticket',
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
'STAFF_UPDATED': 'Το μέλος προσωπικού έχει ενημερωθεί',
|
||||
'UPDATE': 'Ενημέρωση',
|
||||
'NEVER': 'Ποτέ',
|
||||
'HIMSELF': 'ο ίδιος',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Τα εισιτήρια δημιουργήθηκαν',
|
||||
'CHART_CLOSE': 'Τα εισιτήρια κλείσανε',
|
||||
|
@ -353,8 +354,8 @@
|
|||
'LAST_365_DAYS': 'Τελευταίες 365 μέρες',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'σχολίασε αυτό το εισιτήριο',
|
||||
'ACTIVITY_ASSIGN_THIS': 'ορίστηκε αυτό το εισιτήριο',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'δεν ορίστηκε αυτό το εισιτήριο',
|
||||
'ACTIVITY_ASSIGN_THIS': 'ορίστηκε αυτό το εισιτήριο σε',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'δεν ορίστηκε αυτό το εισιτήριο σε',
|
||||
'ACTIVITY_CLOSE_THIS': 'έκλεισε αυτό το εισιτήριο',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'δημιουργήθηκε αυτό το εισιτήριο',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'άνοιξε εκ νέου αυτό το εισιτήριο',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'स्टाफ सदस्य को अद्यतन किया गया है',
|
||||
'UPDATE': 'अद्यतन',
|
||||
'NEVER': 'कभी नहीँ',
|
||||
'HIMSELF': 'स्वयं',
|
||||
|
||||
'CHART_CREATE_TICKET': 'टिकट बनाया',
|
||||
'CHART_CLOSE': 'टिकट बंद कर दिया',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'पिछले 365 दिन',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'यह टिकट टिप्पणी की',
|
||||
'ACTIVITY_ASSIGN_THIS': 'इस टिकट को सौंपा',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'इस टिकट को असाइन किया गया',
|
||||
'ACTIVITY_ASSIGN_THIS': 'इस टिकट को सौंपा गया',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'इस टिकट को असाइन नहीं किया गया',
|
||||
'ACTIVITY_CLOSE_THIS': 'इस टिकट को बंद कर दिया',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'यह टिकट बनाया',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'इस टिकट को फिर से खोल दिया',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Il membro del personale è stato aggiornato',
|
||||
'UPDATE': 'Aggiornare',
|
||||
'NEVER': 'Mai',
|
||||
'HIMSELF': 'lui stesso',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Tickets creato',
|
||||
'CHART_CLOSE': 'Tickets chiuso',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Ultimi 365 giorni',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'ha commentato questo ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'assegnato questo ticket',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'non ha assegnato questo ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'assegnato questo ticket a',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'non ha assegnato questo ticket a',
|
||||
'ACTIVITY_CLOSE_THIS': 'ha chiuso questo ticket',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'ha creato questo ticket',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'ha riaperto questo ticket',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'スタッフメンバーが更新されました',
|
||||
'UPDATE': '更新',
|
||||
'NEVER': '決して',
|
||||
'HIMSELF': '彼自身',
|
||||
|
||||
'CHART_CREATE_TICKET': '作成されたチケット',
|
||||
'CHART_CLOSE': 'チケットが閉じられました',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': '過去365日間',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'はこのチケットにコメントしました',
|
||||
'ACTIVITY_ASSIGN_THIS': 'がこのチケットを割り当てました',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'はこのチケットの割り当てを解除しました',
|
||||
'ACTIVITY_ASSIGN_THIS': 'はこのチケットを',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'はこのチケットの割当を解除しました',
|
||||
'ACTIVITY_CLOSE_THIS': 'がこのチケットを閉鎖しました',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'がこのチケットを作成しました',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'がこのチケットを再開しました',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Medewerker is gewijzigd',
|
||||
'UPDATE': 'Update',
|
||||
'NEVER': 'Nooit',
|
||||
'HIMSELF': 'zichzelf',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Aangemaakte incidenten',
|
||||
'CHART_CLOSE': 'Gesloten incidenten',
|
||||
|
@ -353,8 +354,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Laatste 365 dagen',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'heeft een bericht achtergelaten op dit incident',
|
||||
'ACTIVITY_ASSIGN_THIS': 'heeft dit incident toegewezen',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'heeft dit incident niet-toegewezen aan een medewerker',
|
||||
'ACTIVITY_ASSIGN_THIS': 'heeft dit incident toegewezen aan',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'heeft dit incident niet-toegewezen aan een medewerker aan',
|
||||
'ACTIVITY_CLOSE_THIS': 'heeft dit incident gesloten',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'heeft dit incident aangemaakt',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'heeft dit incident heropend',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Membro da equipe foi atualizado',
|
||||
'UPDATE': 'Actualizar',
|
||||
'NEVER': 'Nunca',
|
||||
'HIMSELF': 'ele mesmo',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Ingressos criados',
|
||||
'CHART_CLOSE': 'Ingressos fechados',
|
||||
|
@ -352,8 +353,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Últimos 365 dias',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'comentou este ticket',
|
||||
'ACTIVITY_ASSIGN_THIS': 'atribuído este bilhete',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'não atribuído este bilhete',
|
||||
'ACTIVITY_ASSIGN_THIS': 'atribuído este bilhete para',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'não atribuído este bilhete para',
|
||||
'ACTIVITY_CLOSE_THIS': 'fechado este bilhete',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'criado este bilhete',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'reaberto este bilhete',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Сотрудник обновлен',
|
||||
'UPDATE': 'Обновить',
|
||||
'NEVER': 'Никогда',
|
||||
'HIMSELF': 'сам',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Билеты создано',
|
||||
'CHART_CLOSE': ' Билеты закрыты',
|
||||
|
@ -351,8 +352,8 @@ export default {
|
|||
'LAST_365_DAYS': 'Последние 365 дней',
|
||||
|
||||
'ACTIVITY_COMMENT_THIS': 'прокомментировал этот билет',
|
||||
'ACTIVITY_ASSIGN_THIS': 'присвоен этот билет',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'неназначенный билет',
|
||||
'ACTIVITY_ASSIGN_THIS': 'присвоен этот билет в',
|
||||
'ACTIVITY_UN_ASSIGN_THIS': 'неназначенный билет в',
|
||||
'ACTIVITY_CLOSE_THIS': 'закрыл этот билет',
|
||||
'ACTIVITY_CREATE_TICKET_THIS': 'создал этот билет',
|
||||
'ACTIVITY_RE_OPEN_THIS': 'снова открыт этот билет',
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'STAFF_UPDATED': 'Çalışanlar güncellendi',
|
||||
'UPDATE': 'Güncelleştirme',
|
||||
'NEVER': 'Asla',
|
||||
'HIMSELF': 'kendisi',
|
||||
|
||||
'CHART_CREATE_TICKET': 'Biletler oluşturuldu',
|
||||
'CHART_CLOSE': 'Biletler kapandı',
|
||||
|
|
|
@ -31,7 +31,7 @@ class AssignStaffController extends Controller {
|
|||
const METHOD = 'POST';
|
||||
|
||||
private $ticket;
|
||||
private $user;
|
||||
private $staffToAssign;
|
||||
|
||||
public function validations() {
|
||||
return [
|
||||
|
@ -49,16 +49,19 @@ class AssignStaffController extends Controller {
|
|||
$ticketNumber = Controller::request('ticketNumber');
|
||||
$staffId = Controller::request('staffId');
|
||||
$this->ticket = Ticket::getByTicketNumber($ticketNumber);
|
||||
|
||||
if($staffId) {
|
||||
$this->user = Staff::getDataStore($staffId, 'id');
|
||||
if($this->user->isNull()) {
|
||||
$this->staffToAssign = Staff::getDataStore($staffId, 'id');
|
||||
|
||||
if($this->staffToAssign->isNull()) {
|
||||
throw new Exception(ERRORS::INVALID_STAFF);
|
||||
}
|
||||
if(!$this->user->sharedDepartmentList->includesId($this->ticket->department->id)) {
|
||||
|
||||
if(!$this->staffToAssign->sharedDepartmentList->includesId($this->ticket->department->id)) {
|
||||
throw new Exception(ERRORS::INVALID_DEPARTMENT);
|
||||
}
|
||||
} else {
|
||||
$this->user = Controller::getLoggedUser();
|
||||
$this->staffToAssign = Controller::getLoggedUser();
|
||||
}
|
||||
|
||||
if($this->ticket->owner) {
|
||||
|
@ -68,18 +71,19 @@ class AssignStaffController extends Controller {
|
|||
if(!$this->ticketHasStaffDepartment()) {
|
||||
throw new Exception(ERRORS::INVALID_DEPARTMENT);
|
||||
} else {
|
||||
$this->user->sharedTicketList->add($this->ticket);
|
||||
$this->ticket->owner = $this->user;
|
||||
$this->ticket->unread = !$this->ticket->isAuthor($this->user);
|
||||
$this->staffToAssign->sharedTicketList->add($this->ticket);
|
||||
$this->ticket->owner = $this->staffToAssign;
|
||||
$this->ticket->unread = !$this->ticket->isAuthor($this->staffToAssign);
|
||||
$event = Ticketevent::getEvent(Ticketevent::ASSIGN);
|
||||
$event->setProperties(array(
|
||||
'authorStaff' => Controller::getLoggedUser(),
|
||||
'date' => Date::getCurrentDate()
|
||||
'date' => Date::getCurrentDate(),
|
||||
'content' => $this->staffToAssign->name,
|
||||
));
|
||||
$this->ticket->addEvent($event);
|
||||
|
||||
$this->ticket->store();
|
||||
$this->user->store();
|
||||
$this->staffToAssign->store();
|
||||
|
||||
Response::respondSuccess();
|
||||
}
|
||||
|
@ -89,7 +93,7 @@ class AssignStaffController extends Controller {
|
|||
public function ticketHasStaffDepartment() {
|
||||
$departmentMatch = false;
|
||||
|
||||
foreach ($this->user->sharedDepartmentList as $department) {
|
||||
foreach ($this->staffToAssign->sharedDepartmentList as $department) {
|
||||
if($this->ticket->department->id === $department->id) {
|
||||
$departmentMatch = true;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,8 @@ class UnAssignStaffController extends Controller {
|
|||
$event = Ticketevent::getEvent(Ticketevent::UN_ASSIGN);
|
||||
$event->setProperties(array(
|
||||
'authorStaff' => $user,
|
||||
'date' => Date::getCurrentDate()
|
||||
'date' => Date::getCurrentDate(),
|
||||
'content' => $owner->name
|
||||
));
|
||||
|
||||
$ticket->addEvent($event);
|
||||
|
|
|
@ -52,6 +52,9 @@ class EnableUserSystemController extends Controller {
|
|||
$ticketList = Ticket::getAll();
|
||||
|
||||
foreach($ticketList as $ticket) {
|
||||
if($ticket->authorStaff) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$userInstance = User::getDataStore($ticket->authorEmail, 'email');
|
||||
|
||||
|
|
|
@ -79,6 +79,10 @@ class CreateController extends Controller {
|
|||
'validation' => DataValidator::email(),
|
||||
'error' => ERRORS::INVALID_EMAIL
|
||||
];
|
||||
$validations['requestData']['name'] = [
|
||||
'validation' => DataValidator::length(2, 40),
|
||||
'error' => ERRORS::INVALID_NAME
|
||||
];
|
||||
}
|
||||
|
||||
return $validations;
|
||||
|
|
|
@ -58,6 +58,7 @@ describe'system/disable-user-system' do
|
|||
content: 'The north remembers',
|
||||
departmentId: 1,
|
||||
language: 'en',
|
||||
name: 'Test Subject',
|
||||
email: 'emailtest@opensupports.com'
|
||||
})
|
||||
|
||||
|
@ -92,7 +93,7 @@ describe'system/disable-user-system' do
|
|||
|
||||
numberOftickets= $database.query("SELECT * FROM ticket WHERE author_email IS NULL AND author_name IS NULL AND author_id IS NOT NULL" )
|
||||
|
||||
(numberOftickets.num_rows).should.equal(40)
|
||||
(numberOftickets.num_rows).should.equal(39)
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue