1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Merge pull request #3814 from turbo124/v2

Require HTTPS as a configurable option
This commit is contained in:
David Bomba 2020-06-18 17:11:18 +10:00 committed by GitHub
commit 84374b1fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 102 deletions

View File

@ -314,11 +314,10 @@ class BaseController extends Controller
public function flutterRoute()
{
// // Ensure all request are over HTTPS in production
// if (! request()->secure()) {
// return redirect()->secure(request()->path());
// }
if (config('ninja.require_https') && !request()->isSecure()) {
return redirect()->secure(request()->getRequestUri());
}
if ((bool)$this->checkAppSetup() !== false && Schema::hasTable('accounts') && $account = Account::all()->first()) {
$data = [];

View File

@ -35,9 +35,9 @@ class UpdatePaymentRequest extends Request
public function rules()
{
{//min:1 removed
return [
'invoices' => ['required','array','min:1',new PaymentAppliedValidAmount,new ValidCreditsPresentRule],
'invoices' => ['required','array',new PaymentAppliedValidAmount,new ValidCreditsPresentRule],
'invoices.*.invoice_id' => 'distinct',
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
];

View File

@ -38,7 +38,7 @@ class CompanyPresenter extends EntityPresenter
$settings = $this->entity->settings;
}
return iconv_strlen($settings->company_logo > 0) ? $settings->company_logo : 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png';
return (strlen($settings->company_logo) > 0) ? $settings->company_logo : 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png';
}
public function address($settings = null)

View File

@ -151,14 +151,16 @@ class PaymentRepository extends BaseRepository
$invoice_totals -= $credit_totals;
//$payment->amount = $invoice_totals; //creates problems when setting amount like this.
if ($invoice_totals == $payment->amount) {
if($credit_totals == $payment->amount){
$payment->applied += $credit_totals;
} elseif ($invoice_totals == $payment->amount) {
$payment->applied += $payment->amount;
} elseif ($invoice_totals < $payment->amount) {
$payment->applied += $invoice_totals;
}
$payment->save();
return $payment->fresh();
}

View File

@ -37,7 +37,7 @@ class ApplyPayment extends AbstractService
->ledger()
->updatePaymentBalance($this->payment_amount*-1);
info("apply paymenet method - current client balance = {$this->payment->client->balance}");
info("apply payment method - current client balance = {$this->payment->client->balance}");
info("reducing client balance by payment amount {$this->payment_amount}");
@ -56,7 +56,7 @@ class ApplyPayment extends AbstractService
$this->invoice->fresh('client');
info("1 end of apply payment method the client balnace = {$this->invoice->client->balance}");
info("1 end of apply payment method the client balance = {$this->invoice->client->balance}");
if ($this->invoice->hasPartial()) {
//is partial and amount is exactly the partial amount

View File

@ -71,7 +71,8 @@ class HandleReversal extends AbstractService
if ($total_paid > 0) {
$credit = CreditFactory::create($this->invoice->company_id, $this->invoice->user_id);
$credit->client_id = $this->invoice->client_id;
$credit->invoice_id = $this->invoice->id;
$item = InvoiceItemFactory::create();
$item->quantity = 1;
$item->cost = (float)$total_paid;

View File

@ -76,7 +76,7 @@ class PaymentTransformer extends EntityTransformer
'updated_at' => (int)$payment->updated_at,
'archived_at' => (int)$payment->deleted_at,
'is_deleted' => (bool) $payment->is_deleted,
'type_id' => (string) $payment->payment_type_id ?: '',
'type_id' => (string) $payment->type_id ?: '',
'invitation_id' => (string) $payment->invitation_id ?: '',
'private_notes' => (string) $payment->private_notes ?: '',
'number' => (string) $payment->number ?: '',

View File

@ -24,6 +24,8 @@ trait Uploadable
if ($file) {
$path = UploadAvatar::dispatchNow($file, $company->company_key);
info("the path {$path}");
if ($path) {
$settings = $entity->settings;
$settings->company_logo = $path;

150
composer.lock generated
View File

@ -107,16 +107,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.142.1",
"version": "3.142.4",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "ab92ec111132712417cc97be06275553b10a76ab"
"reference": "1d55df0b6490f6a9d6ebfd3a73d297d299ff8802"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ab92ec111132712417cc97be06275553b10a76ab",
"reference": "ab92ec111132712417cc97be06275553b10a76ab",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/1d55df0b6490f6a9d6ebfd3a73d297d299ff8802",
"reference": "1d55df0b6490f6a9d6ebfd3a73d297d299ff8802",
"shasum": ""
},
"require": {
@ -188,7 +188,7 @@
"s3",
"sdk"
],
"time": "2020-06-12T18:16:31+00:00"
"time": "2020-06-17T18:18:58+00:00"
},
{
"name": "checkout/checkout-sdk-php",
@ -1086,6 +1086,20 @@
"sqlserver",
"sqlsrv"
],
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2020-04-20T17:19:26+00:00"
},
{
@ -1387,16 +1401,16 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.17",
"version": "2.1.18",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a"
"reference": "cfa3d44471c7f5bfb684ac2b0da7114283d78441"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ade6887fd9bd74177769645ab5c474824f8a418a",
"reference": "ade6887fd9bd74177769645ab5c474824f8a418a",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/cfa3d44471c7f5bfb684ac2b0da7114283d78441",
"reference": "cfa3d44471c7f5bfb684ac2b0da7114283d78441",
"shasum": ""
},
"require": {
@ -1420,7 +1434,7 @@
},
"autoload": {
"psr-4": {
"Egulias\\EmailValidator\\": "EmailValidator"
"Egulias\\EmailValidator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@ -1441,7 +1455,7 @@
"validation",
"validator"
],
"time": "2020-02-13T22:36:52+00:00"
"time": "2020-06-16T20:11:17+00:00"
},
{
"name": "fedeisas/laravel-mail-css-inliner",
@ -1804,16 +1818,16 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.4",
"version": "6.5.5",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "a4a1b6930528a8f7ee03518e6442ec7a44155d9d"
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/a4a1b6930528a8f7ee03518e6442ec7a44155d9d",
"reference": "a4a1b6930528a8f7ee03518e6442ec7a44155d9d",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"reference": "9d4290de1cfd701f38099ef7e183b64b4b7b0c5e",
"shasum": ""
},
"require": {
@ -1821,7 +1835,7 @@
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.6.1",
"php": ">=5.5",
"symfony/polyfill-intl-idn": "1.17.0"
"symfony/polyfill-intl-idn": "^1.17.0"
},
"require-dev": {
"ext-curl": "*",
@ -1867,7 +1881,7 @@
"rest",
"web service"
],
"time": "2020-05-25T19:35:05+00:00"
"time": "2020-06-16T21:01:06+00:00"
},
{
"name": "guzzlehttp/promises",
@ -2432,16 +2446,16 @@
},
{
"name": "laravel/framework",
"version": "v6.18.19",
"version": "v6.18.20",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "69321afec31f4a908112e5dc8995fc91024fd971"
"reference": "2862a9857533853bb2851bac39d65e3bfb8ba6cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/69321afec31f4a908112e5dc8995fc91024fd971",
"reference": "69321afec31f4a908112e5dc8995fc91024fd971",
"url": "https://api.github.com/repos/laravel/framework/zipball/2862a9857533853bb2851bac39d65e3bfb8ba6cd",
"reference": "2862a9857533853bb2851bac39d65e3bfb8ba6cd",
"shasum": ""
},
"require": {
@ -2523,6 +2537,7 @@
"suggest": {
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).",
"ext-ftp": "Required to use the Flysystem FTP driver.",
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
"ext-memcached": "Required to use the memcache cache driver.",
"ext-pcntl": "Required to use all features of the queue worker.",
@ -2575,7 +2590,7 @@
"framework",
"laravel"
],
"time": "2020-06-09T13:59:34+00:00"
"time": "2020-06-16T13:21:33+00:00"
},
{
"name": "laravel/slack-notification-channel",
@ -4095,16 +4110,16 @@
},
{
"name": "opis/closure",
"version": "3.5.4",
"version": "3.5.5",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
"reference": "1d0deef692f66dae5d70663caee2867d0971306b"
"reference": "dec9fc5ecfca93f45cd6121f8e6f14457dff372c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opis/closure/zipball/1d0deef692f66dae5d70663caee2867d0971306b",
"reference": "1d0deef692f66dae5d70663caee2867d0971306b",
"url": "https://api.github.com/repos/opis/closure/zipball/dec9fc5ecfca93f45cd6121f8e6f14457dff372c",
"reference": "dec9fc5ecfca93f45cd6121f8e6f14457dff372c",
"shasum": ""
},
"require": {
@ -4152,7 +4167,7 @@
"serialization",
"serialize"
],
"time": "2020-06-07T11:41:29+00:00"
"time": "2020-06-17T14:59:55+00:00"
},
{
"name": "paragonie/random_compat",
@ -5865,6 +5880,12 @@
"screenshot",
"webpage"
],
"funding": [
{
"url": "https://www.patreon.com/spatie",
"type": "patreon"
}
],
"time": "2020-04-20T10:33:41+00:00"
},
{
@ -6272,7 +6293,7 @@
},
{
"name": "symfony/css-selector",
"version": "v5.1.1",
"version": "v5.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -6683,7 +6704,7 @@
},
{
"name": "symfony/filesystem",
"version": "v5.1.1",
"version": "v5.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@ -6984,7 +7005,7 @@
},
{
"name": "symfony/mime",
"version": "v5.1.1",
"version": "v5.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
@ -7061,7 +7082,7 @@
},
{
"name": "symfony/options-resolver",
"version": "v5.1.1",
"version": "v5.1.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@ -8436,16 +8457,16 @@
},
{
"name": "yajra/laravel-datatables-oracle",
"version": "v9.10.1",
"version": "v9.10.2",
"source": {
"type": "git",
"url": "https://github.com/yajra/laravel-datatables.git",
"reference": "01b4a4fdbd13e4d77fa2d27916cdafac789d2d1a"
"reference": "7ccbc890aa03d645bd509c03299234dc631240ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/01b4a4fdbd13e4d77fa2d27916cdafac789d2d1a",
"reference": "01b4a4fdbd13e4d77fa2d27916cdafac789d2d1a",
"url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/7ccbc890aa03d645bd509c03299234dc631240ee",
"reference": "7ccbc890aa03d645bd509c03299234dc631240ee",
"shasum": ""
},
"require": {
@ -8513,7 +8534,7 @@
"type": "patreon"
}
],
"time": "2020-05-30T04:43:39+00:00"
"time": "2020-06-17T03:08:37+00:00"
}
],
"packages-dev": [
@ -8706,52 +8727,6 @@
],
"time": "2020-05-05T10:53:32+00:00"
},
{
"name": "beganovich/omnipay-checkout",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/beganovich/omnipay-checkout.git",
"reference": "a4e78bc3ce6ea39ea2c2b7da3019b3966fc86a21"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/beganovich/omnipay-checkout/zipball/a4e78bc3ce6ea39ea2c2b7da3019b3966fc86a21",
"reference": "a4e78bc3ce6ea39ea2c2b7da3019b3966fc86a21",
"shasum": ""
},
"require": {
"omnipay/common": "^3",
"php": "^7.1"
},
"require-dev": {
"omnipay/tests": "^3"
},
"type": "library",
"autoload": {
"psr-4": {
"Omnipay\\Checkout\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Benjamin Beganović",
"email": "ben@invoiceninja.com",
"role": "Developer"
}
],
"description": "Checkout driver for the Omnipay PHP payment processing library",
"homepage": "https://github.com/beganovich/omnipay-checkout",
"keywords": [
"beganovich",
"omnipay-checkout"
],
"time": "2020-05-11T22:18:27+00:00"
},
{
"name": "beyondcode/laravel-dump-server",
"version": "1.3.0",
@ -10957,16 +10932,16 @@
},
{
"name": "webmozart/assert",
"version": "1.8.0",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
"reference": "9dc4f203e36f2b486149058bade43c851dd97451"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
"reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
"url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
"reference": "9dc4f203e36f2b486149058bade43c851dd97451",
"shasum": ""
},
"require": {
@ -10974,6 +10949,7 @@
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
@ -11001,7 +10977,7 @@
"check",
"validate"
],
"time": "2020-04-18T12:12:48+00:00"
"time": "2020-06-16T10:16:42+00:00"
},
{
"name": "wildbit/postmark-php",

View File

@ -6,7 +6,7 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Client::class, function (Faker $faker) {
return [
'name' => $faker->name(),
'name' => $faker->company(),
'website' => $faker->url,
'private_notes' => $faker->text(200),
'balance' => 0,