You are here

public function InvoiceRestModel::mapToNode in Invoice 7

Maps the model to the specified node

Parameters

object $node:

File

./invoice_classes.inc, line 93

Class

InvoiceRestModel
REST invoice model that is used for binding request data and returning the entity result

Code

public function mapToNode($node) {

  // Set invoice properties
  $node->template = $this->template;
  $node->invoice_invoice_number_zerofill = $this->leading_zeros;
  $node->invoice_invoice_number_prefix = $this->prefix;
  $node->invoice_description = $this->description;
  $node->pay_limit = $this->pay_limit;
  $node->pay_status = $this->pay_status;

  // Set customer
  $customer = (object) $this->customer;
  $node->customer_number = $customer->customer_number;
  $node->company_name = $customer->company_name;
  $node->firstname = $customer->firstname;
  $node->lastname = $customer->lastname;
  $node->street = $customer->street;
  $node->building_number = $customer->building_number;
  $node->zipcode = $customer->zipcode;
  $node->city = $customer->city;
  $node->state = $customer->state;
  $node->country = $customer->country;
  $node->coc_number = $customer->coc_number;
  $node->vat_number = $customer->vat_number;
  $node->customer_description = $customer->description;
  $node->description = $customer->description;

  // Set items
  $node->invoice_items = $this->items;
}