Skip to content

Commit

Permalink
fix/PPP-268 Added missing feature, linking documents
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszkrzaczkowski authored and rskrzypczak committed Sep 11, 2024
1 parent 0242144 commit 338b0e9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
44 changes: 44 additions & 0 deletions plugins/yetiforce/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ rcube_webmail.prototype.registerEvents = function () {
this.mailId = this.crmContent.find('#mailActionBarID').val();
this.registerAddRecord();
this.registerAddReletedRecord();
this.registerAddAttachments();
this.registerSelectRecord();
this.registerRemoveRecord();
this.registerImportMail();
Expand Down Expand Up @@ -123,6 +124,49 @@ rcube_webmail.prototype.registerImportMail = function () {
});
});
};
rcube_webmail.prototype.registerAddAttachments = function () {
rcmail.crmContent.find('button.addAttachments').click(function (e) {
const row = $(e.currentTarget).closest('.rowRelatedRecord');
const relatedModule = row.data('module');
const relatedRecordId = row.data('id');
rcmail.crm.app.showRecordsList(
{
module: 'Documents',
related_parent_module: 'OSSMailView',
related_parent_id: rcmail.mailId,
multi_select: true,
record_selected: true
},
(modal, instance) => {
instance.setSelectEvent((responseData, e) => {
rcmail.crm.AppConnector.request({
async: false,
dataType: 'json',
data: {
module: relatedModule,
action: 'RelationAjax',
mode: 'addRelation',
related_module: 'Documents',
src_record: relatedRecordId,
related_record_list: JSON.stringify(Object.keys(responseData))
}
}).done(function (data) {
let notifyParams = {
text: rcmail.crm.app.vtranslate('JS_DOCUMENTS_ADDED'),
type: 'success',
animation: 'show'
};
if (!data['success']) {
notifyParams.type = 'error';
notifyParams.text = rcmail.crm.app.vtranslate('JS_ERROR');
}
rcmail.crm.app.showNotify(notifyParams);
});
});
}
);
});
};
rcube_webmail.prototype.registerRemoveRecord = function () {
rcmail.crmContent.find('button.removeRecord').click(function (e) {
rcmail.removeRecord($(e.currentTarget).closest('.rowRelatedRecord').data('id'));
Expand Down
8 changes: 0 additions & 8 deletions plugins/yetiforce/preview.min.js

This file was deleted.

Loading

0 comments on commit 338b0e9

Please sign in to comment.