projects
/
misc
/
kostenrechnung
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
848d93f
)
Support required fields - report information into backend
author
Joey Schulze
<joey@infodrom.org>
Sun, 28 Feb 2010 16:56:14 +0000
(17:56 +0100)
committer
Joey Schulze
<joey@infodrom.org>
Sun, 28 Feb 2010 16:56:14 +0000
(17:56 +0100)
ajax/ajax.php
patch
|
blob
|
history
diff --git
a/ajax/ajax.php
b/ajax/ajax.php
index
bbef0e4
..
e973776
100644
(file)
--- a/
ajax/ajax.php
+++ b/
ajax/ajax.php
@@
-68,6
+68,10
@@
function save($mask)
"sys_edit = now()");
foreach ($mask['edit'] as $field => $info)
"sys_edit = now()");
foreach ($mask['edit'] as $field => $info)
+ if ($info['required'] === true && empty($_POST[$field]))
+ return array('error' => sprintf('Pflichtfeld %s nicht ausgefüllt', $info['name']),
+ 'errormsg' => 'Pflichtfelder nicht ausgefüllt');
+
if ($info['type'] == 'boolean') {
$update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
} elseif ($info['type'] == 'number') {
if ($info['type'] == 'boolean') {
$update[] = sprintf("%s=%d", $field, $_POST[$field] == 'on'?1:0);
} elseif ($info['type'] == 'number') {
@@
-111,6
+115,9
@@
function insert($mask)
$values = array("'".pg_escape_string($_SESSION['sys']['login'])."'", 'now()');
foreach ($mask['edit'] as $field => $info)
$values = array("'".pg_escape_string($_SESSION['sys']['login'])."'", 'now()');
foreach ($mask['edit'] as $field => $info)
+ if ($info['required'] === true && empty($_POST[$field]))
+ return array('error' => sprintf('Pflichtfeld %s nicht ausgefüllt', $info['name']),
+ 'errormsg' => 'Pflichtfelder nicht ausgefüllt');
if ($info['type'] == 'boolean') {
$fields[] = $field;
$values[] = $_POST[$field] == 'on'?1:0;
if ($info['type'] == 'boolean') {
$fields[] = $field;
$values[] = $_POST[$field] == 'on'?1:0;