mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added support for Dwolla
This commit is contained in:
parent
2e39bfaba1
commit
060a14736b
@ -57,9 +57,9 @@ class SendRecurringInvoices extends Command
|
|||||||
$invoice->invoice_date = date_create()->format('Y-m-d');
|
$invoice->invoice_date = date_create()->format('Y-m-d');
|
||||||
$invoice->discount = $recurInvoice->discount;
|
$invoice->discount = $recurInvoice->discount;
|
||||||
$invoice->po_number = $recurInvoice->po_number;
|
$invoice->po_number = $recurInvoice->po_number;
|
||||||
$invoice->public_notes = $recurInvoice->public_notes;
|
$invoice->public_notes = Utils::processVariables($recurInvoice->public_notes);
|
||||||
$invoice->terms = $recurInvoice->terms;
|
$invoice->terms = Utils::processVariables($recurInvoice->terms);
|
||||||
$invoice->invoice_footer = $recurInvoice->invoice_footer;
|
$invoice->invoice_footer = Utils::processVariables($recurInvoice->invoice_footer);
|
||||||
$invoice->tax_name = $recurInvoice->tax_name;
|
$invoice->tax_name = $recurInvoice->tax_name;
|
||||||
$invoice->tax_rate = $recurInvoice->tax_rate;
|
$invoice->tax_rate = $recurInvoice->tax_rate;
|
||||||
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
|
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
|
||||||
|
@ -10,7 +10,7 @@ use View;
|
|||||||
use Validator;
|
use Validator;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use URL;
|
use URL;
|
||||||
|
use Utils;
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\AccountGateway;
|
use App\Models\AccountGateway;
|
||||||
@ -198,9 +198,14 @@ class AccountGatewayController extends BaseController
|
|||||||
|
|
||||||
$gateway = Gateway::findOrFail($gatewayId);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
|
$optional = array_merge(Gateway::$hiddenFields, Gateway::$optionalFields);
|
||||||
|
|
||||||
|
if (Utils::isNinja() && $gatewayId == GATEWAY_DWOLLA) {
|
||||||
|
$optional = array_merge($optional, ['key', 'secret']);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($fields as $field => $details) {
|
foreach ($fields as $field => $details) {
|
||||||
if (!in_array($field, array_merge(Gateway::$hiddenFields, Gateway::$optionalFields))) {
|
if (!in_array($field, $optional)) {
|
||||||
if (strtolower($gateway->name) == 'beanstream') {
|
if (strtolower($gateway->name) == 'beanstream') {
|
||||||
if (in_array($field, ['merchant_id', 'passCode'])) {
|
if (in_array($field, ['merchant_id', 'passCode'])) {
|
||||||
$rules[$gateway->id.'_'.$field] = 'required';
|
$rules[$gateway->id.'_'.$field] = 'required';
|
||||||
|
@ -59,10 +59,14 @@ class InvoiceController extends BaseController
|
|||||||
'columns' => Utils::trans(['checkbox', 'invoice_number', 'client', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status', 'action']),
|
'columns' => Utils::trans(['checkbox', 'invoice_number', 'client', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status', 'action']),
|
||||||
];
|
];
|
||||||
|
|
||||||
$recurringInvoices = Invoice::scope()->where('is_recurring', '=', true);
|
$recurringInvoices = Invoice::scope()
|
||||||
|
->where('is_recurring', '=', true);
|
||||||
|
|
||||||
if (Session::get('show_trash:invoice')) {
|
if (Session::get('show_trash:invoice')) {
|
||||||
$recurringInvoices->withTrashed();
|
$recurringInvoices->withTrashed();
|
||||||
|
} else {
|
||||||
|
$recurringInvoices->join('clients', 'clients.id', '=', 'invoices.client_id')
|
||||||
|
->where('clients.deleted_at', '=', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($recurringInvoices->count() > 0) {
|
if ($recurringInvoices->count() > 0) {
|
||||||
|
@ -205,7 +205,9 @@ class PaymentController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($accountGateway->gateway->id == GATEWAY_DWOLLA && isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET'])) {
|
if ($accountGateway->gateway->id == GATEWAY_DWOLLA && isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET'])) {
|
||||||
$gateway->setKeySecret($_ENV['DWOLLA_KEY'], $_ENV['DWOLLA_SECRET']);
|
$gateway->setKey($_ENV['DWOLLA_KEY']);
|
||||||
|
$gateway->setSecret($_ENV['DWOLLA_SECRET']);
|
||||||
|
$gateway->setSandbox(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $gateway;
|
return $gateway;
|
||||||
@ -272,6 +274,7 @@ class PaymentController extends BaseController
|
|||||||
'amount' => $invoice->getRequestedAmount(),
|
'amount' => $invoice->getRequestedAmount(),
|
||||||
'card' => $card,
|
'card' => $card,
|
||||||
'currency' => $currencyCode,
|
'currency' => $currencyCode,
|
||||||
|
'redirect' => URL::to('complete'), // Dwolla: remove
|
||||||
'returnUrl' => URL::to('complete'),
|
'returnUrl' => URL::to('complete'),
|
||||||
'cancelUrl' => $invitation->getLink(),
|
'cancelUrl' => $invitation->getLink(),
|
||||||
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
|
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
|
||||||
@ -470,7 +473,7 @@ class PaymentController extends BaseController
|
|||||||
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
|
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
|
||||||
|
|
||||||
$license = License::where('license_key', '=', $licenseKey)
|
$license = License::where('license_key', '=', $licenseKey)
|
||||||
->where('is_claimed', '<', 3)
|
->where('is_claimed', '<', 5)
|
||||||
->where('product_id', '=', $productId)
|
->where('product_id', '=', $productId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
@ -506,6 +509,7 @@ class PaymentController extends BaseController
|
|||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Input::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
Utils::logError('Payment Error [invalid]');
|
||||||
return Redirect::to('payment/'.$invitationKey)
|
return Redirect::to('payment/'.$invitationKey)
|
||||||
->withErrors($validator);
|
->withErrors($validator);
|
||||||
}
|
}
|
||||||
@ -530,7 +534,7 @@ class PaymentController extends BaseController
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$gateway = self::createGateway($accountGateway);
|
$gateway = self::createGateway($accountGateway);
|
||||||
$details = self::getPaymentDetails($invitation, $useToken || !$onSite ? false : Input::all());
|
$details = self::getPaymentDetails($invitation, ($useToken || !$onSite) ? false : Input::all());
|
||||||
|
|
||||||
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
||||||
if ($useToken) {
|
if ($useToken) {
|
||||||
@ -555,6 +559,10 @@ class PaymentController extends BaseController
|
|||||||
|
|
||||||
$token->token = $cardReference;
|
$token->token = $cardReference;
|
||||||
$token->save();
|
$token->save();
|
||||||
|
} else {
|
||||||
|
Session::flash('error', $tokenResponse->getMessage());
|
||||||
|
Utils::logError('Payment Error [no-token-ref]: ' . $tokenResponse->getMessage());
|
||||||
|
return Redirect::to('payment/'.$invitationKey)->withInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -565,6 +573,7 @@ class PaymentController extends BaseController
|
|||||||
if (!$ref) {
|
if (!$ref) {
|
||||||
|
|
||||||
Session::flash('error', $response->getMessage());
|
Session::flash('error', $response->getMessage());
|
||||||
|
Utils::logError('Payment Error [no-ref]: ' . $response->getMessage());
|
||||||
|
|
||||||
if ($onSite) {
|
if ($onSite) {
|
||||||
return Redirect::to('payment/'.$invitationKey)->withInput();
|
return Redirect::to('payment/'.$invitationKey)->withInput();
|
||||||
@ -573,10 +582,15 @@ class PaymentController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($response->isSuccessful()) {
|
if ($response->isSuccessful() && $accountGateway->gateway_id != GATEWAY_DWOLLA) {
|
||||||
$payment = self::createPayment($invitation, $ref);
|
$payment = self::createPayment($invitation, $ref);
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
|
|
||||||
|
if ($account->account_key == NINJA_ACCOUNT_KEY) {
|
||||||
|
Session::flash('trackEventCategory', '/account');
|
||||||
|
Session::flash('trackEventAction', '/buy_pro_plan');
|
||||||
|
}
|
||||||
|
|
||||||
return Redirect::to('view/'.$payment->invitation->invitation_key);
|
return Redirect::to('view/'.$payment->invitation->invitation_key);
|
||||||
} elseif ($response->isRedirect()) {
|
} elseif ($response->isRedirect()) {
|
||||||
$invitation->transaction_reference = $ref;
|
$invitation->transaction_reference = $ref;
|
||||||
@ -587,13 +601,14 @@ class PaymentController extends BaseController
|
|||||||
$response->redirect();
|
$response->redirect();
|
||||||
} else {
|
} else {
|
||||||
Session::flash('error', $response->getMessage());
|
Session::flash('error', $response->getMessage());
|
||||||
|
Utils::logError('Payment Error [fatal]: ' . $response->getMessage());
|
||||||
|
|
||||||
return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later.<p>', $response->getMessage());
|
return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later.<p>', $response->getMessage());
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$errorMessage = trans('texts.payment_error');
|
$errorMessage = trans('texts.payment_error');
|
||||||
Session::flash('error', $errorMessage."<p>".$e->getMessage());
|
Session::flash('error', $errorMessage."<p>".$e->getMessage());
|
||||||
Utils::logError(Utils::getErrorString($e));
|
Utils::logError('Payment Error [uncaught]:' . Utils::getErrorString($e));
|
||||||
|
|
||||||
if ($onSite) {
|
if ($onSite) {
|
||||||
return Redirect::to('payment/'.$invitationKey)->withInput();
|
return Redirect::to('payment/'.$invitationKey)->withInput();
|
||||||
|
@ -396,11 +396,6 @@ define('GATEWAY_GOOGLE', 33);
|
|||||||
define('GATEWAY_QUICKBOOKS', 35);
|
define('GATEWAY_QUICKBOOKS', 35);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* TEST VALUES FOR THE CREDIT CARDS
|
|
||||||
* NUMBER IS FOR THE BINARY COUNT FOR WHICH IMAGES TO DISPLAY
|
|
||||||
* card IS FOR CARD IMAGE AND text IS FOR CARD NAME (TO ADD TO alt FOR IMAGE)
|
|
||||||
**/
|
|
||||||
$creditCards = [
|
$creditCards = [
|
||||||
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
|
1 => ['card' => 'images/credit_cards/Test-Visa-Icon.png', 'text' => 'Visa'],
|
||||||
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
|
2 => ['card' => 'images/credit_cards/Test-MasterCard-Icon.png', 'text' => 'Master Card'],
|
||||||
@ -411,84 +406,6 @@ $creditCards = [
|
|||||||
|
|
||||||
define('CREDIT_CARDS', serialize($creditCards));
|
define('CREDIT_CARDS', serialize($creditCards));
|
||||||
|
|
||||||
|
|
||||||
HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
|
|
||||||
$class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2.'/*') ) ? ' class="active"' : '';
|
|
||||||
$title = ucwords(trans("texts.$text")) . Utils::getProLabel($text);
|
|
||||||
return '<li'.$class.'><a href="'.URL::to($url).'" '.$extra.'>'.$title.'</a></li>';
|
|
||||||
});
|
|
||||||
|
|
||||||
HTML::macro('tab_link', function($url, $text, $active = false) {
|
|
||||||
$class = $active ? ' class="active"' : '';
|
|
||||||
return '<li'.$class.'><a href="'.URL::to($url).'" data-toggle="tab">'.$text.'</a></li>';
|
|
||||||
});
|
|
||||||
|
|
||||||
HTML::macro('menu_link', function($type) {
|
|
||||||
$types = $type.'s';
|
|
||||||
$Type = ucfirst($type);
|
|
||||||
$Types = ucfirst($types);
|
|
||||||
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*advanced_settings*') ? ' active' : '';
|
|
||||||
|
|
||||||
$str = '<li class="dropdown '.$class.'">
|
|
||||||
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
|
|
||||||
<ul class="dropdown-menu" id="menu1">
|
|
||||||
<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
|
|
||||||
|
|
||||||
if ($type == ENTITY_INVOICE && Auth::user()->isPro()) {
|
|
||||||
$str .= '<li class="divider"></li>
|
|
||||||
<li><a href="'.URL::to('quotes').'">'.trans("texts.quotes").'</a></li>
|
|
||||||
<li><a href="'.URL::to('quotes/create').'">'.trans("texts.new_quote").'</a></li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$str .= '</ul>
|
|
||||||
</li>';
|
|
||||||
|
|
||||||
return $str;
|
|
||||||
});
|
|
||||||
|
|
||||||
HTML::macro('image_data', function($imagePath) {
|
|
||||||
return 'data:image/jpeg;base64,' . base64_encode(file_get_contents(public_path().'/'.$imagePath));
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
HTML::macro('breadcrumbs', function() {
|
|
||||||
$str = '<ol class="breadcrumb">';
|
|
||||||
|
|
||||||
// Get the breadcrumbs by exploding the current path.
|
|
||||||
$basePath = Utils::basePath();
|
|
||||||
$parts = explode('?', $_SERVER['REQUEST_URI']);
|
|
||||||
$path = $parts[0];
|
|
||||||
|
|
||||||
if ($basePath != '/') {
|
|
||||||
$path = str_replace($basePath, '', $path);
|
|
||||||
}
|
|
||||||
$crumbs = explode('/', $path);
|
|
||||||
|
|
||||||
foreach ($crumbs as $key => $val) {
|
|
||||||
if (is_numeric($val)) {
|
|
||||||
unset($crumbs[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$crumbs = array_values($crumbs);
|
|
||||||
for ($i=0; $i<count($crumbs); $i++) {
|
|
||||||
$crumb = trim($crumbs[$i]);
|
|
||||||
if (!$crumb) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($crumb == 'company') {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
$name = trans("texts.$crumb");
|
|
||||||
if ($i==count($crumbs)-1) {
|
|
||||||
$str .= "<li class='active'>$name</li>";
|
|
||||||
} else {
|
|
||||||
$str .= '<li>'.link_to($crumb, $name).'</li>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $str . '</ol>';
|
|
||||||
});
|
|
||||||
|
|
||||||
function uctrans($text)
|
function uctrans($text)
|
||||||
{
|
{
|
||||||
return ucwords(trans($text));
|
return ucwords(trans($text));
|
||||||
@ -508,20 +425,6 @@ function otrans($text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Validator::extend('positive', function($attribute, $value, $parameters) {
|
|
||||||
return Utils::parseFloat($value) >= 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
Validator::extend('has_credit', function($attribute, $value, $parameters) {
|
|
||||||
$publicClientId = $parameters[0];
|
|
||||||
$amount = $parameters[1];
|
|
||||||
|
|
||||||
$client = \App\Models\Client::scope($publicClientId)->firstOrFail();
|
|
||||||
$credit = $client->getTotalCredit();
|
|
||||||
|
|
||||||
return $credit >= $amount;
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Log all SQL queries to laravel.log
|
// Log all SQL queries to laravel.log
|
||||||
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
|
Event::listen('illuminate.query', function($query, $bindings, $time, $name)
|
||||||
|
@ -65,7 +65,7 @@ class EntityModel extends Eloquent
|
|||||||
$accountId = Auth::user()->account_id;
|
$accountId = Auth::user()->account_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->whereAccountId($accountId);
|
$query->where($this->getTable() .'.account_id', '=', $accountId);
|
||||||
|
|
||||||
if ($publicId) {
|
if ($publicId) {
|
||||||
if (is_array($publicId)) {
|
if (is_array($publicId)) {
|
||||||
|
@ -11,7 +11,7 @@ class Gateway extends Eloquent
|
|||||||
PAYMENT_TYPE_CREDIT_CARD,
|
PAYMENT_TYPE_CREDIT_CARD,
|
||||||
PAYMENT_TYPE_PAYPAL,
|
PAYMENT_TYPE_PAYPAL,
|
||||||
PAYMENT_TYPE_BITCOIN,
|
PAYMENT_TYPE_BITCOIN,
|
||||||
//PAYMENT_TYPE_DWOLLA
|
PAYMENT_TYPE_DWOLLA
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $hiddenFields = [
|
public static $hiddenFields = [
|
||||||
@ -23,22 +23,15 @@ class Gateway extends Eloquent
|
|||||||
'logoImageUrl',
|
'logoImageUrl',
|
||||||
'borderColor',
|
'borderColor',
|
||||||
// Dwolla
|
// Dwolla
|
||||||
'gatewaySession',
|
'redirect',
|
||||||
'purchaseOrder',
|
|
||||||
'Callback',
|
|
||||||
'Redirect',
|
|
||||||
'shipping',
|
|
||||||
'tax',
|
|
||||||
'discount',
|
|
||||||
'notes',
|
|
||||||
'AllowFundingSources',
|
|
||||||
'AllowGuestCheckout',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $optionalFields = [
|
public static $optionalFields = [
|
||||||
// PayPal
|
// PayPal
|
||||||
'testMode',
|
'testMode',
|
||||||
'developerMode',
|
'developerMode',
|
||||||
|
// Dwolla
|
||||||
|
'sandbox',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getLogoUrl()
|
public function getLogoUrl()
|
||||||
|
@ -52,10 +52,10 @@ class InvoiceRepository
|
|||||||
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||||
->where('invoices.account_id', '=', $accountId)
|
->where('invoices.account_id', '=', $accountId)
|
||||||
->where('invoices.is_quote', '=', false)
|
->where('invoices.is_quote', '=', false)
|
||||||
->where('clients.deleted_at', '=', null)
|
|
||||||
->where('contacts.deleted_at', '=', null)
|
->where('contacts.deleted_at', '=', null)
|
||||||
->where('invoices.is_recurring', '=', true)
|
->where('invoices.is_recurring', '=', true)
|
||||||
->where('contacts.is_primary', '=', true)
|
->where('contacts.is_primary', '=', true)
|
||||||
|
->where('clients.deleted_at', '=', null)
|
||||||
->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'invoices.deleted_at', 'invoices.is_deleted');
|
->select('clients.public_id as client_public_id', 'clients.name as client_name', 'invoices.public_id', 'amount', 'frequencies.name as frequency', 'start_date', 'end_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'invoices.deleted_at', 'invoices.is_deleted');
|
||||||
|
|
||||||
if ($clientPublicId) {
|
if ($clientPublicId) {
|
||||||
@ -292,6 +292,12 @@ class InvoiceRepository
|
|||||||
$invoice->terms = trim($data['terms']) ? trim($data['terms']) : (!$publicId && $account->invoice_terms ? $account->invoice_terms : '');
|
$invoice->terms = trim($data['terms']) ? trim($data['terms']) : (!$publicId && $account->invoice_terms ? $account->invoice_terms : '');
|
||||||
$invoice->invoice_footer = trim($data['invoice_footer']) ? trim($data['invoice_footer']) : (!$publicId && $account->invoice_footer ? $account->invoice_footer : '');
|
$invoice->invoice_footer = trim($data['invoice_footer']) ? trim($data['invoice_footer']) : (!$publicId && $account->invoice_footer ? $account->invoice_footer : '');
|
||||||
$invoice->public_notes = trim($data['public_notes']);
|
$invoice->public_notes = trim($data['public_notes']);
|
||||||
|
|
||||||
|
// process date variables
|
||||||
|
$invoice->terms = Utils::processVariables($invoice->terms);
|
||||||
|
$invoice->invoice_footer = Utils::processVariables($invoice->invoice_footer);
|
||||||
|
$invoice->public_notes = Utils::processVariables($invoice->public_notes);
|
||||||
|
|
||||||
$invoice->po_number = trim($data['po_number']);
|
$invoice->po_number = trim($data['po_number']);
|
||||||
$invoice->invoice_design_id = $data['invoice_design_id'];
|
$invoice->invoice_design_id = $data['invoice_design_id'];
|
||||||
|
|
||||||
|
@ -78,6 +78,11 @@ class PaymentRepository
|
|||||||
$rules['payment_type_id'] = 'has_credit:'.$input['client'].','.$input['amount'];
|
$rules['payment_type_id'] = 'has_credit:'.$input['client'].','.$input['amount'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($input['invoice']) && $input['invoice']) {
|
||||||
|
$invoice = Invoice::scope($input['invoice'])->firstOrFail();
|
||||||
|
$rules['amount'] .= "|less_than:{$invoice->balance}";
|
||||||
|
}
|
||||||
|
|
||||||
$validator = \Validator::make($input, $rules);
|
$validator = \Validator::make($input, $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<?php namespace App\Providers;
|
<?php namespace App\Providers;
|
||||||
|
|
||||||
|
use Session;
|
||||||
|
use Auth;
|
||||||
|
use Utils;
|
||||||
|
use HTML;
|
||||||
|
use URL;
|
||||||
|
use Request;
|
||||||
|
use Validator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider {
|
class AppServiceProvider extends ServiceProvider {
|
||||||
@ -11,7 +18,105 @@ class AppServiceProvider extends ServiceProvider {
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
HTML::macro('nav_link', function($url, $text, $url2 = '', $extra = '') {
|
||||||
|
$class = ( Request::is($url) || Request::is($url.'/*') || Request::is($url2.'/*') ) ? ' class="active"' : '';
|
||||||
|
$title = ucwords(trans("texts.$text")) . Utils::getProLabel($text);
|
||||||
|
return '<li'.$class.'><a href="'.URL::to($url).'" '.$extra.'>'.$title.'</a></li>';
|
||||||
|
});
|
||||||
|
|
||||||
|
HTML::macro('tab_link', function($url, $text, $active = false) {
|
||||||
|
$class = $active ? ' class="active"' : '';
|
||||||
|
return '<li'.$class.'><a href="'.URL::to($url).'" data-toggle="tab">'.$text.'</a></li>';
|
||||||
|
});
|
||||||
|
|
||||||
|
HTML::macro('menu_link', function($type) {
|
||||||
|
$types = $type.'s';
|
||||||
|
$Type = ucfirst($type);
|
||||||
|
$Types = ucfirst($types);
|
||||||
|
$class = ( Request::is($types) || Request::is('*'.$type.'*')) && !Request::is('*advanced_settings*') ? ' active' : '';
|
||||||
|
|
||||||
|
$str = '<li class="dropdown '.$class.'">
|
||||||
|
<a href="'.URL::to($types).'" class="dropdown-toggle">'.trans("texts.$types").'</a>
|
||||||
|
<ul class="dropdown-menu" id="menu1">
|
||||||
|
<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
|
||||||
|
|
||||||
|
if ($type == ENTITY_INVOICE && Auth::user()->isPro()) {
|
||||||
|
$str .= '<li class="divider"></li>
|
||||||
|
<li><a href="'.URL::to('quotes').'">'.trans("texts.quotes").'</a></li>
|
||||||
|
<li><a href="'.URL::to('quotes/create').'">'.trans("texts.new_quote").'</a></li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$str .= '</ul>
|
||||||
|
</li>';
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
});
|
||||||
|
|
||||||
|
HTML::macro('image_data', function($imagePath) {
|
||||||
|
return 'data:image/jpeg;base64,' . base64_encode(file_get_contents(public_path().'/'.$imagePath));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
HTML::macro('breadcrumbs', function() {
|
||||||
|
$str = '<ol class="breadcrumb">';
|
||||||
|
|
||||||
|
// Get the breadcrumbs by exploding the current path.
|
||||||
|
$basePath = Utils::basePath();
|
||||||
|
$parts = explode('?', $_SERVER['REQUEST_URI']);
|
||||||
|
$path = $parts[0];
|
||||||
|
|
||||||
|
if ($basePath != '/') {
|
||||||
|
$path = str_replace($basePath, '', $path);
|
||||||
|
}
|
||||||
|
$crumbs = explode('/', $path);
|
||||||
|
|
||||||
|
foreach ($crumbs as $key => $val) {
|
||||||
|
if (is_numeric($val)) {
|
||||||
|
unset($crumbs[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$crumbs = array_values($crumbs);
|
||||||
|
for ($i=0; $i<count($crumbs); $i++) {
|
||||||
|
$crumb = trim($crumbs[$i]);
|
||||||
|
if (!$crumb) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($crumb == 'company') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$name = trans("texts.$crumb");
|
||||||
|
if ($i==count($crumbs)-1) {
|
||||||
|
$str .= "<li class='active'>$name</li>";
|
||||||
|
} else {
|
||||||
|
$str .= '<li>'.link_to($crumb, $name).'</li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $str . '</ol>';
|
||||||
|
});
|
||||||
|
|
||||||
|
Validator::extend('positive', function($attribute, $value, $parameters) {
|
||||||
|
return Utils::parseFloat($value) >= 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
Validator::extend('has_credit', function($attribute, $value, $parameters) {
|
||||||
|
$publicClientId = $parameters[0];
|
||||||
|
$amount = $parameters[1];
|
||||||
|
|
||||||
|
$client = \App\Models\Client::scope($publicClientId)->firstOrFail();
|
||||||
|
$credit = $client->getTotalCredit();
|
||||||
|
|
||||||
|
return $credit >= $amount;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Validator::extend('less_than', function($attribute, $value, $parameters) {
|
||||||
|
return floatval($value) <= floatval($parameters[0]);
|
||||||
|
});
|
||||||
|
|
||||||
|
Validator::replacer('less_than', function($message, $attribute, $rule, $parameters) {
|
||||||
|
return str_replace(':value', $parameters[0], $message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
50
composer.lock
generated
50
composer.lock
generated
@ -120,26 +120,26 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/formers/former.git",
|
"url": "https://github.com/formers/former.git",
|
||||||
"reference": "5d4dbc7bc98b363946dc59ce63565a2b49f138ca"
|
"reference": "a2fbec9d29cf820d54dfa6f0ddb875339d77e930"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/formers/former/zipball/5d4dbc7bc98b363946dc59ce63565a2b49f138ca",
|
"url": "https://api.github.com/repos/formers/former/zipball/a2fbec9d29cf820d54dfa6f0ddb875339d77e930",
|
||||||
"reference": "5d4dbc7bc98b363946dc59ce63565a2b49f138ca",
|
"reference": "a2fbec9d29cf820d54dfa6f0ddb875339d77e930",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"anahkiasen/html-object": "~1.4",
|
"anahkiasen/html-object": "~1.4",
|
||||||
"illuminate/config": "5.0.*",
|
"illuminate/config": "~5.0",
|
||||||
"illuminate/container": "5.0.*",
|
"illuminate/container": "~5.0",
|
||||||
"illuminate/http": "5.0.*",
|
"illuminate/http": "~5.0",
|
||||||
"illuminate/routing": "5.0.*",
|
"illuminate/routing": "~5.0",
|
||||||
"illuminate/session": "5.0.*",
|
"illuminate/session": "~5.0",
|
||||||
"illuminate/translation": "5.0.*",
|
"illuminate/translation": "~5.0",
|
||||||
"php": ">=5.4.0"
|
"php": ">=5.4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"illuminate/database": "5.0.*",
|
"illuminate/database": "~5.0",
|
||||||
"mockery/mockery": "~0.9.1",
|
"mockery/mockery": "~0.9.1",
|
||||||
"phpunit/phpunit": "~4"
|
"phpunit/phpunit": "~4"
|
||||||
},
|
},
|
||||||
@ -171,7 +171,7 @@
|
|||||||
"foundation",
|
"foundation",
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2015-05-26 22:05:25"
|
"time": "2015-06-01 18:46:46"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "anahkiasen/html-object",
|
"name": "anahkiasen/html-object",
|
||||||
@ -5397,12 +5397,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/webpatser/laravel-countries.git",
|
"url": "https://github.com/webpatser/laravel-countries.git",
|
||||||
"reference": "ae5d18d2d7ba45e155fda4fbbbf968e4869a2e04"
|
"reference": "3d2ee664037783d0df629a178437981e6f1a1f8b"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/webpatser/laravel-countries/zipball/ae5d18d2d7ba45e155fda4fbbbf968e4869a2e04",
|
"url": "https://api.github.com/repos/webpatser/laravel-countries/zipball/3d2ee664037783d0df629a178437981e6f1a1f8b",
|
||||||
"reference": "ae5d18d2d7ba45e155fda4fbbbf968e4869a2e04",
|
"reference": "3d2ee664037783d0df629a178437981e6f1a1f8b",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -5441,7 +5441,7 @@
|
|||||||
"iso_3166_3",
|
"iso_3166_3",
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2015-05-21 06:56:40"
|
"time": "2015-06-02 10:57:25"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "wildbit/laravel-postmark-provider",
|
"name": "wildbit/laravel-postmark-provider",
|
||||||
@ -5747,16 +5747,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "2.1.1",
|
"version": "2.1.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "60991776b3994cd8297b861e8ddc7f9c9500dedc"
|
"reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/60991776b3994cd8297b861e8ddc7f9c9500dedc",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/28a6b34e91d789b2608072ab3c82eaae7cdb973c",
|
||||||
"reference": "60991776b3994cd8297b861e8ddc7f9c9500dedc",
|
"reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -5805,7 +5805,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-05-31 03:14:06"
|
"time": "2015-06-03 07:01:01"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
@ -5993,16 +5993,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.6.9",
|
"version": "4.6.10",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1"
|
"reference": "7b5fe98b28302a8b25693b2298bca74463336975"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/816d12536a7a032adc3b68737f82cfbbf98b79c1",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975",
|
||||||
"reference": "816d12536a7a032adc3b68737f82cfbbf98b79c1",
|
"reference": "7b5fe98b28302a8b25693b2298bca74463336975",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -6061,7 +6061,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-05-29 06:00:03"
|
"time": "2015-06-03 05:03:30"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
@ -111,25 +111,6 @@ class ConstantsSeeder extends Seeder
|
|||||||
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
|
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
|
||||||
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
|
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
|
||||||
|
|
||||||
Currency::create(array('name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
Currency::create(array('name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'));
|
|
||||||
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/Y g:i a', 'label' => '10/Mar/2013'));
|
||||||
DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
|
DatetimeFormat::create(array('format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'));
|
||||||
DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
|
DatetimeFormat::create(array('format' => 'd/F/Y g:i a', 'label' => '10/March/2013'));
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
|
use App\Models\Currency;
|
||||||
|
|
||||||
class PaymentLibrariesSeeder extends Seeder
|
class PaymentLibrariesSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Eloquent::unguard();
|
Eloquent::unguard();
|
||||||
@ -28,24 +28,49 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'Dwolla', 'provider' => 'Dwolla', 'payment_library_id' => 1],
|
['name' => 'Dwolla', 'provider' => 'Dwolla', 'payment_library_id' => 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway)
|
foreach ($gateways as $gateway) {
|
||||||
{
|
if (!DB::table('gateways')->where('name', '=', $gateway['name'])->get()) {
|
||||||
if (!DB::table('gateways')->where('name', '=', $gateway['name'])->get())
|
|
||||||
{
|
|
||||||
Gateway::create($gateway);
|
Gateway::create($gateway);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentTerms = [
|
$paymentTerms = [
|
||||||
['num_days' => -1, 'name' => 'Net 0']
|
['num_days' => -1, 'name' => 'Net 0'],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($paymentTerms as $paymentTerm)
|
foreach ($paymentTerms as $paymentTerm) {
|
||||||
{
|
if (!DB::table('payment_terms')->where('name', '=', $paymentTerm['name'])->get()) {
|
||||||
if (!DB::table('payment_terms')->where('name', '=', $paymentTerm['name'])->get())
|
|
||||||
{
|
|
||||||
PaymentTerm::create($paymentTerm);
|
PaymentTerm::create($paymentTerm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$currencies = [
|
||||||
|
['name' => 'US Dollar', 'code' => 'USD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Pound Sterling', 'code' => 'GBP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Euro', 'code' => 'EUR', 'symbol' => '€', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Rand', 'code' => 'ZAR', 'symbol' => 'R', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Danish Krone', 'code' => 'DKK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Israeli Shekel', 'code' => 'ILS', 'symbol' => 'NIS ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Swedish Krona', 'code' => 'SEK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Kenyan Shilling', 'code' => 'KES', 'symbol' => 'KSh ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Canadian Dollar', 'code' => 'CAD', 'symbol' => 'C$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Philippine Peso', 'code' => 'PHP', 'symbol' => 'P ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Indian Rupee', 'code' => 'INR', 'symbol' => 'Rs. ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Australian Dollar', 'code' => 'AUD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Singapore Dollar', 'code' => 'SGD', 'symbol' => 'SGD ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr ', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => 'VND ', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF ', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Malaysian Ringgit', 'code' => 'MYR', 'symbol' => 'RM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
['name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($currencies as $currency) {
|
||||||
|
if (!DB::table('currencies')->whereName($currency['name'])->get()) {
|
||||||
|
Currency::create($currency);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31637,7 +31637,7 @@ function GetPdf(invoice, javascript){
|
|||||||
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
|
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
|
||||||
var top = doc.internal.pageSize.height - layout.marginLeft;
|
var top = doc.internal.pageSize.height - layout.marginLeft;
|
||||||
if (!invoice.is_pro) top -= 25;
|
if (!invoice.is_pro) top -= 25;
|
||||||
var footer = doc.splitTextToSize(invoice.invoice_footer, 500);
|
var footer = doc.splitTextToSize(processVariables(invoice.invoice_footer), 500);
|
||||||
var numLines = footer.length - 1;
|
var numLines = footer.length - 1;
|
||||||
doc.text(layout.marginLeft, top - (numLines * 8), footer);
|
doc.text(layout.marginLeft, top - (numLines * 8), footer);
|
||||||
}
|
}
|
||||||
@ -32419,13 +32419,13 @@ function displayNotesAndTerms(doc, layout, invoice, y)
|
|||||||
var origY = y;
|
var origY = y;
|
||||||
|
|
||||||
if (invoice.public_notes) {
|
if (invoice.public_notes) {
|
||||||
var notes = doc.splitTextToSize(invoice.public_notes, 260);
|
var notes = doc.splitTextToSize(processVariables(invoice.public_notes), 260);
|
||||||
doc.text(layout.marginLeft, y, notes);
|
doc.text(layout.marginLeft, y, notes);
|
||||||
y += 16 + (notes.length * doc.internal.getFontSize());
|
y += 16 + (notes.length * doc.internal.getFontSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoice.terms) {
|
if (invoice.terms) {
|
||||||
var terms = doc.splitTextToSize(invoice.terms, 260);
|
var terms = doc.splitTextToSize(processVariables(invoice.terms), 260);
|
||||||
doc.setFontType("bold");
|
doc.setFontType("bold");
|
||||||
doc.text(layout.marginLeft, y, invoiceLabels.terms);
|
doc.text(layout.marginLeft, y, invoiceLabels.terms);
|
||||||
y += 16;
|
y += 16;
|
||||||
@ -33136,7 +33136,7 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
footer: function(){
|
footer: function(){
|
||||||
f = [{ text:invoice.invoice_footer?invoice.invoice_footer:"", margin: [40, 0]}]
|
f = [{ text:invoice.invoice_footer?processVariables(invoice.invoice_footer):"", margin: [40, 0]}]
|
||||||
if (!invoice.is_pro && logoImages.imageLogo1) {
|
if (!invoice.is_pro && logoImages.imageLogo1) {
|
||||||
f.push({
|
f.push({
|
||||||
image: logoImages.imageLogo1,
|
image: logoImages.imageLogo1,
|
||||||
@ -33153,7 +33153,24 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
dd = $.extend(true, baseDD, dd);
|
dd = $.extend(true, baseDD, dd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var fonts = {
|
pdfMake.fonts = {
|
||||||
|
wqy: {
|
||||||
|
normal: 'wqy.ttf',
|
||||||
|
bold: 'wqy.ttf',
|
||||||
|
italics: 'wqy.ttf',
|
||||||
|
bolditalics: 'wqy.ttf'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
pdfMake.fonts = {
|
||||||
|
NotoSansCJKsc: {
|
||||||
|
normal: 'NotoSansCJKsc-Regular.ttf',
|
||||||
|
bold: 'NotoSansCJKsc-Medium.ttf',
|
||||||
|
italics: 'NotoSansCJKsc-Italic.ttf',
|
||||||
|
bolditalics: 'NotoSansCJKsc-Italic.ttf'
|
||||||
|
},
|
||||||
Roboto: {
|
Roboto: {
|
||||||
normal: 'Roboto-Regular.ttf',
|
normal: 'Roboto-Regular.ttf',
|
||||||
bold: 'Roboto-Medium.ttf',
|
bold: 'Roboto-Medium.ttf',
|
||||||
@ -33174,12 +33191,12 @@ NINJA.notesAndTerms = function(invoice)
|
|||||||
{
|
{
|
||||||
var text = [];
|
var text = [];
|
||||||
if (invoice.public_notes) {
|
if (invoice.public_notes) {
|
||||||
text.push({text:invoice.public_notes, style:'notes'});
|
text.push({text:processVariables(invoice.public_notes), style:'notes'});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoice.terms) {
|
if (invoice.terms) {
|
||||||
text.push({text:invoiceLabels.terms, style:'termsLabel'});
|
text.push({text:invoiceLabels.terms, style:'termsLabel'});
|
||||||
text.push({text:invoice.terms, style:'terms'});
|
text.push({text:processVariables(invoice.terms), style:'terms'});
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@ -33314,6 +33331,8 @@ NINJA.accountAddress = function(account) {
|
|||||||
if(account.address2) data.push({text:account.address2, style:'accountDetails'});
|
if(account.address2) data.push({text:account.address2, style:'accountDetails'});
|
||||||
if(address) data.push({text:address, style:'accountDetails'});
|
if(address) data.push({text:address, style:'accountDetails'});
|
||||||
if(account.country) data.push({text:account.country.name, style: 'accountDetails'});
|
if(account.country) data.push({text:account.country.name, style: 'accountDetails'});
|
||||||
|
if(account.custom_label1 && account.custom_value1) data.push({text:account.custom_label1 +' '+ account.custom_value1, style: 'accountDetails'});
|
||||||
|
if(account.custom_label2 && account.custom_value2) data.push({text:account.custom_label2 +' '+ account.custom_value2, style: 'accountDetails'});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
footer: function(){
|
footer: function(){
|
||||||
f = [{ text:invoice.invoice_footer?invoice.invoice_footer:"", margin: [40, 0]}]
|
f = [{ text:invoice.invoice_footer?processVariables(invoice.invoice_footer):"", margin: [40, 0]}]
|
||||||
if (!invoice.is_pro && logoImages.imageLogo1) {
|
if (!invoice.is_pro && logoImages.imageLogo1) {
|
||||||
f.push({
|
f.push({
|
||||||
image: logoImages.imageLogo1,
|
image: logoImages.imageLogo1,
|
||||||
@ -49,7 +49,24 @@ function GetPdfMake(invoice, javascript, callback) {
|
|||||||
dd = $.extend(true, baseDD, dd);
|
dd = $.extend(true, baseDD, dd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var fonts = {
|
pdfMake.fonts = {
|
||||||
|
wqy: {
|
||||||
|
normal: 'wqy.ttf',
|
||||||
|
bold: 'wqy.ttf',
|
||||||
|
italics: 'wqy.ttf',
|
||||||
|
bolditalics: 'wqy.ttf'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
pdfMake.fonts = {
|
||||||
|
NotoSansCJKsc: {
|
||||||
|
normal: 'NotoSansCJKsc-Regular.ttf',
|
||||||
|
bold: 'NotoSansCJKsc-Medium.ttf',
|
||||||
|
italics: 'NotoSansCJKsc-Italic.ttf',
|
||||||
|
bolditalics: 'NotoSansCJKsc-Italic.ttf'
|
||||||
|
},
|
||||||
Roboto: {
|
Roboto: {
|
||||||
normal: 'Roboto-Regular.ttf',
|
normal: 'Roboto-Regular.ttf',
|
||||||
bold: 'Roboto-Medium.ttf',
|
bold: 'Roboto-Medium.ttf',
|
||||||
@ -70,12 +87,12 @@ NINJA.notesAndTerms = function(invoice)
|
|||||||
{
|
{
|
||||||
var text = [];
|
var text = [];
|
||||||
if (invoice.public_notes) {
|
if (invoice.public_notes) {
|
||||||
text.push({text:invoice.public_notes, style:'notes'});
|
text.push({text:processVariables(invoice.public_notes), style:'notes'});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoice.terms) {
|
if (invoice.terms) {
|
||||||
text.push({text:invoiceLabels.terms, style:'termsLabel'});
|
text.push({text:invoiceLabels.terms, style:'termsLabel'});
|
||||||
text.push({text:invoice.terms, style:'terms'});
|
text.push({text:processVariables(invoice.terms), style:'terms'});
|
||||||
}
|
}
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@ -210,6 +227,8 @@ NINJA.accountAddress = function(account) {
|
|||||||
if(account.address2) data.push({text:account.address2, style:'accountDetails'});
|
if(account.address2) data.push({text:account.address2, style:'accountDetails'});
|
||||||
if(address) data.push({text:address, style:'accountDetails'});
|
if(address) data.push({text:address, style:'accountDetails'});
|
||||||
if(account.country) data.push({text:account.country.name, style: 'accountDetails'});
|
if(account.country) data.push({text:account.country.name, style: 'accountDetails'});
|
||||||
|
if(account.custom_label1 && account.custom_value1) data.push({text:account.custom_label1 +' '+ account.custom_value1, style: 'accountDetails'});
|
||||||
|
if(account.custom_label2 && account.custom_value2) data.push({text:account.custom_label2 +' '+ account.custom_value2, style: 'accountDetails'});
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
66368
public/js/pdfmake.js
Normal file
66368
public/js/pdfmake.js
Normal file
File diff suppressed because one or more lines are too long
@ -102,7 +102,7 @@ function GetPdf(invoice, javascript){
|
|||||||
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
|
SetPdfColor(invoice.invoice_design_id == 2 || invoice.invoice_design_id == 3 ? 'White' : 'Black',doc);
|
||||||
var top = doc.internal.pageSize.height - layout.marginLeft;
|
var top = doc.internal.pageSize.height - layout.marginLeft;
|
||||||
if (!invoice.is_pro) top -= 25;
|
if (!invoice.is_pro) top -= 25;
|
||||||
var footer = doc.splitTextToSize(invoice.invoice_footer, 500);
|
var footer = doc.splitTextToSize(processVariables(invoice.invoice_footer), 500);
|
||||||
var numLines = footer.length - 1;
|
var numLines = footer.length - 1;
|
||||||
doc.text(layout.marginLeft, top - (numLines * 8), footer);
|
doc.text(layout.marginLeft, top - (numLines * 8), footer);
|
||||||
}
|
}
|
||||||
@ -884,13 +884,13 @@ function displayNotesAndTerms(doc, layout, invoice, y)
|
|||||||
var origY = y;
|
var origY = y;
|
||||||
|
|
||||||
if (invoice.public_notes) {
|
if (invoice.public_notes) {
|
||||||
var notes = doc.splitTextToSize(invoice.public_notes, 260);
|
var notes = doc.splitTextToSize(processVariables(invoice.public_notes), 260);
|
||||||
doc.text(layout.marginLeft, y, notes);
|
doc.text(layout.marginLeft, y, notes);
|
||||||
y += 16 + (notes.length * doc.internal.getFontSize());
|
y += 16 + (notes.length * doc.internal.getFontSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoice.terms) {
|
if (invoice.terms) {
|
||||||
var terms = doc.splitTextToSize(invoice.terms, 260);
|
var terms = doc.splitTextToSize(processVariables(invoice.terms), 260);
|
||||||
doc.setFontType("bold");
|
doc.setFontType("bold");
|
||||||
doc.text(layout.marginLeft, y, invoiceLabels.terms);
|
doc.text(layout.marginLeft, y, invoiceLabels.terms);
|
||||||
y += 16;
|
y += 16;
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
//pdfmake
|
//pdfmake
|
||||||
|
|
||||||
|
/*
|
||||||
|
var dd = {
|
||||||
|
content: 'wqy中文wqy',
|
||||||
|
defaultStyle: {
|
||||||
|
font: 'wqy'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
var dd = {
|
var dd = {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@ -113,6 +123,7 @@ var dd = {
|
|||||||
],
|
],
|
||||||
|
|
||||||
defaultStyle: {
|
defaultStyle: {
|
||||||
|
//font: 'arialuni',
|
||||||
fontSize: NINJA.fontSize,
|
fontSize: NINJA.fontSize,
|
||||||
margin: [8, 4, 8, 4]
|
margin: [8, 4, 8, 4]
|
||||||
},
|
},
|
||||||
|
@ -673,4 +673,8 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -76,6 +76,7 @@ return array(
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -664,5 +664,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -74,6 +74,7 @@ return array(
|
|||||||
"positive" => ":attribute muss größer als null sein.",
|
"positive" => ":attribute muss größer als null sein.",
|
||||||
"has_credit" => "Der Kunde hat nicht genug Guthaben.",
|
"has_credit" => "Der Kunde hat nicht genug Guthaben.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -673,5 +673,6 @@ return array(
|
|||||||
|
|
||||||
'payment_type_dwolla' => 'Dwolla',
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
'gateway_help_43' => ':link to sign up for Dwolla.',
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -72,6 +72,7 @@ return array(
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -643,5 +643,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -73,7 +73,7 @@ return array(
|
|||||||
"positive" => ":attribute debe ser mayor que cero.",
|
"positive" => ":attribute debe ser mayor que cero.",
|
||||||
"has_credit" => "el cliente no tiene crédito suficiente.",
|
"has_credit" => "el cliente no tiene crédito suficiente.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -672,5 +672,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -73,7 +73,7 @@ return array(
|
|||||||
"positive" => ":attribute debe ser mayor que cero.",
|
"positive" => ":attribute debe ser mayor que cero.",
|
||||||
"has_credit" => "el cliente no tiene crédito suficiente.",
|
"has_credit" => "el cliente no tiene crédito suficiente.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -664,5 +664,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -74,6 +74,7 @@ return array(
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -664,4 +664,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -74,6 +74,7 @@ return array(
|
|||||||
"positive" => ":attribute doit être supérieur à zero.",
|
"positive" => ":attribute doit être supérieur à zero.",
|
||||||
"has_credit" => "Le client n'a pas un crédit suffisant.",
|
"has_credit" => "Le client n'a pas un crédit suffisant.",
|
||||||
"notmasked" => "Les valeurs sont masquées",
|
"notmasked" => "Les valeurs sont masquées",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -666,4 +666,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -73,6 +73,7 @@ return array(
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -674,6 +674,10 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ return array(
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -672,5 +672,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -72,6 +72,7 @@ return array(
|
|||||||
"positive" => ":attribute må være mer enn null.",
|
"positive" => ":attribute må være mer enn null.",
|
||||||
"has_credit" => "Klienten har ikke høy nok kreditt.",
|
"has_credit" => "Klienten har ikke høy nok kreditt.",
|
||||||
"notmasked" => "Verdiene er skjult",
|
"notmasked" => "Verdiene er skjult",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -667,5 +667,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -74,6 +74,7 @@ return array(
|
|||||||
"positive" => ":attribute moet groter zijn dan nul.",
|
"positive" => ":attribute moet groter zijn dan nul.",
|
||||||
"has_credit" => "De klant heeft niet voldoende krediet.",
|
"has_credit" => "De klant heeft niet voldoende krediet.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -667,5 +667,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -72,7 +72,7 @@ return array(
|
|||||||
"positive" => ":attribute deve ser maior que zero.",
|
"positive" => ":attribute deve ser maior que zero.",
|
||||||
"has_credit" => "O cliente não possui crédito suficiente.",
|
"has_credit" => "O cliente não possui crédito suficiente.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -670,5 +670,9 @@ return array(
|
|||||||
'prefix' => 'Prefix',
|
'prefix' => 'Prefix',
|
||||||
'counter' => 'Counter',
|
'counter' => 'Counter',
|
||||||
|
|
||||||
|
'payment_type_dwolla' => 'Dwolla',
|
||||||
|
'gateway_help_43' => ':link to sign up for Dwolla.',
|
||||||
|
'partial_value' => 'Must be greater than zero and less than the total',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -76,6 +76,7 @@ return [
|
|||||||
"positive" => "The :attribute must be greater than zero.",
|
"positive" => "The :attribute must be greater than zero.",
|
||||||
"has_credit" => "The client does not have enough credit.",
|
"has_credit" => "The client does not have enough credit.",
|
||||||
"notmasked" => "The values are masked",
|
"notmasked" => "The values are masked",
|
||||||
|
"less_than" => 'The :attribute must be less than :value',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
@if (in_array($field, $hiddenFields))
|
@if (in_array($field, $hiddenFields))
|
||||||
{{-- do nothing --}}
|
{{-- do nothing --}}
|
||||||
@elseif ($gateway->id == GATEWAY_DWOLLA && ($field == 'Key' || $field == 'Secret')
|
@elseif ($gateway->id == GATEWAY_DWOLLA && ($field == 'key' || $field == 'secret')
|
||||||
&& isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET']))
|
&& isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET']))
|
||||||
{{-- do nothing --}}
|
{{-- do nothing --}}
|
||||||
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
|
@elseif ($field == 'testMode' || $field == 'developerMode' || $field == 'sandbox')
|
||||||
|
@ -204,7 +204,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function deleteLogo() {
|
function deleteLogo() {
|
||||||
if (confirm("{{ trans('texts.are_you_sure') }}")) {
|
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
|
||||||
$('.removeLogoForm').submit();
|
$('.removeLogoForm').submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteAccountGateway(id) {
|
function deleteAccountGateway(id) {
|
||||||
if (!confirm('Are you sure?')) {
|
if (!confirm("{!! trans('texts.are_you_sure') !!}")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteToken(id) {
|
function deleteToken(id) {
|
||||||
if (!confirm('Are you sure?')) {
|
if (!confirm("{!! trans('texts.are_you_sure') !!}")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteUser(id) {
|
function deleteUser(id) {
|
||||||
if (!confirm('Are you sure?')) {
|
if (!confirm("{!! trans('texts.are_you_sure') !!}")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDeleteClick() {
|
function onDeleteClick() {
|
||||||
if (confirm("{{ trans('texts.are_you_sure') }}")) {
|
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
|
||||||
$('#action').val('delete');
|
$('#action').val('delete');
|
||||||
$('.mainForm').submit();
|
$('.mainForm').submit();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,8 @@
|
|||||||
{!! Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")
|
{!! Former::text('due_date')->data_bind("datePicker: due_date, valueUpdate: 'afterkeydown'")
|
||||||
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'due_date\')"></i>') !!}
|
->data_date_format(Session::get(SESSION_DATE_PICKER_FORMAT, DEFAULT_DATE_PICKER_FORMAT))->append('<i class="glyphicon glyphicon-calendar" onclick="toggleDatePicker(\'due_date\')"></i>') !!}
|
||||||
|
|
||||||
{!! Former::text('partial')->data_bind("value: partial, valueUpdate: 'afterkeydown'")->onchange('onPartialChange()') !!}
|
{!! Former::text('partial')->data_bind("value: partial, valueUpdate: 'afterkeydown'")->onchange('onPartialChange()')
|
||||||
|
->rel('tooltip')->data_toggle('tooltip')->data_placement('bottom')->title(trans('texts.partial_value')) !!}
|
||||||
</div>
|
</div>
|
||||||
@if ($entityType == ENTITY_INVOICE)
|
@if ($entityType == ENTITY_INVOICE)
|
||||||
<div data-bind="visible: is_recurring" style="display: none">
|
<div data-bind="visible: is_recurring" style="display: none">
|
||||||
@ -597,7 +598,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[rel=tooltip]').tooltip();
|
$('[rel=tooltip]').tooltip({'trigger':'manual'});
|
||||||
|
|
||||||
$('#invoice_date, #due_date, #start_date, #end_date').datepicker();
|
$('#invoice_date, #due_date, #start_date, #end_date').datepicker();
|
||||||
|
|
||||||
@ -770,14 +771,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onEmailClick() {
|
function onEmailClick() {
|
||||||
if (confirm('{{ trans("texts.confirm_email_$entityType") }}')) {
|
if (confirm('{!! trans("texts.confirm_email_$entityType") !!}')) {
|
||||||
preparePdfData('email');
|
preparePdfData('email');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSaveClick() {
|
function onSaveClick() {
|
||||||
if (model.invoice().is_recurring()) {
|
if (model.invoice().is_recurring()) {
|
||||||
if (confirm('{{ trans("texts.confirm_recurring_email_$entityType") }}')) {
|
if (confirm('{!! trans("texts.confirm_recurring_email_$entityType") !!}')) {
|
||||||
submitAction('');
|
submitAction('');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -802,6 +803,7 @@
|
|||||||
model.showClientForm();
|
model.showClientForm();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
onPartialChange(true);
|
||||||
$('#action').val(value);
|
$('#action').val(value);
|
||||||
$('#submitButton').click();
|
$('#submitButton').click();
|
||||||
}
|
}
|
||||||
@ -866,7 +868,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onDeleteClick() {
|
function onDeleteClick() {
|
||||||
if (confirm('Are you sure you want to delete this {{ $entityType }}?')) {
|
if (confirm('{!! trans("texts.are_you_sure") !!}')) {
|
||||||
submitAction('delete');
|
submitAction('delete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1664,11 +1666,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPartialChange()
|
function onPartialChange(silent)
|
||||||
{
|
{
|
||||||
var val = NINJA.parseFloat($('#partial').val());
|
var val = NINJA.parseFloat($('#partial').val());
|
||||||
|
var oldVal = val;
|
||||||
val = Math.max(Math.min(val, model.invoice().totals.rawTotal()), 0);
|
val = Math.max(Math.min(val, model.invoice().totals.rawTotal()), 0);
|
||||||
$('#partial').val(val || '');
|
model.invoice().partial(val || '');
|
||||||
|
|
||||||
|
if (!silent && val != oldVal) {
|
||||||
|
$('#partial').tooltip('show');
|
||||||
|
setTimeout(function() {
|
||||||
|
$('#partial').tooltip('hide');
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onRecurringEnabled()
|
function onRecurringEnabled()
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
function submitForm(action) {
|
function submitForm(action) {
|
||||||
if (action == 'delete') {
|
if (action == 'delete') {
|
||||||
if (!confirm('Are you sure?')) {
|
if (!confirm('{!! trans("texts.are_you_sure") !!}')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,10 @@
|
|||||||
$('form.warn-on-exit input, form.warn-on-exit textarea, form.warn-on-exit select').change(function() {
|
$('form.warn-on-exit input, form.warn-on-exit textarea, form.warn-on-exit select').change(function() {
|
||||||
NINJA.formIsChanged = true;
|
NINJA.formIsChanged = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@if (Session::has('trackEventCategory') && Session::has('trackEventAction'))
|
||||||
|
trackEvent('{{ session('trackEventCategory') }}', '{{ session('trackEventAction') }}');
|
||||||
|
@endif
|
||||||
});
|
});
|
||||||
$('form').submit(function() {
|
$('form').submit(function() {
|
||||||
NINJA.formIsChanged = false;
|
NINJA.formIsChanged = false;
|
||||||
@ -125,7 +129,6 @@
|
|||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//$('a[rel!=ext]').click(function() { $(window).off('beforeunload') });
|
//$('a[rel!=ext]').click(function() { $(window).off('beforeunload') });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user