public function make_draft()
    {
        if (!userHasPermission('admin:invoice:invoice:edit')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        $oUri     = Factory::service('Uri');
        $oInvoice = $this->oInvoiceModel->getById($oUri->segment(5));
        if (!$oInvoice) {
            show404();
        }

        // --------------------------------------------------------------------------

        //  Allow getting a constant
        $oInvoiceModel = $this->oInvoiceModel;

        $aData = [
            'state' => $oInvoiceModel::STATE_DRAFT,
        ];
        if ($this->oInvoiceModel->update($oInvoice->id, $aData)) {
            $sStatus  = 'success';
            $sMessage = 'Invoice updated successfully!';
        } else {
            $sStatus  = 'error';
            $sMessage = 'Invoice failed to update invoice. ' . $this->oInvoiceModel->lastError();
        }

        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->setFlashData($sStatus, $sMessage);

        redirect('admin/invoice/invoice/edit/' . $oInvoice->id);
    }