Skip to content

Commit

Permalink
Merge pull request civicrm#19 from Parag18/VAT-416-Push
Browse files Browse the repository at this point in the history
VAT-416 Added display option for button on display preferences page.
  • Loading branch information
pradpnayak committed Jul 1, 2014
2 parents 68ef3c6 + 316c9cd commit 32b6da4
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CRM/Contact/Page/View/UserDashBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ function buildUserDashBoard() {
usort($dashboardElements, array('CRM_Utils_Sort', 'cmpFunc'));
$this->assign('dashboardElements', $dashboardElements);

// return true when 'Invoices / Credit Notes' checkbox is checked
$this->assign('invoices', $this->_userOptions['Invoices / Credit Notes']);

if (!empty($this->_userOptions['Groups'])) {
$this->assign('showGroup', TRUE);
//build group selector
Expand Down
18 changes: 18 additions & 0 deletions CRM/Contribute/xml/Menu/Contribute.xml
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,22 @@
<access_arguments>access CiviContribute,administer CiviCRM</access_arguments>
<adminGroup>CiviContribute</adminGroup>
</item>
<item>
<path>civicrm/contribute/invoice</path>
<title>CiviContributePdf</title>
<page_callback>CRM_Financial_Page_AJAX::getPrintPDF</page_callback>
<access_arguments>access CiviContribute</access_arguments>
<page_type>1</page_type>
<weight>620</weight>
<component>CiviContribute</component>
</item>
<item>
<path>civicrm/contribute/invoice/email</path>
<title>CiviContributePdf</title>
<page_callback>CRM_Contribute_Form_Task_Invoice</page_callback>
<access_arguments>access CiviContribute</access_arguments>
<page_type>1</page_type>
<weight>630</weight>
<component>CiviContribute</component>
</item>
</menu>
12 changes: 12 additions & 0 deletions CRM/Financial/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,4 +507,16 @@ static function getBatchSummary() {
echo json_encode($batchSummary);
CRM_Utils_System::civiExit();
}

/**
* Callback to perform action on Print Invoice button.
*/
static function getPrintPDF() {

$contribIDs = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
$contributionIDs = array($contribIDs);
$contactIds = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
$params = array('output' => 'pdf_invoice');
CRM_Contribute_Form_Task_Invoice::printPDF($contributionIDs , $params, $contactIds);
}
}
18 changes: 18 additions & 0 deletions css/civicrm.css
Original file line number Diff line number Diff line change
Expand Up @@ -4672,3 +4672,21 @@ span.crm-status-icon {
.crm-container .survey-completed {
text-decoration: line-through;
}

.crm-printButton {
padding-left: 469px;
}

.crm-invoiceButton {
text-shadow: 0 1px 0 black;
background: #70716B url(../i/crm-button-bg.gif) repeat-x top left;
color: #FFFFFF !important;
font-size: 13px;
font-weight: normal;
margin-right: 16px;
padding: 2px 6px;
text-decoration: none;
cursor: pointer;
border: 1px solid #3e3e3e;
border-radius: 3px 3px 3px 3px;
}
26 changes: 26 additions & 0 deletions templates/CRM/Contribute/Form/ContributionView.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
</a>
{/if}
{include file="CRM/common/formButtons.tpl" location="top"}
{assign var='emailUrlParams' value="reset=1&id=$id&cid=$contact_id&select=email"}
{assign var='invoiceUrlParams' value="reset=1&id=$id&cid=$contact_id"}
{if $contribution_status != 'Refunded'}
<div class="crm-printButton"><a class="button" href="{crmURL p='civicrm/contribute/invoice' q=$invoiceUrlParams}">
{ts}Print Invoice{/ts}</a>
<a class="button" href="{crmURL p='civicrm/contribute/invoice/email' q=$emailUrlParams}">
{ts}Email Invoice{/ts}</a></div>
{else}
<div class="crm-printButton"><a class="button" href="{crmURL p='civicrm/contribute/invoice' q=$invoiceUrlParams}">
{ts}Print invoice and Credit note{/ts}</a></div>
{/if}
</div>
</div>
<table class="crm-info-panel">
Expand Down Expand Up @@ -81,6 +92,12 @@
</td>
</tr>
{/if}
{if $tax_amount}
<tr>
<td class="label">{ts}Total Tax Amount{/ts}</td>
<td>{$tax_amount|crmMoney:$currency}</td>
</tr>
{/if}
{if $non_deductible_amount}
<tr>
<td class="label">{ts}Non-deductible Amount{/ts}</td>
Expand Down Expand Up @@ -306,5 +323,14 @@
class="icon delete-icon"></div>{ts}Delete{/ts}</span></a>
{/if}
{include file="CRM/common/formButtons.tpl" location="bottom"}
{if $contribution_status != 'Refunded'}
<div class="crm-printButton"><a class="button" href="{crmURL p='civicrm/contribute/invoice' q=$invoiceUrlParams}">
{ts}Print Invoice{/ts}</a>
<a class="button" href="{crmURL p='civicrm/contribute/invoice/email' q=$emailUrlParams}">
{ts}Email Invoice{/ts}</a></div>
{else}
<div class="crm-printButton"><a class="button" href="{crmURL p='civicrm/contribute/invoice' q=$invoiceUrlParams}">
{ts}Print invoice and Credit note{/ts}</a></div>
{/if}
</div>
</div>
15 changes: 15 additions & 0 deletions templates/CRM/Contribute/Page/UserDashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<th>{ts}Received date{/ts}</th>
<th>{ts}Receipt Sent{/ts}</th>
<th>{ts}Status{/ts}</th>
{if $invoices}
<th></th>
{/if}
</tr>

{foreach from=$contribute_rows item=row}
Expand All @@ -47,6 +50,18 @@
<td>{$row.receive_date|truncate:10:''|crmDate}</td>
<td>{$row.receipt_date|truncate:10:''|crmDate}</td>
<td>{$row.contribution_status}</td>
{if $invoices}
<td>
{assign var='urlParams' value="reset=1&id=$row.contribution_id&cid=$row.contact_id"}
<a class="crm-invoiceButton" href="{crmURL p='civicrm/contribute/invoice' q=$urlParams}">
{if $row.contribution_status != 'Refunded'}
<span>{ts}Print Invoice{/ts}</span>
{else}
<span>{ts}Print Credit Note{/ts}</span>
{/if}
</a>
</td>
{/if}
</tr>
{/foreach}
</table>
Expand Down
4 changes: 4 additions & 0 deletions xml/templates/civicrm_data.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ VALUES

-- for selection changes
(@option_group_id_act, '{ts escape="sql"}Change Registration{/ts}', 48, 'Change Registration', NULL, 1, NULL, 48, '{ts escape="sql"}Changes to an existing event registration.{/ts}', 0, 1, 1, @eventCompId, NULL),
-- for Print or Email Contribution Invoices
(@option_group_id_act, '{ts escape="sql"}Downloaded Invoice{/ts}', 49, 'Downloaded Invoice', NULL, 1, NULL, 49, '{ts escape="sql"}Downloaded Invoice.{/ts}',0, 1, 1, NULL, NULL),
(@option_group_id_act, '{ts escape="sql"}Emailed Invoice{/ts}', 50, 'Emailed Invoice', NULL, 1, NULL, 50, '{ts escape="sql"}Emailed Invoice.{/ts}',0, 1, 1, NULL, NULL),

(@option_group_id_gender, '{ts escape="sql"}Female{/ts}', 1, 'Female', NULL, 0, NULL, 1, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_gender, '{ts escape="sql"}Male{/ts}', 2, 'Male', NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL),
Expand Down Expand Up @@ -507,6 +510,7 @@ VALUES
(@option_group_id_udOpt, '{ts escape="sql"}Pledges{/ts}' , 7, 'CiviPledge', NULL, 0, NULL, 7, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_udOpt, '{ts escape="sql"}Personal Campaign Pages{/ts}' , 8, 'PCP', NULL, 0, NULL, 8, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_udOpt, '{ts escape="sql"}Assigned Activities{/ts}' , 9, 'Assigned Activities', NULL, 0, NULL, 9, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_udOpt, '{ts escape="sql"}Invoices / Credit Notes{/ts}' , 10, 'Invoices / Credit Notes', NULL, 0, NULL, 10, NULL, 0, 0, 1, NULL, NULL),

(@option_group_id_acsOpt, '{ts escape="sql"}Email Address{/ts}' , 2, 'email' , NULL, 0, NULL, 2, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_acsOpt, '{ts escape="sql"}Phone{/ts}' , 3, 'phone' , NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
Expand Down

0 comments on commit 32b6da4

Please sign in to comment.