elofgren: Instead of setting className= in NewsletterAdmin?'s save() and savenewsletter() functions (in order to fix an undefined variable problem earlier), set it to 'NewsletterType?' in save() and 'Newsletter' in savenewsletter(), and then use those values in both calls to DataObject::get_one() (merged from branches/gsoc)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41782 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-14 18:12:00 +00:00
parent 1eca17e0a9
commit 4c0681927d
2 changed files with 9 additions and 8 deletions

View File

@ -381,8 +381,11 @@ JS;
}
$brokenPageList .= "</ul>";
Notifications::notifyByEmail("BrokenLink", "Page_BrokenLinkEmail");
} else {
$brokenPageList = '';
}
$deleteList = '';
if( $folderID ) {
$remaining = DB::query("SELECT COUNT(*) FROM `File` WHERE `ParentID`=$folderID")->value();

View File

@ -442,11 +442,9 @@ class NewsletterAdmin extends LeftAndMain {
if( isset($_REQUEST['Type']) && $_REQUEST['Type'] == 'Newsletter' )
return $this->savenewsletter( $urlParams, $form );
// @TODO: Find the real fix for this.
$className = '';
$id = $_REQUEST['ID'];
$record = DataObject::get_one('NewsletterType', "`NewsletterType`.ID = $id");
$className = 'NewsletterType';
$record = DataObject::get_one($className, "`$className`.ID = $id");
// Is the template attached to the type, or the newsletter itself?
@ -463,10 +461,10 @@ class NewsletterAdmin extends LeftAndMain {
public function savenewsletter($urlParams, $form) {
$id = $_REQUEST['ID'];
// @TODO: Find the real fix for this.
$className = '';
$record = DataObject::get_one('Newsletter', "`$className`.ID = $id");
$className = 'Newsletter';
$record = DataObject::get_one($className, "`$className`.ID = $id");
// Is the template attached to the type, or the newsletter itself?
$type = $record->getNewsletterType();