X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FTask%2FInvoice.php;h=776362dff90752c781f9101edc4ab1c3c32924a4;hb=1273d77c64386bcc2f5da087cefaa0c480fb02e0;hp=1debcaa6c4917b6faa8a4d4c72d793eca6ab9f81;hpb=926fc8be309aa0131138cdbfa8f1fe0e17968678;p=civicrm-core.git diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index 1debcaa6c4..776362dff9 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -25,6 +25,9 @@ +--------------------------------------------------------------------+ */ +use Dompdf\Dompdf; +use Dompdf\Options; + /** * * @package CRM @@ -220,7 +223,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { */ public function postProcess() { $params = $this->controller->exportValues($this->_name); - $this->printPDF($this->_contributionIds, $params, $this->_contactIds, $this); + self::printPDF($this->_contributionIds, $params, $this->_contactIds); } /** @@ -232,10 +235,8 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * Associated array of submitted values. * @param array $contactIds * Contact Id. - * @param CRM_Core_Form $form - * Form object. */ - public static function printPDF($contribIDs, &$params, $contactIds, &$form) { + public static function printPDF($contribIDs, &$params, $contactIds) { // get all the details needed to generate a invoice $messageInvoice = array(); $invoiceTemplate = CRM_Core_Smarty::singleton(); @@ -319,14 +320,11 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $dueDate = date('F j ,Y', strtotime($contributionReceiveDate . "+" . $prefixValue['due_date'] . "" . $prefixValue['due_date_period'])); if ($input['component'] == 'contribute') { - $eid = $contribID; - $etable = 'contribution'; - $lineItem = CRM_Price_BAO_LineItem::getLineItems($eid, $etable, NULL, TRUE, TRUE); + $lineItem = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contribID); } else { $eid = $contribution->_relatedObjects['participant']->id; - $etable = 'participant'; - $lineItem = CRM_Price_BAO_LineItem::getLineItems($eid, $etable, NULL, TRUE, FALSE, '', TRUE); + $lineItem = CRM_Price_BAO_LineItem::getLineItems($eid, 'participant', NULL, TRUE, FALSE, TRUE); } //TO DO: Need to do changes for partially paid to display amount due on PDF invoice @@ -642,8 +640,10 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * Name of file which is in pdf format */ static public function putFile($html, $name = 'Invoice.pdf') { - require_once "vendor/dompdf/dompdf/dompdf_config.inc.php"; - $doc = new DOMPDF(); + $options = new Options(); + $options->set('isRemoteEnabled', TRUE); + + $doc = new DOMPDF($options); $doc->load_html($html); $doc->render(); $html = $doc->output(); @@ -661,7 +661,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $contributionIDs = array($contributionId); $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE); $params = array('output' => 'pdf_invoice'); - CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs, $params, $contactId, CRM_Core_DAO::$_nullObject); + CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs, $params, $contactId); } }