📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit e1f3e845 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update HistoryContextMenu.js to fix a bug in the split operation.

parent b1335709
......@@ -206,21 +206,28 @@ Ext.define("Event.grid.plugin.HistoryContextMenu", {
record.set("HistoryEnd_date", newEndDate);
me.window.hide();
// duplicate record
startDate = new Date(newEndDate);
startDate = Ext.Date.add(startDate, Ext.Date.DAY, 1);
startDate = Ext.Date.format(startDate, "Y-m-d");
newRecord = record.copy();
newRecord.set("HistoryId", null, {dirty: false});
newRecord.set("HistoryStart_date", startDate, {dirty: false});
newRecord.set("HistoryEnd_date", null, {dirty: false});
// edit and insert the duplicated record below the current one
rowEditor.setCurrentIndex();
rowEditor.formPanel.setAction("duplicate", newRecord);
rowEditor.window.setTitle(rowEditor.duplicateTitle);
rowEditor.window.show();
// wait that the first action is over.
// since the the store will send the write event which close
// the window of the editor
record.store.on("write", function() {
// duplicate record
startDate = new Date(newEndDate);
startDate = Ext.Date.add(startDate, Ext.Date.DAY, 1);
startDate = Ext.Date.format(startDate, "Y-m-d");
newRecord = record.copy();
newRecord.set("HistoryId", null, {dirty: false});
newRecord.set("HistoryStart_date", startDate, {dirty: false});
newRecord.set("HistoryEnd_date", null, {dirty: false});
// edit and insert the duplicated record below the current one
rowEditor.setCurrentIndex();
rowEditor.formPanel.setAction("duplicate", newRecord);
rowEditor.window.setTitle(rowEditor.duplicateTitle);
rowEditor.window.show();
}, me, {single: true});
});
window.setTitle(me.textSplitEvent);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment