Commit 9d47a8ce authored by Vincent Bechu's avatar Vincent Bechu

[erp5_officejs_ooffice] save promise resolve when no modification

parent 0c335868
...@@ -885,9 +885,13 @@ define([ ...@@ -885,9 +885,13 @@ define([
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me)); Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('refreshhistory', _.bind(me.onRefreshHistory, me)); Common.Gateway.on('refreshhistory', _.bind(me.onRefreshHistory, me));
Common.Gateway.on('save', function () { Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) { if (me.api.isDocumentModified()) {
me.api.asc_Save(); me.api.asc_Save();
} }
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
}
}); });
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.37205.45053.30037</string> </value> <value> <string>961.31926.50683.29252</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1486024275.69</float> <float>1503045227.0</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -668,9 +668,13 @@ define([ ...@@ -668,9 +668,13 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me)); Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me)); Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () { Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) { if (me.api.isDocumentModified()) {
me.api.asc_Save(); me.api.asc_Save();
} }
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
}
}); });
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.37205.45053.30037</string> </value> <value> <string>961.31925.26684.9898</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1486024308.4</float> <float>1503045344.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -676,9 +676,13 @@ define([ ...@@ -676,9 +676,13 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me)); Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me)); Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () { Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.asc_isDocumentModified()) { if (me.api.asc_isDocumentModified()) {
me.api.asc_Save(); me.api.asc_Save();
} }
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
}
}); });
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me)); Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'}); Common.Gateway.sendInfo({mode:me.appOptions.isEdit?'edit':'view'});
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>958.18339.3430.47257</string> </value> <value> <string>961.31905.4301.26982</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1490605671.4</float> <float>1503044440.28</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -548,8 +548,10 @@ if (Common === undefined) { ...@@ -548,8 +548,10 @@ if (Common === undefined) {
return save_defer.promise; return save_defer.promise;
}) })
.push(function (data) { .push(function (data) {
var body = data[g.props.key]; if (data) {
return zip.putAttachment('/', 'body.txt', body); var body = data[g.props.key];
return zip.putAttachment('/', 'body.txt', body);
}
}) })
.push(function () { .push(function () {
return zip.getAttachment('/', '/'); return zip.getAttachment('/', '/');
......
...@@ -233,7 +233,7 @@ ...@@ -233,7 +233,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.660.18881.18705</string> </value> <value> <string>961.10686.10882.5973</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -251,7 +251,7 @@ ...@@ -251,7 +251,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1501231192.91</float> <float>1503043242.86</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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