-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix possibility to download receipts (not invoices) in CRM admin
remp/helpdesk#1073
- Loading branch information
Showing
5 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Components/DownloadReceiptButton/ReceiptAdminButtonFactory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Crm\InvoicesModule\Components; | ||
|
||
use Crm\ApplicationModule\Widget\WidgetFactoryInterface; | ||
use Crm\ApplicationModule\Widget\WidgetInterface; | ||
use Crm\ApplicationModule\Widget\WidgetManager; | ||
|
||
class ReceiptAdminButtonFactory implements WidgetFactoryInterface | ||
{ | ||
protected $widgetManager; | ||
|
||
public function __construct( | ||
WidgetManager $widgetManager | ||
) { | ||
$this->widgetManager = $widgetManager; | ||
} | ||
|
||
public function create(): WidgetInterface | ||
{ | ||
$receiptButton = new DownloadReceiptButton($this->widgetManager); | ||
$receiptButton->setAdmin(); | ||
return $receiptButton; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Components/DownloadReceiptButton/download_receipt_button.latte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
{if $showButton} | ||
{if $admin} | ||
<a href="{plink :Invoices:ReceiptsAdmin:downloadReceipt $paymentId}" class="btn btn-sm btn-primary"> | ||
<i class="fa fa-download"></i> {_invoices.frontend.invoice_button.download} | ||
</a> | ||
{else} | ||
<a href="{plink ':Invoices:Receipts:downloadReceipt' $paymentId}" class="btn btn-sm btn-primary"> | ||
<i class="fa fa-download"></i> {_invoices.frontend.download_receipt} | ||
</a> | ||
{/if} | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters