From: Joey Schulze Date: Sun, 28 Feb 2010 16:56:14 +0000 (+0100) Subject: Support required fields - report information into backend X-Git-Tag: 2010-06-02_customer~164 X-Git-Url: https://git.infodrom.org/?p=misc%2Fkostenrechnung;a=commitdiff_plain;h=ecdf9b356e69b18539688ccf09529e2f3a47f149;ds=sidebyside Support required fields - report information into backend --- diff --git a/ajax/ajax.php b/ajax/ajax.php index bbef0e4..e973776 100644 --- a/ajax/ajax.php +++ b/ajax/ajax.php @@ -68,6 +68,10 @@ function save($mask) "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') { @@ -111,6 +115,9 @@ function insert($mask) $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;