Skip to content
This repository has been archived by the owner on Apr 5, 2020. It is now read-only.

Commit

Permalink
Check whether HVAL_FORMPARAM is set. Fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Jul 3, 2016
1 parent 3cea8db commit 865f950
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Scriptlets for the XP Framework ChangeLog

## ?.?.? / ????-??-??

## 8.0.2 / 2016-07-03

* Fixed issue #9: Undefined offset error in AbstractState
(@thekid)

## 8.0.1 / 2016-05-25

* Deprecated `Request::getInputStream()` in favor of new `in()` method.
Expand Down
18 changes: 9 additions & 9 deletions src/main/php/scriptlet/xml/workflow/AbstractState.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,33 @@ public function hasHandlers() {
*/
protected function addHandlerToFormresult($handler, $node, $request) {
$node->addChild(Node::fromArray($handler->values[HVAL_PERSISTENT], 'values'));
foreach (array_keys($handler->values[HVAL_FORMPARAM]) as $key) {
if (isset($handler->values[HVAL_FORMPARAM])) foreach ($handler->values[HVAL_FORMPARAM] as $key => $value) {

// Skip parameters which were set via setFormValue() and which were
// posted via request to avoid duplicate parameters. We do not need
// to use $response->addFormValue() because this is done in
// XMLScriptlet::processRequest() called in XMLScriptlet::doGet().
if ($request->hasParam($key)) continue;
$request->setParam($key, $handler->values[HVAL_FORMPARAM][$key]);
$request->setParam($key, $value);
}

// Add wrapper parameter representation if the handler has a wrapper
// and this wrapper implements the IFormresultAggregate interface
if ($handler->hasWrapper() && $handler->wrapper instanceof IFormresultAggregate) {
$wrapper= $node->addChild(new Node('wrapper'));
foreach (array_keys($handler->wrapper->paraminfo) as $name) {
foreach ($handler->wrapper->paraminfo as $name => $paraminfo) {
$param= $wrapper->addChild(new Node('param', null, [
'name' => $name,
'type' => $handler->wrapper->paraminfo[$name]['type'],
'occurrence' => $handler->wrapper->paraminfo[$name]['occurrence'],
'type' => $paraminfo['type'],
'occurrence' => $paraminfo['occurrence'],
]));
if ($handler->wrapper->paraminfo[$name]['values']) {
foreach ($handler->wrapper->paraminfo[$name]['values'] as $key => $value) {
if ($paraminfo['values']) {
foreach ($paraminfo['values'] as $key => $value) {
$param->addChild(new Node('value', $value, ['name' => $key]));
}
}
if ($handler->wrapper->paraminfo[$name]['default']) {
$param->addChild(new Node('default', $handler->wrapper->paraminfo[$name]['default']));
if ($paraminfo['default']) {
$param->addChild(new Node('default', $paraminfo['default']));
}
}
}
Expand Down

0 comments on commit 865f950

Please sign in to comment.