fixes default handling of record types
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 25 Apr 2016 10:11:58 +0000 (12:11 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 25 Apr 2016 10:14:29 +0000 (12:14 +0200)
... when new relation is added

Change-Id: I9e459db746b47280825000a20a5ff742fa116ad6
Reviewed-on: http://gerrit.tine20.com/customers/3083
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/js/widgets/grid/LinkGridPanel.js

index 4ac2e30..cab34c7 100644 (file)
@@ -172,6 +172,11 @@ Tine.widgets.grid.LinkGridPanel = Ext.extend(Tine.widgets.grid.PickerGridPanel,
 
         // check if already in
         if (this.store.findExact('related_id', recordToAdd.id) === -1) {
+            var recordType = record.get('type');
+            if (! Ext.isString(recordType) && recordType.default) {
+                record.set('type', recordType.default);
+                record.commit();
+            }
             this.store.add([record]);
         }