Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Leif Andersson
ReglerAddress
Commits
c49d00b9
Commit
c49d00b9
authored
Sep 21, 2015
by
Leif Andersson
Browse files
Flyttade kod från changeDatabase till add_edit. Tog bort changeDatabase.
parent
4e0809ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
action.add_edit.php
View file @
c49d00b9
...
...
@@ -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
());
...
...
action.changeDatabase.php
deleted
100644 → 0
View file @
4e0809ab
<?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
);
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment