public function _EM_get_next_nodes() { $workflow_id = I('get.workflow_id'); $source_id = I('get.source_id'); $check_permission = true; $next_nodes = D('Bpm/Workflow')->get_next_nodes($workflow_id, $source_id, $check_permission); $fields = explode(',', I('get._fd')); if ($fields) { foreach ($next_nodes as $k => $node) { $next_nodes[$k] = filter_array_fields($node, $fields); } } $this->response($next_nodes, 'workflow_node', true); }
protected final function merge_same_rows($rows, $attribute_fields) { $cleaned_rows = []; foreach ($rows as $row) { if ($row['product_unique_id']) { $unique_key = sprintf('%s_%s', $row['product_unique_id'], $row['storage_id']); } else { if ($attribute_fields) { $unique_key = sprintf('%d_%s_%d', $row['product_id'], implode('_', filter_array_fields($row, $attribute_fields)), $row['storage_id']); } else { $unique_key = $row['product_id'] + '_' + $row['storage_id']; } } if (array_key_exists($unique_key, $cleaned_rows)) { $cleaned_rows[$unique_key]['quantity'] += $row['quantity']; continue; } $cleaned_rows[$unique_key] = $row; } return reIndex($cleaned_rows); }
function filter_array_fields_multi($array, $fields) { foreach ($array as $k => $v) { $array[$k] = filter_array_fields($v, $fields); } return $array; }