Commit 9f389db3 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Make sure that institutions with members cannot be deleted at delete form

validation time. Added some i18n strings for deletion too.
parent 3f6fb17d
......@@ -39,6 +39,12 @@ $delete = param_boolean('delete');
if ($institution || $add) {
if ($delete) {
function delete_validate(Pieform $form, $values) {
if (get_field('usr', 'COUNT(*)', 'institution', $values['i'])) {
throw new Exception('Attempt to delete an institution that has members');
function delete_cancel_submit() {
redirect(get_config('wwwroot') . 'admin/institutions.php');
......@@ -156,6 +156,8 @@ $string['defaultaccountinactivewarn'] = 'Default account expire warning time';
$string['defaultaccountinactivewarndescription'] = 'The time before user accounts are to expire at which a warning message will be sent to them';
$string['defaultaccountlifetime'] = 'Default account lifetime';
$string['defaultaccountlifetimedescription'] = 'How long accounts will last for by default';
$string['deleteinstitution'] = 'Delete Institution';
$string['deleteinstitutionconfirm'] = 'Are you really sure you wish to delete this institution?';
$string['institutionaddedsuccessfully'] = 'Institution added successfully';
$string['institutiondeletedsuccessfully'] = 'Institution deleted successfully';
$string['institutionname'] = 'Institution name';
Supports Markdown
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