<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Gives all the statues for conribution
- *
- * @access public
*/
public $_contributionStatusId;
/**
* Gives the HTML template of PDF Invoice
- *
- * @access public
*/
public $_messageInvoice;
/**
* This variable is used to assign parameters for HTML template of PDF Invoice
- *
- * @access public
*/
public $_invoiceTemplate;
* Build all the data structures needed to build the form
*
* @return void
- * @access public
*/
- function preProcess() {
+ public function preProcess() {
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
if ($id) {
$this->_contributionIds = array($id);
array(
'url' => $url,
'title' => ts('Search Results'),
- )
+ ),
);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
/**
* Build the form object
*
- * @access public
*
* @return void
*/
$this->addWysiwyg('email_comment', ts('If you would like to add personal message to email please add it here. (If sending to more then one receipient the same message will be sent to each contact.)'), array(
'rows' => 2,
- 'cols' => 40
+ 'cols' => 40,
));
- if ($this->_selectedOutput == 'email') {
- $this->addButtons(array(
- array(
- 'type' => 'upload',
- 'name' => ts('Email Invoice'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
- }
- else {
- $this->addButtons(array(
- array(
- 'type' => 'upload',
- 'name' => ts('Process Invoice(s)'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
- }
+ $this->addButtons(array(
+ array(
+ 'type' => 'upload',
+ 'name' => $this->_selectedOutput == 'email' ? ts('Send Email') : ts('Process Invoice(s)'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ )
+ );
}
/**
*
* @param array $values
*
- * @return array list of errors to be posted back to the form
- * @static
- * @access public
+ * @return array
+ * list of errors to be posted back to the form
*/
- static function formRule($values) {
+ public static function formRule($values) {
$errors = array();
if ($values['output'] == 'email_invoice' && empty($values['from_email_address'])) {
/**
* Process the form after the input has been submitted and validated
*
- * @access public
*
* @return void
*/
}
/**
- *
- * process the PDf and email with activity and attachment
+ * Process the PDf and email with activity and attachment
* on click of Print Invoices
*
- * @param array $contribIDs Contribution Id
- * @param array $params associated array of submitted values
- * @param array $contactIds Contact Id
- * @param CRM_Core_Form $form form object
- * @static
- *
+ * @param array $contribIDs
+ * Contribution Id.
+ * @param array $params
+ * Associated array of submitted values.
+ * @param array $contactIds
+ * Contact Id.
+ * @param CRM_Core_Form $form
+ * Form object.
*/
- static function printPDF($contribIDs, &$params, $contactIds, &$form) {
+ public static function printPDF($contribIDs, &$params, $contactIds, &$form) {
// get all the details needed to generate a invoice
$messageInvoice = array();
$invoiceTemplate = CRM_Core_Smarty::singleton();
CRM_Core_Error::fatal();
}
- $contribution = & $objects['contribution'];
+ $contribution = &$objects['contribution'];
$input['amount'] = $contribution->total_amount;
$input['invoice_id'] = $contribution->invoice_id;
CRM_Utils_PDF_Utils::html2pdf($messageInvoice, 'Invoice.pdf', FALSE, array(
'margin_top' => 10,
'margin_left' => 65,
- 'metric' => 'px'
+ 'metric' => 'px',
));
// functions call for adding activity with attachment
$fileName = self::putFile($html);
}
/**
+ * Add activity for Email Invoice and the PDF Invoice
*
- * This function is use for adding activity for
- * Email Invoice and the PDF Invoice
+ * @param string $subject
+ * Activity subject.
+ * @param array $contactIds
+ * Contact Id.
+ * @param string $fileName
+ * Gives the location with name of the file.
+ * @param array $params
+ * For invoices.
*
- * @param string $subject Activity subject
- * @param array $contactIds Contact Id
- * @param string $fileName gives the location with name of the file
- * @param array $params for invoices
- *
- * @access public
- * @static
*/
static public function addActivities($subject, $contactIds, $fileName, $params) {
$session = CRM_Core_Session::singleton();
'name'
);
}
- else{
+ else {
$activityTypeID = CRM_Core_OptionGroup::getValue('activity_type',
'Emailed Invoice',
'name'
}
/**
+ * Create the Invoice file in upload folder for attachment
*
- * This function is use for creating the Invoice file in upload folder
- * for attachment
- *
- * @param $html content for pdf in html format
- *
- * return $fileName of file which is in pdf format
+ * @param string $html
+ * Content for pdf in html format.
*
* @return string
+ * Name of file which is in pdf format
*/
static public function putFile($html) {
- require_once("packages/dompdf/dompdf_config.inc.php");
+ require_once "packages/dompdf/dompdf_config.inc.php";
spl_autoload_register('DOMPDF_autoload');
$doc = new DOMPDF();
$doc->load_html($html);
/**
* Callback to perform action on Print Invoice button.
*/
- static function getPrintPDF() {
+ public static function getPrintPDF() {
$contributionId = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
$contributionIDs = array($contributionId);
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE);
CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs, $params, $contactId, CRM_Core_DAO::$_nullObject);
}
}
-