public function CustomerForm()
    {
        // If no estimate found, generate error
        if (!$this->hasEstimate()) {
            return $this->redirect($this->Link("noestimate"));
        }

        $session = $this
            ->getRequest()
            ->getSession();

        $member = Security::getCurrentUser();
        $contact = ($member) ? $member->Contact() : $member;

        $form = CustomerDetailsForm::create(
            $this,
            'CustomerForm',
            $this->getEstimate()
        );

        $data = $session->get("Checkout." . $form->FormName() . ".data");
        
        if (is_array($data)) {
            $form->loadDataFrom($data);
        } elseif ($contact) {
            // Fill email, phone, etc
            $form->loadDataFrom($contact);
            
            // Then fill with Address info
            if($contact->DefaultLocation()) {
                $form->loadDataFrom($contact->DefaultLocation());
            }
        }

        $this->extend("updateCustomerForm", $form);

        return $form;
    }
public function CustomerForm()
    {
        // If no estimate found, generate error
        if (!$this->hasEstimate()) {
            return $this->redirect($this->Link("noestimate"));
        }

        $session = $this
            ->getRequest()
            ->getSession();

        $member = Security::getCurrentUser();
        $contact = ($member) ? $member->Contact() : $member;

        $form = CustomerDetailsForm::create(
            $this,
            'CustomerForm',
            $this->getEstimate()
        );

        $data = $session->get("Checkout." . $form->FormName() . ".data");
        
        if (is_array($data)) {
            $form->loadDataFrom($data);
        } elseif ($contact) {
            // Fill email, phone, etc
            $form->loadDataFrom($contact);
            
            // Then fill with Address info
            if($contact->DefaultLocation()) {
                $form->loadDataFrom($contact->DefaultLocation());
            }
        }

        $this->extend("updateCustomerForm", $form);

        return $form;
    }
public function CustomerForm ( ) { // If no estimate found, generate error if ( ! $ this -> hasEstimate ( ) ) { return $ this -> redirect ( $ this -> Link ( "noestimate" ) ) ; } $ session = $ this -> getRequest ( ) -> getSession ( ) ; $ member = Security :: getCurrentUser ( ) ; $ contact = ( $ member ) ? $ member -> Contact ( ) : $ member ; $ form = CustomerDetailsForm :: create ( $ this , 'CustomerForm' , $ this -> getEstimate ( ) ) ; $ data = $ session -> get ( "Checkout." . $ form -> FormName ( ) . ".data" ) ; if ( is_array ( $ data ) ) { $ form -> loadDataFrom ( $ data ) ; } elseif ( $ contact ) { // Fill email, phone, etc $ form -> loadDataFrom ( $ contact ) ; // Then fill with Address info if ( $ contact -> DefaultLocation ( ) ) { $ form -> loadDataFrom ( $ contact -> DefaultLocation ( ) ) ; } } $ this -> extend ( "updateCustomerForm" , $ form ) ; return $ form ; }
Form to capture the customers details

@return CustomerDetailsForm
Form to capture the customers details