Commit c49d00b9 authored by Leif Andersson's avatar Leif Andersson
Browse files

Flyttade kod från changeDatabase till add_edit. Tog bort changeDatabase.

parent 4e0809ab
......@@ -6,11 +6,6 @@ $canChangeRecord = False;
if ($this->CheckPermission('Use ReglerAddress')) {$canChangeRecord = True; }
$fields = array(
'ID', 'Fornamn', 'Efternamn', 'Titel', 'Personnummer', 'SkolaForetag',
'Avdelning', 'Adress', 'Besok', 'Hem', 'Epost', 'Telefon', 'TelefonMobil',
'TelefonHem', 'URL', 'AnknytningTillInst', 'DiverseInfo');
$simpleFields = array(
'ID' => 'ID',
'Fornamn' => 'Förnamn',
......@@ -35,6 +30,30 @@ $areaFields = array(
'ICE' => 'ICE',
);
if (isset($params['submit'])) {
$record = new Person($params);
//echo '<pre>'; print_r($record); echo '</pre>';
$record->updateRecord();
$paramsB['module_message'] = 'Adressinformation ändrad';
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
if (isset($params['oldEpost']) && isset($params['Epost'])) {
if ($params['oldEpost'] != $params['Epost']) Group::setMailLists();
}
$this->Redirect($id, 'defaultadmin', $returnid, $paramsB);
}
if (isset($params['doGroups'])) {
$paramsB = array();
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
$this->Redirect($id, 'changeGroups', $returnid, $paramsB);
}
if (isset($params['ID'])) {
$ID = $params['ID'];
......@@ -43,6 +62,21 @@ if (isset($params['ID'])) {
$person = new Person();
$ID = null;
}
if (isset($params['cancelUpdate'])) {
$paramsB = array();
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
if ($this->CheckPermission('Use ReglerAddress')) {
$paramsB['module_message'] = 'Adressändring avbruten';
}
$this->Redirect($id, 'defaultadmin', $returnid, $paramsB);
return;
}
$smarty = $this->smarty;
$headline = $person->Fornamn . ' ' .$person->Efternamn;
......@@ -52,7 +86,7 @@ if ($canChangeRecord) { $headline = 'Redigera adress: ' . $headline; }
$smarty->assign('headline',$headline);
$place = $this->CreateFormStart($id, 'changeDatabase', $returnid);
$place = $this->CreateFormStart($id, 'add_edit', $returnid);
$smarty->assign('start_form', $place);
$smarty->assign('end_form', $this->CreateFormEnd());
......
<?php
require_once 'lib/class.Group.php';
if (!isset($gCms)) exit;
//echo '<pre>'; print_r($params); echo '</pre>'; exit;
if (isset($params['cancelUpdate'])) {
$paramsB = array();
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
if ($this->CheckPermission('Use ReglerAddress')) {
$paramsB['module_message'] = 'Adressändring avbruten';
}
$this->Redirect($id, 'defaultadmin', $returnid, $paramsB);
return;
}
if (! $this->CheckPermission('Use ReglerAddress')) {
return $this->DisplayErrorPage($id, $params, $returnid,
'ReglerAddress access denied.');
}
if (isset($params['doGroups'])) {
$paramsB = array();
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
$this->Redirect($id, 'changeGroups', $returnid, $paramsB);
}
if (isset($params['submit'])) {
$record = new Person($params);
//echo '<pre>'; print_r($record); echo '</pre>';
$record->updateRecord();
$paramsB['module_message'] = 'Adressinformation ändrad';
foreach (Person::$firstFields as $field) {
if (isset($params[$field])) {
$paramsB[$field] = $params[$field];
}
}
if (isset($params['oldEpost']) && isset($params['Epost'])) {
if ($params['oldEpost'] != $params['Epost']) Group::setMailLists();
}
$this->Redirect($id, 'defaultadmin', $returnid, $paramsB);
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment