merge with master

This commit is contained in:
yuri
2015-03-04 11:47:55 +02:00
15 changed files with 131 additions and 59 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ return array (
'Lead',
'Opportunity',
),
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Email", "Campaign"),
"tabList" => array("Account", "Contact", "Lead", "Opportunity", "Calendar", "Meeting", "Call", "Task", "Case", "Email", "Document", "Campaign"),
"quickCreateList" => array("Account", "Contact", "Lead", "Opportunity", "Meeting", "Call", "Task", "Case"),
'calendarDefaultEntity' => 'Meeting',
'disableExport' => false,
@@ -140,8 +140,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"contacts": {
"type": "hasMany",
@@ -153,8 +152,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"leads": {
"type": "hasMany",
@@ -166,8 +164,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"parent": {
"type": "belongsToParent",
@@ -135,8 +135,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"contacts": {
"type": "hasMany",
@@ -148,8 +147,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"leads": {
"type": "hasMany",
@@ -161,8 +159,7 @@
"len": "36",
"default": "None"
}
},
"layoutRelationshipsDisabled": true
}
},
"parent": {
"type": "belongsToParent",
+17 -1
View File
@@ -26,6 +26,7 @@ use \Espo\ORM\Entity;
use \Espo\Entities;
use \Espo\Core\Exceptions\Error;
use \Espo\Core\Exceptions\Forbidden;
class Email extends Record
{
@@ -133,7 +134,22 @@ class Email extends Record
public function getEntity($id = null)
{
$entity = parent::getEntity($id);
$entity = $this->getRepository()->get($id);
if (!empty($entity) && !empty($id)) {
$this->loadAdditionalFields($entity);
if (!$this->getAcl()->check($entity, 'read')) {
$userIdList = $entity->get('usersIds');
if (!is_array($userIdList) || !in_array($this->getUser()->id, $userIdList)) {
throw new Forbidden();
}
}
}
if (!empty($entity)) {
$this->prepareEntityForOutput($entity);
}
if (!empty($entity) && !empty($id)) {
if ($entity->get('fromEmailAddressName')) {
+4 -1
View File
@@ -271,7 +271,7 @@ class User extends Record
$body = $this->getLanguage()->translate('passwordChangeLinkEmailBody', 'messages', 'User');
$link = $this->getConfig()->get('siteUrl') . '?entryPoint=changePassword&id=' . $requestId;
$body = str_replace('{link}', $link, $body);
$email->set(array(
@@ -289,6 +289,9 @@ class User extends Record
if ($id == 'system') {
throw new Forbidden();
}
if ($id == $this->getUser()->id) {
throw new Forbidden();
}
return parent::deleteEntity($id);
}
}
@@ -17,56 +17,55 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Crm:Views.Call.List', 'Views.List', function (Dep) {
return Dep.extend({
actionSetHeld: function (data) {
var id = data.id;
if (!id) {
return;
}
}
var model = this.collection.get(id);
if (!model) {
return;
}
model.set('status', 'Held');
this.listenToOnce(model, 'sync', function () {
this.notify(false);
this.collection.fetch();
}, this);
this.notify('Saving...');
model.save();
model.save();
},
actionSetNotHeld: function (data) {
var id = data.id;
if (!id) {
return;
}
}
var model = this.collection.get(id);
if (!model) {
return;
}
model.set('status', 'Not Held');
this.listenToOnce(model, 'sync', function () {
this.notify(false);
this.collection.fetch();
}, this);
this.notify('Saving...');
model.save();
model.save();
},
});
});
@@ -13,7 +13,7 @@
{{{avatar}}}
</div>
<div class="stream-head-text-container">
<span class="text-muted"><span class="glyphicon glyphicon-envelope "></span>
<span class="text-muted"><span class="glyphicon glyphicon-envelope action" style="cursor: pointer;" title="{{translate 'View'}}" data-action="viewRecord" data-id="{{emailId}}" data-scope="Email"></span>
{{{message}}}
</span>
</div>
@@ -47,9 +47,6 @@ Espo.define('Views.Email.Record.Detail', 'Views.Record.Detail', function (Dep) {
setup: function () {
Dep.prototype.setup.call(this);
this.listenTo(this.model, 'change:attachmentsIds', function () {
this.handleAttachmentField();
}, this);
},
handleAttachmentField: function () {
@@ -64,8 +61,9 @@ Espo.define('Views.Email.Record.Detail', 'Views.Record.Detail', function (Dep) {
Dep.prototype.afterRender.call(this);
this.handleAttachmentField();
this.listenTo(this.model, 'change:attachmentsIds', function () {
this.handleAttachmentField();
}, this);
},
});
+18 -14
View File
@@ -132,18 +132,15 @@ Espo.define('Views.Record.List', 'View', function (Dep) {
this.$el.find('.list > table tbody tr').removeClass('active');
}
},
'click [data-action="quickEdit"]': function (e) {
var $target = $(e.currentTarget);
var id = $target.data('id');
var data = $target.data();
this.quickEdit(id, data);
},
'click [data-action="quickRemove"]': function (e) {
var $target = $(e.currentTarget);
var id = $target.data('id');
var data = $target.data();
this.quickRemove(id, data);
'click .action': function (e) {
$el = $(e.currentTarget);
var action = $el.data('action');
var method = 'action' + Espo.Utils.upperCaseFirst(action);
if (typeof this[method] == 'function') {
var data = $el.data();
this[method](data);
e.stopPropagation();
}
},
'click .checkbox-dropdown [data-action="selectAllResult"]': function (e) {
this.selectAllResult();
@@ -785,8 +782,11 @@ Espo.define('Views.Record.List', 'View', function (Dep) {
});
},
quickEdit: function (id, d) {
actionQuickEdit: function (d) {
d = d || {}
var id = d.id;
if (!id) return;
if (this.allowQuickEdit) {
this.notify('Loading...');
this.createView('quickEdit', 'Modals.Edit', {
@@ -811,7 +811,11 @@ Espo.define('Views.Record.List', 'View', function (Dep) {
return 'tr[data-id="' + id + '"]';
},
quickRemove: function (id) {
actionQuickRemove: function (data) {
data = data || {}
var id = data.id;
if (!id) return;
var model = this.collection.get(id);
if (!this.getAcl().checkModel(model, 'delete')) {
this.notify('Access denied', 'error');
@@ -33,7 +33,9 @@ Espo.define('Views.Record.Panels.Bottom', 'View', function (Dep) {
var action = $el.data('action');
var method = 'action' + Espo.Utils.upperCaseFirst(action);
if (typeof this[method] == 'function') {
this[method]($el.data('id'));
var data = $el.data();
this[method](data);
e.stopPropagation();
}
}
},
@@ -58,6 +60,22 @@ Espo.define('Views.Record.Panels.Bottom', 'View', function (Dep) {
return [];
},
actionViewRecord: function (data) {
var id = data.id;
var scope = data.scope;
this.notify('Loading...');
this.createView('quickDetail', 'Modals.Detail', {
scope: scope,
id: id
}, function (view) {
view.once('after:render', function () {
Espo.Ui.notify(false);
});
view.render();
}.bind(this));
}
});
});
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
************************************************************************/
Espo.define('Views.Record.Panels.DefaultSide', 'Views.Record.Panels.Side', function (Dep) {
@@ -138,7 +138,9 @@ Espo.define('Views.Record.Panels.Relationship', ['Views.Record.Panels.Bottom', '
this.collection.fetch();
},
actionViewRelated: function (id) {
actionViewRelated: function (data) {
var id = data.id;
this.notify('Loading...');
this.createView('quickDetail', 'Modals.Detail', {
scope: this.collection.get(id).name,
@@ -154,7 +156,9 @@ Espo.define('Views.Record.Panels.Relationship', ['Views.Record.Panels.Bottom', '
}.bind(this));
},
actionEditRelated: function (id) {
actionEditRelated: function (data) {
var id = data.id;
this.notify('Loading...');
this.createView('quickEdit', 'Modals.Edit', {
scope: this.collection.get(id).name,
@@ -170,7 +174,9 @@ Espo.define('Views.Record.Panels.Relationship', ['Views.Record.Panels.Bottom', '
}.bind(this));
},
actionUnlinkRelated: function (id) {
actionUnlinkRelated: function (data) {
var id = data.id;
var self = this;
if (confirm(this.translate('unlinkRecordConfirmation', 'messages'))) {
var model = this.collection.get(id);
@@ -193,7 +199,9 @@ Espo.define('Views.Record.Panels.Relationship', ['Views.Record.Panels.Bottom', '
}
},
actionRemoveRelated: function (id) {
actionRemoveRelated: function (data) {
var id = data.id;
var self = this;
if (confirm(this.translate('removeRecordConfirmation', 'messages'))) {
var model = this.collection.get(id);
+16
View File
@@ -107,6 +107,22 @@ Espo.define('Views.Stream.List', 'Views.Record.ListExpanded', function (Dep) {
});
},
actionViewRecord: function (data) {
var id = data.id;
var scope = data.scope;
this.notify('Loading...');
this.createView('quickDetail', 'Modals.Detail', {
scope: scope,
id: id
}, function (view) {
view.once('after:render', function () {
Espo.Ui.notify(false);
});
view.render();
}.bind(this));
}
});
});
@@ -27,9 +27,17 @@ Espo.define('Views.Stream.Notes.EmailReceived', 'Views.Stream.Note', function (D
isRemovable: true,
data: function () {
return _.extend({
emailId: this.emailId
}, Dep.prototype.data.call(this));
},
setup: function () {
var data = this.model.get('data') || {};
this.emailId = data.emailId;
if (this.model.get('post')) {
this.createField('post', null, null, 'Stream.Fields.Post');
}
@@ -27,9 +27,17 @@ Espo.define('Views.Stream.Notes.EmailSent', 'Views.Stream.Note', function (Dep)
isRemovable: true,
data: function () {
return _.extend({
emailId: this.emailId
}, Dep.prototype.data.call(this));
},
setup: function () {
var data = this.model.get('data') || {};
this.emailId = data.emailId;
if (this.model.get('post')) {
this.createField('post', null, null, 'Stream.Fields.Post');
}