<?php

/**
 *
 * @see Waindigo_Invoices_Model_Invoice
 */
class Waindigo_InfusionsoftApi_Extend_Waindigo_Invoices_Model_Invoice extends XFCP_Waindigo_InfusionsoftApi_Extend_Waindigo_Invoices_Model_Invoice
{

    /**
     * Gets the specified invoice ID by Infusionsoft order ID.
     *
     * @param integer $orderId
     *
     * @return int
     */
    public function getInvoiceIdByInfusionsoftOrderId($orderId)
    {
        if (empty($orderId)) {
            return false;
        }

        return $this->_getDb()->fetchOne(
            '
			SELECT invoice_id
			FROM invoice_waindigo
			WHERE infusionsoft_invoice_id_waindigo = ?
		', $orderId);
    }
}