/** * Validate an Invoice ID * * Verifies that the invoice exists. * * @param array $config Field configuration * @param string $data Field data * @return InvoiceDBO Invoice DBO for this Invoice ID * @throws RecordNotFoundException */ public function validate($data) { $data = parent::validate($data); try { $invoiceDBO = load_InvoiceDBO(intval($data)); } catch (DBNoRowsFoundException $e) { throw new RecordNotFoundException("Invoice"); } return $invoiceDBO; }
/** * Touch Invoice * * When a line item is added to an Invoice we must "touch" the Invoice to make * sure it's oustanding flag gets set properly. */ function touchInvoice() { $invoicedbo = load_InvoiceDBO($this->invoiceid); update_InvoiceDBO($invoicedbo); }
/** * Touch Invoice * * When a line item is added to an Invoice we must "touch" the Invoice to make * sure it's oustanding flag gets set properly. */ function touchInvoice() { if (!($this->invoiceid > 0)) { // No invoice to touch! return; } // Update the invoice record $invoicedbo = load_InvoiceDBO($this->invoiceid); update_InvoiceDBO($invoicedbo); }