From 76627295701b25511a739eaf243e019230e810d9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 24 Mar 2015 17:26:39 +0200 Subject: [PATCH 1/3] Fixed footer location and added Quetzal --- app/controllers/InvoiceController.php | 6 +++--- app/database/seeds/ConstantsSeeder.php | 2 +- public/built.js | 1 + public/js/script.js | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/InvoiceController.php b/app/controllers/InvoiceController.php index 6d6598842256..a43de084d5bc 100755 --- a/app/controllers/InvoiceController.php +++ b/app/controllers/InvoiceController.php @@ -398,7 +398,7 @@ class InvoiceController extends \BaseController } if (!empty(Input::get('pdfupload')) && strpos(Input::get('pdfupload'), 'data:application/pdf;base64,') === 0) { - $this->storePDF(Input::get('pdfupload'), $input->invoice->public_id); + $this->storePDF(Input::get('pdfupload'), $invoice->id); } if ($action == 'clone') { @@ -544,11 +544,11 @@ class InvoiceController extends \BaseController return View::make('invoices.history', $data); } - private function storePDF($encodedString, $public_id) + private function storePDF($encodedString, $invoiceId) { $uploadsDir = storage_path().'/pdfcache/'; $encodedString = str_replace('data:application/pdf;base64,', '', $encodedString); - $name = 'cache-'.$public_id.'.pdf'; + $name = 'cache-'.$invoiceId.'.pdf'; if (file_put_contents($uploadsDir.$name, base64_decode($encodedString)) !== false) { $finfo = new finfo(FILEINFO_MIME); diff --git a/app/database/seeds/ConstantsSeeder.php b/app/database/seeds/ConstantsSeeder.php index 53e3a26cf6d8..be6b33c4a652 100755 --- a/app/database/seeds/ConstantsSeeder.php +++ b/app/database/seeds/ConstantsSeeder.php @@ -139,7 +139,7 @@ class ConstantsSeeder extends Seeder Currency::create(array('name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => 'VND ', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.')); Currency::create(array('name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF ', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.')); - + Currency::create(array('name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.')); DatetimeFormat::create(array('format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013')); DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013')); diff --git a/public/built.js b/public/built.js index a07bb5754085..48468f6878dd 100644 --- a/public/built.js +++ b/public/built.js @@ -31609,6 +31609,7 @@ function GetPdf(invoice, javascript){ doc.setFontSize('8'); SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc); var top = doc.internal.pageSize.height - layout.marginLeft; + if (!invoice.is_pro) top -= 25; var numLines = invoice.invoice_footer.split("\n").length - 1; doc.text(layout.marginLeft, top - (numLines * 8), invoice.invoice_footer); } diff --git a/public/js/script.js b/public/js/script.js index eecfa9302546..4b0d64875d6a 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -86,6 +86,7 @@ function GetPdf(invoice, javascript){ doc.setFontSize('8'); SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc); var top = doc.internal.pageSize.height - layout.marginLeft; + if (!invoice.is_pro) top -= 25; var numLines = invoice.invoice_footer.split("\n").length - 1; doc.text(layout.marginLeft, top - (numLines * 8), invoice.invoice_footer); } From 13994f98a839f4739529a22c9a0a16623a78ebc9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 24 Mar 2015 18:07:48 +0200 Subject: [PATCH 2/3] Changed PDF attachment to use private id --- app/ninja/mailers/Mailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ninja/mailers/Mailer.php b/app/ninja/mailers/Mailer.php index 20b7d5b11f7a..9a7788ff2c3f 100755 --- a/app/ninja/mailers/Mailer.php +++ b/app/ninja/mailers/Mailer.php @@ -25,7 +25,7 @@ class Mailer $invoice = Invoice::find($data['id']); $invoice->load('account'); $accountAttributes = $invoice->account()->getParent()->getRelations()['account']->getAttributes(); - $pdfPath = storage_path().'/pdfcache/cache-'.$invoice->getAttributes()['public_id'].'.pdf'; + $pdfPath = storage_path().'/pdfcache/cache-'.$invoice->id.'.pdf'; if($accountAttributes['pdf_email_attachment'] === 1 && file_exists($pdfPath)) { $message->attach( From a014bf313cc1a50b09e1453813b35637f3872c9c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 25 Mar 2015 17:52:01 +0200 Subject: [PATCH 3/3] Fixed issue related to using multiple gateways --- app/controllers/PaymentController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index c0241a8979fe..4f74c8575a6b 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -328,7 +328,9 @@ class PaymentController extends \BaseController } else { return self::do_payment($invitationKey, false); } - } + } else { + Session::put('payment_type', PAYMENT_TYPE_ANY); + } $invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); $invoice = $invitation->invoice;