changed preModifyActions() return value

This commit is contained in:
Roland Gruber 2012-01-04 20:51:34 +00:00
parent 236e582005
commit 38bfc1c454
3 changed files with 18 additions and 8 deletions

View File

@ -4,6 +4,7 @@
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"><title>Upgrade notes</title>
@ -21,7 +22,13 @@ This is a list of API changes for all LAM releases.
<br>
<h2>3.6 -&gt; 3.7</h2>The module function <span style="font-weight: bold;">postModifyActions()</span> must return an array containing any messages to display.<br>
<h2>3.6 -&gt; 3.7</h2>Module interface:<br>
<ul>
<li><span style="font-weight: bold;">postModifyActions()</span>: Must return an array containing any messages to display</li>
<li><span style="font-weight: bold;">preModifyActions():</span> Changed return value from boolean to array of message arrays<br>
</li>
</ul>
<br>
<h2>3.5.0 -&gt; 3.6</h2>
LAM now supports client-side validation (required + numeric fields). See htmlInputField::setValidationRule().<br>

View File

@ -1034,14 +1034,14 @@ abstract class baseModule {
*
* Calling this method requires the existence of an enclosing {@link accountContainer}.<br>
* <br>
* An error message should be printed if the function returns false.
* The modification is aborted if an error message is returned.
*
* @param boolean $newAccount new account
* @param array $attributes LDAP attributes of this entry
* @return boolean true, if no problems occured
* @return array array which contains status messages. Each entry is an array containing the status message parameters.
*/
public function preModifyActions($newAccount, $attributes) {
return true;
return array();
}
/**

View File

@ -1636,10 +1636,13 @@ class accountContainer {
logNewMessage(LOG_DEBUG, 'Edit page pre/postModify attributes: ' . print_r($prePostModifyAttributes, true));
$preModifyOk = true;
foreach ($module as $singlemodule) {
$result = $this->module[$singlemodule]->preModifyActions($this->isNewAccount, $prePostModifyAttributes);
if (!$result) {
$preModifyOk = false;
break;
$preModifyMessages = $this->module[$singlemodule]->preModifyActions($this->isNewAccount, $prePostModifyAttributes);
$errors = array_merge($errors, $preModifyMessages);
for ($i = 0; $i < sizeof($preModifyMessages); $i++) {
if ($preModifyMessages[$i][0] == 'ERROR') {
$preModifyOk = false;
break;
}
}
}
if (!$preModifyOk) {