mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
merge downloads into single action for e invoices
This commit is contained in:
parent
035b683eb7
commit
44956ce6b8
@ -252,11 +252,20 @@ class InvoiceController extends Controller
|
|||||||
// create new archive
|
// create new archive
|
||||||
$zipFile = new \PhpZip\ZipFile();
|
$zipFile = new \PhpZip\ZipFile();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
foreach ($invoices as $invoice) {
|
foreach ($invoices as $invoice) {
|
||||||
//add it to the zip
|
|
||||||
$zipFile->addFromString(basename($invoice->pdf_file_path()), file_get_contents($invoice->pdf_file_path(null, 'url', true)));
|
if ($invoice->client->getSetting('enable_e_invoice')) {
|
||||||
|
$xml = $invoice->service()->getEInvoice();
|
||||||
|
$zipFile->addFromString($invoice->getFileName("xml"), $xml);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $invoice->service()->getRawInvoicePdf();
|
||||||
|
$zip_file_name = $invoice->getFileName();
|
||||||
|
$zipFile->addFromString($zip_file_name, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$filename = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip';
|
$filename = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.invoices')).'.zip';
|
||||||
$filepath = sys_get_temp_dir().'/'.$filename;
|
$filepath = sys_get_temp_dir().'/'.$filename;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
@csrf
|
@csrf
|
||||||
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
|
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
|
||||||
@csrf
|
@csrf
|
||||||
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" class="button button-primary bg-secondary" name="action-xml" value="download">{{ ctrans('texts.download_xml') }}</button>
|
|
||||||
@if(!empty(auth()->user()->client->service()->getPaymentMethods(0)))
|
@if(!empty(auth()->user()->client->service()->getPaymentMethods(0)))
|
||||||
<button onclick="setTimeout(() => this.disabled = true, 0); return true;" type="submit" class="button button-primary bg-primary" name="action" value="payment">{{ ctrans('texts.pay_now') }}</button>
|
<button onclick="setTimeout(() => this.disabled = true, 0); return true;" type="submit" class="button button-primary bg-primary" name="action" value="payment">{{ ctrans('texts.pay_now') }}</button>
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user