attendee helper fns
authorCornelius Weiß <c.weiss@metaways.de>
Fri, 14 Jul 2017 11:21:44 +0000 (13:21 +0200)
committerCornelius Weiss <c.weiss@metaways.de>
Fri, 14 Jul 2017 11:51:13 +0000 (13:51 +0200)
Change-Id: If79e056a15ac36259e68b607dfe08ebe753aefec
Reviewed-on: http://gerrit.tine20.com/customers/5172
Reviewed-by: Cornelius Weiss <c.weiss@metaways.de>
Tested-by: Cornelius Weiss <c.weiss@metaways.de>
tine20/Calendar/js/Model.js

index 952d640..d3523f3 100644 (file)
@@ -786,6 +786,24 @@ Tine.Calendar.Model.Attender.getAttendeeStore.getAttenderRecord = function(atten
     return attendeeRecord;
 };
 
     return attendeeRecord;
 };
 
+Tine.Calendar.Model.Attender.getAttendeeStore.getSignature = function(attendee) {
+    var _ = window.lodash;
+
+    attendee = _.isFunction(attendee.beginEdit) ? attendee.data : attendee;
+    return [attendee.cal_event_id, attendee.user_type, attendee.user_id.id, attendee.role].join('/');
+};
+
+Tine.Calendar.Model.Attender.getAttendeeStore.fromSignature = function(signatureId) {
+    var ids = signatureId.split('/');
+
+    return new Tine.Calendar.Model.Attender({
+        cal_event_id: ids[0],
+        user_type: ids[1],
+        user_id: ids[2],
+        role: ids[3]
+    });
+}
+
 /**
  * returns attendee data
  * optinally fills into event record
 /**
  * returns attendee data
  * optinally fills into event record