Skip to content

Commit

Permalink
fix(Tinebase/Calendar): determine window title of edit dialog based o…
Browse files Browse the repository at this point in the history
…n id
  • Loading branch information
jevers authored and Christian Feitl committed Mar 19, 2024
1 parent de86986 commit d8e40df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tine20/Calendar/js/EventEditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,10 @@ Tine.Calendar.EventEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
Tine.Calendar.EventEditDialog.superclass.onRecordLoad.call(this);
},

isNewRecord: function () {
return !this.record || !(this.record.get && this.record.get('creation_time'))
},

/**
* is called after all subpanels have been loaded
*/
Expand Down
10 changes: 9 additions & 1 deletion tine20/Tinebase/js/widgets/dialog/EditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ Tine.widgets.dialog.EditDialog = Ext.extend(Ext.FormPanel, {
this.doCopyRecord();
this.window.setTitle(String.format(i18n._('Copy {0}'), this.i18nRecordName));
} else {
if (!this.record || !(this.record.get && this.record.get('creation_time'))) {
if (this.isNewRecord()) {
this.window.setTitle(formatMessage('{gender, select, male {Add New {recordName}} female {Add New {recordName}} other {Add New {recordName}}}', {
gender: this.recordClass.getRecordGender(),
recordName: this.i18nRecordName
Expand Down Expand Up @@ -1076,6 +1076,14 @@ Tine.widgets.dialog.EditDialog = Ext.extend(Ext.FormPanel, {
wrapTicket();
},

/**
* overwrite if record id is already set on new records
* @returns {boolean}
*/
isNewRecord: function () {
return !this.record || !(this.record.get && this.record.id )
},

setReadOnly: function(readOnly) {
this.readOnly = true;
this.action_saveAndClose.setHidden(readOnly);
Expand Down

0 comments on commit d8e40df

Please sign in to comment.