1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-17 16:42:48 +01:00

Bug fixes

This commit is contained in:
Hillel Coren 2015-06-07 11:05:30 +03:00
parent b80842759e
commit 77c90ad21f
17 changed files with 165 additions and 109 deletions

View File

@ -51,7 +51,7 @@ class SendRecurringInvoices extends Command
$invoice = Invoice::createNew($recurInvoice);
$invoice->client_id = $recurInvoice->client_id;
$invoice->recurring_invoice_id = $recurInvoice->id;
$invoice->invoice_number = 'R'.$recurInvoice->account->getNextInvoiceNumber();
$invoice->invoice_number = $recurInvoice->account->getNextInvoiceNumber(false, 'R');
$invoice->amount = $recurInvoice->amount;
$invoice->balance = $recurInvoice->amount;
$invoice->invoice_date = date_create()->format('Y-m-d');

View File

@ -204,10 +204,14 @@ class PaymentController extends BaseController
$gateway->$function($val);
}
if ($accountGateway->gateway->id == GATEWAY_DWOLLA && isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET'])) {
$gateway->setKey($_ENV['DWOLLA_KEY']);
$gateway->setSecret($_ENV['DWOLLA_SECRET']);
$gateway->setSandbox(false);
if ($accountGateway->gateway->id == GATEWAY_DWOLLA) {
if ($gateway->getSandbox() && isset($_ENV['DWOLLA_SANDBOX_KEY']) && isset($_ENV['DWOLLA_SANSBOX_SECRET'])) {
$gateway->setKey($_ENV['DWOLLA_SANDBOX_KEY']);
$gateway->setSecret($_ENV['DWOLLA_SANSBOX_SECRET']);
} elseif (isset($_ENV['DWOLLA_KEY']) && isset($_ENV['DWOLLA_SECRET'])) {
$gateway->setKey($_ENV['DWOLLA_KEY']);
$gateway->setSecret($_ENV['DWOLLA_SECRET']);
}
}
return $gateway;
@ -274,7 +278,6 @@ class PaymentController extends BaseController
'amount' => $invoice->getRequestedAmount(),
'card' => $card,
'currency' => $currencyCode,
'redirect' => URL::to('complete'), // Dwolla: remove
'returnUrl' => URL::to('complete'),
'cancelUrl' => $invitation->getLink(),
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
@ -582,7 +585,7 @@ class PaymentController extends BaseController
}
}
if ($response->isSuccessful() && $accountGateway->gateway_id != GATEWAY_DWOLLA) {
if ($response->isSuccessful()) {
$payment = self::createPayment($invitation, $ref);
Session::flash('message', trans('texts.applied_payment'));

View File

@ -20,6 +20,7 @@ use App\Models\Size;
use App\Models\TaxRate;
use App\Models\Invitation;
use App\Models\Activity;
use App\Models\Invoice;
use App\Ninja\Mailers\ContactMailer as Mailer;
use App\Ninja\Repositories\InvoiceRepository;
use App\Ninja\Repositories\ClientRepository;

View File

@ -59,7 +59,10 @@ class StartupCheck
} else {
$orderBy = 'id';
}
Cache::forever($name, $class::orderBy($orderBy)->get());
$tableData = $class::orderBy($orderBy)->get();
if (count($tableData)) {
Cache::forever($name, $tableData);
}
}
}

View File

@ -353,7 +353,7 @@ define('NINJA_GATEWAY_ID', GATEWAY_STRIPE);
define('NINJA_GATEWAY_CONFIG', '');
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
define('NINJA_VERSION', '2.1.2');
define('NINJA_VERSION', '2.2.0');
define('NINJA_DATE', '2000-01-01');
define('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com');
define('RELEASES_URL', 'https://github.com/hillelcoren/invoice-ninja/releases/');
@ -458,4 +458,3 @@ if (Auth::check() && Auth::user()->id === 1)
Auth::loginUsingId(1);
}
*/

View File

@ -347,7 +347,7 @@ class Utils
$timezone = Session::get(SESSION_TIMEZONE, DEFAULT_TIMEZONE);
$format = Session::get(SESSION_DATETIME_FORMAT, DEFAULT_DATETIME_FORMAT);
$dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $date);
$dateTime->setTimeZone(new DateTimeZone($timezone));

View File

@ -322,6 +322,16 @@ class Activity extends Eloquent
}
$invoice->save();
// deleting a payment from credit creates a new credit
if ($payment->payment_type_id == PAYMENT_TYPE_CREDIT) {
$credit = Credit::createNew();
$credit->client_id = $client->id;
$credit->credit_date = Carbon::now()->toDateTimeString();
$credit->balance = $credit->amount = $payment->amount;
$credit->private_notes = $payment->transaction_reference;
$credit->save();
}
$activity = Activity::getBlank();
$activity->payment_id = $payment->id;
$activity->client_id = $invoice->client_id;

View File

@ -23,7 +23,7 @@ class Gateway extends Eloquent
'logoImageUrl',
'borderColor',
// Dwolla
'redirect',
'returnUrl',
];
public static $optionalFields = [

View File

@ -435,7 +435,7 @@ class InvoiceRepository
&& $account->share_counter) {
$invoiceNumber = $invoice->invoice_number;
if (strpos($invoiceNumber, $account->quote_number_prefix) === 0) {
if ($account->quote_number_prefix && strpos($invoiceNumber, $account->quote_number_prefix) === 0) {
$invoiceNumber = substr($invoiceNumber, strlen($account->quote_number_prefix));
}
$clone->invoice_number = $account->invoice_number_prefix.$invoiceNumber;

View File

@ -37,7 +37,7 @@
"guzzlehttp/guzzle": "~5.0",
"laravelcollective/html": "~5.0",
"wildbit/laravel-postmark-provider": "dev-master",
"mach-kernel/omnipay-dwolla": "dev-master"
"Dwolla/omnipay-dwolla": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "~4.0",

148
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "c3732ac70e554cbab216fc1993487412",
"hash": "d0351e24aaf5ec67780a029d5deaebf4",
"packages": [
{
"name": "alfaproject/omnipay-neteller",
@ -1169,6 +1169,63 @@
],
"time": "2014-09-09 13:34:57"
},
{
"name": "dwolla/omnipay-dwolla",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/Dwolla/omnipay-dwolla.git",
"reference": "f6cf1650a368fd9388a63c5af47be2873782c006"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dwolla/omnipay-dwolla/zipball/f6cf1650a368fd9388a63c5af47be2873782c006",
"reference": "f6cf1650a368fd9388a63c5af47be2873782c006",
"shasum": ""
},
"require": {
"omnipay/common": "~2.0"
},
"require-dev": {
"omnipay/tests": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Omnipay\\Dwolla\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Adrian Macneil",
"email": "adrian@adrianmacneil.com"
},
{
"name": "David Stancu",
"homepage": "https://github.com/mach-kernel"
}
],
"description": "Dwolla support for the Omnipay payment library",
"homepage": "https://github.com/mach-kernel/omnipay-dwolla",
"keywords": [
"dwolla",
"gateway",
"merchant",
"omnipay",
"pay",
"payment"
],
"time": "2015-06-04 22:32:07"
},
{
"name": "fruitcakestudio/omnipay-sisow",
"version": "v2.0.1",
@ -2115,63 +2172,6 @@
],
"time": "2015-03-26 11:54:18"
},
{
"name": "mach-kernel/omnipay-dwolla",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/mach-kernel/omnipay-dwolla.git",
"reference": "cdf228962a28ea1d9d150e33ef25f0e57f157124"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mach-kernel/omnipay-dwolla/zipball/cdf228962a28ea1d9d150e33ef25f0e57f157124",
"reference": "cdf228962a28ea1d9d150e33ef25f0e57f157124",
"shasum": ""
},
"require": {
"omnipay/common": "~2.0"
},
"require-dev": {
"omnipay/tests": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"Omnipay\\Dwolla\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Adrian Macneil",
"email": "adrian@adrianmacneil.com"
},
{
"name": "David Stancu",
"homepage": "https://github.com/mach-kernel"
}
],
"description": "Dwolla support for the Omnipay payment library",
"homepage": "https://github.com/mach-kernel/omnipay-dwolla",
"keywords": [
"dwolla",
"gateway",
"merchant",
"omnipay",
"pay",
"payment"
],
"time": "2014-06-10 16:41:50"
},
{
"name": "maximebf/debugbar",
"version": "v1.10.4",
@ -4109,16 +4109,16 @@
},
{
"name": "omnipay/targetpay",
"version": "v2.2.0",
"version": "v2.2.1",
"source": {
"type": "git",
"url": "https://github.com/omnipay/targetpay.git",
"reference": "7274721c97f6f8ad3d2a8b4dea474ac548c45bac"
"url": "https://github.com/thephpleague/omnipay-targetpay.git",
"reference": "fc74d5d0f7929ce86298faec9e195985d7d4afe0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/omnipay/targetpay/zipball/7274721c97f6f8ad3d2a8b4dea474ac548c45bac",
"reference": "7274721c97f6f8ad3d2a8b4dea474ac548c45bac",
"url": "https://api.github.com/repos/thephpleague/omnipay-targetpay/zipball/fc74d5d0f7929ce86298faec9e195985d7d4afe0",
"reference": "fc74d5d0f7929ce86298faec9e195985d7d4afe0",
"shasum": ""
},
"require": {
@ -4149,11 +4149,11 @@
},
{
"name": "Omnipay Contributors",
"homepage": "https://github.com/omnipay/targetpay/contributors"
"homepage": "https://github.com/thephpleague/omnipay-targetpay/contributors"
}
],
"description": "TargetPay driver for the Omnipay payment processing library",
"homepage": "https://github.com/omnipay/targetpay",
"homepage": "https://github.com/thephpleague/omnipay-targetpay",
"keywords": [
"gateway",
"merchant",
@ -4162,7 +4162,7 @@
"payment",
"targetpay"
],
"time": "2014-04-14 12:23:56"
"time": "2014-09-17 00:38:39"
},
{
"name": "omnipay/worldpay",
@ -5993,16 +5993,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.6.10",
"version": "4.7.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "7b5fe98b28302a8b25693b2298bca74463336975"
"reference": "c2241b8d3381be3e4c6125ae347687d59f286784"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7b5fe98b28302a8b25693b2298bca74463336975",
"reference": "7b5fe98b28302a8b25693b2298bca74463336975",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c2241b8d3381be3e4c6125ae347687d59f286784",
"reference": "c2241b8d3381be3e4c6125ae347687d59f286784",
"shasum": ""
},
"require": {
@ -6013,7 +6013,7 @@
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "~1.3,>=1.3.1",
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
"phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0",
@ -6035,7 +6035,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.6.x-dev"
"dev-master": "4.7.x-dev"
}
},
"autoload": {
@ -6061,7 +6061,7 @@
"testing",
"xunit"
],
"time": "2015-06-03 05:03:30"
"time": "2015-06-05 04:14:02"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -6551,7 +6551,7 @@
"alfaproject/omnipay-skrill": 20,
"omnipay/bitpay": 20,
"wildbit/laravel-postmark-provider": 20,
"mach-kernel/omnipay-dwolla": 20
"dwolla/omnipay-dwolla": 20
},
"prefer-stable": false,
"prefer-lowest": false,

View File

@ -111,23 +111,6 @@ class ConstantsSeeder extends Seeder
PaymentTerm::create(array('num_days' => 60, 'name' => 'Net 60'));
PaymentTerm::create(array('num_days' => 90, 'name' => 'Net 90'));
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/F/Y g:i a', 'label' => '10/March/2013'));
DatetimeFormat::create(array('format' => 'd-F-Y g:i a', 'label' => '10-March-2013'));
DatetimeFormat::create(array('format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'));
DatetimeFormat::create(array('format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'));
DatetimeFormat::create(array('format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'));
DateFormat::create(array('format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'));
DateFormat::create(array('format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'));
DateFormat::create(array('format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'));
DateFormat::create(array('format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'));
DateFormat::create(array('format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'));
DateFormat::create(array('format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'));
DateFormat::create(array('format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'));
DateFormat::create(array('format' => 'Y-M-d', 'picker_format' => 'yyyy-M-dd', 'label' => '2013-03-10'));
PaymentLibrary::create(['name' => 'Omnipay']);
PaymentLibrary::create(['name' => 'PHP-Payments [Deprecated]']);

View File

@ -3,6 +3,8 @@
use App\Models\Gateway;
use App\Models\PaymentTerm;
use App\Models\Currency;
use App\Models\DateFormat;
use App\Models\DatetimeFormat;
class PaymentLibrariesSeeder extends Seeder
{
@ -10,6 +12,14 @@ class PaymentLibrariesSeeder extends Seeder
{
Eloquent::unguard();
$this->createGateways();
$this->createPaymentTerms();
$this->createDateFormats();
$this->createDatetimeFormats();
}
private function createGateways() {
$gateways = [
['name' => 'BeanStream', 'provider' => 'BeanStream', 'payment_library_id' => 2],
['name' => 'Psigate', 'provider' => 'Psigate', 'payment_library_id' => 2],
@ -34,6 +44,10 @@ class PaymentLibrariesSeeder extends Seeder
}
}
}
private function createPaymentTerms() {
$paymentTerms = [
['num_days' => -1, 'name' => 'Net 0'],
];
@ -74,4 +88,47 @@ class PaymentLibrariesSeeder extends Seeder
}
}
}
private function createDateFormats() {
$formats = [
['format' => 'd/M/Y', 'picker_format' => 'dd/M/yyyy', 'label' => '10/Mar/2013'],
['format' => 'd-M-Y', 'picker_format' => 'dd-M-yyyy', 'label' => '10-Mar-2013'],
['format' => 'd/F/Y', 'picker_format' => 'dd/MM/yyyy', 'label' => '10/March/2013'],
['format' => 'd-F-Y', 'picker_format' => 'dd-MM-yyyy', 'label' => '10-March-2013'],
['format' => 'M j, Y', 'picker_format' => 'M d, yyyy', 'label' => 'Mar 10, 2013'],
['format' => 'F j, Y', 'picker_format' => 'MM d, yyyy', 'label' => 'March 10, 2013'],
['format' => 'D M j, Y', 'picker_format' => 'D MM d, yyyy', 'label' => 'Mon March 10, 2013'],
['format' => 'Y-M-d', 'picker_format' => 'yyyy-M-dd', 'label' => '2013-03-10'],
['format' => 'd/m/Y', 'picker_format' => 'dd/mm/yyyy', 'label' => '20/03/2013'],
];
foreach ($formats as $format) {
if (!DB::table('date_formats')->whereLabel($format['label'])->get()) {
DateFormat::create($format);
}
}
}
private function createDatetimeFormats() {
$formats = [
['format' => 'd/M/Y g:i a', 'label' => '10/Mar/2013'],
['format' => 'd-M-Yk g:i a', 'label' => '10-Mar-2013'],
['format' => 'd/F/Y g:i a', 'label' => '10/March/2013'],
['format' => 'd-F-Y g:i a', 'label' => '10-March-2013'],
['format' => 'M j, Y g:i a', 'label' => 'Mar 10, 2013 6:15 pm'],
['format' => 'F j, Y g:i a', 'label' => 'March 10, 2013 6:15 pm'],
['format' => 'D M jS, Y g:ia', 'label' => 'Mon March 10th, 2013 6:15 pm'],
['format' => 'Y-M-d g:i a', 'label' => '2013-03-10 6:15 pm'],
['format' => 'd/m/Y g:i a', 'label' => '20/03/2013 6:15 pm'],
];
foreach ($formats as $format) {
if (!DB::table('datetime_formats')->whereLabel($format['label'])->get()) {
DatetimeFormat::create($format);
}
}
}
}

View File

@ -2450,7 +2450,7 @@ table.dataTable thead > tr > th, table.invoice-table thead > tr > th {
color:#fff;
}
table.dataTable tr:hover {
background-color: #f0f9ff !important;
background-color: #F2F5FE !important;
}
th:first-child {
border-radius: 3px 0 0 0;
@ -2472,7 +2472,7 @@ border-bottom: none;
}
.table-striped>tbody>tr:nth-child(odd)>tr,
.table-striped>tbody>tr:nth-child(odd)>th {
background-color: #FDFDFD;
/*background-color: #FDFDFD;*/
}
table.table thead .sorting_asc {
background: url('../images/sort_asc.png') no-repeat 90% 50%;

View File

@ -66,7 +66,7 @@ table.dataTable thead > tr > th, table.invoice-table thead > tr > th {
color:#fff;
}
table.dataTable tr:hover {
background-color: #f0f9ff !important;
background-color: #F2F5FE !important;
}
th:first-child {
border-radius: 3px 0 0 0;

View File

@ -0,0 +1 @@
We're currently undergoing a brief maintenance, we'll be right back.

View File

@ -180,7 +180,6 @@
}
$(function() {
var $clientSelect = $('select#client');
for (var i=0; i<clients.length; i++) {
var client = clients[i];