Magento无效 - 方法Mage_Sales_Model_Order :: assignCustomer

Basically, im trying to make a finance section on magento, I have looked into how to place an order as part of the finance submission, everywhere I look uses the code below (Not exact):

$order = Mage::getModel('sales/order');
$store = Mage::app()->getStore();
$website_id = Mage::app()->getWebsite()->getStoreId();
$quote = Mage::getModel('sales/order')->setStoreId($store->getId());
$customer = Mage::getSingleton('customer/session')->getCustomer();
$quote->assignCustomer($customer);
$quote->setSendCconfirmation(1);
$product_ids = array();
$cart = Mage::getModel('checkout/cart')->getQuote();

foreach($cart->getAllVisibleItems() as $item) {
    $quote->addProduct($item->getProduct() , $item->getQty());
}

$shipping = $quote->getShippingAddress();
$shipping->setCollectShippingRates(true)->collectShippingRates()->setShippingMethod('flatrate_flatrate')->setPaymentMethod(array(
    'method' => 'checkmo'
));
try {
    $service = Mage::getModel('sales/service_quote', $quote);
    $service->submitAll();
    $increment_id = $service->getOrder()->getRealOrderId();
}

catch(Exception $e) {
    die($e->getMessage());
}

catch(Mage_Core_Exception $d) {
    die($d->getMessage());
}

And for some reason i keep getting this error:

this is the exception screen.

I was loading the customer from session, and not supplying the correct model as an argument , for anyone also looking for this answer;

$customer = Mage::getModel('customer/customer')->loadByEmail(Mage::getSingleton('customer/session')->getCustomer()->getEmail());