diff --git a/include/class.organization.php b/include/class.organization.php index e79f18af0316abbc6d2c971a938d2da44c987608..6d3ceaeb143471d6eccb237253c0cb1dac11f200 100644 --- a/include/class.organization.php +++ b/include/class.organization.php @@ -407,9 +407,16 @@ implements TemplateVariable { if (!parent::delete()) return false; + // Remove users from this organization + User::objects() + ->filter(array('org' => $this)) + ->update(array('org_id' => 0)); + foreach ($this->getDynamicData(false) as $entry) { - $entry->delete(); + if (!$entry->delete()) + return false; } + return true; } static function fromVars($vars) { diff --git a/include/staff/templates/org-delete.tmpl.php b/include/staff/templates/org-delete.tmpl.php index 290d20e121932c75e3de195b957915e5bc378eac..fe32251e36743842eef8539282569f1669e70677 100644 --- a/include/staff/templates/org-delete.tmpl.php +++ b/include/staff/templates/org-delete.tmpl.php @@ -26,7 +26,7 @@ if ($info['error']) { <?php foreach ($org->getDynamicData() as $entry) { ?> <tr><td colspan="2" style="border-bottom: 1px dotted black"><strong><?php - echo $entry->getForm()->get('title'); ?></strong></td></tr> + echo $entry->getTitle(); ?></strong></td></tr> <?php foreach ($entry->getAnswers() as $a) { ?> <tr style="vertical-align:top"><td style="width:30%;border-bottom: 1px dotted #ccc"><?php echo Format::htmlchars($a->getField()->get('label')); ?>:</td>