diff --git a/helper/lookup.php b/helper/lookup.php new file mode 100644 index 00000000..7651bca4 --- /dev/null +++ b/helper/lookup.php @@ -0,0 +1,59 @@ +column->getTable(); + $lbl = $field->column->getLabel(); + if(!isset($tosave[$tbl])) $tosave[$tbl] = array(); + $tosave[$tbl][$lbl] = $field->getParam('value'); + } + + foreach($tosave as $table => $data) { + $access = AccessTable::byTableName($table, 0, 0); + if (!$access instanceof AccessTableLookup) continue; + + if(!$access->getSchema()->isEditable()) { + msg('lookup save error: no permission for schema', -1); + return false; + } + $validator = $access->getValidator($data); + if($validator->validate()) { + $validator->saveData(); + } + } + + // set thank you message + if(!$thanks) { + $thanks = sprintf($this->getLang('bureaucracy_action_struct_lookup_thanks'), wl($ID)); + } else { + $thanks = hsc($thanks); + } + + return $thanks; + } +} \ No newline at end of file diff --git a/lang/en/lang.php b/lang/en/lang.php index f88bb40b..4ed149fb 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -109,4 +109,6 @@ $lang['lookup new entry'] = 'Create new Entry'; $lang['js']['lookup_delete'] = 'Delete Entry'; +$lang['bureaucracy_action_struct_lookup_thanks'] = 'The entry has been stored. Add another entry.'; + //Setup VIM: ex: et ts=4 :