From aecace74cad82c8cc81d5ed1ebea2bfe4df7723b Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 26 Nov 2002 01:01:40 +0000 Subject: [PATCH] Code cleanup. --- lib/WebGUI/Wobject/MailForm.pm | 48 +++++++++++++++------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/lib/WebGUI/Wobject/MailForm.pm b/lib/WebGUI/Wobject/MailForm.pm index adda5d2f5..e853e9fce 100755 --- a/lib/WebGUI/Wobject/MailForm.pm +++ b/lib/WebGUI/Wobject/MailForm.pm @@ -32,45 +32,39 @@ our @fields = qw(width fromField fromStatus toField toStatus #------------------------------------------------------------------- sub duplicate { - my ($w, %data, $newFieldId, $sth); + my ($w, %data, $sth); tie %data, 'Tie::CPHash'; $w = $_[0]->SUPER::duplicate($_[1]); $w = WebGUI::Wobject::MailForm->new({wobjectId=>$w,namespace=>$namespace}); $w->set({ width=>$_[0]->get("width"), - fromField=>$_[0]->get("fromField"), - fromStatus=>$_[0]->get("fromStatus"), - toField=>$_[0]->get("toField"), - toStatus=>$_[0]->get("toStatus"), - ccField=>$_[0]->get("ccField"), - ccStatus=>$_[0]->get("ccStatus"), - bccField=>$_[0]->get("bccField"), - bccStatus=>$_[0]->get("bccStatus"), - subjectField=>$_[0]->get("subjectField"), - subjectStatus=>$_[0]->get("subjectStatus"), + fromField=>$_[0]->get("fromField"), + fromStatus=>$_[0]->get("fromStatus"), + toField=>$_[0]->get("toField"), + toStatus=>$_[0]->get("toStatus"), + ccField=>$_[0]->get("ccField"), + ccStatus=>$_[0]->get("ccStatus"), + bccField=>$_[0]->get("bccField"), + bccStatus=>$_[0]->get("bccStatus"), + subjectField=>$_[0]->get("subjectField"), + subjectStatus=>$_[0]->get("subjectStatus"), acknowledgement=>$_[0]->get("acknowledgement"), storeEntries=>$_[0]->get("storeEntries"), - }); + }); $sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId")); - while (%data = $sth->hash) { - $newFieldId = getNextId("MailForm_fieldId"); - WebGUI::SQL->write( - "insert into MailForm_field values (".$w->get("wobjectId").", $newFieldId, $data{sequenceNumber}, ". - quote($data{name}).", ". - quote($data{status}).", ". - quote($data{type}).", ". - quote($data{possibleValues}).", ". - quote($data{defaultValue}).")" ); - } - $sth->finish; + while (%data = $sth->hash) { + $data{MailForm_fieldId} = "new"; + $w->setCollateral("MailForm_field","MailForm_fieldId",\%data); + } + $sth->finish; } #------------------------------------------------------------------- sub purge { - WebGUI::SQL->write("delete from MailForm_field where wobjectId=".$_[0]->get("wobjectId")); - WebGUI::SQL->write("delete from MailForm_entry where wobjectId=".$_[0]->get("wobjectId")); - WebGUI::SQL->write("delete from MailForm_entryData where wobjectId=".$_[0]->get("wobjectId")); - $_[0]->SUPER::purge(); + WebGUI::SQL->write("delete from MailForm_field where wobjectId=".$_[0]->get("wobjectId")); + WebGUI::SQL->write("delete from MailForm_entry where wobjectId=".$_[0]->get("wobjectId")); + WebGUI::SQL->write("delete from MailForm_entryData where wobjectId=".$_[0]->get("wobjectId")); + $_[0]->SUPER::purge(); } #-------------------------------------------------------------------