Bug fixes

This commit is contained in:
Hillel Coren 2015-11-03 00:05:28 +02:00
parent 1ae35b853a
commit c3d43ab480
6 changed files with 27 additions and 15 deletions

View File

@ -524,6 +524,11 @@ class PaymentController extends BaseController
return Redirect::to($invitation->getLink()); return Redirect::to($invitation->getLink());
} }
// PayFast transaction referencce
if ($accountGateway->isGateway(GATEWAY_PAYFAST) && Request::has('pt')) {
$token = Request::query('pt');
}
try { try {
if (method_exists($gateway, 'completePurchase') && !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)) { if (method_exists($gateway, 'completePurchase') && !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)) {
$details = $this->paymentService->getPaymentDetails($invitation, $accountGateway); $details = $this->paymentService->getPaymentDetails($invitation, $accountGateway);
@ -592,19 +597,11 @@ class PaymentController extends BaseController
private function error($type, $error, $accountGateway, $exception = false) private function error($type, $error, $accountGateway, $exception = false)
{ {
if (!$error) {
if ($exception) {
$error = $exception->getMessage();
} else {
$error = trans('texts.payment_error');
}
}
$message = ''; $message = '';
if ($accountGateway && $accountGateway->gateway) { if ($accountGateway && $accountGateway->gateway) {
$message = $accountGateway->gateway->name . ': '; $message = $accountGateway->gateway->name . ': ';
} }
$message .= $error; $message .= $error ?: trans('texts.payment_error');
Session::flash('error', $message); Session::flash('error', $message);
Utils::logError("Payment Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message)); Utils::logError("Payment Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message));

View File

@ -235,6 +235,9 @@ class InvoiceRepository extends BaseRepository
$entityType = ENTITY_QUOTE; $entityType = ENTITY_QUOTE;
} }
$invoice = $account->createInvoice($entityType, $data['client_id']); $invoice = $account->createInvoice($entityType, $data['client_id']);
if (isset($data['has_tasks']) && $data['has_tasks']) {
$invoice->has_tasks = true;
}
} else { } else {
$invoice = Invoice::scope($publicId)->firstOrFail(); $invoice = Invoice::scope($publicId)->firstOrFail();
} }
@ -258,7 +261,6 @@ class InvoiceRepository extends BaseRepository
$invoice->is_amount_discount = $data['is_amount_discount'] ? true : false; $invoice->is_amount_discount = $data['is_amount_discount'] ? true : false;
$invoice->partial = round(Utils::parseFloat($data['partial']), 2); $invoice->partial = round(Utils::parseFloat($data['partial']), 2);
$invoice->invoice_date = isset($data['invoice_date_sql']) ? $data['invoice_date_sql'] : Utils::toSqlDate($data['invoice_date']); $invoice->invoice_date = isset($data['invoice_date_sql']) ? $data['invoice_date_sql'] : Utils::toSqlDate($data['invoice_date']);
$invoice->has_tasks = isset($data['has_tasks']) ? ($data['has_tasks'] ? true : false) : false;
if ($invoice->is_recurring) { if ($invoice->is_recurring) {
if ($invoice->start_date && $invoice->start_date != Utils::toSqlDate($data['start_date'])) { if ($invoice->start_date && $invoice->start_date != Utils::toSqlDate($data['start_date'])) {

View File

@ -31627,6 +31627,12 @@ function GetPdfMake(invoice, javascript, callback) {
} }
} }
if (key === 'footer') {
return function(page, pages) {
return page === pages ? val : '';
}
}
// check for markdown // check for markdown
if (key === 'text') { if (key === 'text') {
val = NINJA.parseMarkdownText(val, true); val = NINJA.parseMarkdownText(val, true);

View File

@ -54,6 +54,13 @@ function GetPdfMake(invoice, javascript, callback) {
} }
} }
// only show the footer on the last page
if (key === 'footer') {
return function(page, pages) {
return page === pages ? val : '';
}
}
// check for markdown // check for markdown
if (key === 'text') { if (key === 'text') {
val = NINJA.parseMarkdownText(val, true); val = NINJA.parseMarkdownText(val, true);

View File

@ -760,7 +760,7 @@
@endif @endif
$('#clientModal').on('shown.bs.modal', function () { $('#clientModal').on('shown.bs.modal', function () {
$('#name').focus(); $('#client\\[name\\]').focus();
}).on('hidden.bs.modal', function () { }).on('hidden.bs.modal', function () {
if (model.clientBackup) { if (model.clientBackup) {
model.loadClient(model.clientBackup); model.loadClient(model.clientBackup);

View File

@ -228,7 +228,7 @@ function InvoiceModel(data) {
self.balance = ko.observable(0); self.balance = ko.observable(0);
self.invoice_design_id = ko.observable(1); self.invoice_design_id = ko.observable(1);
self.partial = ko.observable(0); self.partial = ko.observable(0);
self.has_tasks = ko.observable(false); self.has_tasks = ko.observable();
self.custom_value1 = ko.observable(0); self.custom_value1 = ko.observable(0);
self.custom_value2 = ko.observable(0); self.custom_value2 = ko.observable(0);