Mix preserved arrays replacing new arrays when new array is empty

This commit is contained in:
Nathan Gray 2013-10-01 09:20:23 +00:00
parent 3f5dcfea04
commit bc6acd4a3e

View File

@ -204,7 +204,7 @@ class etemplate_new extends etemplate_widget_template
if(egw_json_response::isJSONResponse()) if(egw_json_response::isJSONResponse())
{ {
$response = egw_json_response::get(); $response = egw_json_response::get();
echo '<script>egw_LAB.wait(function() {egw_json_request.prototype.handleResponse('; echo '<script>egw_LAB.wait(function() {var json = egw.json(); json.handleResponse(';
ob_flush(); ob_flush();
$response->sendResult(); $response->sendResult();
unset($response); unset($response);
@ -415,7 +415,8 @@ class etemplate_new extends etemplate_widget_template
foreach($new as $k => $v) foreach($new as $k => $v)
{ {
if (!is_array($v) || !isset($old[$k]) || // no array or a new array if (!is_array($v) || !isset($old[$k]) || // no array or a new array
isset($v[0]) && !is_array($v[0]) && isset($v[count($v)-1])) // or no associative array, eg. selecting multiple accounts isset($v[0]) && !is_array($v[0]) && isset($v[count($v)-1]) || // or no associative array, eg. selecting multiple accounts
is_array($v) && count($v) == 0 && is_array($old[$k])) // Empty array replacing non-empty
{ {
$old[$k] = $v; $old[$k] = $v;
} }