Compare commits
210 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edb4a90823 | ||
|
|
ec0ec4401a | ||
|
|
7b82c799f2 | ||
|
|
a75fd54e8a | ||
|
|
70d263dfa2 | ||
|
|
1463544bdb | ||
|
|
59de0216ac | ||
|
|
69c0b5e530 | ||
|
|
d3edf6ab21 | ||
|
|
fba8e6bb9f | ||
|
|
9b74091119 | ||
|
|
7d1c236c27 | ||
|
|
260f8a909c | ||
|
|
7d7f05b5ee | ||
|
|
5f610a9d49 | ||
|
|
e0d903629a | ||
|
|
93ab20492e | ||
|
|
ebf5666b2a | ||
|
|
5bf7c07048 | ||
|
|
ba0380c0e7 | ||
|
|
9ddcea260d | ||
|
|
c1096d7100 | ||
|
|
d2221ff20b | ||
|
|
13a0789089 | ||
|
|
b95982de03 | ||
|
|
d25fc0c72d | ||
|
|
5ecdc6e084 | ||
|
|
72c4aed24b | ||
|
|
3d58ec0aec | ||
|
|
0a39fbb141 | ||
|
|
9bcd4e028b | ||
|
|
9ee4512e01 | ||
|
|
8b855003a1 | ||
|
|
f9e44df6fe | ||
|
|
9ceda7dfb5 | ||
|
|
ca386a2e62 | ||
|
|
5851a3ed7d | ||
|
|
87f63d07fc | ||
|
|
cf69b439c0 | ||
|
|
5f8d0afe1b | ||
|
|
8ed57d5edf | ||
|
|
9ca4bf2d02 | ||
|
|
1bb5a8efd4 | ||
|
|
63d17685de | ||
|
|
38349476fb | ||
|
|
76631a7f59 | ||
|
|
76c4cc982f | ||
|
|
7be517f0c3 | ||
|
|
b66ed112ef | ||
|
|
027aef9ce0 | ||
|
|
d2e8b1e884 | ||
|
|
7157225aa7 | ||
|
|
fd8d4b835c | ||
|
|
2d8d375cbf | ||
|
|
8f10b89736 | ||
|
|
47be5a5f3a | ||
|
|
830a82ff9b | ||
|
|
996afc767c | ||
|
|
a536b9d6b8 | ||
|
|
3925173bee | ||
|
|
9969f52bd6 | ||
|
|
5121a02b4d | ||
|
|
41b4812c50 | ||
|
|
284daf314b | ||
|
|
a612dcde86 | ||
|
|
9648764acb | ||
|
|
fd8e5b886a | ||
|
|
775917cbac | ||
|
|
22be3c2a84 | ||
|
|
b90c423569 | ||
|
|
159fe7120e | ||
|
|
a65acadafa | ||
|
|
1979eccadd | ||
|
|
c1526b59ae | ||
|
|
a369e017c9 | ||
|
|
788344783e | ||
|
|
e2c71df8b6 | ||
|
|
5253cbc902 | ||
|
|
84a54b08c7 | ||
|
|
03a1c2be8a | ||
|
|
d5e5acf6c4 | ||
|
|
95c36f111b | ||
|
|
60897083d1 | ||
|
|
7d61ec8317 | ||
|
|
f7747f06f5 | ||
|
|
45acf67daa | ||
|
|
7364b8e021 | ||
|
|
b54dc7bf0a | ||
|
|
70444c7a12 | ||
|
|
6a146e8fff | ||
|
|
cfeee5f98c | ||
|
|
53bebc4d0f | ||
|
|
2204272953 | ||
|
|
2897fdaa9e | ||
|
|
de5d5d3b10 | ||
|
|
35d5f532bc | ||
|
|
2d243be4ae | ||
|
|
53c8f8d6e0 | ||
|
|
9e489535cc | ||
|
|
8816bd30c3 | ||
|
|
2b8af442cc | ||
|
|
d73e56cbb6 | ||
|
|
bdecb380fc | ||
|
|
7aa172b1db | ||
|
|
9d7145c61b | ||
|
|
97713e130b | ||
|
|
1ddffc01c9 | ||
|
|
7e973ff91e | ||
|
|
ebcbbbaa1f | ||
|
|
bf6e93f8d8 | ||
|
|
1937169640 | ||
|
|
49038a0c17 | ||
|
|
3e86707f9f | ||
|
|
b427a69735 | ||
|
|
487d44ba67 | ||
|
|
a4a55f5369 | ||
|
|
35795e415b | ||
|
|
64674fea24 | ||
|
|
2ecab1b6a6 | ||
|
|
c97a3b8c16 | ||
|
|
3689a70e36 | ||
|
|
597cfc0662 | ||
|
|
fa5c787140 | ||
|
|
32a9df4e67 | ||
|
|
7106056115 | ||
|
|
0b1a8d7572 | ||
|
|
32002bcfc3 | ||
|
|
9a4b63adbb | ||
|
|
136ae88f95 | ||
|
|
7ae74ab8ed | ||
|
|
c51f27803f | ||
|
|
ebd87245af | ||
|
|
64269c5fc0 | ||
|
|
a164e945a7 | ||
|
|
e619d1d541 | ||
|
|
40c30cce2f | ||
|
|
b5aee8a8bf | ||
|
|
63b331dcc8 | ||
|
|
956f2fda33 | ||
|
|
7cedb82d1e | ||
|
|
8dbd44d37d | ||
|
|
4c6c71a85d | ||
|
|
37126963f6 | ||
|
|
e751a1ddbf | ||
|
|
e3039763c6 | ||
|
|
d6049b026e | ||
|
|
d5c264f540 | ||
|
|
21cc007474 | ||
|
|
a66b500fc6 | ||
|
|
fd4cf13234 | ||
|
|
26ae669659 | ||
|
|
5c85088a23 | ||
|
|
955ab0c5db | ||
|
|
dcfd178c20 | ||
|
|
d50b754cb0 | ||
|
|
9372a304c7 | ||
|
|
54b47d4ac0 | ||
|
|
d398ae2411 | ||
|
|
9dfa3bc9dd | ||
|
|
22e739ca26 | ||
|
|
fd960fa543 | ||
|
|
1e0fa8d044 | ||
|
|
6037e92fd3 | ||
|
|
b9a0438632 | ||
|
|
74a56afe6d | ||
|
|
1a4b9ddac6 | ||
|
|
ba45d0b272 | ||
|
|
3671bcced5 | ||
|
|
5ad41db0ce | ||
|
|
dbc0ba02fc | ||
|
|
97271449ed | ||
|
|
e58e6b3980 | ||
|
|
e25c6b8ee2 | ||
|
|
37c7ec4265 | ||
|
|
b02bf18989 | ||
|
|
1324394256 | ||
|
|
391df15a96 | ||
|
|
50a0532bf4 | ||
|
|
0743b003ab | ||
|
|
05b12a6bb9 | ||
|
|
1da5352bed | ||
|
|
7a07c3da1c | ||
|
|
7b5e0a4eb2 | ||
|
|
f441166133 | ||
|
|
c5cbfff67b | ||
|
|
e87dd65bc2 | ||
|
|
d9ce3467ae | ||
|
|
e15de6dee6 | ||
|
|
511ba0ee36 | ||
|
|
f5e6f23712 | ||
|
|
874c162db2 | ||
|
|
e56846131f | ||
|
|
93f0385a45 | ||
|
|
c9acbc3688 | ||
|
|
2ca59a68e2 | ||
|
|
a29082d85e | ||
|
|
03d4992875 | ||
|
|
48cfe8cc6b | ||
|
|
7dc4ecd209 | ||
|
|
a99aa30669 | ||
|
|
2d02e4f569 | ||
|
|
8dde332c6d | ||
|
|
c7c95423cf | ||
|
|
25a1ec88eb | ||
|
|
533d7b8546 | ||
|
|
b002dfd2af | ||
|
|
4dfb6de450 | ||
|
|
686042c922 | ||
|
|
f0692c75b4 | ||
|
|
661232acaa |
199 changed files with 14913 additions and 5726 deletions
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -36,6 +36,6 @@ If applicable, add screenshots to help explain your problem.
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
|
||||||
Note: Before posting don't forget to check our "Troubleshooting" category in the [docs](https://invoiceninja.github.io/docs/self-host-troubleshooting/) (https://invoiceninja.github.io/docs/self-host-troubleshooting/).
|
<!-- Note: Before posting don't forget to check our "Troubleshooting" category in the [docs](https://invoiceninja.github.io/docs/self-host-troubleshooting/) (https://invoiceninja.github.io/docs/self-host-troubleshooting/) -->
|
||||||
|
|
||||||
**(v5) Can you replicate the issue on our demo site? https://demo.invoiceninja.com**
|
**(v5) Can you replicate the issue on our demo site? https://demo.invoiceninja.com**
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -17,7 +17,7 @@
|
||||||
/bootstrap/environment.php
|
/bootstrap/environment.php
|
||||||
/vendor
|
/vendor
|
||||||
/node_modules
|
/node_modules
|
||||||
/.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
/.env
|
/.env
|
||||||
/.env.development.php
|
/.env.development.php
|
||||||
|
|
|
||||||
88
LICENSE
88
LICENSE
|
|
@ -1,47 +1,47 @@
|
||||||
Copyright (c) 2018 by Hillel Coren
|
Elastic License 2.0 (ELv2)
|
||||||
Invoice Ninja * https://www.invoiceninja.com
|
Elastic License
|
||||||
"CREATE. SEND. GET PAID"
|
|
||||||
|
|
||||||
All Rights Reserved
|
Acceptance
|
||||||
ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license)
|
By using the software, you agree to all of the terms and conditions below.
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the conditions below are met.
|
|
||||||
These conditions require a modest attribution to InvoiceNinja.com (the
|
|
||||||
"Author"), who hopes that its promotional value may help justify the
|
|
||||||
thousands of dollars in otherwise billable time invested in writing
|
|
||||||
this and other freely available, open-source software.
|
|
||||||
|
|
||||||
1. Redistributions of source code, in whole or part and with or without
|
Copyright License
|
||||||
modification (the "Code"), must prominently display this GPG-signed
|
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
||||||
text in verifiable form.
|
|
||||||
2. Redistributions of the Code in binary form must be accompanied by
|
|
||||||
this GPG-signed text in any documentation and, each time the resulting
|
|
||||||
executable program or a program dependent thereon is launched, a
|
|
||||||
prominent display (e.g., splash screen or banner text) of the Author's
|
|
||||||
attribution information, which includes:
|
|
||||||
(a) Name ("Hillel Coren"),
|
|
||||||
(b) Professional identification ("Invoice Ninja"), and
|
|
||||||
(c) URL ("https://www.invoiceninja.com").
|
|
||||||
3. Neither the name nor any trademark of the Author may be used to
|
|
||||||
endorse or promote products derived from this software without specific
|
|
||||||
prior written permission.
|
|
||||||
4. Users are entirely responsible, to the exclusion of the Author and
|
|
||||||
any other persons, for compliance with (1) regulations set by owners or
|
|
||||||
administrators of employed equipment, (2) licensing terms of any other
|
|
||||||
software, and (3) local regulations regarding use, including those
|
|
||||||
regarding import, export, and use of encryption software.
|
|
||||||
|
|
||||||
THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND
|
Limitations
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
||||||
EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS;
|
Patents
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
||||||
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
Notices
|
||||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
||||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
||||||
|
|
||||||
|
No Other Rights
|
||||||
|
These terms do not imply any licenses other than those expressly granted in these terms.
|
||||||
|
|
||||||
|
Termination
|
||||||
|
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
||||||
|
|
||||||
|
No Liability
|
||||||
|
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
||||||
|
|
||||||
|
Definitions
|
||||||
|
The licensor is the entity offering these terms, and the software is the software the licensor makes available under these terms, including any portion of it.
|
||||||
|
|
||||||
|
you refers to the individual or entity agreeing to these terms.
|
||||||
|
|
||||||
|
your company is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. control means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
||||||
|
|
||||||
|
your licenses are all the licenses granted to you for the software under these terms.
|
||||||
|
|
||||||
|
use means anything you do with the software requiring one of your licenses.
|
||||||
|
|
||||||
|
trademark means trademarks, service marks, and similar rights.
|
||||||
|
|
||||||
|
For more information regarding the interpretation of this license please see here: https://invoiceninja.github.io/docs/legal/license/
|
||||||
22
README.md
22
README.md
|
|
@ -15,7 +15,7 @@ Just make sure to add the `invoice-ninja` tag to your question.
|
||||||
|
|
||||||
#### Note: v5 is now tagged Stable! To upgrade from v4 you need to [install v5](https://invoiceninja.github.io/docs/self-host-installation/) as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management.
|
#### Note: v5 is now tagged Stable! To upgrade from v4 you need to [install v5](https://invoiceninja.github.io/docs/self-host-installation/) as a separate app and then use the migration tool in the latest version of v4 on Settings > Account Management.
|
||||||
|
|
||||||
All Pro and Enterprise features from the hosted app are included in the open-source code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client facing parts of the app.
|
All Pro and Enterprise features from the hosted app are included in the open-code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client facing parts of the app.
|
||||||
|
|
||||||
The self-host zip includes all third party libraries whereas downloading the code from GitHub requires using Composer to install the dependencies.
|
The self-host zip includes all third party libraries whereas downloading the code from GitHub requires using Composer to install the dependencies.
|
||||||
|
|
||||||
|
|
@ -25,17 +25,19 @@ The self-host zip includes all third party libraries whereas downloading the cod
|
||||||
* [Support Forum](https://www.invoiceninja.com/forums/forum/support/)
|
* [Support Forum](https://www.invoiceninja.com/forums/forum/support/)
|
||||||
* [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
|
* [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
|
||||||
|
|
||||||
## Referral Program
|
|
||||||
* Earn 50% of Pro & Enterprise Plans up to 4 years - [Learn more](https://www.invoiceninja.com/referral-program/)
|
|
||||||
|
|
||||||
## Mobile App
|
## Mobile App
|
||||||
* [iPhone](https://itunes.apple.com/us/app/invoice-ninja/id1435514417?ls=1&mt=8)
|
* [iPhone](https://apps.apple.com/us/app/invoice-ninja-v5/id1503970375#?platform=iphone)
|
||||||
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.flutter)
|
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app)
|
||||||
* [Source Code](https://github.com/invoiceninja/flutter-mobile)
|
* [Linux](https://github.com/invoiceninja/flutter-mobile)
|
||||||
|
|
||||||
|
## Desktop App
|
||||||
|
* [MacOS](https://apps.apple.com/app/id1503970375)
|
||||||
|
* [Windows](https://microsoft.com/en-us/p/invoice-ninja/9n3f2bbcfdr6)
|
||||||
|
* [MacOS Desktop](https://snapcraft.io/invoiceninja)
|
||||||
|
|
||||||
## Installation Options
|
## Installation Options
|
||||||
* [Ansible](https://github.com/invoiceninja/ansible-installer)
|
* [Ansible](https://github.com/invoiceninja/ansible-installer)
|
||||||
* [Self-Host Zip](https://docs.invoiceninja.com/install.html)
|
* [Self-Host Zip](https://invoice-ninja.readthedocs.io/en/latest/install.html)
|
||||||
* [Docker File](https://hub.docker.com/r/invoiceninja/invoiceninja/)
|
* [Docker File](https://hub.docker.com/r/invoiceninja/invoiceninja/)
|
||||||
* [Cloudron](https://cloudron.io/store/com.invoiceninja.cloudronapp.html)
|
* [Cloudron](https://cloudron.io/store/com.invoiceninja.cloudronapp.html)
|
||||||
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja)
|
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja)
|
||||||
|
|
@ -49,7 +51,7 @@ The self-host zip includes all third party libraries whereas downloading the cod
|
||||||
## Development
|
## Development
|
||||||
* [API Documentation](https://invoice-ninja.readthedocs.io/en/latest/api.html)
|
* [API Documentation](https://invoice-ninja.readthedocs.io/en/latest/api.html)
|
||||||
* [PHP SDK](https://github.com/invoiceninja/sdk-php)
|
* [PHP SDK](https://github.com/invoiceninja/sdk-php)
|
||||||
* [Zend Framework](https://github.com/alexz707/InvoiceNinjaModule)
|
* [Laminas Framework](https://github.com/alexz707/InvoiceNinjaModule)
|
||||||
* [Custom Module](https://invoice-ninja.readthedocs.io/en/latest/custom_modules.html) | [Watch Video](https://www.youtube.com/watch?v=8jJ-PYuq85k)
|
* [Custom Module](https://invoice-ninja.readthedocs.io/en/latest/custom_modules.html) | [Watch Video](https://www.youtube.com/watch?v=8jJ-PYuq85k)
|
||||||
|
|
||||||
## Third Party Modules
|
## Third Party Modules
|
||||||
|
|
@ -92,5 +94,5 @@ For information on how contribute to Invoice Ninja, please see our [contributing
|
||||||
* [Mike Skaggs](https://github.com/titan-fail)
|
* [Mike Skaggs](https://github.com/titan-fail)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
Invoice Ninja is released under the Attribution Assurance License.
|
Invoice Ninja is released under the Elastic License 2.0
|
||||||
See [LICENSE](LICENSE) for details.
|
See [LICENSE](LICENSE) for details.
|
||||||
|
|
|
||||||
3
SECURITY.md
Normal file
3
SECURITY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
If you discover any security related issues, please email contact@invoiceninja.com instead of using the issue tracker.
|
||||||
|
|
@ -78,7 +78,7 @@ class CheckData extends Command
|
||||||
$this->checkContacts();
|
$this->checkContacts();
|
||||||
|
|
||||||
if (! $this->option('client_id')) {
|
if (! $this->option('client_id')) {
|
||||||
$this->checkBlankInvoiceHistory();
|
//$this->checkBlankInvoiceHistory();
|
||||||
$this->checkPaidToDate();
|
$this->checkPaidToDate();
|
||||||
$this->checkDraftSentInvoices();
|
$this->checkDraftSentInvoices();
|
||||||
}
|
}
|
||||||
|
|
@ -92,12 +92,12 @@ class CheckData extends Command
|
||||||
if (! $this->option('client_id')) {
|
if (! $this->option('client_id')) {
|
||||||
$this->checkOAuth();
|
$this->checkOAuth();
|
||||||
//$this->checkInvitations();
|
//$this->checkInvitations();
|
||||||
$this->checkAccountData();
|
//$this->checkAccountData();
|
||||||
$this->checkLookupData();
|
$this->checkLookupData();
|
||||||
$this->checkFailedJobs();
|
$this->checkFailedJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->checkTranslations();
|
//$this->checkTranslations();
|
||||||
$this->logMessage('Done: ' . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
|
$this->logMessage('Done: ' . strtoupper($this->isValid ? RESULT_SUCCESS : RESULT_FAILURE));
|
||||||
$errorEmail = env('ERROR_EMAIL');
|
$errorEmail = env('ERROR_EMAIL');
|
||||||
|
|
||||||
|
|
@ -160,6 +160,7 @@ class CheckData extends Command
|
||||||
$invoices = Invoice::whereInvoiceStatusId(INVOICE_STATUS_SENT)
|
$invoices = Invoice::whereInvoiceStatusId(INVOICE_STATUS_SENT)
|
||||||
->whereIsPublic(false)
|
->whereIsPublic(false)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
|
->where('updated_at', '>', '2022-01-01')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->logMessage($invoices->count() . ' draft sent invoices');
|
$this->logMessage($invoices->count() . ' draft sent invoices');
|
||||||
|
|
@ -638,7 +639,7 @@ class CheckData extends Command
|
||||||
->where('payments.payment_status_id', '!=', 3)
|
->where('payments.payment_status_id', '!=', 3)
|
||||||
->where('payments.is_deleted', '=', 0);
|
->where('payments.is_deleted', '=', 0);
|
||||||
})
|
})
|
||||||
->where('invoices.updated_at', '>', '2017-10-01')
|
->where('invoices.updated_at', '>', '2022-01-01')
|
||||||
->groupBy('invoices.id')
|
->groupBy('invoices.id')
|
||||||
->havingRaw('(invoices.amount - invoices.balance) != coalesce(sum(payments.amount - payments.refunded), 0)')
|
->havingRaw('(invoices.amount - invoices.balance) != coalesce(sum(payments.amount - payments.refunded), 0)')
|
||||||
->get(['invoices.id', 'invoices.amount', 'invoices.balance', DB::raw('coalesce(sum(payments.amount - payments.refunded), 0)')]);
|
->get(['invoices.id', 'invoices.amount', 'invoices.balance', DB::raw('coalesce(sum(payments.amount - payments.refunded), 0)')]);
|
||||||
|
|
@ -662,6 +663,7 @@ class CheckData extends Command
|
||||||
->where('invoices.is_public', '=', 1)
|
->where('invoices.is_public', '=', 1)
|
||||||
->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD)
|
->where('invoices.invoice_type_id', '=', INVOICE_TYPE_STANDARD)
|
||||||
->where('invoices.is_recurring', '=', 0)
|
->where('invoices.is_recurring', '=', 0)
|
||||||
|
->where('clients.updated_at', '>', '2022-01-01')
|
||||||
->havingRaw('abs(clients.balance - sum(invoices.balance)) > .01 and clients.balance != 999999999.9999');
|
->havingRaw('abs(clients.balance - sum(invoices.balance)) > .01 and clients.balance != 999999999.9999');
|
||||||
|
|
||||||
if ($this->option('client_id')) {
|
if ($this->option('client_id')) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ use App\Models\User;
|
||||||
use App\Traits\GenerateMigrationResources;
|
use App\Traits\GenerateMigrationResources;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class ExportMigrations extends Command
|
class ExportMigrations extends Command
|
||||||
{
|
{
|
||||||
|
|
@ -17,7 +18,7 @@ class ExportMigrations extends Command
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $signature = 'migrations:export {--user=} {--random=}';
|
protected $signature = 'migrations:export {--user=} {--email=} {--random=}';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
|
|
@ -46,8 +47,36 @@ class ExportMigrations extends Command
|
||||||
$this->info('Note: Migrations will be stored inside of (storage/migrations) folder.');
|
$this->info('Note: Migrations will be stored inside of (storage/migrations) folder.');
|
||||||
|
|
||||||
if($this->option('user')) {
|
if($this->option('user')) {
|
||||||
$record = User::findOrFail($this->option('user'));
|
$record = User::on(DB_NINJA_1)->find($this->option('user'));
|
||||||
|
|
||||||
|
if($record)
|
||||||
return $this->export($record);
|
return $this->export($record);
|
||||||
|
|
||||||
|
$record = User::on(DB_NINJA_2)->find($this->option('user'));
|
||||||
|
|
||||||
|
if($record)
|
||||||
|
return $this->export($record);
|
||||||
|
|
||||||
|
|
||||||
|
$this->info('I could not find that user - sorry');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($this->option('email')) {
|
||||||
|
$record = User::on(DB_NINJA_1)->where('email', $this->option('email'))->first();
|
||||||
|
|
||||||
|
if($record)
|
||||||
|
return $this->export($record);
|
||||||
|
|
||||||
|
$record = User::on(DB_NINJA_2)->where('email', $this->option('email'))->first();
|
||||||
|
|
||||||
|
if($record)
|
||||||
|
return $this->export($record);
|
||||||
|
|
||||||
|
|
||||||
|
$this->info('I could not find that user by email - sorry');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->option('random')){
|
if($this->option('random')){
|
||||||
|
|
@ -70,6 +99,7 @@ class ExportMigrations extends Command
|
||||||
private function export($user)
|
private function export($user)
|
||||||
{
|
{
|
||||||
$this->account = $user->account;
|
$this->account = $user->account;
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
$accountKey = $this->account->account_key;
|
$accountKey = $this->account->account_key;
|
||||||
|
|
@ -92,17 +122,20 @@ class ExportMigrations extends Command
|
||||||
'products' => $this->getProducts(),
|
'products' => $this->getProducts(),
|
||||||
'credits' => $this->getCreditsNotes(),
|
'credits' => $this->getCreditsNotes(),
|
||||||
'invoices' => $this->getInvoices(),
|
'invoices' => $this->getInvoices(),
|
||||||
|
'recurring_expenses' => $this->getRecurringExpenses(),
|
||||||
'recurring_invoices' => $this->getRecurringInvoices(),
|
'recurring_invoices' => $this->getRecurringInvoices(),
|
||||||
'quotes' => $this->getQuotes(),
|
'quotes' => $this->getQuotes(),
|
||||||
'payments' => array_merge($this->getPayments(), $this->getCredits()),
|
'payments' => $this->getPayments(),
|
||||||
'documents' => $this->getDocuments(),
|
'documents' => $this->getDocuments(),
|
||||||
'expense_categories' => $this->getExpenseCategories(),
|
'expense_categories' => $this->getExpenseCategories(),
|
||||||
'task_statuses' => $this->getTaskStatuses(),
|
'task_statuses' => $this->getTaskStatuses(),
|
||||||
'expenses' => $this->getExpenses(),
|
'expenses' => $this->getExpenses(),
|
||||||
'tasks' => $this->getTasks(),
|
'tasks' => $this->getTasks(),
|
||||||
'documents' => $this->getDocuments(),
|
'documents' => $this->getDocuments(),
|
||||||
|
'ninja_tokens' => $this->getNinjaToken(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Storage::makeDirectory('migrations');
|
||||||
$file = storage_path("migrations/{$fileName}.zip");
|
$file = storage_path("migrations/{$fileName}.zip");
|
||||||
|
|
||||||
$zip = new \ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
|
|
|
||||||
154
app/Console/Commands/ForceMigration.php
Normal file
154
app/Console/Commands/ForceMigration.php
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Jobs\HostedMigration;
|
||||||
|
use App\Libraries\Utils;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class ForceMigration extends Command
|
||||||
|
{
|
||||||
|
// define('DB_NINJA_1', 'db-ninja-1');
|
||||||
|
// define('DB_NINJA_2', 'db-ninja-2');
|
||||||
|
|
||||||
|
public $db = DB_NINJA_1;
|
||||||
|
|
||||||
|
public $force = false;
|
||||||
|
|
||||||
|
public $user = false;
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'ninja:force-migrate-v5 {--email=} {--force=} {--database=}';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Force migrate accounts to v5 - (Hosted function only)';
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->option('database'))
|
||||||
|
$this->db = $this->option('database');
|
||||||
|
|
||||||
|
if($this->option('force'))
|
||||||
|
$this->force = $this->option('force');
|
||||||
|
|
||||||
|
if(!Utils::isNinjaProd())
|
||||||
|
return;
|
||||||
|
|
||||||
|
config(['database.default' => $this->db]);
|
||||||
|
|
||||||
|
$company = $this->getCompany();
|
||||||
|
|
||||||
|
if(!$company){
|
||||||
|
|
||||||
|
$this->logMessage('Could not find a company with that email address');
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->forceMigrate($company);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getCompany()
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->option('email')){
|
||||||
|
|
||||||
|
$user = User::on($this->db)
|
||||||
|
->where('email', $this->option('email'))
|
||||||
|
->whereNull('public_id')
|
||||||
|
->orWhere('public_id', 0)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if(!$user){
|
||||||
|
$this->logMessage('Could not find an owner user with that email address');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->user = $user;
|
||||||
|
|
||||||
|
return $user->account->company;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// $company = Company::on($this->db)
|
||||||
|
// ->whereNull('plan')
|
||||||
|
// ->orWhereIn('plan', ['','free'])
|
||||||
|
// ->whereHas('accounts', function ($query){
|
||||||
|
// $query->where('account_key', '!=', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
|
||||||
|
// $query->orWhere('account_key', '!=', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx702');
|
||||||
|
// $query->orWhere('account_key', '!=', 'AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT');
|
||||||
|
// })
|
||||||
|
// ->with('accounts')
|
||||||
|
// ->withCount('accounts')
|
||||||
|
// ->having('accounts_count', '>=', 1)
|
||||||
|
// ->first();
|
||||||
|
|
||||||
|
// return $company;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function logMessage($str)
|
||||||
|
{
|
||||||
|
$str = date('Y-m-d h:i:s').' '.$str;
|
||||||
|
$this->info($str);
|
||||||
|
$this->log .= $str."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
private function forceMigrate($company)
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
if(!$this->user)
|
||||||
|
$this->user = $company->accounts->first()->users()->whereNull('public_id')->orWhere('public_id', 0)->first();
|
||||||
|
|
||||||
|
|
||||||
|
if(!$this->user){
|
||||||
|
$this->logMessage('Could not find an owner user with that email address');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($company){
|
||||||
|
|
||||||
|
foreach($company->accounts as $key => $account)
|
||||||
|
{
|
||||||
|
|
||||||
|
$data['companies'][$key]['id'] = $account->id;
|
||||||
|
$data['companies'][$key]['force'] = $this->force;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->dispatch(new HostedMigration($this->user, $data, $this->db, true));
|
||||||
|
|
||||||
|
$company->is_migrated = true;
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -70,6 +70,8 @@ class SendRecurringInvoices extends Command
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
|
|
||||||
|
if(!$account->account_email_settings->is_disabled)
|
||||||
$account->checkCounterReset();
|
$account->checkCounterReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,6 +96,11 @@ class SendRecurringInvoices extends Command
|
||||||
$this->info(date('r') . ' Processing Invoice: '. $recurInvoice->id);
|
$this->info(date('r') . ' Processing Invoice: '. $recurInvoice->id);
|
||||||
|
|
||||||
$account = $recurInvoice->account;
|
$account = $recurInvoice->account;
|
||||||
|
|
||||||
|
if($account->account_email_settings->is_disabled){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$account->loadLocalizationSettings($recurInvoice->client);
|
$account->loadLocalizationSettings($recurInvoice->client);
|
||||||
Auth::loginUsingId($recurInvoice->activeUser()->id);
|
Auth::loginUsingId($recurInvoice->activeUser()->id);
|
||||||
|
|
||||||
|
|
@ -127,7 +134,7 @@ class SendRecurringInvoices extends Command
|
||||||
foreach ($expenses as $expense) {
|
foreach ($expenses as $expense) {
|
||||||
$shouldSendToday = $expense->shouldSendToday();
|
$shouldSendToday = $expense->shouldSendToday();
|
||||||
|
|
||||||
if (! $shouldSendToday) {
|
if (! $shouldSendToday || $expense->account->account_email_settings->is_disabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class SendReminders extends Command
|
||||||
|
|
||||||
/** @var Invoice $invoice */
|
/** @var Invoice $invoice */
|
||||||
foreach ($delayedAutoBillInvoices as $invoice) {
|
foreach ($delayedAutoBillInvoices as $invoice) {
|
||||||
if ($invoice->isPaid()) {
|
if ($invoice->isPaid() || $invoice->account->is_deleted) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ class SendReminders extends Command
|
||||||
$this->info(date('r ') . $accounts->count() . ' accounts found with fees enabled');
|
$this->info(date('r ') . $accounts->count() . ' accounts found with fees enabled');
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->account_email_settings->is_disabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ class SendReminders extends Command
|
||||||
$this->info(date('r ') . count($accounts) . ' accounts found with reminders enabled');
|
$this->info(date('r ') . count($accounts) . ' accounts found with reminders enabled');
|
||||||
|
|
||||||
foreach ($accounts as $account) {
|
foreach ($accounts as $account) {
|
||||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->account_email_settings->is_disabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ class SendReminders extends Command
|
||||||
$account = $scheduledReport->account;
|
$account = $scheduledReport->account;
|
||||||
$account->loadLocalizationSettings();
|
$account->loadLocalizationSettings();
|
||||||
|
|
||||||
if (! $account->hasFeature(FEATURE_REPORTS)) {
|
if (! $account->hasFeature(FEATURE_REPORTS) || $account->account_email_settings->is_disabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
82
app/Console/Commands/SyncAccounts.php
Normal file
82
app/Console/Commands/SyncAccounts.php
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Libraries\Utils;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class SyncAccounts extends Command
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'ninja:sync-v5';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Sync accounts to v5 - (Hosted function only)';
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!Utils::isNinjaProd())
|
||||||
|
return;
|
||||||
|
|
||||||
|
config(['database.default' => DB_NINJA_1]);
|
||||||
|
|
||||||
|
$this->updateAccounts();
|
||||||
|
|
||||||
|
config(['database.default' => DB_NINJA_2]);
|
||||||
|
|
||||||
|
$this->updateAccounts();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function updateAccounts()
|
||||||
|
{
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
$a = Company::whereIn('plan', ['pro', 'enterprise'])
|
||||||
|
->with('accounts')
|
||||||
|
->cursor()->each(function ($company) use ($data){
|
||||||
|
|
||||||
|
$accounts = $company->accounts->pluck('account_key');
|
||||||
|
|
||||||
|
$data[] = [
|
||||||
|
'plan' => $company->plan,
|
||||||
|
'plan_term' => $company->plan_term,
|
||||||
|
'plan_started' => $company->plan_started,
|
||||||
|
'plan_paid' => $company->plan_paid,
|
||||||
|
'plan_expires' => $company->plan_expires,
|
||||||
|
'num_users' => $company->num_users,
|
||||||
|
'accounts' => $accounts
|
||||||
|
];
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//post DATA
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,7 @@ class Kernel extends ConsoleKernel
|
||||||
'App\Console\Commands\CalculatePayouts',
|
'App\Console\Commands\CalculatePayouts',
|
||||||
'App\Console\Commands\UpdateKey',
|
'App\Console\Commands\UpdateKey',
|
||||||
'App\Console\Commands\ExportMigrations',
|
'App\Console\Commands\ExportMigrations',
|
||||||
|
'App\Console\Commands\SyncAccounts',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,5 +56,20 @@ class Kernel extends ConsoleKernel
|
||||||
->command('ninja:send-reminders --force')
|
->command('ninja:send-reminders --force')
|
||||||
->sendOutputTo($logFile)
|
->sendOutputTo($logFile)
|
||||||
->daily();
|
->daily();
|
||||||
|
|
||||||
|
if(Utils::isNinjaProd())
|
||||||
|
{
|
||||||
|
|
||||||
|
$schedule
|
||||||
|
->command('ninja:sync-v5')
|
||||||
|
->withoutOverlapping()
|
||||||
|
->daily();
|
||||||
|
|
||||||
|
|
||||||
|
// $schedule
|
||||||
|
// ->command('ninja:force-migrate-v5')
|
||||||
|
// ->everyMinute()
|
||||||
|
// ->withoutOverlapping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ if (! defined('APP_NAME')) {
|
||||||
define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com'));
|
define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com'));
|
||||||
define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest'));
|
define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest'));
|
||||||
define('NINJA_DATE', '2000-01-01');
|
define('NINJA_DATE', '2000-01-01');
|
||||||
define('NINJA_VERSION', '4.5.40' . env('NINJA_VERSION_SUFFIX'));
|
define('NINJA_VERSION', '4.5.50' . env('NINJA_VERSION_SUFFIX'));
|
||||||
define('NINJA_TERMS_VERSION', '1.0.1');
|
define('NINJA_TERMS_VERSION', '1.0.1');
|
||||||
|
|
||||||
define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'));
|
define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'));
|
||||||
|
|
@ -631,6 +631,8 @@ if (! defined('APP_NAME')) {
|
||||||
define('INVOICE_FIELDS_PRODUCT', 'product_fields');
|
define('INVOICE_FIELDS_PRODUCT', 'product_fields');
|
||||||
define('INVOICE_FIELDS_TASK', 'task_fields');
|
define('INVOICE_FIELDS_TASK', 'task_fields');
|
||||||
|
|
||||||
|
define('NINJA_V5_TOKEN', env('NINJA_V5_TOKEN',false));
|
||||||
|
|
||||||
$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'],
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,19 @@
|
||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Illuminate\Foundation\Validation\ValidationException;
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
use Illuminate\Http\Exception\HttpResponseException;
|
|
||||||
use Illuminate\Support\Facades\Response;
|
|
||||||
use Illuminate\Session\TokenMismatchException;
|
use Illuminate\Session\TokenMismatchException;
|
||||||
|
use Illuminate\Support\Facades\Response;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Request;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Handler.
|
* Class Handler.
|
||||||
|
|
@ -30,7 +29,6 @@ class Handler extends ExceptionHandler
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
TokenMismatchException::class,
|
TokenMismatchException::class,
|
||||||
ModelNotFoundException::class,
|
ModelNotFoundException::class,
|
||||||
ValidationException::class,
|
|
||||||
\Illuminate\Validation\ValidationException::class,
|
\Illuminate\Validation\ValidationException::class,
|
||||||
//AuthorizationException::class,
|
//AuthorizationException::class,
|
||||||
//HttpException::class,
|
//HttpException::class,
|
||||||
|
|
@ -103,7 +101,7 @@ class Handler extends ExceptionHandler
|
||||||
*/
|
*/
|
||||||
public function render($request, Exception $e)
|
public function render($request, Exception $e)
|
||||||
{
|
{
|
||||||
$value = Request::header('X-Ninja-Token');
|
$value = \Request::header('X-Ninja-Token');
|
||||||
|
|
||||||
if ($e instanceof ModelNotFoundException) {
|
if ($e instanceof ModelNotFoundException) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use File;
|
use File;
|
||||||
use Image;
|
use Image;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
@ -109,7 +108,7 @@ class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
$user = false;
|
$user = false;
|
||||||
$account = false;
|
$account = false;
|
||||||
$guestKey = Input::get('guest_key'); // local storage key to login until registered
|
$guestKey = \Request::input('guest_key'); // local storage key to login until registered
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
return Redirect::to('invoices/create');
|
return Redirect::to('invoices/create');
|
||||||
|
|
@ -141,13 +140,13 @@ class AccountController extends BaseController
|
||||||
Session::flash('warning', $message);
|
Session::flash('warning', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($redirectTo = Input::get('redirect_to')) {
|
if ($redirectTo = \Request::input('redirect_to')) {
|
||||||
$redirectTo = SITE_URL . '/' . ltrim($redirectTo, '/');
|
$redirectTo = SITE_URL . '/' . ltrim($redirectTo, '/');
|
||||||
} else {
|
} else {
|
||||||
$redirectTo = Input::get('sign_up') ? 'dashboard' : 'invoices/create';
|
$redirectTo = \Request::input('sign_up') ? 'dashboard' : 'invoices/create';
|
||||||
}
|
}
|
||||||
|
|
||||||
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
|
return Redirect::to($redirectTo)->with('sign_up', \Request::input('sign_up'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -159,9 +158,9 @@ class AccountController extends BaseController
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
$company = $account->company;
|
$company = $account->company;
|
||||||
|
|
||||||
$plan = Input::get('plan');
|
$plan = \Request::input('plan');
|
||||||
$term = Input::get('plan_term');
|
$term = \Request::input('plan_term');
|
||||||
$numUsers = Input::get('num_users');
|
$numUsers = \Request::input('num_users');
|
||||||
|
|
||||||
if ($plan != PLAN_ENTERPRISE) {
|
if ($plan != PLAN_ENTERPRISE) {
|
||||||
$numUsers = 1;
|
$numUsers = 1;
|
||||||
|
|
@ -764,11 +763,11 @@ class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
$modules = Input::get('modules');
|
$modules = \Request::input('modules');
|
||||||
|
|
||||||
if (Utils::isSelfHost()) {
|
if (Utils::isSelfHost()) {
|
||||||
// get all custom modules, including disabled
|
// get all custom modules, including disabled
|
||||||
$custom_modules = collect(Input::get('custom_modules'))->each(function ($item, $key) {
|
$custom_modules = collect(\Request::input('custom_modules'))->each(function ($item, $key) {
|
||||||
$module = Module::find($item);
|
$module = Module::find($item);
|
||||||
if ($module && $module->disabled()) {
|
if ($module && $module->disabled()) {
|
||||||
$module->enable();
|
$module->enable();
|
||||||
|
|
@ -782,10 +781,10 @@ class AccountController extends BaseController
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->force_pdfjs = Input::get('force_pdfjs') ? true : false;
|
$user->force_pdfjs = \Request::input('force_pdfjs') ? true : false;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$account->live_preview = Input::get('live_preview') ? true : false;
|
$account->live_preview = \Request::input('live_preview') ? true : false;
|
||||||
|
|
||||||
// Automatically disable live preview when using a large font
|
// Automatically disable live preview when using a large font
|
||||||
$fonts = Cache::get('fonts')->filter(function ($font) use ($account) {
|
$fonts = Cache::get('fonts')->filter(function ($font) use ($account) {
|
||||||
|
|
@ -813,7 +812,7 @@ class AccountController extends BaseController
|
||||||
*/
|
*/
|
||||||
private function saveCustomizeDesign()
|
private function saveCustomizeDesign()
|
||||||
{
|
{
|
||||||
$designId = intval(Input::get('design_id')) ?: CUSTOM_DESIGN1;
|
$designId = intval(\Request::input('design_id')) ?: CUSTOM_DESIGN1;
|
||||||
$field = 'custom_design' . ($designId - 10);
|
$field = 'custom_design' . ($designId - 10);
|
||||||
|
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
||||||
|
|
@ -821,7 +820,7 @@ class AccountController extends BaseController
|
||||||
if (! $account->custom_design1) {
|
if (! $account->custom_design1) {
|
||||||
$account->invoice_design_id = CUSTOM_DESIGN1;
|
$account->invoice_design_id = CUSTOM_DESIGN1;
|
||||||
}
|
}
|
||||||
$account->$field = Input::get('custom_design');
|
$account->$field = \Request::input('custom_design');
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
@ -897,28 +896,28 @@ class AccountController extends BaseController
|
||||||
|
|
||||||
foreach (AccountEmailSettings::$templates as $type) {
|
foreach (AccountEmailSettings::$templates as $type) {
|
||||||
$subjectField = "email_subject_{$type}";
|
$subjectField = "email_subject_{$type}";
|
||||||
$subject = Input::get($subjectField, $account->getEmailSubject($type));
|
$subject = \Request::input($subjectField, $account->getEmailSubject($type));
|
||||||
$account->account_email_settings->$subjectField = ($subject == $account->getDefaultEmailSubject($type) ? null : $subject);
|
$account->account_email_settings->$subjectField = ($subject == $account->getDefaultEmailSubject($type) ? null : $subject);
|
||||||
|
|
||||||
$bodyField = "email_template_{$type}";
|
$bodyField = "email_template_{$type}";
|
||||||
$body = Input::get($bodyField, $account->getEmailTemplate($type));
|
$body = \Request::input($bodyField, $account->getEmailTemplate($type));
|
||||||
$account->account_email_settings->$bodyField = ($body == $account->getDefaultEmailTemplate($type) ? null : $body);
|
$account->account_email_settings->$bodyField = ($body == $account->getDefaultEmailTemplate($type) ? null : $body);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ([TEMPLATE_REMINDER1, TEMPLATE_REMINDER2, TEMPLATE_REMINDER3] as $type) {
|
foreach ([TEMPLATE_REMINDER1, TEMPLATE_REMINDER2, TEMPLATE_REMINDER3] as $type) {
|
||||||
$enableField = "enable_{$type}";
|
$enableField = "enable_{$type}";
|
||||||
$account->$enableField = Input::get($enableField) ? true : false;
|
$account->$enableField = \Request::input($enableField) ? true : false;
|
||||||
$account->{"num_days_{$type}"} = Input::get("num_days_{$type}");
|
$account->{"num_days_{$type}"} = \Request::input("num_days_{$type}");
|
||||||
$account->{"field_{$type}"} = Input::get("field_{$type}");
|
$account->{"field_{$type}"} = \Request::input("field_{$type}");
|
||||||
$account->{"direction_{$type}"} = Input::get("field_{$type}") == REMINDER_FIELD_INVOICE_DATE ? REMINDER_DIRECTION_AFTER : Input::get("direction_{$type}");
|
$account->{"direction_{$type}"} = \Request::input("field_{$type}") == REMINDER_FIELD_INVOICE_DATE ? REMINDER_DIRECTION_AFTER : \Request::input("direction_{$type}");
|
||||||
|
|
||||||
$number = preg_replace('/[^0-9]/', '', $type);
|
$number = preg_replace('/[^0-9]/', '', $type);
|
||||||
$account->account_email_settings->{"late_fee{$number}_amount"} = Input::get("late_fee{$number}_amount");
|
$account->account_email_settings->{"late_fee{$number}_amount"} = \Request::input("late_fee{$number}_amount");
|
||||||
$account->account_email_settings->{"late_fee{$number}_percent"} = Input::get("late_fee{$number}_percent");
|
$account->account_email_settings->{"late_fee{$number}_percent"} = \Request::input("late_fee{$number}_percent");
|
||||||
}
|
}
|
||||||
|
|
||||||
$account->enable_reminder4 = Input::get('enable_reminder4') ? true : false;
|
$account->enable_reminder4 = \Request::input('enable_reminder4') ? true : false;
|
||||||
$account->account_email_settings->frequency_id_reminder4 = Input::get('frequency_id_reminder4');
|
$account->account_email_settings->frequency_id_reminder4 = \Request::input('frequency_id_reminder4');
|
||||||
|
|
||||||
$account->save();
|
$account->save();
|
||||||
$account->account_email_settings->save();
|
$account->account_email_settings->save();
|
||||||
|
|
@ -935,7 +934,7 @@ class AccountController extends BaseController
|
||||||
private function saveTaxRates()
|
private function saveTaxRates()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->fill(Input::all());
|
$account->fill(Request::all());
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
@ -950,10 +949,10 @@ class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
$account->show_product_notes = Input::get('show_product_notes') ? true : false;
|
$account->show_product_notes = \Request::input('show_product_notes') ? true : false;
|
||||||
$account->fill_products = Input::get('fill_products') ? true : false;
|
$account->fill_products = \Request::input('fill_products') ? true : false;
|
||||||
$account->update_products = Input::get('update_products') ? true : false;
|
$account->update_products = \Request::input('update_products') ? true : false;
|
||||||
$account->convert_products = Input::get('convert_products') ? true : false;
|
$account->convert_products = \Request::input('convert_products') ? true : false;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
@ -969,15 +968,15 @@ class AccountController extends BaseController
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_INVOICE_SETTINGS)) {
|
if (Auth::user()->account->hasFeature(FEATURE_INVOICE_SETTINGS)) {
|
||||||
$rules = [];
|
$rules = [];
|
||||||
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
|
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
|
||||||
if (Input::get("{$entityType}_number_type") == 'pattern') {
|
if (\Request::input("{$entityType}_number_type") == 'pattern') {
|
||||||
$rules["{$entityType}_number_pattern"] = 'has_counter';
|
$rules["{$entityType}_number_pattern"] = 'has_counter';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Input::get('credit_number_enabled')) {
|
if (\Request::input('credit_number_enabled')) {
|
||||||
$rules['credit_number_prefix'] = 'required_without:credit_number_pattern';
|
$rules['credit_number_prefix'] = 'required_without:credit_number_pattern';
|
||||||
$rules['credit_number_pattern'] = 'required_without:credit_number_prefix';
|
$rules['credit_number_pattern'] = 'required_without:credit_number_prefix';
|
||||||
}
|
}
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to('settings/'.ACCOUNT_INVOICE_SETTINGS)
|
return Redirect::to('settings/'.ACCOUNT_INVOICE_SETTINGS)
|
||||||
|
|
@ -985,47 +984,47 @@ class AccountController extends BaseController
|
||||||
->withInput();
|
->withInput();
|
||||||
} else {
|
} else {
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->custom_value1 = Input::get('custom_value1');
|
$account->custom_value1 = \Request::input('custom_value1');
|
||||||
$account->custom_value2 = Input::get('custom_value2');
|
$account->custom_value2 = \Request::input('custom_value2');
|
||||||
$account->custom_invoice_taxes1 = Input::get('custom_invoice_taxes1') ? true : false;
|
$account->custom_invoice_taxes1 = \Request::input('custom_invoice_taxes1') ? true : false;
|
||||||
$account->custom_invoice_taxes2 = Input::get('custom_invoice_taxes2') ? true : false;
|
$account->custom_invoice_taxes2 = \Request::input('custom_invoice_taxes2') ? true : false;
|
||||||
$account->custom_fields = request()->custom_fields;
|
$account->custom_fields = request()->custom_fields;
|
||||||
$account->invoice_number_padding = Input::get('invoice_number_padding');
|
$account->invoice_number_padding = \Request::input('invoice_number_padding');
|
||||||
$account->invoice_number_counter = Input::get('invoice_number_counter');
|
$account->invoice_number_counter = \Request::input('invoice_number_counter');
|
||||||
$account->quote_number_prefix = Input::get('quote_number_prefix');
|
$account->quote_number_prefix = \Request::input('quote_number_prefix');
|
||||||
$account->share_counter = Input::get('share_counter') ? true : false;
|
$account->share_counter = \Request::input('share_counter') ? true : false;
|
||||||
$account->invoice_terms = Input::get('invoice_terms');
|
$account->invoice_terms = \Request::input('invoice_terms');
|
||||||
$account->invoice_footer = Input::get('invoice_footer');
|
$account->invoice_footer = \Request::input('invoice_footer');
|
||||||
$account->quote_terms = Input::get('quote_terms');
|
$account->quote_terms = \Request::input('quote_terms');
|
||||||
$account->auto_convert_quote = Input::get('auto_convert_quote');
|
$account->auto_convert_quote = \Request::input('auto_convert_quote');
|
||||||
$account->auto_archive_quote = Input::get('auto_archive_quote');
|
$account->auto_archive_quote = \Request::input('auto_archive_quote');
|
||||||
$account->auto_archive_invoice = Input::get('auto_archive_invoice');
|
$account->auto_archive_invoice = \Request::input('auto_archive_invoice');
|
||||||
$account->auto_email_invoice = Input::get('auto_email_invoice');
|
$account->auto_email_invoice = \Request::input('auto_email_invoice');
|
||||||
$account->recurring_invoice_number_prefix = Input::get('recurring_invoice_number_prefix');
|
$account->recurring_invoice_number_prefix = \Request::input('recurring_invoice_number_prefix');
|
||||||
|
|
||||||
$account->client_number_prefix = trim(Input::get('client_number_prefix'));
|
$account->client_number_prefix = trim(\Request::input('client_number_prefix'));
|
||||||
$account->client_number_pattern = trim(Input::get('client_number_pattern'));
|
$account->client_number_pattern = trim(\Request::input('client_number_pattern'));
|
||||||
$account->client_number_counter = Input::get('client_number_counter');
|
$account->client_number_counter = \Request::input('client_number_counter');
|
||||||
$account->credit_number_counter = Input::get('credit_number_counter');
|
$account->credit_number_counter = \Request::input('credit_number_counter');
|
||||||
$account->credit_number_prefix = trim(Input::get('credit_number_prefix'));
|
$account->credit_number_prefix = trim(\Request::input('credit_number_prefix'));
|
||||||
$account->credit_number_pattern = trim(Input::get('credit_number_pattern'));
|
$account->credit_number_pattern = trim(\Request::input('credit_number_pattern'));
|
||||||
$account->reset_counter_frequency_id = Input::get('reset_counter_frequency_id');
|
$account->reset_counter_frequency_id = \Request::input('reset_counter_frequency_id');
|
||||||
$account->reset_counter_date = $account->reset_counter_frequency_id ? Utils::toSqlDate(Input::get('reset_counter_date')) : null;
|
$account->reset_counter_date = $account->reset_counter_frequency_id ? Utils::toSqlDate(\Request::input('reset_counter_date')) : null;
|
||||||
|
|
||||||
if (Input::has('recurring_hour')) {
|
if (Request::has('recurring_hour')) {
|
||||||
$account->recurring_hour = Input::get('recurring_hour');
|
$account->recurring_hour = \Request::input('recurring_hour');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $account->share_counter) {
|
if (! $account->share_counter) {
|
||||||
$account->quote_number_counter = Input::get('quote_number_counter');
|
$account->quote_number_counter = \Request::input('quote_number_counter');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
|
foreach ([ENTITY_INVOICE, ENTITY_QUOTE, ENTITY_CLIENT] as $entityType) {
|
||||||
if (Input::get("{$entityType}_number_type") == 'prefix') {
|
if (\Request::input("{$entityType}_number_type") == 'prefix') {
|
||||||
$account->{"{$entityType}_number_prefix"} = trim(Input::get("{$entityType}_number_prefix"));
|
$account->{"{$entityType}_number_prefix"} = trim(\Request::input("{$entityType}_number_prefix"));
|
||||||
$account->{"{$entityType}_number_pattern"} = null;
|
$account->{"{$entityType}_number_pattern"} = null;
|
||||||
} else {
|
} else {
|
||||||
$account->{"{$entityType}_number_pattern"} = trim(Input::get("{$entityType}_number_pattern"));
|
$account->{"{$entityType}_number_pattern"} = trim(\Request::input("{$entityType}_number_pattern"));
|
||||||
$account->{"{$entityType}_number_prefix"} = null;
|
$account->{"{$entityType}_number_prefix"} = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1053,27 +1052,27 @@ class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
if (Auth::user()->account->hasFeature(FEATURE_CUSTOMIZE_INVOICE_DESIGN)) {
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->hide_quantity = Input::get('hide_quantity') ? true : false;
|
$account->hide_quantity = \Request::input('hide_quantity') ? true : false;
|
||||||
$account->hide_paid_to_date = Input::get('hide_paid_to_date') ? true : false;
|
$account->hide_paid_to_date = \Request::input('hide_paid_to_date') ? true : false;
|
||||||
$account->all_pages_header = Input::get('all_pages_header') ? true : false;
|
$account->all_pages_header = \Request::input('all_pages_header') ? true : false;
|
||||||
$account->all_pages_footer = Input::get('all_pages_footer') ? true : false;
|
$account->all_pages_footer = \Request::input('all_pages_footer') ? true : false;
|
||||||
$account->invoice_embed_documents = Input::get('invoice_embed_documents') ? true : false;
|
$account->invoice_embed_documents = \Request::input('invoice_embed_documents') ? true : false;
|
||||||
$account->header_font_id = Input::get('header_font_id');
|
$account->header_font_id = \Request::input('header_font_id');
|
||||||
$account->body_font_id = Input::get('body_font_id');
|
$account->body_font_id = \Request::input('body_font_id');
|
||||||
$account->primary_color = Input::get('primary_color');
|
$account->primary_color = \Request::input('primary_color');
|
||||||
$account->secondary_color = Input::get('secondary_color');
|
$account->secondary_color = \Request::input('secondary_color');
|
||||||
$account->invoice_design_id = Input::get('invoice_design_id');
|
$account->invoice_design_id = \Request::input('invoice_design_id');
|
||||||
$account->quote_design_id = Input::get('quote_design_id');
|
$account->quote_design_id = \Request::input('quote_design_id');
|
||||||
$account->font_size = intval(Input::get('font_size'));
|
$account->font_size = intval(\Request::input('font_size'));
|
||||||
$account->page_size = Input::get('page_size');
|
$account->page_size = \Request::input('page_size');
|
||||||
$account->background_image_id = Document::getPrivateId(request()->background_image_id);
|
$account->background_image_id = Document::getPrivateId(request()->background_image_id);
|
||||||
|
|
||||||
$labels = [];
|
$labels = [];
|
||||||
foreach (Account::$customLabels as $field) {
|
foreach (Account::$customLabels as $field) {
|
||||||
$labels[$field] = Input::get("labels_{$field}");
|
$labels[$field] = \Request::input("labels_{$field}");
|
||||||
}
|
}
|
||||||
$account->invoice_labels = json_encode($labels);
|
$account->invoice_labels = json_encode($labels);
|
||||||
$account->invoice_fields = Input::get('invoice_fields_json');
|
$account->invoice_fields = \Request::input('invoice_fields_json');
|
||||||
|
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
|
|
@ -1089,12 +1088,12 @@ class AccountController extends BaseController
|
||||||
private function saveNotifications()
|
private function saveNotifications()
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$user->notify_sent = Input::get('notify_sent');
|
$user->notify_sent = \Request::input('notify_sent');
|
||||||
$user->notify_viewed = Input::get('notify_viewed');
|
$user->notify_viewed = \Request::input('notify_viewed');
|
||||||
$user->notify_paid = Input::get('notify_paid');
|
$user->notify_paid = \Request::input('notify_paid');
|
||||||
$user->notify_approved = Input::get('notify_approved');
|
$user->notify_approved = \Request::input('notify_approved');
|
||||||
$user->only_notify_owned = Input::get('only_notify_owned');
|
$user->only_notify_owned = \Request::input('only_notify_owned');
|
||||||
$user->slack_webhook_url = Input::get('slack_webhook_url');
|
$user->slack_webhook_url = \Request::input('slack_webhook_url');
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
$account = $user->account;
|
$account = $user->account;
|
||||||
|
|
@ -1117,8 +1116,8 @@ class AccountController extends BaseController
|
||||||
$this->accountRepo->save($request->input(), $account);
|
$this->accountRepo->save($request->input(), $account);
|
||||||
|
|
||||||
/* Logo image file */
|
/* Logo image file */
|
||||||
if ($uploaded = Input::file('logo')) {
|
if ($uploaded = Request::file('logo')) {
|
||||||
$path = Input::file('logo')->getRealPath();
|
$path = Request::file('logo')->getRealPath();
|
||||||
$disk = $account->getLogoDisk();
|
$disk = $account->getLogoDisk();
|
||||||
$extension = strtolower($uploaded->getClientOriginalExtension());
|
$extension = strtolower($uploaded->getClientOriginalExtension());
|
||||||
|
|
||||||
|
|
@ -1204,7 +1203,7 @@ class AccountController extends BaseController
|
||||||
{
|
{
|
||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$email = trim(strtolower(Input::get('email')));
|
$email = trim(strtolower(\Request::input('email')));
|
||||||
|
|
||||||
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
||||||
return Redirect::to('settings/' . ACCOUNT_USER_DETAILS)
|
return Redirect::to('settings/' . ACCOUNT_USER_DETAILS)
|
||||||
|
|
@ -1218,34 +1217,34 @@ class AccountController extends BaseController
|
||||||
$rules['phone'] = 'required';
|
$rules['phone'] = 'required';
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to('settings/'.ACCOUNT_USER_DETAILS)
|
return Redirect::to('settings/'.ACCOUNT_USER_DETAILS)
|
||||||
->withErrors($validator)
|
->withErrors($validator)
|
||||||
->withInput();
|
->withInput();
|
||||||
} else {
|
} else {
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
$user->first_name = trim(\Request::input('first_name'));
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->last_name = trim(\Request::input('last_name'));
|
||||||
$user->username = $email;
|
$user->username = $email;
|
||||||
$user->email = $email;
|
$user->email = $email;
|
||||||
$user->phone = trim(Input::get('phone'));
|
$user->phone = trim(\Request::input('phone'));
|
||||||
$user->dark_mode = Input::get('dark_mode');
|
$user->dark_mode = \Request::input('dark_mode');
|
||||||
|
|
||||||
if (! Auth::user()->is_admin) {
|
if (! Auth::user()->is_admin) {
|
||||||
$user->notify_sent = Input::get('notify_sent');
|
$user->notify_sent = \Request::input('notify_sent');
|
||||||
$user->notify_viewed = Input::get('notify_viewed');
|
$user->notify_viewed = \Request::input('notify_viewed');
|
||||||
$user->notify_paid = Input::get('notify_paid');
|
$user->notify_paid = \Request::input('notify_paid');
|
||||||
$user->notify_approved = Input::get('notify_approved');
|
$user->notify_approved = \Request::input('notify_approved');
|
||||||
$user->only_notify_owned = Input::get('only_notify_owned');
|
$user->only_notify_owned = \Request::input('only_notify_owned');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->google_2fa_secret && ! Input::get('enable_two_factor')) {
|
if ($user->google_2fa_secret && ! \Request::input('enable_two_factor')) {
|
||||||
$user->google_2fa_secret = null;
|
$user->google_2fa_secret = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils::isNinja()) {
|
if (Utils::isNinja()) {
|
||||||
if (Input::get('referral_code') && ! $user->referral_code) {
|
if (\Request::input('referral_code') && ! $user->referral_code) {
|
||||||
$user->referral_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$user->referral_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1267,15 +1266,15 @@ class AccountController extends BaseController
|
||||||
/** @var \App\Models\Account $account */
|
/** @var \App\Models\Account $account */
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
$account->timezone_id = Input::get('timezone_id') ? Input::get('timezone_id') : null;
|
$account->timezone_id = \Request::input('timezone_id') ? \Request::input('timezone_id') : null;
|
||||||
$account->date_format_id = Input::get('date_format_id') ? Input::get('date_format_id') : null;
|
$account->date_format_id = \Request::input('date_format_id') ? \Request::input('date_format_id') : null;
|
||||||
$account->datetime_format_id = Input::get('datetime_format_id') ? Input::get('datetime_format_id') : null;
|
$account->datetime_format_id = \Request::input('datetime_format_id') ? \Request::input('datetime_format_id') : null;
|
||||||
$account->currency_id = Input::get('currency_id') ? Input::get('currency_id') : 1; // US Dollar
|
$account->currency_id = \Request::input('currency_id') ? \Request::input('currency_id') : 1; // US Dollar
|
||||||
$account->language_id = Input::get('language_id') ? Input::get('language_id') : 1; // English
|
$account->language_id = \Request::input('language_id') ? \Request::input('language_id') : 1; // English
|
||||||
$account->military_time = Input::get('military_time') ? true : false;
|
$account->military_time = \Request::input('military_time') ? true : false;
|
||||||
$account->show_currency_code = Input::get('show_currency_code') ? true : false;
|
$account->show_currency_code = \Request::input('show_currency_code') ? true : false;
|
||||||
$account->start_of_week = Input::get('start_of_week') ? Input::get('start_of_week') : 0;
|
$account->start_of_week = \Request::input('start_of_week') ? \Request::input('start_of_week') : 0;
|
||||||
$account->financial_year_start = Input::get('financial_year_start') ? Input::get('financial_year_start') : null;
|
$account->financial_year_start = \Request::input('financial_year_start') ? \Request::input('financial_year_start') : null;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
event(new UserSettingsChanged());
|
event(new UserSettingsChanged());
|
||||||
|
|
@ -1291,10 +1290,10 @@ class AccountController extends BaseController
|
||||||
private function saveOnlinePayments()
|
private function saveOnlinePayments()
|
||||||
{
|
{
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->token_billing_type_id = Input::get('token_billing_type_id');
|
$account->token_billing_type_id = \Request::input('token_billing_type_id');
|
||||||
$account->auto_bill_on_due_date = boolval(Input::get('auto_bill_on_due_date'));
|
$account->auto_bill_on_due_date = boolval(\Request::input('auto_bill_on_due_date'));
|
||||||
$account->gateway_fee_enabled = boolval(Input::get('gateway_fee_enabled'));
|
$account->gateway_fee_enabled = boolval(\Request::input('gateway_fee_enabled'));
|
||||||
$account->send_item_details = boolval(Input::get('send_item_details'));
|
$account->send_item_details = boolval(\Request::input('send_item_details'));
|
||||||
|
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
|
|
@ -1332,7 +1331,7 @@ class AccountController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function checkEmail()
|
public function checkEmail()
|
||||||
{
|
{
|
||||||
$email = trim(strtolower(Input::get('email')));
|
$email = trim(strtolower(\Request::input('email')));
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
||||||
|
|
@ -1370,16 +1369,16 @@ class AccountController extends BaseController
|
||||||
$rules['new_email'] .= ',' . Auth::user()->id . ',id';
|
$rules['new_email'] .= ',' . Auth::user()->id . ',id';
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$firstName = trim(Input::get('new_first_name'));
|
$firstName = trim(\Request::input('new_first_name'));
|
||||||
$lastName = trim(Input::get('new_last_name'));
|
$lastName = trim(\Request::input('new_last_name'));
|
||||||
$email = trim(strtolower(Input::get('new_email')));
|
$email = trim(strtolower(\Request::input('new_email')));
|
||||||
$password = trim(Input::get('new_password'));
|
$password = trim(\Request::input('new_password'));
|
||||||
|
|
||||||
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
if (! \App\Models\LookupUser::validateField('email', $email, $user)) {
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -1408,7 +1407,7 @@ class AccountController extends BaseController
|
||||||
|
|
||||||
$user->account->startTrial(PLAN_PRO);
|
$user->account->startTrial(PLAN_PRO);
|
||||||
|
|
||||||
if (Input::get('go_pro') == 'true') {
|
if (\Request::input('go_pro') == 'true') {
|
||||||
session([REQUESTED_PRO_PLAN => true]);
|
session([REQUESTED_PRO_PLAN => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1422,15 +1421,15 @@ class AccountController extends BaseController
|
||||||
public function doRegister()
|
public function doRegister()
|
||||||
{
|
{
|
||||||
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
$affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
|
||||||
$email = trim(Input::get('email'));
|
$email = trim(\Request::input('email'));
|
||||||
|
|
||||||
if (! $email || $email == TEST_USERNAME) {
|
if (! $email || $email == TEST_USERNAME) {
|
||||||
return RESULT_FAILURE;
|
return RESULT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$license = new License();
|
$license = new License();
|
||||||
$license->first_name = Input::get('first_name');
|
$license->first_name = \Request::input('first_name');
|
||||||
$license->last_name = Input::get('last_name');
|
$license->last_name = \Request::input('last_name');
|
||||||
$license->email = $email;
|
$license->email = $email;
|
||||||
$license->transaction_reference = Request::getClientIp();
|
$license->transaction_reference = Request::getClientIp();
|
||||||
$license->license_key = Utils::generateLicense();
|
$license->license_key = Utils::generateLicense();
|
||||||
|
|
@ -1457,7 +1456,7 @@ class AccountController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function cancelAccount()
|
public function cancelAccount()
|
||||||
{
|
{
|
||||||
if ($reason = trim(Input::get('reason'))) {
|
if ($reason = trim(\Request::input('reason'))) {
|
||||||
$email = Auth::user()->email;
|
$email = Auth::user()->email;
|
||||||
$name = Auth::user()->getDisplayName();
|
$name = Auth::user()->getDisplayName();
|
||||||
|
|
||||||
|
|
@ -1550,7 +1549,7 @@ class AccountController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function previewEmail(TemplateService $templateService)
|
public function previewEmail(TemplateService $templateService)
|
||||||
{
|
{
|
||||||
$template = Input::get('template');
|
$template = \Request::input('template');
|
||||||
$invitation = \App\Models\Invitation::scope()
|
$invitation = \App\Models\Invitation::scope()
|
||||||
->with('invoice.client.contacts')
|
->with('invoice.client.contacts')
|
||||||
->first();
|
->first();
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ use App\Models\AccountGateway;
|
||||||
use App\Models\Gateway;
|
use App\Models\Gateway;
|
||||||
use App\Services\AccountGatewayService;
|
use App\Services\AccountGatewayService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
use Request;
|
||||||
use Session;
|
use Session;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -90,7 +90,7 @@ class AccountGatewayController extends BaseController
|
||||||
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$accountGatewaysIds = $account->gatewayIds();
|
$accountGatewaysIds = $account->gatewayIds();
|
||||||
$wepay = Input::get('wepay');
|
$wepay = \Request::input('wepay');
|
||||||
|
|
||||||
$data = self::getViewModel();
|
$data = self::getViewModel();
|
||||||
$data['url'] = 'gateways';
|
$data['url'] = 'gateways';
|
||||||
|
|
@ -158,8 +158,8 @@ class AccountGatewayController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
$count = $this->accountGatewayService->bulk($ids, $action);
|
$count = $this->accountGatewayService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans("texts.{$action}d_account_gateway"));
|
Session::flash('message', trans("texts.{$action}d_account_gateway"));
|
||||||
|
|
@ -174,7 +174,7 @@ class AccountGatewayController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function save($accountGatewayPublicId = false)
|
public function save($accountGatewayPublicId = false)
|
||||||
{
|
{
|
||||||
$gatewayId = Input::get('primary_gateway_id') ?: Input::get('secondary_gateway_id');
|
$gatewayId = \Request::input('primary_gateway_id') ?: \Request::input('secondary_gateway_id');
|
||||||
$gateway = Gateway::findOrFail($gatewayId);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
|
|
||||||
$rules = [];
|
$rules = [];
|
||||||
|
|
@ -208,8 +208,8 @@ class AccountGatewayController extends BaseController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$creditcards = Input::get('creditCardTypes');
|
$creditcards = \Request::input('creditCardTypes');
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
$url = $accountGatewayPublicId ? "/gateways/{$accountGatewayPublicId}/edit" : 'gateways/create?other_providers=' . ($gatewayId == GATEWAY_WEPAY ? 'false' : 'true');
|
$url = $accountGatewayPublicId ? "/gateways/{$accountGatewayPublicId}/edit" : 'gateways/create?other_providers=' . ($gatewayId == GATEWAY_WEPAY ? 'false' : 'true');
|
||||||
|
|
@ -250,7 +250,7 @@ class AccountGatewayController extends BaseController
|
||||||
|
|
||||||
if ($gatewayId != GATEWAY_WEPAY) {
|
if ($gatewayId != GATEWAY_WEPAY) {
|
||||||
foreach ($fields as $field => $details) {
|
foreach ($fields as $field => $details) {
|
||||||
$value = trim(Input::get($gateway->id . '_' . $field));
|
$value = trim(\Request::input($gateway->id . '_' . $field));
|
||||||
// if the new value is masked use the original value
|
// if the new value is masked use the original value
|
||||||
if ($oldConfig && $value && $value === str_repeat('*', strlen($value))) {
|
if ($oldConfig && $value && $value === str_repeat('*', strlen($value))) {
|
||||||
$value = $oldConfig->$field;
|
$value = $oldConfig->$field;
|
||||||
|
|
@ -265,28 +265,28 @@ class AccountGatewayController extends BaseController
|
||||||
$config = clone $oldConfig;
|
$config = clone $oldConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
$publishableKey = trim(Input::get('publishable_key'));
|
$publishableKey = trim(\Request::input('publishable_key'));
|
||||||
if ($publishableKey = str_replace('*', '', $publishableKey)) {
|
if ($publishableKey = str_replace('*', '', $publishableKey)) {
|
||||||
$config->publishableKey = $publishableKey;
|
$config->publishableKey = $publishableKey;
|
||||||
} elseif ($oldConfig && property_exists($oldConfig, 'publishableKey')) {
|
} elseif ($oldConfig && property_exists($oldConfig, 'publishableKey')) {
|
||||||
$config->publishableKey = $oldConfig->publishableKey;
|
$config->publishableKey = $oldConfig->publishableKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
$plaidClientId = trim(Input::get('plaid_client_id'));
|
$plaidClientId = trim(\Request::input('plaid_client_id'));
|
||||||
if (! $plaidClientId || $plaidClientId = str_replace('*', '', $plaidClientId)) {
|
if (! $plaidClientId || $plaidClientId = str_replace('*', '', $plaidClientId)) {
|
||||||
$config->plaidClientId = $plaidClientId;
|
$config->plaidClientId = $plaidClientId;
|
||||||
} elseif ($oldConfig && property_exists($oldConfig, 'plaidClientId')) {
|
} elseif ($oldConfig && property_exists($oldConfig, 'plaidClientId')) {
|
||||||
$config->plaidClientId = $oldConfig->plaidClientId;
|
$config->plaidClientId = $oldConfig->plaidClientId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$plaidSecret = trim(Input::get('plaid_secret'));
|
$plaidSecret = trim(\Request::input('plaid_secret'));
|
||||||
if (! $plaidSecret || $plaidSecret = str_replace('*', '', $plaidSecret)) {
|
if (! $plaidSecret || $plaidSecret = str_replace('*', '', $plaidSecret)) {
|
||||||
$config->plaidSecret = $plaidSecret;
|
$config->plaidSecret = $plaidSecret;
|
||||||
} elseif ($oldConfig && property_exists($oldConfig, 'plaidSecret')) {
|
} elseif ($oldConfig && property_exists($oldConfig, 'plaidSecret')) {
|
||||||
$config->plaidSecret = $oldConfig->plaidSecret;
|
$config->plaidSecret = $oldConfig->plaidSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
$plaidPublicKey = trim(Input::get('plaid_public_key'));
|
$plaidPublicKey = trim(\Request::input('plaid_public_key'));
|
||||||
if (! $plaidPublicKey || $plaidPublicKey = str_replace('*', '', $plaidPublicKey)) {
|
if (! $plaidPublicKey || $plaidPublicKey = str_replace('*', '', $plaidPublicKey)) {
|
||||||
$config->plaidPublicKey = $plaidPublicKey;
|
$config->plaidPublicKey = $plaidPublicKey;
|
||||||
} elseif ($oldConfig && property_exists($oldConfig, 'plaidPublicKey')) {
|
} elseif ($oldConfig && property_exists($oldConfig, 'plaidPublicKey')) {
|
||||||
|
|
@ -294,11 +294,11 @@ class AccountGatewayController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gatewayId == GATEWAY_STRIPE) {
|
if ($gatewayId == GATEWAY_STRIPE) {
|
||||||
$config->enableAlipay = boolval(Input::get('enable_alipay'));
|
$config->enableAlipay = boolval(\Request::input('enable_alipay'));
|
||||||
$config->enableSofort = boolval(Input::get('enable_sofort'));
|
$config->enableSofort = boolval(\Request::input('enable_sofort'));
|
||||||
$config->enableSepa = boolval(Input::get('enable_sepa'));
|
$config->enableSepa = boolval(\Request::input('enable_sepa'));
|
||||||
$config->enableBitcoin = boolval(Input::get('enable_bitcoin'));
|
$config->enableBitcoin = boolval(\Request::input('enable_bitcoin'));
|
||||||
$config->enableApplePay = boolval(Input::get('enable_apple_pay'));
|
$config->enableApplePay = boolval(\Request::input('enable_apple_pay'));
|
||||||
|
|
||||||
if ($config->enableApplePay && $uploadedFile = request()->file('apple_merchant_id')) {
|
if ($config->enableApplePay && $uploadedFile = request()->file('apple_merchant_id')) {
|
||||||
$config->appleMerchantId = File::get($uploadedFile);
|
$config->appleMerchantId = File::get($uploadedFile);
|
||||||
|
|
@ -308,11 +308,11 @@ class AccountGatewayController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gatewayId == GATEWAY_STRIPE || $gatewayId == GATEWAY_WEPAY) {
|
if ($gatewayId == GATEWAY_STRIPE || $gatewayId == GATEWAY_WEPAY) {
|
||||||
$config->enableAch = boolval(Input::get('enable_ach'));
|
$config->enableAch = boolval(\Request::input('enable_ach'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gatewayId == GATEWAY_BRAINTREE) {
|
if ($gatewayId == GATEWAY_BRAINTREE) {
|
||||||
$config->enablePayPal = boolval(Input::get('enable_paypal'));
|
$config->enablePayPal = boolval(\Request::input('enable_paypal'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cardCount = 0;
|
$cardCount = 0;
|
||||||
|
|
@ -323,9 +323,9 @@ class AccountGatewayController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
$accountGateway->accepted_credit_cards = $cardCount;
|
$accountGateway->accepted_credit_cards = $cardCount;
|
||||||
$accountGateway->show_address = Input::get('show_address') ? true : false;
|
$accountGateway->show_address = \Request::input('show_address') ? true : false;
|
||||||
$accountGateway->show_shipping_address = Input::get('show_shipping_address') ? true : false;
|
$accountGateway->show_shipping_address = \Request::input('show_shipping_address') ? true : false;
|
||||||
$accountGateway->update_address = Input::get('update_address') ? true : false;
|
$accountGateway->update_address = \Request::input('update_address') ? true : false;
|
||||||
$accountGateway->setConfig($config);
|
$accountGateway->setConfig($config);
|
||||||
|
|
||||||
if ($accountGatewayPublicId) {
|
if ($accountGatewayPublicId) {
|
||||||
|
|
@ -395,7 +395,7 @@ class AccountGatewayController extends BaseController
|
||||||
'country' => 'required|in:US,CA,GB',
|
'country' => 'required|in:US,CA,GB',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to('gateways/create')
|
return Redirect::to('gateways/create')
|
||||||
|
|
@ -404,9 +404,9 @@ class AccountGatewayController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $user->email) {
|
if (! $user->email) {
|
||||||
$user->email = trim(Input::get('email'));
|
$user->email = trim(\Request::input('email'));
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
$user->first_name = trim(\Request::input('first_name'));
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->last_name = trim(\Request::input('last_name'));
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -416,9 +416,9 @@ class AccountGatewayController extends BaseController
|
||||||
$userDetails = [
|
$userDetails = [
|
||||||
'client_id' => WEPAY_CLIENT_ID,
|
'client_id' => WEPAY_CLIENT_ID,
|
||||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||||
'email' => Input::get('email'),
|
'email' => \Request::input('email'),
|
||||||
'first_name' => Input::get('first_name'),
|
'first_name' => \Request::input('first_name'),
|
||||||
'last_name' => Input::get('last_name'),
|
'last_name' => \Request::input('last_name'),
|
||||||
'original_ip' => \Request::getClientIp(true),
|
'original_ip' => \Request::getClientIp(true),
|
||||||
'original_device' => \Request::server('HTTP_USER_AGENT'),
|
'original_device' => \Request::server('HTTP_USER_AGENT'),
|
||||||
'tos_acceptance_time' => time(),
|
'tos_acceptance_time' => time(),
|
||||||
|
|
@ -434,18 +434,18 @@ class AccountGatewayController extends BaseController
|
||||||
$wepay = new WePay($accessToken);
|
$wepay = new WePay($accessToken);
|
||||||
|
|
||||||
$accountDetails = [
|
$accountDetails = [
|
||||||
'name' => Input::get('company_name'),
|
'name' => \Request::input('company_name'),
|
||||||
'description' => trans('texts.wepay_account_description'),
|
'description' => trans('texts.wepay_account_description'),
|
||||||
'theme_object' => json_decode(WEPAY_THEME),
|
'theme_object' => json_decode(WEPAY_THEME),
|
||||||
'callback_uri' => $accountGateway->getWebhookUrl(),
|
'callback_uri' => $accountGateway->getWebhookUrl(),
|
||||||
'rbits' => $account->present()->rBits,
|
'rbits' => $account->present()->rBits,
|
||||||
'country' => Input::get('country'),
|
'country' => \Request::input('country'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (Input::get('country') == 'CA') {
|
if (\Request::input('country') == 'CA') {
|
||||||
$accountDetails['currencies'] = ['CAD'];
|
$accountDetails['currencies'] = ['CAD'];
|
||||||
$accountDetails['country_options'] = ['debit_opt_in' => boolval(Input::get('debit_cards'))];
|
$accountDetails['country_options'] = ['debit_opt_in' => boolval(\Request::input('debit_cards'))];
|
||||||
} elseif (Input::get('country') == 'GB') {
|
} elseif (\Request::input('country') == 'GB') {
|
||||||
$accountDetails['currencies'] = ['GBP'];
|
$accountDetails['currencies'] = ['GBP'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ class AccountGatewayController extends BaseController
|
||||||
'accountId' => $wepayAccount->account_id,
|
'accountId' => $wepayAccount->account_id,
|
||||||
'state' => $wepayAccount->state,
|
'state' => $wepayAccount->state,
|
||||||
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
'testMode' => WEPAY_ENVIRONMENT == WEPAY_STAGE,
|
||||||
'country' => Input::get('country'),
|
'country' => \Request::input('country'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($confirmationRequired) {
|
if ($confirmationRequired) {
|
||||||
|
|
@ -522,7 +522,7 @@ class AccountGatewayController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function savePaymentGatewayLimits()
|
public function savePaymentGatewayLimits()
|
||||||
{
|
{
|
||||||
$gateway_type_id = intval(Input::get('gateway_type_id'));
|
$gateway_type_id = intval(\Request::input('gateway_type_id'));
|
||||||
$gateway_settings = AccountGatewaySettings::scope()->where('gateway_type_id', '=', $gateway_type_id)->first();
|
$gateway_settings = AccountGatewaySettings::scope()->where('gateway_type_id', '=', $gateway_type_id)->first();
|
||||||
|
|
||||||
if ( ! $gateway_settings) {
|
if ( ! $gateway_settings) {
|
||||||
|
|
@ -530,14 +530,14 @@ class AccountGatewayController extends BaseController
|
||||||
$gateway_settings->gateway_type_id = $gateway_type_id;
|
$gateway_settings->gateway_type_id = $gateway_type_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gateway_settings->min_limit = Input::get('limit_min_enable') ? intval(Input::get('limit_min')) : null;
|
$gateway_settings->min_limit = \Request::input('limit_min_enable') ? intval(\Request::input('limit_min')) : null;
|
||||||
$gateway_settings->max_limit = Input::get('limit_max_enable') ? intval(Input::get('limit_max')) : null;
|
$gateway_settings->max_limit = \Request::input('limit_max_enable') ? intval(\Request::input('limit_max')) : null;
|
||||||
|
|
||||||
if ($gateway_settings->max_limit !== null && $gateway_settings->min_limit > $gateway_settings->max_limit) {
|
if ($gateway_settings->max_limit !== null && $gateway_settings->min_limit > $gateway_settings->max_limit) {
|
||||||
$gateway_settings->max_limit = $gateway_settings->min_limit;
|
$gateway_settings->max_limit = $gateway_settings->min_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gateway_settings->fill(Input::all());
|
$gateway_settings->fill(Request::all());
|
||||||
$gateway_settings->save();
|
$gateway_settings->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ use Config;
|
||||||
use DB;
|
use DB;
|
||||||
use Event;
|
use Event;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Response;
|
use Response;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
@ -58,17 +57,17 @@ class AppController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$test = Input::get('test');
|
$test = \Request::input('test');
|
||||||
|
|
||||||
$app = Input::get('app');
|
$app = \Request::input('app');
|
||||||
$app['key'] = env('APP_KEY') ?: strtolower(str_random(RANDOM_KEY_LENGTH));
|
$app['key'] = env('APP_KEY') ?: strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$app['debug'] = Input::get('debug') ? 'true' : 'false';
|
$app['debug'] = \Request::input('debug') ? 'true' : 'false';
|
||||||
$app['https'] = Input::get('https') ? 'true' : 'false';
|
$app['https'] = \Request::input('https') ? 'true' : 'false';
|
||||||
|
|
||||||
$database = Input::get('database');
|
$database = \Request::input('database');
|
||||||
$dbType = 'mysql'; // $database['default'];
|
$dbType = 'mysql'; // $database['default'];
|
||||||
$database['connections'] = [$dbType => $database['type']];
|
$database['connections'] = [$dbType => $database['type']];
|
||||||
$mail = Input::get('mail');
|
$mail = \Request::input('mail');
|
||||||
|
|
||||||
if ($test == 'mail') {
|
if ($test == 'mail') {
|
||||||
return self::testMail($mail);
|
return self::testMail($mail);
|
||||||
|
|
@ -137,10 +136,10 @@ class AppController extends BaseController
|
||||||
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
|
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
|
||||||
|
|
||||||
if (! Account::count()) {
|
if (! Account::count()) {
|
||||||
$firstName = trim(Input::get('first_name'));
|
$firstName = trim(\Request::input('first_name'));
|
||||||
$lastName = trim(Input::get('last_name'));
|
$lastName = trim(\Request::input('last_name'));
|
||||||
$email = trim(strtolower(Input::get('email')));
|
$email = trim(strtolower(\Request::input('email')));
|
||||||
$password = trim(Input::get('password'));
|
$password = trim(\Request::input('password'));
|
||||||
$account = $this->accountRepo->create($firstName, $lastName, $email, $password);
|
$account = $this->accountRepo->create($firstName, $lastName, $email, $password);
|
||||||
|
|
||||||
$user = $account->users()->first();
|
$user = $account->users()->first();
|
||||||
|
|
@ -167,13 +166,13 @@ class AppController extends BaseController
|
||||||
return Redirect::to('/settings/system_settings');
|
return Redirect::to('/settings/system_settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = Input::get('app');
|
$app = \Request::input('app');
|
||||||
$db = Input::get('database');
|
$db = \Request::input('database');
|
||||||
$mail = Input::get('mail');
|
$mail = \Request::input('mail');
|
||||||
|
|
||||||
$_ENV['APP_URL'] = $app['url'];
|
$_ENV['APP_URL'] = $app['url'];
|
||||||
$_ENV['APP_DEBUG'] = Input::get('debug') ? 'true' : 'false';
|
$_ENV['APP_DEBUG'] = \Request::input('debug') ? 'true' : 'false';
|
||||||
$_ENV['REQUIRE_HTTPS'] = Input::get('https') ? 'true' : 'false';
|
$_ENV['REQUIRE_HTTPS'] = \Request::input('https') ? 'true' : 'false';
|
||||||
|
|
||||||
$_ENV['DB_TYPE'] = 'mysql'; // $db['default'];
|
$_ENV['DB_TYPE'] = 'mysql'; // $db['default'];
|
||||||
$_ENV['DB_HOST'] = $db['type']['host'];
|
$_ENV['DB_HOST'] = $db['type']['host'];
|
||||||
|
|
@ -314,7 +313,7 @@ class AppController extends BaseController
|
||||||
Session::flush();
|
Session::flush();
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
|
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
|
||||||
Event::fire(new UserSettingsChanged());
|
Event::dispatch(new UserSettingsChanged());
|
||||||
|
|
||||||
// legacy fix: check cipher is in .env file
|
// legacy fix: check cipher is in .env file
|
||||||
if (! env('APP_CIPHER')) {
|
if (! env('APP_CIPHER')) {
|
||||||
|
|
@ -346,7 +345,12 @@ class AppController extends BaseController
|
||||||
FROM information_schema.TABLES
|
FROM information_schema.TABLES
|
||||||
WHERE TABLE_NAME='clients' AND TABLE_SCHEMA='ninja'");
|
WHERE TABLE_NAME='clients' AND TABLE_SCHEMA='ninja'");
|
||||||
|
|
||||||
if (count($result) && $result[0]->engine == 'InnoDB') {
|
if(property_exists($result[0], 'engine'))
|
||||||
|
$engine = $result[0]->engine;
|
||||||
|
else
|
||||||
|
$engine = $result[0]->ENGINE;
|
||||||
|
|
||||||
|
if (count($result) && $engine == 'InnoDB') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,15 +367,15 @@ class AppController extends BaseController
|
||||||
|
|
||||||
public function emailBounced()
|
public function emailBounced()
|
||||||
{
|
{
|
||||||
$messageId = Input::get('MessageID');
|
$messageId = \Request::input('MessageID');
|
||||||
$error = Input::get('Name') . ': ' . Input::get('Description');
|
$error = \Request::input('Name') . ': ' . \Request::input('Description');
|
||||||
|
|
||||||
return $this->emailService->markBounced($messageId, $error) ? RESULT_SUCCESS : RESULT_FAILURE;
|
return $this->emailService->markBounced($messageId, $error) ? RESULT_SUCCESS : RESULT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function emailOpened()
|
public function emailOpened()
|
||||||
{
|
{
|
||||||
$messageId = Input::get('MessageID');
|
$messageId = \Request::input('MessageID');
|
||||||
|
|
||||||
return $this->emailService->markOpened($messageId) ? RESULT_SUCCESS : RESULT_FAILURE;
|
return $this->emailService->markOpened($messageId) ? RESULT_SUCCESS : RESULT_FAILURE;
|
||||||
|
|
||||||
|
|
@ -409,7 +413,7 @@ class AppController extends BaseController
|
||||||
|
|
||||||
public function stats()
|
public function stats()
|
||||||
{
|
{
|
||||||
if (! hash_equals(Input::get('password') ?: '', env('RESELLER_PASSWORD'))) {
|
if (! hash_equals(\Request::input('password') ?: '', env('RESELLER_PASSWORD'))) {
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class LoginController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::fire(new UserLoggedIn());
|
Event::dispatch(new UserLoggedIn());
|
||||||
|
|
||||||
return redirect()->intended($this->redirectTo);
|
return redirect()->intended($this->redirectTo);
|
||||||
}
|
}
|
||||||
|
|
@ -188,11 +188,11 @@ class LoginController extends Controller
|
||||||
$key = $userId . ':' . $request->totp;
|
$key = $userId . ':' . $request->totp;
|
||||||
|
|
||||||
//use cache to store token to blacklist
|
//use cache to store token to blacklist
|
||||||
Cache::add($key, true, 4);
|
Cache::add($key, true, 4 * 60);
|
||||||
|
|
||||||
//login and redirect user
|
//login and redirect user
|
||||||
auth()->loginUsingId($userId);
|
auth()->loginUsingId($userId);
|
||||||
Event::fire(new UserLoggedIn());
|
Event::dispatch(new UserLoggedIn());
|
||||||
|
|
||||||
if ($trust = request()->trust) {
|
if ($trust = request()->trust) {
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class ResetPasswordController extends Controller
|
||||||
$this->middleware('guest');
|
$this->middleware('guest');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sendResetResponse($response)
|
protected function sendResetResponse(Request $request, $response)
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
|
|
@ -51,8 +51,8 @@ class ResetPasswordController extends Controller
|
||||||
session(['2fa:user:id' => $user->id]);
|
session(['2fa:user:id' => $user->id]);
|
||||||
return redirect('/validate_two_factor/' . $user->account->account_key);
|
return redirect('/validate_two_factor/' . $user->account->account_key);
|
||||||
} else {
|
} else {
|
||||||
Event::fire(new UserLoggedIn());
|
Event::dispatch(new UserLoggedIn());
|
||||||
return $this->traitSendResetResponse($response);
|
return $this->traitSendResetResponse($request, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use Cache;
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use File;
|
use File;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
@ -74,8 +73,8 @@ class BankAccountController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
$count = $this->bankAccountService->bulk($ids, $action);
|
$count = $this->bankAccountService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans('texts.archived_bank_account'));
|
Session::flash('message', trans('texts.archived_bank_account'));
|
||||||
|
|
@ -85,9 +84,9 @@ class BankAccountController extends BaseController
|
||||||
|
|
||||||
public function validateAccount()
|
public function validateAccount()
|
||||||
{
|
{
|
||||||
$publicId = Input::get('public_id');
|
$publicId = \Request::input('public_id');
|
||||||
$username = trim(Input::get('bank_username'));
|
$username = trim(\Request::input('bank_username'));
|
||||||
$password = trim(Input::get('bank_password'));
|
$password = trim(\Request::input('bank_password'));
|
||||||
|
|
||||||
if ($publicId) {
|
if ($publicId) {
|
||||||
$bankAccount = BankAccount::scope($publicId)->firstOrFail();
|
$bankAccount = BankAccount::scope($publicId)->firstOrFail();
|
||||||
|
|
@ -100,11 +99,11 @@ class BankAccountController extends BaseController
|
||||||
$bankId = $bankAccount->bank_id;
|
$bankId = $bankAccount->bank_id;
|
||||||
} else {
|
} else {
|
||||||
$bankAccount = new BankAccount;
|
$bankAccount = new BankAccount;
|
||||||
$bankAccount->bank_id = Input::get('bank_id');
|
$bankAccount->bank_id = \Request::input('bank_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
$bankAccount->app_version = Input::get('app_version');
|
$bankAccount->app_version = \Request::input('app_version');
|
||||||
$bankAccount->ofx_version = Input::get('ofx_version');
|
$bankAccount->ofx_version = \Request::input('ofx_version');
|
||||||
|
|
||||||
if ($publicId) {
|
if ($publicId) {
|
||||||
$bankAccount->save();
|
$bankAccount->save();
|
||||||
|
|
@ -115,18 +114,18 @@ class BankAccountController extends BaseController
|
||||||
|
|
||||||
public function store(CreateBankAccountRequest $request)
|
public function store(CreateBankAccountRequest $request)
|
||||||
{
|
{
|
||||||
$bankAccount = $this->bankAccountRepo->save(Input::all());
|
$bankAccount = $this->bankAccountRepo->save(Request::all());
|
||||||
|
|
||||||
$bankId = Input::get('bank_id');
|
$bankId = \Request::input('bank_id');
|
||||||
$username = trim(Input::get('bank_username'));
|
$username = trim(\Request::input('bank_username'));
|
||||||
$password = trim(Input::get('bank_password'));
|
$password = trim(\Request::input('bank_password'));
|
||||||
|
|
||||||
return json_encode($this->bankAccountService->loadBankAccounts($bankAccount, $username, $password, true));
|
return json_encode($this->bankAccountService->loadBankAccounts($bankAccount, $username, $password, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function importExpenses($bankId)
|
public function importExpenses($bankId)
|
||||||
{
|
{
|
||||||
return $this->bankAccountService->importExpenses($bankId, Input::all());
|
return $this->bankAccountService->importExpenses($bankId, Request::all());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showImportOFX()
|
public function showImportOFX()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
||||||
use App\Models\EntityModel;
|
use App\Models\EntityModel;
|
||||||
use App\Ninja\Serializers\ArraySerializer;
|
use App\Ninja\Serializers\ArraySerializer;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use League\Fractal\Manager;
|
use League\Fractal\Manager;
|
||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||||
use League\Fractal\Resource\Collection;
|
use League\Fractal\Resource\Collection;
|
||||||
|
|
@ -24,7 +23,7 @@ use Utils;
|
||||||
* @SWG\Info(
|
* @SWG\Info(
|
||||||
* version="1.0.0",
|
* version="1.0.0",
|
||||||
* title="Invoice Ninja API",
|
* title="Invoice Ninja API",
|
||||||
* description="An open-source invoicing and time-tracking app built with Laravel",
|
* description="A source-available invoicing and time-tracking app built with Laravel",
|
||||||
* termsOfService="",
|
* termsOfService="",
|
||||||
* @SWG\Contact(
|
* @SWG\Contact(
|
||||||
* email="contact@invoiceninja.com"
|
* email="contact@invoiceninja.com"
|
||||||
|
|
@ -56,11 +55,11 @@ class BaseAPIController extends Controller
|
||||||
{
|
{
|
||||||
$this->manager = new Manager();
|
$this->manager = new Manager();
|
||||||
|
|
||||||
if ($include = Request::get('include')) {
|
if ($include = \Request::get('include')) {
|
||||||
$this->manager->parseIncludes($include);
|
$this->manager->parseIncludes($include);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->serializer = Request::get('serializer') ?: API_SERIALIZER_ARRAY;
|
$this->serializer = \Request::get('serializer') ?: API_SERIALIZER_ARRAY;
|
||||||
|
|
||||||
if ($this->serializer === API_SERIALIZER_JSON) {
|
if ($this->serializer === API_SERIALIZER_JSON) {
|
||||||
$this->manager->setSerializer(new JsonApiSerializer());
|
$this->manager->setSerializer(new JsonApiSerializer());
|
||||||
|
|
@ -92,24 +91,24 @@ class BaseAPIController extends Controller
|
||||||
protected function listResponse($query)
|
protected function listResponse($query)
|
||||||
{
|
{
|
||||||
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
||||||
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
|
$transformer = new $transformerClass(Auth::user()->account, \Request::input('serializer'));
|
||||||
|
|
||||||
$includes = $transformer->getDefaultIncludes();
|
$includes = $transformer->getDefaultIncludes();
|
||||||
$includes = $this->getRequestIncludes($includes);
|
$includes = $this->getRequestIncludes($includes);
|
||||||
|
|
||||||
$query->with($includes);
|
$query->with($includes);
|
||||||
|
|
||||||
if (Input::get('filter_active')) {
|
if (\Request::input('filter_active')) {
|
||||||
$query->whereNull('deleted_at');
|
$query->whereNull('deleted_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::get('updated_at') > 0) {
|
if (\Request::input('updated_at') > 0) {
|
||||||
$updatedAt = intval(Input::get('updated_at'));
|
$updatedAt = intval(\Request::input('updated_at'));
|
||||||
$query->where('updated_at', '>=', date('Y-m-d H:i:s', $updatedAt));
|
$query->where('updated_at', '>=', date('Y-m-d H:i:s', $updatedAt));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::get('client_id') > 0) {
|
if (\Request::input('client_id') > 0) {
|
||||||
$clientPublicId = Input::get('client_id');
|
$clientPublicId = \Request::input('client_id');
|
||||||
$filter = function ($query) use ($clientPublicId) {
|
$filter = function ($query) use ($clientPublicId) {
|
||||||
$query->where('public_id', '=', $clientPublicId);
|
$query->where('public_id', '=', $clientPublicId);
|
||||||
};
|
};
|
||||||
|
|
@ -136,7 +135,7 @@ class BaseAPIController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
$transformerClass = EntityModel::getTransformerName($this->entityType);
|
||||||
$transformer = new $transformerClass(Auth::user()->account, Input::get('serializer'));
|
$transformer = new $transformerClass(Auth::user()->account, \Request::input('serializer'));
|
||||||
|
|
||||||
$data = $this->createItem($item, $transformer, $this->entityType);
|
$data = $this->createItem($item, $transformer, $this->entityType);
|
||||||
|
|
||||||
|
|
@ -161,7 +160,7 @@ class BaseAPIController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
if (is_a($query, "Illuminate\Database\Eloquent\Builder")) {
|
||||||
$limit = Input::get('per_page', DEFAULT_API_PAGE_SIZE);
|
$limit = \Request::input('per_page', DEFAULT_API_PAGE_SIZE);
|
||||||
if (Utils::isNinja()) {
|
if (Utils::isNinja()) {
|
||||||
$limit = min(MAX_API_PAGE_SIZE, $limit);
|
$limit = min(MAX_API_PAGE_SIZE, $limit);
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +177,7 @@ class BaseAPIController extends Controller
|
||||||
|
|
||||||
protected function response($response)
|
protected function response($response)
|
||||||
{
|
{
|
||||||
$index = Request::get('index') ?: 'data';
|
$index = \Request::get('index') ?: 'data';
|
||||||
|
|
||||||
if ($index == 'none') {
|
if ($index == 'none') {
|
||||||
unset($response['meta']);
|
unset($response['meta']);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -15,24 +14,24 @@ class BlueVineController extends BaseController
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'personal_user_full_name' => Input::get('name'),
|
'personal_user_full_name' => \Request::input('name'),
|
||||||
'business_phone_number' => Input::get('phone'),
|
'business_phone_number' => \Request::input('phone'),
|
||||||
'email' => Input::get('email'),
|
'email' => \Request::input('email'),
|
||||||
'personal_fico_score' => intval(Input::get('fico_score')),
|
'personal_fico_score' => intval(\Request::input('fico_score')),
|
||||||
'business_annual_revenue' => intval(Input::get('annual_revenue')),
|
'business_annual_revenue' => intval(\Request::input('annual_revenue')),
|
||||||
'business_monthly_average_bank_balance' => intval(Input::get('average_bank_balance')),
|
'business_monthly_average_bank_balance' => intval(\Request::input('average_bank_balance')),
|
||||||
'business_inception_date' => date('Y-m-d', strtotime(Input::get('business_inception'))),
|
'business_inception_date' => date('Y-m-d', strtotime(\Request::input('business_inception'))),
|
||||||
'partner_internal_business_id' => 'ninja_account_' . $user->account_id,
|
'partner_internal_business_id' => 'ninja_account_' . $user->account_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (! empty(Input::get('quote_type_factoring'))) {
|
if (! empty(\Request::input('quote_type_factoring'))) {
|
||||||
$data['invoice_factoring_offer'] = true;
|
$data['invoice_factoring_offer'] = true;
|
||||||
$data['desired_credit_line'] = intval(Input::get('desired_credit_limit')['invoice_factoring']);
|
$data['desired_credit_line'] = intval(\Request::input('desired_credit_limit')['invoice_factoring']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty(Input::get('quote_type_loc'))) {
|
if (! empty(\Request::input('quote_type_loc'))) {
|
||||||
$data['line_of_credit_offer'] = true;
|
$data['line_of_credit_offer'] = true;
|
||||||
$data['desired_credit_line_for_loc'] = intval(Input::get('desired_credit_limit')['line_of_credit']);
|
$data['desired_credit_line_for_loc'] = intval(\Request::input('desired_credit_limit')['line_of_credit']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$api_client = new \GuzzleHttp\Client();
|
$api_client = new \GuzzleHttp\Client();
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
use DB;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Input;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
class BotController extends Controller
|
class BotController extends Controller
|
||||||
|
|
@ -28,7 +27,7 @@ class BotController extends Controller
|
||||||
{
|
{
|
||||||
abort(404);
|
abort(404);
|
||||||
|
|
||||||
$input = Input::all();
|
$input = \Request::all();
|
||||||
$botUserId = $input['from']['id'];
|
$botUserId = $input['from']['id'];
|
||||||
|
|
||||||
if (! $token = $this->authenticate($input)) {
|
if (! $token = $this->authenticate($input)) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ use App\Http\Requests\CreateClientRequest;
|
||||||
use App\Http\Requests\UpdateClientRequest;
|
use App\Http\Requests\UpdateClientRequest;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Ninja\Repositories\ClientRepository;
|
use App\Ninja\Repositories\ClientRepository;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class ClientApiController extends BaseAPIController
|
class ClientApiController extends BaseAPIController
|
||||||
|
|
@ -46,11 +45,11 @@ class ClientApiController extends BaseAPIController
|
||||||
->orderBy('updated_at', 'desc')
|
->orderBy('updated_at', 'desc')
|
||||||
->withTrashed();
|
->withTrashed();
|
||||||
|
|
||||||
if ($email = Input::get('email')) {
|
if ($email = \Request::input('email')) {
|
||||||
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
||||||
$query->where('email', $email);
|
$query->where('email', $email);
|
||||||
});
|
});
|
||||||
} elseif ($idNumber = Input::get('id_number')) {
|
} elseif ($idNumber = \Request::input('id_number')) {
|
||||||
$clients = $clients->whereIdNumber($idNumber);
|
$clients = $clients->whereIdNumber($idNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\ClientAuth;
|
namespace App\Http\Controllers\ClientAuth;
|
||||||
|
|
||||||
|
use Illuminate\Mail\Message;
|
||||||
use Password;
|
use Password;
|
||||||
use Config;
|
use Config;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
@ -39,7 +40,7 @@ class ForgotPasswordController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function showLinkRequestForm()
|
public function showLinkRequestForm()
|
||||||
{
|
{
|
||||||
|
|
@ -55,7 +56,7 @@ class ForgotPasswordController extends Controller
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function sendResetLinkEmail(Request $request)
|
public function sendResetLinkEmail(Request $request)
|
||||||
{
|
{
|
||||||
|
|
@ -91,7 +92,7 @@ class ForgotPasswordController extends Controller
|
||||||
});
|
});
|
||||||
|
|
||||||
return $response == Password::RESET_LINK_SENT
|
return $response == Password::RESET_LINK_SENT
|
||||||
? $this->sendResetLinkResponse($response)
|
? $this->sendResetLinkResponse($request, $response)
|
||||||
: $this->sendResetLinkFailedResponse($request, $response);
|
: $this->sendResetLinkFailedResponse($request, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use App\Ninja\Repositories\ClientRepository;
|
||||||
use App\Services\ClientService;
|
use App\Services\ClientService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -57,7 +56,7 @@ class ClientController extends BaseController
|
||||||
|
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterIdByEntity(ENTITY_CLIENT);
|
$userId = Auth::user()->filterIdByEntity(ENTITY_CLIENT);
|
||||||
|
|
||||||
return $this->clientService->getDatatable($search, $userId);
|
return $this->clientService->getDatatable($search, $userId);
|
||||||
|
|
@ -201,7 +200,7 @@ class ClientController extends BaseController
|
||||||
private static function getViewModel()
|
private static function getViewModel()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'data' => Input::old('data'),
|
'data' => \Request::old('data'),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
'sizes' => Cache::get('sizes'),
|
'sizes' => Cache::get('sizes'),
|
||||||
'customLabel1' => Auth::user()->account->customLabel('client1'),
|
'customLabel1' => Auth::user()->account->customLabel('client1'),
|
||||||
|
|
@ -227,8 +226,8 @@ class ClientController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
if ($action == 'purge' && ! auth()->user()->is_admin) {
|
if ($action == 'purge' && ! auth()->user()->is_admin) {
|
||||||
return redirect('dashboard')->withError(trans('texts.not_authorized'));
|
return redirect('dashboard')->withError(trans('texts.not_authorized'));
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,17 @@ class ClientPortalController extends BaseController
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
$account = $invoice->account;
|
$account = $invoice->account;
|
||||||
|
|
||||||
|
/* Forward requests from V4 to V5 if the domain is set */
|
||||||
|
if(strlen($account->account_email_settings->forward_url_for_v5) >1){
|
||||||
|
|
||||||
|
if ($invoice->isType(INVOICE_TYPE_QUOTE))
|
||||||
|
$entity = 'quote';
|
||||||
|
else
|
||||||
|
$entity = 'invoice';
|
||||||
|
|
||||||
|
return redirect($account->account_email_settings->forward_url_for_v5."/client/".$entity."/".$invitationKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (request()->silent) {
|
if (request()->silent) {
|
||||||
session(['silent:' . $client->id => true]);
|
session(['silent:' . $client->id => true]);
|
||||||
return redirect(request()->url() . (request()->borderless ? '?borderless=true' : ''));
|
return redirect(request()->url() . (request()->borderless ? '?borderless=true' : ''));
|
||||||
|
|
@ -78,7 +89,7 @@ class ClientPortalController extends BaseController
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! Input::has('phantomjs') && ! session('silent:' . $client->id) && ! Session::has($invitation->invitation_key)
|
if (! Request::has('phantomjs') && ! session('silent:' . $client->id) && ! Session::has($invitation->invitation_key)
|
||||||
&& (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
|
&& (! Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
|
||||||
if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
|
if ($invoice->isType(INVOICE_TYPE_QUOTE)) {
|
||||||
event(new QuoteInvitationWasViewed($invoice, $invitation));
|
event(new QuoteInvitationWasViewed($invoice, $invitation));
|
||||||
|
|
@ -129,14 +140,14 @@ class ClientPortalController extends BaseController
|
||||||
$paymentURL = '';
|
$paymentURL = '';
|
||||||
if (count($paymentTypes) == 1) {
|
if (count($paymentTypes) == 1) {
|
||||||
$paymentURL = $paymentTypes[0]['url'];
|
$paymentURL = $paymentTypes[0]['url'];
|
||||||
if (in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) {
|
if (array_key_exists('gatewayTypeId', $paymentTypes[0]) && in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) {
|
} elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) {
|
||||||
$paymentURL = URL::to($paymentURL);
|
$paymentURL = URL::to($paymentURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! Input::has('phantomjs')) {
|
if (! Request::has('phantomjs')) {
|
||||||
if ($wepayGateway = $account->getGatewayConfig(GATEWAY_WEPAY)) {
|
if ($wepayGateway = $account->getGatewayConfig(GATEWAY_WEPAY)) {
|
||||||
$data['enableWePayACH'] = $wepayGateway->getAchEnabled();
|
$data['enableWePayACH'] = $wepayGateway->getAchEnabled();
|
||||||
}
|
}
|
||||||
|
|
@ -151,6 +162,11 @@ class ClientPortalController extends BaseController
|
||||||
$showApprove = false;
|
$showApprove = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$gatewayTypeIdCast = false;
|
||||||
|
|
||||||
|
if(count($paymentTypes) >= 1 && array_key_exists('gatewayTypeId', $paymentTypes[0]))
|
||||||
|
$gatewayTypeIdCast = $paymentTypes[0]['gatewayTypeId'];
|
||||||
|
|
||||||
$data += [
|
$data += [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'showApprove' => $showApprove,
|
'showApprove' => $showApprove,
|
||||||
|
|
@ -161,8 +177,8 @@ class ClientPortalController extends BaseController
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'paymentTypes' => $paymentTypes,
|
'paymentTypes' => $paymentTypes,
|
||||||
'paymentURL' => $paymentURL,
|
'paymentURL' => $paymentURL,
|
||||||
'phantomjs' => Input::has('phantomjs'),
|
'phantomjs' => Request::has('phantomjs'),
|
||||||
'gatewayTypeId' => count($paymentTypes) == 1 ? $paymentTypes[0]['gatewayTypeId'] : false,
|
'gatewayTypeId' => count($paymentTypes) == 1 ? $gatewayTypeIdCast : false,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($invoice->canBePaid()) {
|
if ($invoice->canBePaid()) {
|
||||||
|
|
@ -228,7 +244,7 @@ class ClientPortalController extends BaseController
|
||||||
return RESULT_FAILURE;
|
return RESULT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($signature = Input::get('signature')) {
|
if ($signature = \Request::input('signature')) {
|
||||||
$invitation->signature_base64 = $signature;
|
$invitation->signature_base64 = $signature;
|
||||||
$invitation->signature_date = date_create();
|
$invitation->signature_date = date_create();
|
||||||
$invitation->save();
|
$invitation->save();
|
||||||
|
|
@ -389,7 +405,7 @@ class ClientPortalController extends BaseController
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_INVOICE, Input::get('sSearch'));
|
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_INVOICE, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function recurringInvoiceDatatable()
|
public function recurringInvoiceDatatable()
|
||||||
|
|
@ -432,7 +448,7 @@ class ClientPortalController extends BaseController
|
||||||
if (! $contact = $this->getContact()) {
|
if (! $contact = $this->getContact()) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
$payments = $this->paymentRepo->findForContact($contact->id, Input::get('sSearch'));
|
$payments = $this->paymentRepo->findForContact($contact->id, \Request::input('sSearch'));
|
||||||
|
|
||||||
return Datatable::query($payments)
|
return Datatable::query($payments)
|
||||||
->addColumn('invoice_number', function ($model) {
|
->addColumn('invoice_number', function ($model) {
|
||||||
|
|
@ -517,7 +533,7 @@ class ClientPortalController extends BaseController
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_QUOTE, Input::get('sSearch'));
|
return $this->invoiceRepo->getClientDatatable($contact->id, ENTITY_QUOTE, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function creditIndex()
|
public function creditIndex()
|
||||||
|
|
@ -626,7 +642,7 @@ class ClientPortalController extends BaseController
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->documentRepo->getClientDatatable($contact->id, ENTITY_DOCUMENT, Input::get('sSearch'));
|
return $this->documentRepo->getClientDatatable($contact->id, ENTITY_DOCUMENT, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function returnError($error = false)
|
private function returnError($error = false)
|
||||||
|
|
@ -839,9 +855,9 @@ class ClientPortalController extends BaseController
|
||||||
|
|
||||||
public function verifyPaymentMethod()
|
public function verifyPaymentMethod()
|
||||||
{
|
{
|
||||||
$publicId = Input::get('source_id');
|
$publicId = \Request::input('source_id');
|
||||||
$amount1 = Input::get('verification1');
|
$amount1 = \Request::input('verification1');
|
||||||
$amount2 = Input::get('verification2');
|
$amount2 = \Request::input('verification2');
|
||||||
|
|
||||||
if (! $contact = $this->getContact()) {
|
if (! $contact = $this->getContact()) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
|
|
@ -895,14 +911,14 @@ class ClientPortalController extends BaseController
|
||||||
$client = $contact->client;
|
$client = $contact->client;
|
||||||
$account = $client->account;
|
$account = $client->account;
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), ['source' => 'required']);
|
$validator = Validator::make(Request::all(), ['source' => 'required']);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to($client->account->enable_client_portal_dashboard ? '/client/dashboard' : '/client/payment_methods/');
|
return Redirect::to($client->account->enable_client_portal_dashboard ? '/client/dashboard' : '/client/payment_methods/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
|
$paymentDriver = $account->paymentDriver(false, GATEWAY_TYPE_TOKEN);
|
||||||
$paymentMethod = PaymentMethod::clientId($client->id)
|
$paymentMethod = PaymentMethod::clientId($client->id)
|
||||||
->wherePublicId(Input::get('source'))
|
->wherePublicId(\Request::input('source'))
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
$customer = $paymentDriver->customer($client->id);
|
$customer = $paymentDriver->customer($client->id);
|
||||||
|
|
@ -934,14 +950,14 @@ class ClientPortalController extends BaseController
|
||||||
|
|
||||||
$client = $contact->client;
|
$client = $contact->client;
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), ['public_id' => 'required']);
|
$validator = Validator::make(Request::all(), ['public_id' => 'required']);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to('client/invoices/recurring');
|
return Redirect::to('client/invoices/recurring');
|
||||||
}
|
}
|
||||||
|
|
||||||
$publicId = Input::get('public_id');
|
$publicId = \Request::input('public_id');
|
||||||
$enable = Input::get('enable');
|
$enable = \Request::input('enable');
|
||||||
$invoice = $client->invoices()->where('public_id', intval($publicId))->first();
|
$invoice = $client->invoices()->where('public_id', intval($publicId))->first();
|
||||||
|
|
||||||
if ($invoice && $invoice->is_recurring && ($invoice->auto_bill == AUTO_BILL_OPT_IN || $invoice->auto_bill == AUTO_BILL_OPT_OUT)) {
|
if ($invoice && $invoice->is_recurring && ($invoice->auto_bill == AUTO_BILL_OPT_IN || $invoice->auto_bill == AUTO_BILL_OPT_OUT)) {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ use App\Http\Requests\CreateContactRequest;
|
||||||
use App\Http\Requests\UpdateContactRequest;
|
use App\Http\Requests\UpdateContactRequest;
|
||||||
use App\Models\Contact;
|
use App\Models\Contact;
|
||||||
use App\Ninja\Repositories\ContactRepository;
|
use App\Ninja\Repositories\ContactRepository;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Utils;
|
use Utils;
|
||||||
use App\Services\ContactService;
|
use App\Services\ContactService;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\UpdateCreditRequest;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Ninja\Repositories\CreditRepository;
|
use App\Ninja\Repositories\CreditRepository;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class CreditApiController extends BaseAPIController
|
class CreditApiController extends BaseAPIController
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use App\Models\Credit;
|
||||||
use App\Ninja\Datatables\CreditDatatable;
|
use App\Ninja\Datatables\CreditDatatable;
|
||||||
use App\Ninja\Repositories\CreditRepository;
|
use App\Ninja\Repositories\CreditRepository;
|
||||||
use App\Services\CreditService;
|
use App\Services\CreditService;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -47,13 +46,13 @@ class CreditController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
return $this->creditService->getDatatable($clientPublicId, Input::get('sSearch'));
|
return $this->creditService->getDatatable($clientPublicId, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(CreditRequest $request)
|
public function create(CreditRequest $request)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
'clientPublicId' => \Request::old('client') ? \Request::old('client') : ($request->client_id ?: 0),
|
||||||
'credit' => null,
|
'credit' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'credits',
|
'url' => 'credits',
|
||||||
|
|
@ -111,7 +110,7 @@ class CreditController extends BaseController
|
||||||
|
|
||||||
private function save($credit = null)
|
private function save($credit = null)
|
||||||
{
|
{
|
||||||
$credit = $this->creditService->save(Input::all(), $credit);
|
$credit = $this->creditService->save(\Request::all(), $credit);
|
||||||
|
|
||||||
$message = $credit->wasRecentlyCreated ? trans('texts.created_credit') : trans('texts.updated_credit');
|
$message = $credit->wasRecentlyCreated ? trans('texts.created_credit') : trans('texts.updated_credit');
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
@ -121,8 +120,8 @@ class CreditController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
$count = $this->creditService->bulk($ids, $action);
|
$count = $this->creditService->bulk($ids, $action);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\UpdateExpenseCategoryRequest;
|
||||||
use App\Models\ExpenseCategory;
|
use App\Models\ExpenseCategory;
|
||||||
use App\Ninja\Repositories\ExpenseCategoryRepository;
|
use App\Ninja\Repositories\ExpenseCategoryRepository;
|
||||||
use App\Services\ExpenseCategoryService;
|
use App\Services\ExpenseCategoryService;
|
||||||
use Input;
|
|
||||||
|
|
||||||
class ExpenseCategoryApiController extends BaseAPIController
|
class ExpenseCategoryApiController extends BaseAPIController
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\UpdateExpenseCategoryRequest;
|
||||||
use App\Ninja\Datatables\ExpenseCategoryDatatable;
|
use App\Ninja\Datatables\ExpenseCategoryDatatable;
|
||||||
use App\Ninja\Repositories\ExpenseCategoryRepository;
|
use App\Ninja\Repositories\ExpenseCategoryRepository;
|
||||||
use App\Services\ExpenseCategoryService;
|
use App\Services\ExpenseCategoryService;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -40,7 +39,7 @@ class ExpenseCategoryController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
return $this->categoryService->getDatatable(Input::get('sSearch'));
|
return $this->categoryService->getDatatable(\Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(ExpenseCategoryRequest $request)
|
public function create(ExpenseCategoryRequest $request)
|
||||||
|
|
@ -89,8 +88,8 @@ class ExpenseCategoryController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
$count = $this->categoryService->bulk($ids, $action);
|
$count = $this->categoryService->bulk($ids, $action);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Services\ExpenseService;
|
use App\Services\ExpenseService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
@ -61,7 +60,7 @@ class ExpenseController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
return $this->expenseService->getDatatable(Input::get('sSearch'));
|
return $this->expenseService->getDatatable(\Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDatatableVendor($vendorPublicId = null)
|
public function getDatatableVendor($vendorPublicId = null)
|
||||||
|
|
@ -83,7 +82,7 @@ class ExpenseController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
|
'vendorPublicId' => Request::old('vendor') ? Request::old('vendor') : $request->vendor_id,
|
||||||
'expense' => null,
|
'expense' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'expenses',
|
'url' => 'expenses',
|
||||||
|
|
@ -190,7 +189,7 @@ class ExpenseController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_expense'));
|
Session::flash('message', trans('texts.updated_expense'));
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
if (in_array($action, ['archive', 'delete', 'restore', 'invoice', 'add_to_invoice'])) {
|
if (in_array($action, ['archive', 'delete', 'restore', 'invoice', 'add_to_invoice'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
@ -227,8 +226,8 @@ class ExpenseController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
$referer = Request::server('HTTP_REFERER');
|
$referer = Request::server('HTTP_REFERER');
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
|
@ -268,7 +267,7 @@ class ExpenseController extends BaseController
|
||||||
->with('expenseCurrencyId', $currencyId)
|
->with('expenseCurrencyId', $currencyId)
|
||||||
->with('expenses', $ids);
|
->with('expenses', $ids);
|
||||||
} else {
|
} else {
|
||||||
$invoiceId = Input::get('invoice_id');
|
$invoiceId = \Request::input('invoice_id');
|
||||||
|
|
||||||
return Redirect::to("invoices/{$invoiceId}/edit")
|
return Redirect::to("invoices/{$invoiceId}/edit")
|
||||||
->with('expenseCurrencyId', $currencyId)
|
->with('expenseCurrencyId', $currencyId)
|
||||||
|
|
@ -291,7 +290,7 @@ class ExpenseController extends BaseController
|
||||||
private static function getViewModel($expense = false)
|
private static function getViewModel($expense = false)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'data' => Input::old('data'),
|
'data' => Request::old('data'),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
'vendors' => Vendor::scope()->withActiveOrSelected($expense ? $expense->vendor_id : false)->with('vendor_contacts')->orderBy('name')->get(),
|
'vendors' => Vendor::scope()->withActiveOrSelected($expense ? $expense->vendor_id : false)->with('vendor_contacts')->orderBy('name')->get(),
|
||||||
'clients' => Client::scope()->withActiveOrSelected($expense ? $expense->client_id : false)->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->withActiveOrSelected($expense ? $expense->client_id : false)->with('contacts')->orderBy('name')->get(),
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ use App\Libraries\Utils;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Ninja\Mailers\Mailer;
|
use App\Ninja\Mailers\Mailer;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Mail;
|
use Mail;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
|
|
@ -65,17 +64,27 @@ class HomeController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function invoiceNow()
|
public function invoiceNow()
|
||||||
{
|
{
|
||||||
|
$url = 'https://invoicing.co';
|
||||||
|
|
||||||
|
if (Request::has('rc')) {
|
||||||
|
$url = $url . '?rc=' . \Request::input('rc');
|
||||||
|
}
|
||||||
|
|
||||||
|
return Redirect::to($url);
|
||||||
|
|
||||||
|
/*
|
||||||
// Track the referral/campaign code
|
// Track the referral/campaign code
|
||||||
if (Input::has('rc')) {
|
if (Request::has('rc')) {
|
||||||
session([SESSION_REFERRAL_CODE => Input::get('rc')]);
|
session([SESSION_REFERRAL_CODE => \Request::input('rc')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
$redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'invoices/create';
|
$redirectTo = \Request::input('redirect_to') ? SITE_URL . '/' . ltrim(\Request::input('redirect_to'), '/') : 'invoices/create';
|
||||||
return Redirect::to($redirectTo)->with('sign_up', Input::get('sign_up'));
|
return Redirect::to($redirectTo)->with('sign_up', \Request::input('sign_up'));
|
||||||
} else {
|
} else {
|
||||||
return View::make('public.invoice_now');
|
return View::make('public.invoice_now');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -115,7 +124,7 @@ class HomeController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function logError()
|
public function logError()
|
||||||
{
|
{
|
||||||
return Utils::logError(Input::get('error'), 'JavaScript');
|
return Utils::logError(\Request::input('error'), 'JavaScript');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ use Illuminate\Http\Request;
|
||||||
use App\Services\ImportService;
|
use App\Services\ImportService;
|
||||||
use App\Jobs\ImportData;
|
use App\Jobs\ImportData;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
@ -26,7 +25,7 @@ class ImportController extends BaseController
|
||||||
return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.confirm_account_to_import'));
|
return redirect('/settings/' . ACCOUNT_IMPORT_EXPORT)->withError(trans('texts.confirm_account_to_import'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$source = Input::get('source');
|
$source = \Request::input('source');
|
||||||
$files = [];
|
$files = [];
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
|
|
||||||
|
|
@ -70,8 +69,8 @@ class ImportController extends BaseController
|
||||||
'timestamp' => $timestamp,
|
'timestamp' => $timestamp,
|
||||||
]);
|
]);
|
||||||
} elseif ($source === IMPORT_JSON) {
|
} elseif ($source === IMPORT_JSON) {
|
||||||
$includeData = filter_var(Input::get('data'), FILTER_VALIDATE_BOOLEAN);
|
$includeData = filter_var(\Request::input('data'), FILTER_VALIDATE_BOOLEAN);
|
||||||
$includeSettings = filter_var(Input::get('settings'), FILTER_VALIDATE_BOOLEAN);
|
$includeSettings = filter_var(\Request::input('settings'), FILTER_VALIDATE_BOOLEAN);
|
||||||
if (config('queue.default') === 'sync') {
|
if (config('queue.default') === 'sync') {
|
||||||
$results = $this->importService->importJSON($files[IMPORT_JSON], $includeData, $includeSettings);
|
$results = $this->importService->importJSON($files[IMPORT_JSON], $includeData, $includeSettings);
|
||||||
$message = $this->importService->presentResults($results, $includeSettings);
|
$message = $this->importService->presentResults($results, $includeSettings);
|
||||||
|
|
@ -109,9 +108,9 @@ class ImportController extends BaseController
|
||||||
public function doImportCSV()
|
public function doImportCSV()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$map = Input::get('map');
|
$map = \Request::input('map');
|
||||||
$headers = Input::get('headers');
|
$headers = \Request::input('headers');
|
||||||
$timestamp = Input::get('timestamp');
|
$timestamp = \Request::input('timestamp');
|
||||||
|
|
||||||
if (config('queue.default') === 'sync') {
|
if (config('queue.default') === 'sync') {
|
||||||
$results = $this->importService->importCSV($map, $headers, $timestamp);
|
$results = $this->importService->importCSV($map, $headers, $timestamp);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
|
|
@ -18,7 +17,7 @@ class IntegrationController extends BaseAPIController
|
||||||
*/
|
*/
|
||||||
public function subscribe()
|
public function subscribe()
|
||||||
{
|
{
|
||||||
$eventId = Utils::lookupEventId(trim(Input::get('event')));
|
$eventId = Utils::lookupEventId(trim(\Request::input('event')));
|
||||||
|
|
||||||
if (! $eventId) {
|
if (! $eventId) {
|
||||||
return Response::json('Event is invalid', 500);
|
return Response::json('Event is invalid', 500);
|
||||||
|
|
@ -26,7 +25,7 @@ class IntegrationController extends BaseAPIController
|
||||||
|
|
||||||
$subscription = Subscription::createNew();
|
$subscription = Subscription::createNew();
|
||||||
$subscription->event_id = $eventId;
|
$subscription->event_id = $eventId;
|
||||||
$subscription->target_url = trim(Input::get('target_url'));
|
$subscription->target_url = trim(\Request::input('target_url'));
|
||||||
$subscription->save();
|
$subscription->save();
|
||||||
|
|
||||||
if (! $subscription->id) {
|
if (! $subscription->id) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Services\InvoiceService;
|
use App\Services\InvoiceService;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Validator;
|
use Validator;
|
||||||
|
|
@ -64,12 +63,12 @@ class InvoiceApiController extends BaseAPIController
|
||||||
->orderBy('updated_at', 'desc');
|
->orderBy('updated_at', 'desc');
|
||||||
|
|
||||||
// Filter by invoice number
|
// Filter by invoice number
|
||||||
if ($invoiceNumber = Input::get('invoice_number')) {
|
if ($invoiceNumber = \Request::input('invoice_number')) {
|
||||||
$invoices->whereInvoiceNumber($invoiceNumber);
|
$invoices->whereInvoiceNumber($invoiceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fllter by status
|
// Fllter by status
|
||||||
if ($statusId = Input::get('status_id')) {
|
if ($statusId = \Request::input('status_id')) {
|
||||||
$invoices->where('invoice_status_id', '>=', $statusId);
|
$invoices->where('invoice_status_id', '>=', $statusId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,7 +133,7 @@ class InvoiceApiController extends BaseAPIController
|
||||||
*/
|
*/
|
||||||
public function store(CreateInvoiceAPIRequest $request)
|
public function store(CreateInvoiceAPIRequest $request)
|
||||||
{
|
{
|
||||||
$data = Input::all();
|
$data = \Request::all();
|
||||||
$error = null;
|
$error = null;
|
||||||
|
|
||||||
if (isset($data['email'])) {
|
if (isset($data['email'])) {
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ use App\Services\RecurringInvoiceService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DB;
|
use DB;
|
||||||
use Input;
|
use Illuminate\Support\Facades\Session;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Request;
|
||||||
use URL;
|
use URL;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
|
|
@ -68,7 +68,7 @@ class InvoiceController extends BaseController
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
$accountId = Auth::user()->account_id;
|
$accountId = Auth::user()->account_id;
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
|
|
||||||
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_INVOICE, $search);
|
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_INVOICE, $search);
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ class InvoiceController extends BaseController
|
||||||
public function getRecurringDatatable($clientPublicId = null)
|
public function getRecurringDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
$accountId = Auth::user()->account_id;
|
$accountId = Auth::user()->account_id;
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
|
|
||||||
return $this->recurringInvoiceService->getDatatable($accountId, $clientPublicId, ENTITY_RECURRING_INVOICE, $search);
|
return $this->recurringInvoiceService->getDatatable($accountId, $clientPublicId, ENTITY_RECURRING_INVOICE, $search);
|
||||||
}
|
}
|
||||||
|
|
@ -219,6 +219,9 @@ class InvoiceController extends BaseController
|
||||||
$clients = $clients->where('clients.user_id', '=', Auth::user()->id);
|
$clients = $clients->where('clients.user_id', '=', Auth::user()->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($clientPublicId != 0)
|
||||||
|
$clients->where('public_id', $clientPublicId);
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'clients' => $clients->get(),
|
'clients' => $clients->get(),
|
||||||
'entityType' => $invoice->getEntityType(),
|
'entityType' => $invoice->getEntityType(),
|
||||||
|
|
@ -317,7 +320,7 @@ class InvoiceController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'data' => Input::old('data'),
|
'data' => Request::old('data'),
|
||||||
'account' => Auth::user()->account->load('country'),
|
'account' => Auth::user()->account->load('country'),
|
||||||
'products' => Product::scope()->orderBy('product_key')->get(),
|
'products' => Product::scope()->orderBy('product_key')->get(),
|
||||||
'taxRateOptions' => $taxRateOptions,
|
'taxRateOptions' => $taxRateOptions,
|
||||||
|
|
@ -345,8 +348,8 @@ class InvoiceController extends BaseController
|
||||||
$data = $request->input();
|
$data = $request->input();
|
||||||
$data['documents'] = $request->file('documents');
|
$data['documents'] = $request->file('documents');
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$entityType = Input::get('entityType');
|
$entityType = \Request::input('entityType');
|
||||||
|
|
||||||
$invoice = $this->invoiceService->save($data);
|
$invoice = $this->invoiceService->save($data);
|
||||||
$entityType = $invoice->getEntityType();
|
$entityType = $invoice->getEntityType();
|
||||||
|
|
@ -379,8 +382,8 @@ class InvoiceController extends BaseController
|
||||||
$data = $request->input();
|
$data = $request->input();
|
||||||
$data['documents'] = $request->file('documents');
|
$data['documents'] = $request->file('documents');
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$entityType = Input::get('entityType');
|
$entityType = \Request::input('entityType');
|
||||||
|
|
||||||
$invoice = $this->invoiceService->save($data, $request->entity());
|
$invoice = $this->invoiceService->save($data, $request->entity());
|
||||||
$entityType = $invoice->getEntityType();
|
$entityType = $invoice->getEntityType();
|
||||||
|
|
@ -402,14 +405,14 @@ class InvoiceController extends BaseController
|
||||||
|
|
||||||
private function emailInvoice($invoice)
|
private function emailInvoice($invoice)
|
||||||
{
|
{
|
||||||
$reminder = Input::get('reminder');
|
$reminder = \Request::input('reminder');
|
||||||
$template = Input::get('template');
|
$template = \Request::input('template');
|
||||||
$pdfUpload = Utils::decodePDF(Input::get('pdfupload'));
|
$pdfUpload = Utils::decodePDF(\Request::input('pdfupload'));
|
||||||
$entityType = $invoice->getEntityType();
|
$entityType = $invoice->getEntityType();
|
||||||
|
|
||||||
if (filter_var(Input::get('save_as_default'), FILTER_VALIDATE_BOOLEAN)) {
|
if (filter_var(\Request::input('save_as_default'), FILTER_VALIDATE_BOOLEAN)) {
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account->setTemplateDefaults(Input::get('template_type'), $template['subject'], $template['body']);
|
$account->setTemplateDefaults(\Request::input('template_type'), $template['subject'], $template['body']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! Auth::user()->confirmed) {
|
if (! Auth::user()->confirmed) {
|
||||||
|
|
@ -427,7 +430,7 @@ class InvoiceController extends BaseController
|
||||||
$response = $this->emailRecurringInvoice($invoice);
|
$response = $this->emailRecurringInvoice($invoice);
|
||||||
} else {
|
} else {
|
||||||
$userId = Auth::user()->id;
|
$userId = Auth::user()->id;
|
||||||
$this->dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template));
|
||||||
$response = true;
|
$response = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -490,8 +493,8 @@ class InvoiceController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk($entityType = ENTITY_INVOICE)
|
public function bulk($entityType = ENTITY_INVOICE)
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action') ?: Input::get('action');
|
$action = \Request::input('bulk_action') ?: \Request::input('action');
|
||||||
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
|
||||||
$count = $this->invoiceService->bulk($ids, $action);
|
$count = $this->invoiceService->bulk($ids, $action);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,22 @@ use App\Http\Controllers\BaseController;
|
||||||
use App\Http\Requests\MigrationAuthRequest;
|
use App\Http\Requests\MigrationAuthRequest;
|
||||||
use App\Http\Requests\MigrationCompaniesRequest;
|
use App\Http\Requests\MigrationCompaniesRequest;
|
||||||
use App\Http\Requests\MigrationEndpointRequest;
|
use App\Http\Requests\MigrationEndpointRequest;
|
||||||
|
use App\Http\Requests\MigrationForwardRequest;
|
||||||
use App\Http\Requests\MigrationTypeRequest;
|
use App\Http\Requests\MigrationTypeRequest;
|
||||||
|
use App\Jobs\HostedMigration;
|
||||||
use App\Libraries\Utils;
|
use App\Libraries\Utils;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
|
use App\Models\AccountGatewayToken;
|
||||||
|
use App\Models\Client;
|
||||||
use App\Services\Migration\AuthService;
|
use App\Services\Migration\AuthService;
|
||||||
use App\Services\Migration\CompanyService;
|
use App\Services\Migration\CompanyService;
|
||||||
use App\Services\Migration\CompleteService;
|
use App\Services\Migration\CompleteService;
|
||||||
use App\Traits\GenerateMigrationResources;
|
use App\Traits\GenerateMigrationResources;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Validator;
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
|
|
||||||
class StepsController extends BaseController
|
class StepsController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -45,6 +52,17 @@ class StepsController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function start()
|
public function start()
|
||||||
{
|
{
|
||||||
|
if(Utils::isNinja()){
|
||||||
|
|
||||||
|
session()->put('MIGRATION_ENDPOINT', 'https://v5-app1.invoicing.co');
|
||||||
|
// session()->put('MIGRATION_ENDPOINT', 'http://ninja.test:8000');
|
||||||
|
session()->put('MIGRATION_ACCOUNT_TOKEN','');
|
||||||
|
session()->put('MIGRAITON_API_SECRET', null);
|
||||||
|
|
||||||
|
return $this->companies();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return view('migration.start');
|
return view('migration.start');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,17 +83,12 @@ class StepsController extends BaseController
|
||||||
{
|
{
|
||||||
session()->put('MIGRATION_TYPE', $request->option);
|
session()->put('MIGRATION_TYPE', $request->option);
|
||||||
|
|
||||||
if ($request->option == 0) {
|
if ($request->option == 0 || $request->option == '0') {
|
||||||
|
|
||||||
session()->put('MIGRATION_ENDPOINT', 'https://invoicing.co');
|
|
||||||
|
|
||||||
return redirect(
|
return redirect(
|
||||||
url('/migration/auth')
|
url('/migration/companies?hosted=true')
|
||||||
);
|
);
|
||||||
|
|
||||||
// return redirect(
|
|
||||||
// url('/migration/endpoint')
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect(
|
return redirect(
|
||||||
|
|
@ -83,8 +96,145 @@ class StepsController extends BaseController
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function forwardUrl(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(Utils::isNinjaProd())
|
||||||
|
return $this->autoForwardUrl();
|
||||||
|
|
||||||
|
$rules = [
|
||||||
|
'url' => 'nullable|url',
|
||||||
|
];
|
||||||
|
|
||||||
|
$validator = Validator::make($request->all(), $rules);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return back()
|
||||||
|
->withErrors($validator)
|
||||||
|
->withInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_settings = \Auth::user()->account->account_email_settings;
|
||||||
|
|
||||||
|
if(strlen($request->input('url')) == 0) {
|
||||||
|
$account_settings->is_disabled = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$account_settings->is_disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_settings->forward_url_for_v5 = rtrim($request->input('url'),'/');
|
||||||
|
$account_settings->save();
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function disableForwarding()
|
||||||
|
{
|
||||||
|
$account = \Auth::user()->account;
|
||||||
|
|
||||||
|
$account_settings = $account->account_email_settings;
|
||||||
|
$account_settings->forward_url_for_v5 = '';
|
||||||
|
$account_settings->is_disabled = false;
|
||||||
|
$account_settings->save();
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function autoForwardUrl()
|
||||||
|
{
|
||||||
|
|
||||||
|
$url = 'https://invoicing.co/api/v1/confirm_forwarding';
|
||||||
|
// $url = 'http://devhosted.test:8000/api/v1/confirm_forwarding';
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'X-API-HOSTED-SECRET' => config('ninja.ninja_hosted_secret'),
|
||||||
|
'X-Requested-With' => 'XMLHttpRequest',
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
];
|
||||||
|
|
||||||
|
$account = \Auth::user()->account;
|
||||||
|
$gateway_reference = '';
|
||||||
|
|
||||||
|
$ninja_client = Client::where('public_id', $account->id)->first();
|
||||||
|
|
||||||
|
if($ninja_client){
|
||||||
|
$agt = AccountGatewayToken::where('client_id', $ninja_client->id)->first();
|
||||||
|
|
||||||
|
if($agt)
|
||||||
|
$gateway_reference = $agt->token;
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
'account_key' => $account->account_key,
|
||||||
|
'email' => $account->getPrimaryUser()->email,
|
||||||
|
'plan' => $account->company->plan,
|
||||||
|
'plan_term' =>$account->company->plan_term,
|
||||||
|
'plan_started' =>$account->company->plan_started,
|
||||||
|
'plan_paid' =>$account->company->plan_paid,
|
||||||
|
'plan_expires' =>$account->company->plan_expires,
|
||||||
|
'trial_started' =>$account->company->trial_started,
|
||||||
|
'trial_plan' =>$account->company->trial_plan,
|
||||||
|
'plan_price' =>$account->company->plan_price,
|
||||||
|
'num_users' =>$account->company->num_users,
|
||||||
|
'gateway_reference' => $gateway_reference,
|
||||||
|
];
|
||||||
|
|
||||||
|
$client = new \GuzzleHttp\Client([
|
||||||
|
'headers' => $headers,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $client->post($url,[
|
||||||
|
RequestOptions::JSON => $body,
|
||||||
|
RequestOptions::ALLOW_REDIRECTS => false
|
||||||
|
]);
|
||||||
|
|
||||||
|
if($response->getStatusCode() == 401){
|
||||||
|
info("autoForwardUrl");
|
||||||
|
info($response->getBody());
|
||||||
|
|
||||||
|
} elseif ($response->getStatusCode() == 200) {
|
||||||
|
|
||||||
|
$message_body = json_decode($response->getBody(), true);
|
||||||
|
|
||||||
|
$forwarding_url = $message_body['forward_url'];
|
||||||
|
|
||||||
|
$account_settings = $account->account_email_settings;
|
||||||
|
|
||||||
|
if(strlen($forwarding_url) == 0) {
|
||||||
|
$account_settings->is_disabled = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$account_settings->is_disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$account_settings->forward_url_for_v5 = rtrim($forwarding_url,'/');
|
||||||
|
$account_settings->save();
|
||||||
|
|
||||||
|
$billing_transferred = $message_body['billing_transferred'];
|
||||||
|
|
||||||
|
if($billing_transferred == 'true'){
|
||||||
|
|
||||||
|
$company = $account->company;
|
||||||
|
$company->plan = null;
|
||||||
|
$company->plan_expires = null;
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
info("failed to autoforward");
|
||||||
|
info(json_decode($response->getBody()->getContents()));
|
||||||
|
// dd('else');
|
||||||
|
}
|
||||||
|
|
||||||
|
return back();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function endpoint()
|
public function endpoint()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->shouldGoBack('endpoint')) {
|
if ($this->shouldGoBack('endpoint')) {
|
||||||
return redirect(
|
return redirect(
|
||||||
url($this->access['endpoint']['redirect'])
|
url($this->access['endpoint']['redirect'])
|
||||||
|
|
@ -175,23 +325,38 @@ class StepsController extends BaseController
|
||||||
url($this->access['companies']['redirect'])
|
url($this->access['companies']['redirect'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$bool = true;
|
||||||
|
|
||||||
|
if(Utils::isNinja())
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->dispatch(new HostedMigration(auth()->user(), $request->all(), config('database.default')));
|
||||||
|
|
||||||
|
return view('migration.completed');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$migrationData = $this->generateMigrationData($request->all());
|
$migrationData = $this->generateMigrationData($request->all());
|
||||||
|
|
||||||
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
|
$completeService->data($migrationData)
|
||||||
->data($migrationData)
|
|
||||||
->endpoint(session('MIGRATION_ENDPOINT'))
|
->endpoint(session('MIGRATION_ENDPOINT'))
|
||||||
->start();
|
->start();
|
||||||
}
|
}
|
||||||
finally {
|
catch(\Exception $e){
|
||||||
|
info($e->getMessage());
|
||||||
|
return view('migration.completed', ['customMessage' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($completeService->isSuccessful()) {
|
if ($completeService->isSuccessful()) {
|
||||||
return view('migration.completed');
|
return view('migration.completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
|
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completed()
|
public function completed()
|
||||||
|
|
@ -257,9 +422,10 @@ class StepsController extends BaseController
|
||||||
'products' => $this->getProducts(),
|
'products' => $this->getProducts(),
|
||||||
'credits' => $this->getCreditsNotes(),
|
'credits' => $this->getCreditsNotes(),
|
||||||
'invoices' => $this->getInvoices(),
|
'invoices' => $this->getInvoices(),
|
||||||
|
'recurring_expenses' => $this->getRecurringExpenses(),
|
||||||
'recurring_invoices' => $this->getRecurringInvoices(),
|
'recurring_invoices' => $this->getRecurringInvoices(),
|
||||||
'quotes' => $this->getQuotes(),
|
'quotes' => $this->getQuotes(),
|
||||||
'payments' => array_merge($this->getPayments(), $this->getCredits()),
|
'payments' => $this->getPayments(),
|
||||||
'documents' => $this->getDocuments(),
|
'documents' => $this->getDocuments(),
|
||||||
'expense_categories' => $this->getExpenseCategories(),
|
'expense_categories' => $this->getExpenseCategories(),
|
||||||
'task_statuses' => $this->getTaskStatuses(),
|
'task_statuses' => $this->getTaskStatuses(),
|
||||||
|
|
@ -274,8 +440,6 @@ class StepsController extends BaseController
|
||||||
Storage::makeDirectory('migrations');
|
Storage::makeDirectory('migrations');
|
||||||
$file = Storage::path("migrations/{$fileName}.zip");
|
$file = Storage::path("migrations/{$fileName}.zip");
|
||||||
|
|
||||||
//$file = storage_path("migrations/{$fileName}.zip");
|
|
||||||
|
|
||||||
ksort($localMigrationData);
|
ksort($localMigrationData);
|
||||||
|
|
||||||
$zip = new \ZipArchive();
|
$zip = new \ZipArchive();
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ use App\Libraries\CurlUtils;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use CreditCard;
|
use CreditCard;
|
||||||
use Input;
|
|
||||||
use Omnipay;
|
use Omnipay;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Validator;
|
use Validator;
|
||||||
use View;
|
use View;
|
||||||
|
use Request;
|
||||||
|
|
||||||
class NinjaController extends BaseController
|
class NinjaController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -91,18 +91,18 @@ class NinjaController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function show_license_payment()
|
public function show_license_payment()
|
||||||
{
|
{
|
||||||
if (Input::has('return_url')) {
|
if (\Request::has('return_url')) {
|
||||||
session(['return_url' => Input::get('return_url')]);
|
session(['return_url' => \Request::input('return_url')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('affiliate_key')) {
|
if (\Request::has('affiliate_key')) {
|
||||||
if ($affiliate = Affiliate::where('affiliate_key', '=', Input::get('affiliate_key'))->first()) {
|
if ($affiliate = Affiliate::where('affiliate_key', '=', \Request::input('affiliate_key'))->first()) {
|
||||||
session(['affiliate_id' => $affiliate->id]);
|
session(['affiliate_id' => $affiliate->id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('product_id')) {
|
if (\Request::has('product_id')) {
|
||||||
session(['product_id' => Input::get('product_id')]);
|
session(['product_id' => \Request::input('product_id')]);
|
||||||
} elseif (! Session::has('product_id')) {
|
} elseif (! Session::has('product_id')) {
|
||||||
session(['product_id' => PRODUCT_ONE_CLICK_INSTALL]);
|
session(['product_id' => PRODUCT_ONE_CLICK_INSTALL]);
|
||||||
}
|
}
|
||||||
|
|
@ -111,8 +111,8 @@ class NinjaController extends BaseController
|
||||||
return Utils::fatalError();
|
return Utils::fatalError();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils::isNinjaDev() && Input::has('test_mode')) {
|
if (Utils::isNinjaDev() && \Request::has('test_mode')) {
|
||||||
session(['test_mode' => Input::get('test_mode')]);
|
session(['test_mode' => \Request::input('test_mode')]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = $this->accountRepo->getNinjaAccount();
|
$account = $this->accountRepo->getNinjaAccount();
|
||||||
|
|
@ -167,7 +167,7 @@ class NinjaController extends BaseController
|
||||||
'country_id' => 'required',
|
'country_id' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return redirect()->to('license')
|
return redirect()->to('license')
|
||||||
|
|
@ -185,7 +185,7 @@ class NinjaController extends BaseController
|
||||||
if ($testMode) {
|
if ($testMode) {
|
||||||
$ref = 'TEST_MODE';
|
$ref = 'TEST_MODE';
|
||||||
} else {
|
} else {
|
||||||
$details = self::getLicensePaymentDetails(Input::all(), $affiliate);
|
$details = self::getLicensePaymentDetails(Request::all(), $affiliate);
|
||||||
|
|
||||||
$gateway = Omnipay::create($accountGateway->gateway->provider);
|
$gateway = Omnipay::create($accountGateway->gateway->provider);
|
||||||
$gateway->initialize((array) $accountGateway->getConfig());
|
$gateway->initialize((array) $accountGateway->getConfig());
|
||||||
|
|
@ -203,9 +203,9 @@ class NinjaController extends BaseController
|
||||||
$licenseKey = Utils::generateLicense();
|
$licenseKey = Utils::generateLicense();
|
||||||
|
|
||||||
$license = new License();
|
$license = new License();
|
||||||
$license->first_name = Input::get('first_name');
|
$license->first_name = \Request::input('first_name');
|
||||||
$license->last_name = Input::get('last_name');
|
$license->last_name = \Request::input('last_name');
|
||||||
$license->email = Input::get('email');
|
$license->email = \Request::input('email');
|
||||||
$license->transaction_reference = $ref;
|
$license->transaction_reference = $ref;
|
||||||
$license->license_key = $licenseKey;
|
$license->license_key = $licenseKey;
|
||||||
$license->affiliate_id = Session::get('affiliate_id');
|
$license->affiliate_id = Session::get('affiliate_id');
|
||||||
|
|
@ -241,8 +241,8 @@ class NinjaController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function claim_license()
|
public function claim_license()
|
||||||
{
|
{
|
||||||
$licenseKey = Input::get('license_key');
|
$licenseKey = \Request::input('license_key');
|
||||||
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
|
$productId = \Request::input('product_id', PRODUCT_ONE_CLICK_INSTALL);
|
||||||
|
|
||||||
// add in dashes
|
// add in dashes
|
||||||
if (strlen($licenseKey) == 20) {
|
if (strlen($licenseKey) == 20) {
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ use App\Services\PaymentService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Crawler;
|
use Crawler;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
use Utils;
|
use Utils;
|
||||||
use Validator;
|
use Validator;
|
||||||
use View;
|
use View;
|
||||||
|
use Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class OnlinePaymentController.
|
* Class OnlinePaymentController.
|
||||||
|
|
@ -114,7 +114,7 @@ class OnlinePaymentController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $paymentDriver->startPurchase(Input::all(), $sourceId);
|
return $paymentDriver->startPurchase(Request::all(), $sourceId);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
return $this->error($paymentDriver, $exception);
|
return $this->error($paymentDriver, $exception);
|
||||||
}
|
}
|
||||||
|
|
@ -202,12 +202,12 @@ class OnlinePaymentController extends BaseController
|
||||||
|
|
||||||
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
$paymentDriver = $invitation->account->paymentDriver($invitation, $gatewayTypeId);
|
||||||
|
|
||||||
if ($error = Input::get('error_description') ?: Input::get('error')) {
|
if ($error = \Request::input('error_description') ?: \Request::input('error')) {
|
||||||
return $this->error($paymentDriver, $error);
|
return $this->error($paymentDriver, $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($paymentDriver->completeOffsitePurchase(Input::all())) {
|
if ($paymentDriver->completeOffsitePurchase(Request::all())) {
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ class OnlinePaymentController extends BaseController
|
||||||
$paymentDriver = $accountGateway->paymentDriver();
|
$paymentDriver = $accountGateway->paymentDriver();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = $paymentDriver->handleWebHook(Input::all());
|
$result = $paymentDriver->handleWebHook(Request::all());
|
||||||
|
|
||||||
return response()->json(['message' => $result]);
|
return response()->json(['message' => $result]);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
|
@ -350,8 +350,8 @@ class OnlinePaymentController extends BaseController
|
||||||
return redirect()->to(NINJA_WEB_URL, 301);
|
return redirect()->to(NINJA_WEB_URL, 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = Account::whereAccountKey(Input::get('account_key'))->first();
|
$account = Account::whereAccountKey(\Request::input('account_key'))->first();
|
||||||
$redirectUrl = Input::get('redirect_url');
|
$redirectUrl = \Request::input('redirect_url');
|
||||||
$failureUrl = URL::previous();
|
$failureUrl = URL::previous();
|
||||||
|
|
||||||
if (! $account || ! $account->enable_buy_now_buttons || ! $account->hasFeature(FEATURE_BUY_NOW_BUTTONS)) {
|
if (! $account || ! $account->enable_buy_now_buttons || ! $account->hasFeature(FEATURE_BUY_NOW_BUTTONS)) {
|
||||||
|
|
@ -360,7 +360,7 @@ class OnlinePaymentController extends BaseController
|
||||||
|
|
||||||
Auth::onceUsingId($account->users[0]->id);
|
Auth::onceUsingId($account->users[0]->id);
|
||||||
$account->loadLocalizationSettings();
|
$account->loadLocalizationSettings();
|
||||||
$product = Product::scope(Input::get('product_id'))->first();
|
$product = Product::scope(\Request::input('product_id'))->first();
|
||||||
|
|
||||||
if (! $product) {
|
if (! $product) {
|
||||||
return redirect()->to("{$failureUrl}/?error=invalid product");
|
return redirect()->to("{$failureUrl}/?error=invalid product");
|
||||||
|
|
@ -368,7 +368,7 @@ class OnlinePaymentController extends BaseController
|
||||||
|
|
||||||
// check for existing client using contact_key
|
// check for existing client using contact_key
|
||||||
$client = false;
|
$client = false;
|
||||||
if ($contactKey = Input::get('contact_key')) {
|
if ($contactKey = \Request::input('contact_key')) {
|
||||||
$client = Client::scope()->whereHas('contacts', function ($query) use ($contactKey) {
|
$client = Client::scope()->whereHas('contacts', function ($query) use ($contactKey) {
|
||||||
$query->where('contact_key', $contactKey);
|
$query->where('contact_key', $contactKey);
|
||||||
})->first();
|
})->first();
|
||||||
|
|
@ -380,7 +380,7 @@ class OnlinePaymentController extends BaseController
|
||||||
'email' => 'email|string|max:100',
|
'email' => 'email|string|max:100',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return redirect()->to("{$failureUrl}/?error=" . $validator->errors()->first());
|
return redirect()->to("{$failureUrl}/?error=" . $validator->errors()->first());
|
||||||
}
|
}
|
||||||
|
|
@ -404,17 +404,17 @@ class OnlinePaymentController extends BaseController
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'client_id' => $client->id,
|
'client_id' => $client->id,
|
||||||
'is_recurring' => filter_var(Input::get('is_recurring'), FILTER_VALIDATE_BOOLEAN),
|
'is_recurring' => filter_var(\Request::input('is_recurring'), FILTER_VALIDATE_BOOLEAN),
|
||||||
'is_public' => filter_var(Input::get('is_recurring'), FILTER_VALIDATE_BOOLEAN),
|
'is_public' => filter_var(\Request::input('is_recurring'), FILTER_VALIDATE_BOOLEAN),
|
||||||
'frequency_id' => Input::get('frequency_id'),
|
'frequency_id' => \Request::input('frequency_id'),
|
||||||
'auto_bill_id' => Input::get('auto_bill_id'),
|
'auto_bill_id' => \Request::input('auto_bill_id'),
|
||||||
'start_date' => Input::get('start_date', date('Y-m-d')),
|
'start_date' => \Request::input('start_date', date('Y-m-d')),
|
||||||
'tax_rate1' => $account->tax_rate1,
|
'tax_rate1' => $account->tax_rate1,
|
||||||
'tax_name1' => $account->tax_name1 ?: '',
|
'tax_name1' => $account->tax_name1 ?: '',
|
||||||
'tax_rate2' => $account->tax_rate2,
|
'tax_rate2' => $account->tax_rate2,
|
||||||
'tax_name2' => $account->tax_name2 ?: '',
|
'tax_name2' => $account->tax_name2 ?: '',
|
||||||
'custom_text_value1' => Input::get('custom_invoice1'),
|
'custom_text_value1' => \Request::input('custom_invoice1'),
|
||||||
'custom_text_value2' => Input::get('custom_invoice2'),
|
'custom_text_value2' => \Request::input('custom_invoice2'),
|
||||||
'invoice_items' => [[
|
'invoice_items' => [[
|
||||||
'product_key' => $product->product_key,
|
'product_key' => $product->product_key,
|
||||||
'notes' => $product->notes,
|
'notes' => $product->notes,
|
||||||
|
|
@ -424,8 +424,8 @@ class OnlinePaymentController extends BaseController
|
||||||
'tax_name1' => $product->tax_name1 ?: '',
|
'tax_name1' => $product->tax_name1 ?: '',
|
||||||
'tax_rate2' => $product->tax_rate2,
|
'tax_rate2' => $product->tax_rate2,
|
||||||
'tax_name2' => $product->tax_name2 ?: '',
|
'tax_name2' => $product->tax_name2 ?: '',
|
||||||
'custom_value1' => Input::get('custom_product1') ?: $product->custom_value1,
|
'custom_value1' => \Request::input('custom_product1') ?: $product->custom_value1,
|
||||||
'custom_value2' => Input::get('custom_product2') ?: $product->custom_value2,
|
'custom_value2' => \Request::input('custom_product2') ?: $product->custom_value2,
|
||||||
]],
|
]],
|
||||||
];
|
];
|
||||||
$invoice = $invoiceService->save($data);
|
$invoice = $invoiceService->save($data);
|
||||||
|
|
@ -445,7 +445,7 @@ class OnlinePaymentController extends BaseController
|
||||||
$link = $invitation->getLink();
|
$link = $invitation->getLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter_var(Input::get('return_link'), FILTER_VALIDATE_BOOLEAN)) {
|
if (filter_var(\Request::input('return_link'), FILTER_VALIDATE_BOOLEAN)) {
|
||||||
return $link;
|
return $link;
|
||||||
} else {
|
} else {
|
||||||
return redirect()->to($link);
|
return redirect()->to($link);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use App\Models\Payment;
|
||||||
use App\Ninja\Mailers\ContactMailer;
|
use App\Ninja\Mailers\ContactMailer;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Services\PaymentService;
|
use App\Services\PaymentService;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class PaymentApiController extends BaseAPIController
|
class PaymentApiController extends BaseAPIController
|
||||||
|
|
@ -113,7 +112,7 @@ class PaymentApiController extends BaseAPIController
|
||||||
|
|
||||||
$payment = $this->paymentService->save($request->input(), null, $request->invoice);
|
$payment = $this->paymentService->save($request->input(), null, $request->invoice);
|
||||||
|
|
||||||
if (Input::get('email_receipt')) {
|
if (\Request::input('email_receipt')) {
|
||||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,7 +159,7 @@ class PaymentApiController extends BaseAPIController
|
||||||
$data['public_id'] = $publicId;
|
$data['public_id'] = $publicId;
|
||||||
$payment = $this->paymentRepo->save($data, $request->entity());
|
$payment = $this->paymentRepo->save($data, $request->entity());
|
||||||
|
|
||||||
if (Input::get('email_receipt')) {
|
if (\Request::input('email_receipt')) {
|
||||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ use App\Services\PaymentService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use DropdownButton;
|
use DropdownButton;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
|
use Request;
|
||||||
|
|
||||||
class PaymentController extends BaseController
|
class PaymentController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -79,7 +79,7 @@ class PaymentController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
return $this->paymentService->getDatatable($clientPublicId, Input::get('sSearch'));
|
return $this->paymentService->getDatatable($clientPublicId, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,8 +98,8 @@ class PaymentController extends BaseController
|
||||||
->with('client', 'invoice_status')
|
->with('client', 'invoice_status')
|
||||||
->orderBy('invoice_number')->get();
|
->orderBy('invoice_number')->get();
|
||||||
|
|
||||||
$clientPublicId = Input::old('client') ? Input::old('client') : ($request->client_id ?: 0);
|
$clientPublicId = Request::old('client') ? Request::old('client') : ($request->client_id ?: 0);
|
||||||
$invoicePublicId = Input::old('invoice') ? Input::old('invoice') : ($request->invoice_id ?: 0);
|
$invoicePublicId = Request::old('invoice') ? Request::old('invoice') : ($request->invoice_id ?: 0);
|
||||||
|
|
||||||
$totalCredit = false;
|
$totalCredit = false;
|
||||||
if ($clientPublicId && $client = Client::scope($clientPublicId)->first()) {
|
if ($clientPublicId && $client = Client::scope($clientPublicId)->first()) {
|
||||||
|
|
@ -118,7 +118,7 @@ class PaymentController extends BaseController
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'payments',
|
'url' => 'payments',
|
||||||
'title' => trans('texts.new_payment'),
|
'title' => trans('texts.new_payment'),
|
||||||
'paymentTypeId' => Input::get('paymentTypeId'),
|
'paymentTypeId' => \Request::input('paymentTypeId'),
|
||||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||||
'totalCredit' => $totalCredit,
|
'totalCredit' => $totalCredit,
|
||||||
];
|
];
|
||||||
|
|
@ -211,7 +211,7 @@ class PaymentController extends BaseController
|
||||||
|
|
||||||
$payment = $this->paymentService->save($input, null, $request->invoice);
|
$payment = $this->paymentService->save($input, null, $request->invoice);
|
||||||
|
|
||||||
if (Input::get('email_receipt')) {
|
if (\Request::input('email_receipt')) {
|
||||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||||
Session::flash('message', trans($credit ? 'texts.created_payment_and_credit_emailed_client' : 'texts.created_payment_emailed_client'));
|
Session::flash('message', trans($credit ? 'texts.created_payment_and_credit_emailed_client' : 'texts.created_payment_emailed_client'));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -244,8 +244,8 @@ class PaymentController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
if ($action === 'email') {
|
if ($action === 'email') {
|
||||||
$payment = Payment::scope($ids)->withArchived()->first();
|
$payment = Payment::scope($ids)->withArchived()->first();
|
||||||
|
|
@ -253,8 +253,8 @@ class PaymentController extends BaseController
|
||||||
Session::flash('message', trans('texts.emailed_payment'));
|
Session::flash('message', trans('texts.emailed_payment'));
|
||||||
} else {
|
} else {
|
||||||
$count = $this->paymentService->bulk($ids, $action, [
|
$count = $this->paymentService->bulk($ids, $action, [
|
||||||
'refund_amount' => Input::get('refund_amount'),
|
'refund_amount' => \Request::input('refund_amount'),
|
||||||
'refund_email' => Input::get('refund_email'),
|
'refund_email' => \Request::input('refund_email'),
|
||||||
]);
|
]);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
$message = Utils::pluralize($action == 'refund' ? 'refunded_payment' : $action.'d_payment', $count);
|
$message = Utils::pluralize($action == 'refund' ? 'refunded_payment' : $action.'d_payment', $count);
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ class PaymentTermApiController extends BaseAPIController
|
||||||
|
|
||||||
$paymentTerm = PaymentTerm::createNew();
|
$paymentTerm = PaymentTerm::createNew();
|
||||||
|
|
||||||
$paymentTerm->num_days = Utils::parseInt(Input::get('num_days'));
|
$paymentTerm->num_days = Utils::parseInt(\Request::input('num_days'));
|
||||||
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
|
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
|
||||||
$paymentTerm->save();
|
$paymentTerm->save();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ use App\Http\Requests\UpdatePaymentTermRequest;
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
use App\Services\PaymentTermService;
|
use App\Services\PaymentTermService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -114,7 +113,7 @@ class PaymentTermController extends BaseController
|
||||||
$paymentTerm = PaymentTerm::createNew();
|
$paymentTerm = PaymentTerm::createNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentTerm->num_days = Utils::parseInt(Input::get('num_days'));
|
$paymentTerm->num_days = Utils::parseInt(\Request::input('num_days'));
|
||||||
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
|
$paymentTerm->name = 'Net ' . $paymentTerm->num_days;
|
||||||
$paymentTerm->save();
|
$paymentTerm->save();
|
||||||
|
|
||||||
|
|
@ -129,8 +128,8 @@ class PaymentTermController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
$count = $this->paymentTermService->bulk($ids, $action);
|
$count = $this->paymentTermService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans('texts.archived_payment_term'));
|
Session::flash('message', trans('texts.archived_payment_term'));
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use App\Ninja\Repositories\ProductRepository;
|
||||||
use App\Services\ProductService;
|
use App\Services\ProductService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Illuminate\Auth\Access\AuthorizationException;
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -72,7 +71,7 @@ class ProductController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
return $this->productService->getDatatable(Auth::user()->account_id, Input::get('sSearch'));
|
return $this->productService->getDatatable(Auth::user()->account_id, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cloneProduct(ProductRequest $request, $publicId)
|
public function cloneProduct(ProductRequest $request, $publicId)
|
||||||
|
|
@ -167,7 +166,7 @@ class ProductController extends BaseController
|
||||||
$product = Product::createNew();
|
$product = Product::createNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->productRepo->save(Input::all(), $product);
|
$this->productRepo->save(\Request::all(), $product);
|
||||||
|
|
||||||
$message = $productPublicId ? trans('texts.updated_product') : trans('texts.created_product');
|
$message = $productPublicId ? trans('texts.updated_product') : trans('texts.created_product');
|
||||||
Session::flash('message', $message);
|
Session::flash('message', $message);
|
||||||
|
|
@ -189,8 +188,8 @@ class ProductController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
if ($action == 'invoice') {
|
if ($action == 'invoice') {
|
||||||
$products = Product::scope($ids)->get();
|
$products = Product::scope($ids)->get();
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ use App\Models\Project;
|
||||||
use App\Ninja\Repositories\ProjectRepository;
|
use App\Ninja\Repositories\ProjectRepository;
|
||||||
use App\Services\ProjectService;
|
use App\Services\ProjectService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use App\Ninja\Datatables\ProjectDatatable;
|
||||||
use App\Ninja\Repositories\ProjectRepository;
|
use App\Ninja\Repositories\ProjectRepository;
|
||||||
use App\Services\ProjectService;
|
use App\Services\ProjectService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ class ProjectController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterIdByEntity(ENTITY_PROJECT);
|
$userId = Auth::user()->filterIdByEntity(ENTITY_PROJECT);
|
||||||
|
|
||||||
return $this->projectService->getDatatable($search, $userId);
|
return $this->projectService->getDatatable($search, $userId);
|
||||||
|
|
@ -114,7 +113,7 @@ class ProjectController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_project'));
|
Session::flash('message', trans('texts.updated_project'));
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
if (in_array($action, ['archive', 'delete', 'restore', 'invoice'])) {
|
if (in_array($action, ['archive', 'delete', 'restore', 'invoice'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
@ -124,8 +123,8 @@ class ProjectController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
if ($action == 'invoice') {
|
if ($action == 'invoice') {
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ use App\Ninja\Datatables\ProposalCategoryDatatable;
|
||||||
use App\Ninja\Repositories\ProposalCategoryRepository;
|
use App\Ninja\Repositories\ProposalCategoryRepository;
|
||||||
use App\Services\ProposalCategoryService;
|
use App\Services\ProposalCategoryService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -43,7 +42,7 @@ class ProposalCategoryController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterId();
|
$userId = Auth::user()->filterId();
|
||||||
|
|
||||||
return $this->proposalCategoryService->getDatatable($search, $userId);
|
return $this->proposalCategoryService->getDatatable($search, $userId);
|
||||||
|
|
@ -102,7 +101,7 @@ class ProposalCategoryController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_proposal_category'));
|
Session::flash('message', trans('texts.updated_proposal_category'));
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
@ -112,8 +111,8 @@ class ProposalCategoryController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
$count = $this->proposalCategoryService->bulk($ids, $action);
|
$count = $this->proposalCategoryService->bulk($ids, $action);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ use App\Ninja\Datatables\ProposalDatatable;
|
||||||
use App\Ninja\Repositories\ProposalRepository;
|
use App\Ninja\Repositories\ProposalRepository;
|
||||||
use App\Services\ProposalService;
|
use App\Services\ProposalService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ class ProposalController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
//$userId = Auth::user()->filterId();
|
//$userId = Auth::user()->filterId();
|
||||||
$userId = Auth::user()->filterIdByEntity(ENTITY_PROPOSAL);
|
$userId = Auth::user()->filterIdByEntity(ENTITY_PROPOSAL);
|
||||||
|
|
||||||
|
|
@ -117,7 +116,7 @@ class ProposalController extends BaseController
|
||||||
public function store(CreateProposalRequest $request)
|
public function store(CreateProposalRequest $request)
|
||||||
{
|
{
|
||||||
$proposal = $this->proposalService->save($request->input());
|
$proposal = $this->proposalService->save($request->input());
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
|
|
||||||
if ($action == 'email') {
|
if ($action == 'email') {
|
||||||
$this->dispatch(new SendInvoiceEmail($proposal->invoice, auth()->user()->id, false, false, $proposal));
|
$this->dispatch(new SendInvoiceEmail($proposal->invoice, auth()->user()->id, false, false, $proposal));
|
||||||
|
|
@ -132,7 +131,7 @@ class ProposalController extends BaseController
|
||||||
public function update(UpdateProposalRequest $request)
|
public function update(UpdateProposalRequest $request)
|
||||||
{
|
{
|
||||||
$proposal = $this->proposalService->save($request->input(), $request->entity());
|
$proposal = $this->proposalService->save($request->input(), $request->entity());
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
|
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
|
|
@ -150,8 +149,8 @@ class ProposalController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action') ?: Input::get('action');
|
$action = \Request::input('bulk_action') ?: \Request::input('action');
|
||||||
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
|
||||||
|
|
||||||
$count = $this->proposalService->bulk($ids, $action);
|
$count = $this->proposalService->bulk($ids, $action);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use App\Ninja\Datatables\ProposalSnippetDatatable;
|
||||||
use App\Ninja\Repositories\ProposalSnippetRepository;
|
use App\Ninja\Repositories\ProposalSnippetRepository;
|
||||||
use App\Services\ProposalSnippetService;
|
use App\Services\ProposalSnippetService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ class ProposalSnippetController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterId();
|
$userId = Auth::user()->filterId();
|
||||||
|
|
||||||
return $this->proposalSnippetService->getDatatable($search, $userId);
|
return $this->proposalSnippetService->getDatatable($search, $userId);
|
||||||
|
|
@ -107,7 +106,7 @@ class ProposalSnippetController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_proposal_snippet'));
|
Session::flash('message', trans('texts.updated_proposal_snippet'));
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +116,8 @@ class ProposalSnippetController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
$count = $this->proposalSnippetService->bulk($ids, $action);
|
$count = $this->proposalSnippetService->bulk($ids, $action);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ use App\Ninja\Datatables\ProposalTemplateDatatable;
|
||||||
use App\Ninja\Repositories\ProposalTemplateRepository;
|
use App\Ninja\Repositories\ProposalTemplateRepository;
|
||||||
use App\Services\ProposalTemplateService;
|
use App\Services\ProposalTemplateService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
|
|
@ -43,7 +42,7 @@ class ProposalTemplateController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterId();
|
$userId = Auth::user()->filterId();
|
||||||
|
|
||||||
return $this->proposalTemplateService->getDatatable($search, $userId);
|
return $this->proposalTemplateService->getDatatable($search, $userId);
|
||||||
|
|
@ -147,7 +146,7 @@ class ProposalTemplateController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_proposal_template'));
|
Session::flash('message', trans('texts.updated_proposal_template'));
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
@ -157,8 +156,8 @@ class ProposalTemplateController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
|
|
||||||
$count = $this->proposalTemplateService->bulk($ids, $action);
|
$count = $this->proposalTemplateService->bulk($ids, $action);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Services\InvoiceService;
|
use App\Services\InvoiceService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
@ -60,7 +59,7 @@ class QuoteController extends BaseController
|
||||||
public function getDatatable($clientPublicId = null)
|
public function getDatatable($clientPublicId = null)
|
||||||
{
|
{
|
||||||
$accountId = Auth::user()->account_id;
|
$accountId = Auth::user()->account_id;
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
|
|
||||||
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_QUOTE, $search);
|
return $this->invoiceService->getDatatable($accountId, $clientPublicId, ENTITY_QUOTE, $search);
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +81,7 @@ class QuoteController extends BaseController
|
||||||
$data = [
|
$data = [
|
||||||
'entityType' => $invoice->getEntityType(),
|
'entityType' => $invoice->getEntityType(),
|
||||||
'invoice' => $invoice,
|
'invoice' => $invoice,
|
||||||
'data' => Input::old('data'),
|
'data' => \Request::old('data'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'invoices',
|
'url' => 'invoices',
|
||||||
'title' => trans('texts.new_quote'),
|
'title' => trans('texts.new_quote'),
|
||||||
|
|
@ -115,9 +114,9 @@ class QuoteController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action') ?: Input::get('action');
|
$action = \Request::input('bulk_action') ?: \Request::input('action');
|
||||||
;
|
;
|
||||||
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
$ids = \Request::input('bulk_public_id') ?: (\Request::input('public_id') ?: \Request::input('ids'));
|
||||||
|
|
||||||
if ($action == 'convert') {
|
if ($action == 'convert') {
|
||||||
$invoice = Invoice::with('invoice_items')->scope($ids)->firstOrFail();
|
$invoice = Invoice::with('invoice_items')->scope($ids)->firstOrFail();
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ use App\Ninja\Datatables\RecurringExpenseDatatable;
|
||||||
use App\Ninja\Repositories\RecurringExpenseRepository;
|
use App\Ninja\Repositories\RecurringExpenseRepository;
|
||||||
use App\Services\RecurringExpenseService;
|
use App\Services\RecurringExpenseService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use Request;
|
||||||
|
|
||||||
class RecurringExpenseController extends BaseController
|
class RecurringExpenseController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -46,7 +46,7 @@ class RecurringExpenseController extends BaseController
|
||||||
|
|
||||||
public function getDatatable($expensePublicId = null)
|
public function getDatatable($expensePublicId = null)
|
||||||
{
|
{
|
||||||
$search = Input::get('sSearch');
|
$search = \Request::input('sSearch');
|
||||||
$userId = Auth::user()->filterId();
|
$userId = Auth::user()->filterId();
|
||||||
|
|
||||||
return $this->recurringExpenseService->getDatatable($search, $userId);
|
return $this->recurringExpenseService->getDatatable($search, $userId);
|
||||||
|
|
@ -61,7 +61,7 @@ class RecurringExpenseController extends BaseController
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'vendorPublicId' => Input::old('vendor') ? Input::old('vendor') : $request->vendor_id,
|
'vendorPublicId' => Request::old('vendor') ? Request::old('vendor') : $request->vendor_id,
|
||||||
'expense' => null,
|
'expense' => null,
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'recurring_expenses',
|
'url' => 'recurring_expenses',
|
||||||
|
|
@ -113,7 +113,7 @@ class RecurringExpenseController extends BaseController
|
||||||
private static function getViewModel()
|
private static function getViewModel()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'data' => Input::old('data'),
|
'data' => Request::old('data'),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
'categories' => ExpenseCategory::whereAccountId(Auth::user()->account_id)->withArchived()->orderBy('name')->get(),
|
'categories' => ExpenseCategory::whereAccountId(Auth::user()->account_id)->withArchived()->orderBy('name')->get(),
|
||||||
'taxRates' => TaxRate::scope()->whereIsInclusive(false)->orderBy('name')->get(),
|
'taxRates' => TaxRate::scope()->whereIsInclusive(false)->orderBy('name')->get(),
|
||||||
|
|
@ -136,7 +136,7 @@ class RecurringExpenseController extends BaseController
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_recurring_expense'));
|
Session::flash('message', trans('texts.updated_recurring_expense'));
|
||||||
|
|
||||||
if (in_array(Input::get('action'), ['archive', 'delete', 'restore'])) {
|
if (in_array(\Request::input('action'), ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,8 +145,8 @@ class RecurringExpenseController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
$count = $this->recurringExpenseService->bulk($ids, $action);
|
$count = $this->recurringExpenseService->bulk($ids, $action);
|
||||||
|
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Jobs\RunReport;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\ScheduledReport;
|
use App\Models\ScheduledReport;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
use Carbon;
|
use Carbon;
|
||||||
|
|
@ -58,14 +57,14 @@ class ReportController extends BaseController
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$format = Input::get('format');
|
$format = \Request::input('format');
|
||||||
|
|
||||||
if (Input::get('report_type')) {
|
if (\Request::input('report_type')) {
|
||||||
$reportType = Input::get('report_type');
|
$reportType = \Request::input('report_type');
|
||||||
$dateField = Input::get('date_field');
|
$dateField = \Request::input('date_field');
|
||||||
$startDate = date_create(Input::get('start_date'));
|
$startDate = date_create(\Request::input('start_date'));
|
||||||
$endDate = date_create(Input::get('end_date'));
|
$endDate = date_create(\Request::input('end_date'));
|
||||||
} else {
|
} else {
|
||||||
$reportType = ENTITY_INVOICE;
|
$reportType = ENTITY_INVOICE;
|
||||||
$dateField = FILTER_INVOICE_DATE;
|
$dateField = FILTER_INVOICE_DATE;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
||||||
use App\Models\Subscription;
|
use App\Models\Subscription;
|
||||||
use App\Services\SubscriptionService;
|
use App\Services\SubscriptionService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -107,8 +106,8 @@ class SubscriptionController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
|
|
||||||
$count = $this->subscriptionService->bulk($ids, $action);
|
$count = $this->subscriptionService->bulk($ids, $action);
|
||||||
|
|
||||||
|
|
@ -137,7 +136,7 @@ class SubscriptionController extends BaseController
|
||||||
$subscriptionPublicId = $subscription->public_id;
|
$subscriptionPublicId = $subscription->public_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(\Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to($subscriptionPublicId ? 'subscriptions/edit' : 'subscriptions/create')->withInput()->withErrors($validator);
|
return Redirect::to($subscriptionPublicId ? 'subscriptions/edit' : 'subscriptions/create')->withInput()->withErrors($validator);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Models\Task;
|
||||||
use App\Ninja\Repositories\TaskRepository;
|
use App\Ninja\Repositories\TaskRepository;
|
||||||
use App\Ninja\Transformers\TaskTransformer;
|
use App\Ninja\Transformers\TaskTransformer;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
class TaskApiController extends BaseAPIController
|
class TaskApiController extends BaseAPIController
|
||||||
|
|
@ -103,7 +102,7 @@ class TaskApiController extends BaseAPIController
|
||||||
*/
|
*/
|
||||||
public function store()
|
public function store()
|
||||||
{
|
{
|
||||||
$data = Input::all();
|
$data = \Request::all();
|
||||||
$taskId = isset($data['id']) ? $data['id'] : false;
|
$taskId = isset($data['id']) ? $data['id'] : false;
|
||||||
|
|
||||||
if (isset($data['client_id']) && $data['client_id']) {
|
if (isset($data['client_id']) && $data['client_id']) {
|
||||||
|
|
@ -143,7 +142,7 @@ class TaskApiController extends BaseAPIController
|
||||||
$task = $this->taskRepo->save($taskId, $data);
|
$task = $this->taskRepo->save($taskId, $data);
|
||||||
$task = Task::scope($task->public_id)->with('client')->first();
|
$task = Task::scope($task->public_id)->with('client')->first();
|
||||||
|
|
||||||
$transformer = new TaskTransformer(Auth::user()->account, Input::get('serializer'));
|
$transformer = new TaskTransformer(Auth::user()->account, \Request::input('serializer'));
|
||||||
$data = $this->createItem($task, $transformer, 'task');
|
$data = $this->createItem($task, $transformer, 'task');
|
||||||
|
|
||||||
return $this->response($data);
|
return $this->response($data);
|
||||||
|
|
@ -185,7 +184,7 @@ class TaskApiController extends BaseAPIController
|
||||||
|
|
||||||
$task = $request->entity();
|
$task = $request->entity();
|
||||||
|
|
||||||
$task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Input::all());
|
$task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Request::all());
|
||||||
|
|
||||||
return $this->itemResponse($task);
|
return $this->itemResponse($task);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ use App\Ninja\Repositories\TaskRepository;
|
||||||
use App\Services\TaskService;
|
use App\Services\TaskService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use DropdownButton;
|
use DropdownButton;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
@ -86,7 +85,7 @@ class TaskController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function getDatatable($clientPublicId = null, $projectPublicId = null)
|
public function getDatatable($clientPublicId = null, $projectPublicId = null)
|
||||||
{
|
{
|
||||||
return $this->taskService->getDatatable($clientPublicId, $projectPublicId, Input::get('sSearch'));
|
return $this->taskService->getDatatable($clientPublicId, $projectPublicId, \Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -126,8 +125,8 @@ class TaskController extends BaseController
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'task' => null,
|
'task' => null,
|
||||||
'clientPublicId' => Input::old('client') ? Input::old('client') : ($request->client_id ?: 0),
|
'clientPublicId' => Request::old('client') ? Request::old('client') : ($request->client_id ?: 0),
|
||||||
'projectPublicId' => Input::old('project_id') ? Input::old('project_id') : ($request->project_id ?: 0),
|
'projectPublicId' => Request::old('project_id') ? Request::old('project_id') : ($request->project_id ?: 0),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'tasks',
|
'url' => 'tasks',
|
||||||
'title' => trans('texts.new_task'),
|
'title' => trans('texts.new_task'),
|
||||||
|
|
@ -229,7 +228,7 @@ class TaskController extends BaseController
|
||||||
*/
|
*/
|
||||||
private function save($request, $publicId = null)
|
private function save($request, $publicId = null)
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
|
|
||||||
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
if (in_array($action, ['archive', 'delete', 'restore'])) {
|
||||||
return self::bulk();
|
return self::bulk();
|
||||||
|
|
@ -260,8 +259,8 @@ class TaskController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ?: (Input::get('id') ?: Input::get('ids'));
|
$ids = \Request::input('public_id') ?: (\Request::input('id') ?: \Request::input('ids'));
|
||||||
$referer = Request::server('HTTP_REFERER');
|
$referer = Request::server('HTTP_REFERER');
|
||||||
|
|
||||||
if (in_array($action, ['resume', 'stop'])) {
|
if (in_array($action, ['resume', 'stop'])) {
|
||||||
|
|
@ -277,7 +276,7 @@ class TaskController extends BaseController
|
||||||
Session::flash('message', trans('texts.updated_task_status'));
|
Session::flash('message', trans('texts.updated_task_status'));
|
||||||
return $this->returnBulk($this->entityType, $action, $ids);
|
return $this->returnBulk($this->entityType, $action, $ids);
|
||||||
} elseif ($action == 'invoice' || $action == 'add_to_invoice') {
|
} elseif ($action == 'invoice' || $action == 'add_to_invoice') {
|
||||||
$tasks = Task::scope($ids)->with('account', 'client', 'project')->orderBy('project_id', 'id')->get();
|
$tasks = Task::scope($ids)->with('account', 'client', 'project')->orderBy('project_id')->orderBy('id')->get();
|
||||||
$clientPublicId = false;
|
$clientPublicId = false;
|
||||||
$data = [];
|
$data = [];
|
||||||
|
|
||||||
|
|
@ -315,7 +314,7 @@ class TaskController extends BaseController
|
||||||
if ($action == 'invoice') {
|
if ($action == 'invoice') {
|
||||||
return Redirect::to("invoices/create/{$clientPublicId}")->with('tasks', $data);
|
return Redirect::to("invoices/create/{$clientPublicId}")->with('tasks', $data);
|
||||||
} else {
|
} else {
|
||||||
$invoiceId = Input::get('invoice_id');
|
$invoiceId = \Request::input('invoice_id');
|
||||||
|
|
||||||
return Redirect::to("invoices/{$invoiceId}/edit")->with('tasks', $data);
|
return Redirect::to("invoices/{$invoiceId}/edit")->with('tasks', $data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Models\TaxRate;
|
||||||
use App\Ninja\Repositories\TaxRateRepository;
|
use App\Ninja\Repositories\TaxRateRepository;
|
||||||
use App\Services\TaxRateService;
|
use App\Services\TaxRateService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -81,8 +80,8 @@ class TaxRateController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
$count = $this->taxRateService->bulk($ids, $action);
|
$count = $this->taxRateService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans('texts.archived_tax_rate'));
|
Session::flash('message', trans('texts.archived_tax_rate'));
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
||||||
use App\Models\AccountToken;
|
use App\Models\AccountToken;
|
||||||
use App\Services\TokenService;
|
use App\Services\TokenService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -108,8 +107,8 @@ class TokenController extends BaseController
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$ids = Input::get('bulk_public_id');
|
$ids = \Request::input('bulk_public_id');
|
||||||
$count = $this->tokenService->bulk($ids, $action);
|
$count = $this->tokenService->bulk($ids, $action);
|
||||||
|
|
||||||
Session::flash('message', trans('texts.archived_token'));
|
Session::flash('message', trans('texts.archived_token'));
|
||||||
|
|
@ -134,17 +133,17 @@ class TokenController extends BaseController
|
||||||
->where('public_id', '=', $tokenPublicId)->firstOrFail();
|
->where('public_id', '=', $tokenPublicId)->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(\Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to($tokenPublicId ? 'tokens/edit' : 'tokens/create')->withInput()->withErrors($validator);
|
return Redirect::to($tokenPublicId ? 'tokens/edit' : 'tokens/create')->withInput()->withErrors($validator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tokenPublicId) {
|
if ($tokenPublicId) {
|
||||||
$token->name = trim(Input::get('name'));
|
$token->name = trim(\Request::input('name'));
|
||||||
} else {
|
} else {
|
||||||
$token = AccountToken::createNew();
|
$token = AccountToken::createNew();
|
||||||
$token->name = trim(Input::get('name'));
|
$token->name = trim(\Request::input('name'));
|
||||||
$token->token = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$token->token = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Ninja\Mailers\UserMailer;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Password;
|
use Password;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Request;
|
use Request;
|
||||||
|
|
@ -131,8 +130,8 @@ class UserController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('bulk_action');
|
$action = \Request::input('bulk_action');
|
||||||
$id = Input::get('bulk_public_id');
|
$id = \Request::input('bulk_public_id');
|
||||||
|
|
||||||
$user = User::where('account_id', '=', Auth::user()->account_id)
|
$user = User::where('account_id', '=', Auth::user()->account_id)
|
||||||
->where('public_id', '=', $id)
|
->where('public_id', '=', $id)
|
||||||
|
|
@ -184,7 +183,7 @@ class UserController extends BaseController
|
||||||
$rules['email'] = 'required|email|unique:users';
|
$rules['email'] = 'required|email|unique:users';
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = Validator::make(Input::all(), $rules);
|
$validator = Validator::make(Request::all(), $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
|
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
|
||||||
|
|
@ -192,20 +191,20 @@ class UserController extends BaseController
|
||||||
->withInput();
|
->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! \App\Models\LookupUser::validateField('email', Input::get('email'), $user)) {
|
if (! \App\Models\LookupUser::validateField('email', \Request::input('email'), $user)) {
|
||||||
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
|
return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
|
||||||
->withError(trans('texts.email_taken'))
|
->withError(trans('texts.email_taken'))
|
||||||
->withInput();
|
->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($userPublicId) {
|
if ($userPublicId) {
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
$user->first_name = trim(\Request::input('first_name'));
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->last_name = trim(\Request::input('last_name'));
|
||||||
$user->username = trim(Input::get('email'));
|
$user->username = trim(\Request::input('email'));
|
||||||
$user->email = trim(Input::get('email'));
|
$user->email = trim(\Request::input('email'));
|
||||||
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
||||||
$user->is_admin = boolval(Input::get('is_admin'));
|
$user->is_admin = boolval(\Request::input('is_admin'));
|
||||||
$user->permissions = self::formatUserPermissions(Input::get('permissions'));
|
$user->permissions = self::formatUserPermissions(\Request::input('permissions'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$lastUser = User::withTrashed()->where('account_id', '=', Auth::user()->account_id)
|
$lastUser = User::withTrashed()->where('account_id', '=', Auth::user()->account_id)
|
||||||
|
|
@ -213,23 +212,23 @@ class UserController extends BaseController
|
||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->account_id = Auth::user()->account_id;
|
$user->account_id = Auth::user()->account_id;
|
||||||
$user->first_name = trim(Input::get('first_name'));
|
$user->first_name = trim(\Request::input('first_name'));
|
||||||
$user->last_name = trim(Input::get('last_name'));
|
$user->last_name = trim(\Request::input('last_name'));
|
||||||
$user->username = trim(Input::get('email'));
|
$user->username = trim(\Request::input('email'));
|
||||||
$user->email = trim(Input::get('email'));
|
$user->email = trim(\Request::input('email'));
|
||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
$user->password = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$user->password = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user->public_id = $lastUser->public_id + 1;
|
$user->public_id = $lastUser->public_id + 1;
|
||||||
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
||||||
$user->is_admin = boolval(Input::get('is_admin'));
|
$user->is_admin = boolval(\Request::input('is_admin'));
|
||||||
$user->permissions = self::formatUserPermissions(Input::get('permissions'));
|
$user->permissions = self::formatUserPermissions(\Request::input('permissions'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
if (! $user->confirmed && Input::get('action') === 'email') {
|
if (! $user->confirmed && \Request::input('action') === 'email') {
|
||||||
$this->userMailer->sendConfirmation($user, Auth::user());
|
$this->userMailer->sendConfirmation($user, Auth::user());
|
||||||
$message = trans('texts.sent_invite');
|
$message = trans('texts.sent_invite');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -306,14 +305,14 @@ class UserController extends BaseController
|
||||||
// check the current password is correct
|
// check the current password is correct
|
||||||
if (! Auth::validate([
|
if (! Auth::validate([
|
||||||
'email' => Auth::user()->email,
|
'email' => Auth::user()->email,
|
||||||
'password' => Input::get('current_password'),
|
'password' => \Request::input('current_password'),
|
||||||
])) {
|
])) {
|
||||||
return trans('texts.password_error_incorrect');
|
return trans('texts.password_error_incorrect');
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate the new password
|
// validate the new password
|
||||||
$password = Input::get('new_password');
|
$password = \Request::input('new_password');
|
||||||
$confirm = Input::get('confirm_password');
|
$confirm = \Request::input('confirm_password');
|
||||||
|
|
||||||
if (strlen($password) < 6 || $password != $confirm) {
|
if (strlen($password) < 6 || $password != $confirm) {
|
||||||
return trans('texts.password_error_invalid');
|
return trans('texts.password_error_invalid');
|
||||||
|
|
@ -389,12 +388,12 @@ class UserController extends BaseController
|
||||||
|
|
||||||
public function saveSidebarState()
|
public function saveSidebarState()
|
||||||
{
|
{
|
||||||
if (Input::has('show_left')) {
|
if (Request::has('show_left')) {
|
||||||
Session::put(SESSION_LEFT_SIDEBAR, boolval(Input::get('show_left')));
|
Session::put(SESSION_LEFT_SIDEBAR, boolval(\Request::input('show_left')));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::has('show_right')) {
|
if (Request::has('show_right')) {
|
||||||
Session::put(SESSION_RIGHT_SIDEBAR, boolval(Input::get('show_right')));
|
Session::put(SESSION_RIGHT_SIDEBAR, boolval(\Request::input('show_right')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ use App\Http\Requests\CreateVendorRequest;
|
||||||
use App\Http\Requests\UpdateVendorRequest;
|
use App\Http\Requests\UpdateVendorRequest;
|
||||||
use App\Models\Vendor;
|
use App\Models\Vendor;
|
||||||
use App\Ninja\Repositories\VendorRepository;
|
use App\Ninja\Repositories\VendorRepository;
|
||||||
use Input;
|
|
||||||
use Response;
|
use Response;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use App\Ninja\Repositories\VendorRepository;
|
||||||
use App\Services\VendorService;
|
use App\Services\VendorService;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Session;
|
use Session;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -49,7 +48,7 @@ class VendorController extends BaseController
|
||||||
|
|
||||||
public function getDatatable()
|
public function getDatatable()
|
||||||
{
|
{
|
||||||
return $this->vendorService->getDatatable(Input::get('sSearch'));
|
return $this->vendorService->getDatatable(\Request::input('sSearch'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -149,7 +148,7 @@ class VendorController extends BaseController
|
||||||
private static function getViewModel()
|
private static function getViewModel()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'data' => Input::old('data'),
|
'data' => \Request::old('data'),
|
||||||
'account' => Auth::user()->account,
|
'account' => Auth::user()->account,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -172,8 +171,8 @@ class VendorController extends BaseController
|
||||||
|
|
||||||
public function bulk()
|
public function bulk()
|
||||||
{
|
{
|
||||||
$action = Input::get('action');
|
$action = \Request::input('action');
|
||||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
$ids = \Request::input('public_id') ? \Request::input('public_id') : \Request::input('ids');
|
||||||
$count = $this->vendorService->bulk($ids, $action);
|
$count = $this->vendorService->bulk($ids, $action);
|
||||||
|
|
||||||
$message = Utils::pluralize($action.'d_vendor', $count);
|
$message = Utils::pluralize($action.'d_vendor', $count);
|
||||||
|
|
|
||||||
|
|
@ -64,5 +64,6 @@ class Kernel extends HttpKernel
|
||||||
'lookup' => \App\Http\Middleware\DatabaseLookup::class,
|
'lookup' => \App\Http\Middleware\DatabaseLookup::class,
|
||||||
'permissions.required' => \App\Http\Middleware\PermissionsRequired::class,
|
'permissions.required' => \App\Http\Middleware\PermissionsRequired::class,
|
||||||
'migration' => \App\Http\Middleware\EligibleForMigration::class,
|
'migration' => \App\Http\Middleware\EligibleForMigration::class,
|
||||||
|
'migration_channel' => \App\Http\Middleware\MigrationLookup::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,9 @@ class ApiCheck
|
||||||
return Response::json("Please wait {$wait} second(s)", 403, $headers);
|
return Response::json("Please wait {$wait} second(s)", 403, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::put("hour_throttle:{$key}", $new_hour_throttle, 60);
|
|
||||||
Cache::put("last_api_request:{$key}", time(), 60);
|
Cache::put("hour_throttle:{$key}", $new_hour_throttle, 60 * 60);
|
||||||
|
Cache::put("last_api_request:{$key}", time(), 60 * 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
|
||||||
53
app/Http/Middleware/MigrationLookup.php
Normal file
53
app/Http/Middleware/MigrationLookup.php
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Closure;
|
||||||
|
use App\Models\LookupAccount;
|
||||||
|
use App\Models\LookupContact;
|
||||||
|
use App\Models\LookupInvitation;
|
||||||
|
use App\Models\LookupProposalInvitation;
|
||||||
|
use App\Models\LookupAccountToken;
|
||||||
|
use App\Models\LookupUser;
|
||||||
|
use Auth;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use Utils;
|
||||||
|
|
||||||
|
class MigrationLookup
|
||||||
|
{
|
||||||
|
private string $migration_notification = 'The Invoice Ninja v4 platform is now disabled for free users. Please <a class="btn btn-primary btn-sm" href="/migration/start">Migrate Now</a> to the new Invoice Ninja v5 platform to remain as a free account.<br><br>
|
||||||
|
*Not ready for v5? Upgrade to Pro or Enterprise to remain on v4. *Please note that the v4 platform will be "sunset" in November 2022.';
|
||||||
|
|
||||||
|
private string $silo = 'V4 is now disabled for your account. Please migrate. <a class="btn btn-primary btn-sm" href="/migration/start">Migrate Now</a> Upgrade to v5 and take advantage of our <a class="btn btn-danger btn-sm" href="https://invoicing.co/campaign/black_friday_2022">Black friday promo</a>';
|
||||||
|
|
||||||
|
public function handle(Request $request, Closure $next, $guard = 'user')
|
||||||
|
{
|
||||||
|
if (! env('MULTI_DB_ENABLED')) {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
//need to wrap an additional block over this to funnel users in a particular range
|
||||||
|
if(auth()->user()->id >= config('ninja.migration_user_start') &&
|
||||||
|
auth()->user()->id <= config('ninja.migration_user_end') &&
|
||||||
|
(!auth()->user()->account->company->plan_expires || Carbon::parse(auth()->user()->account->company->plan_expires)->lt(now())))
|
||||||
|
{
|
||||||
|
if ($guard == 'user') {
|
||||||
|
|
||||||
|
if(request()->is('migration/*') || request()->is('settings/*')) {
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect('/settings/account_management')->with('warning',$this->silo);
|
||||||
|
}
|
||||||
|
elseif(!auth()->user()->account->company->plan_expires || Carbon::parse(auth()->user()->account->company->plan_expires)->lt(now())){
|
||||||
|
session()->flash('warning',$this->migration_notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,6 @@ use Cache;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Event;
|
use Event;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Input;
|
|
||||||
use Redirect;
|
use Redirect;
|
||||||
use Schema;
|
use Schema;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
@ -39,9 +38,9 @@ class StartupCheck
|
||||||
// set TRUSTED_PROXIES=* if you want to trust every proxy.
|
// set TRUSTED_PROXIES=* if you want to trust every proxy.
|
||||||
if (isset($_ENV['TRUSTED_PROXIES'])) {
|
if (isset($_ENV['TRUSTED_PROXIES'])) {
|
||||||
if (env('TRUSTED_PROXIES') == '*') {
|
if (env('TRUSTED_PROXIES') == '*') {
|
||||||
$request->setTrustedProxies(['127.0.0.1', $request->server->get('REMOTE_ADDR')]);
|
$request->setTrustedProxies(['127.0.0.1', $request->server->get('REMOTE_ADDR')],Request::HEADER_X_FORWARDED_ALL);
|
||||||
} else{
|
} else{
|
||||||
$request->setTrustedProxies(array_map('trim', explode(',', env('TRUSTED_PROXIES'))));
|
$request->setTrustedProxies(array_map('trim', explode(',', env('TRUSTED_PROXIES'))),Request::HEADER_X_FORWARDED_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,8 +150,8 @@ class StartupCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we're requesting to change the account's language
|
// Check if we're requesting to change the account's language
|
||||||
if (Input::has('lang')) {
|
if (\Request::has('lang')) {
|
||||||
$locale = Input::get('lang');
|
$locale = \Request::input('lang');
|
||||||
App::setLocale($locale);
|
App::setLocale($locale);
|
||||||
session([SESSION_LOCALE => $locale]);
|
session([SESSION_LOCALE => $locale]);
|
||||||
|
|
||||||
|
|
@ -172,15 +171,15 @@ class StartupCheck
|
||||||
|
|
||||||
// Make sure the account/user localization settings are in the session
|
// Make sure the account/user localization settings are in the session
|
||||||
if (Auth::check() && ! Session::has(SESSION_TIMEZONE)) {
|
if (Auth::check() && ! Session::has(SESSION_TIMEZONE)) {
|
||||||
Event::fire(new UserLoggedIn());
|
Event::dispatch(new UserLoggedIn());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user is claiming a license (ie, additional invoices, white label, etc.)
|
// Check if the user is claiming a license (ie, additional invoices, white label, etc.)
|
||||||
if (! Utils::isNinjaProd() && isset($_SERVER['REQUEST_URI'])) {
|
if (! Utils::isNinjaProd() && isset($_SERVER['REQUEST_URI'])) {
|
||||||
$claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license');
|
$claimingLicense = Utils::startsWith($_SERVER['REQUEST_URI'], '/claim_license');
|
||||||
if (! $claimingLicense && Input::has('license_key') && Input::has('product_id')) {
|
if (! $claimingLicense && \Request::has('license_key') && \Request::has('product_id')) {
|
||||||
$licenseKey = Input::get('license_key');
|
$licenseKey = \Request::input('license_key');
|
||||||
$productId = Input::get('product_id');
|
$productId = \Request::input('product_id');
|
||||||
|
|
||||||
$url = (Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}&get_date=true";
|
$url = (Utils::isNinjaDev() ? SITE_URL : NINJA_APP_URL) . "/claim_license?license_key={$licenseKey}&product_id={$productId}&get_date=true";
|
||||||
$data = trim(CurlUtils::get($url));
|
$data = trim(CurlUtils::get($url));
|
||||||
|
|
@ -208,11 +207,11 @@ class StartupCheck
|
||||||
|
|
||||||
// Check data has been cached
|
// Check data has been cached
|
||||||
$cachedTables = unserialize(CACHED_TABLES);
|
$cachedTables = unserialize(CACHED_TABLES);
|
||||||
if (Input::has('clear_cache')) {
|
if (\Request::has('clear_cache')) {
|
||||||
Session::flash('message', 'Cache cleared');
|
Session::flash('message', 'Cache cleared');
|
||||||
}
|
}
|
||||||
foreach ($cachedTables as $name => $class) {
|
foreach ($cachedTables as $name => $class) {
|
||||||
if (Input::has('clear_cache') || ! Cache::has($name)) {
|
if (\Request::has('clear_cache') || ! Cache::has($name)) {
|
||||||
// check that the table exists in case the migration is pending
|
// check that the table exists in case the migration is pending
|
||||||
if (! Schema::hasTable((new $class())->getTable())) {
|
if (! Schema::hasTable((new $class())->getTable())) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ namespace App\Http\Requests;
|
||||||
|
|
||||||
use App\Libraries\HistoryUtils;
|
use App\Libraries\HistoryUtils;
|
||||||
use App\Models\EntityModel;
|
use App\Models\EntityModel;
|
||||||
use Input;
|
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
||||||
class EntityRequest extends Request
|
class EntityRequest extends Request
|
||||||
|
|
@ -33,7 +32,7 @@ class EntityRequest extends Request
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! $publicId) {
|
if (! $publicId) {
|
||||||
$publicId = Input::get('public_id') ?: Input::get('id');
|
$publicId = \Request::input('public_id') ?: \Request::input('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $publicId) {
|
if (! $publicId) {
|
||||||
|
|
|
||||||
30
app/Http/Requests/MigrationForwardRequest.php
Normal file
30
app/Http/Requests/MigrationForwardRequest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class MigrationForwardRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'url' => 'nullable|url',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
191
app/Jobs/HostedMigration.php
Normal file
191
app/Jobs/HostedMigration.php
Normal file
|
|
@ -0,0 +1,191 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Jobs\Job;
|
||||||
|
use App\Libraries\Utils;
|
||||||
|
use App\Models\Account;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Services\Migration\CompleteService;
|
||||||
|
use App\Traits\GenerateMigrationResources;
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
// use Unirest\Request;
|
||||||
|
|
||||||
|
class HostedMigration extends Job
|
||||||
|
{
|
||||||
|
use GenerateMigrationResources;
|
||||||
|
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
public $data;
|
||||||
|
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
private $v4_secret;
|
||||||
|
|
||||||
|
public $migration_token;
|
||||||
|
|
||||||
|
private $forced;
|
||||||
|
|
||||||
|
public $tries = 1;
|
||||||
|
|
||||||
|
public $timeout = 0;
|
||||||
|
|
||||||
|
public function __construct(User $user, array $data, $db, $forced = false)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
$this->data = $data;
|
||||||
|
$this->db = $db;
|
||||||
|
$this->forced = $forced;
|
||||||
|
$this->v4_secret = config('ninja.ninja_hosted_secret');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
config(['database.default' => $this->db]);
|
||||||
|
|
||||||
|
//Create or get a token
|
||||||
|
$this->getToken();
|
||||||
|
|
||||||
|
$completeService = (new CompleteService($this->migration_token));
|
||||||
|
|
||||||
|
$migrationData = $this->generateMigrationData($this->data);
|
||||||
|
|
||||||
|
$completeService->data($migrationData)
|
||||||
|
->endpoint('https://v5-app1.invoicing.co')
|
||||||
|
// ->endpoint('http://devhosted.test:8000')
|
||||||
|
->start();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getToken()
|
||||||
|
{
|
||||||
|
$url = 'https://invoicing.co/api/v1/get_migration_account';
|
||||||
|
// $url = 'http://devhosted.test:8000/api/v1/get_migration_account';
|
||||||
|
|
||||||
|
$headers = [
|
||||||
|
'X-API-HOSTED-SECRET' => $this->v4_secret,
|
||||||
|
'X-Requested-With' => 'XMLHttpRequest',
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
];
|
||||||
|
|
||||||
|
$body = [
|
||||||
|
'first_name' => $this->user->first_name,
|
||||||
|
'last_name' => $this->user->last_name,
|
||||||
|
'email' => $this->user->email,
|
||||||
|
'privacy_policy' => true,
|
||||||
|
'terms_of_service' => true,
|
||||||
|
'password' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
$client = new \GuzzleHttp\Client([
|
||||||
|
'headers' => $headers,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $client->post($url,[
|
||||||
|
RequestOptions::JSON => $body,
|
||||||
|
RequestOptions::ALLOW_REDIRECTS => false
|
||||||
|
]);
|
||||||
|
|
||||||
|
if($response->getStatusCode() == 401){
|
||||||
|
info($response->getBody());
|
||||||
|
|
||||||
|
} elseif ($response->getStatusCode() == 200) {
|
||||||
|
|
||||||
|
$message_body = json_decode($response->getBody(), true);
|
||||||
|
|
||||||
|
$this->migration_token = $message_body['token'];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// info(json_decode($response->getBody()->getContents()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function generateMigrationData(array $data): array
|
||||||
|
{
|
||||||
|
set_time_limit(0);
|
||||||
|
|
||||||
|
$migrationData = [];
|
||||||
|
|
||||||
|
foreach ($data['companies'] as $company) {
|
||||||
|
$account = Account::where('account_key', $company['id'])->firstOrFail();
|
||||||
|
|
||||||
|
$this->account = $account;
|
||||||
|
|
||||||
|
if($this->forced){
|
||||||
|
//forced migration - we need to set this v4 account as inactive.
|
||||||
|
|
||||||
|
//set activate URL
|
||||||
|
$account_email_settings = $this->account->account_email_settings;
|
||||||
|
$account_email_settings->account_email_settings->forward_url_for_v5 = "https://invoiceninja-{$this->account->id}.invoicing.co";
|
||||||
|
$account_email_settings->save();
|
||||||
|
|
||||||
|
$this->account->subdomain = "invoiceninja-{$this->account->id}";
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = date('Y-m-d');
|
||||||
|
$accountKey = $this->account->account_key;
|
||||||
|
|
||||||
|
$output = fopen('php://output', 'w') or Utils::fatalError();
|
||||||
|
|
||||||
|
$fileName = "{$accountKey}-{$date}-invoiceninja";
|
||||||
|
|
||||||
|
$localMigrationData['data'] = [
|
||||||
|
'account' => $this->getAccount(),
|
||||||
|
'company' => $this->getCompany(),
|
||||||
|
'users' => $this->getUsers(),
|
||||||
|
'tax_rates' => $this->getTaxRates(),
|
||||||
|
'payment_terms' => $this->getPaymentTerms(),
|
||||||
|
'clients' => $this->getClients(),
|
||||||
|
'company_gateways' => $this->getCompanyGateways(),
|
||||||
|
'client_gateway_tokens' => $this->getClientGatewayTokens(),
|
||||||
|
'vendors' => $this->getVendors(),
|
||||||
|
'projects' => $this->getProjects(),
|
||||||
|
'products' => $this->getProducts(),
|
||||||
|
'credits' => $this->getCreditsNotes(),
|
||||||
|
'invoices' => $this->getInvoices(),
|
||||||
|
'recurring_expenses' => $this->getRecurringExpenses(),
|
||||||
|
'recurring_invoices' => $this->getRecurringInvoices(),
|
||||||
|
'quotes' => $this->getQuotes(),
|
||||||
|
'payments' => $this->getPayments(),
|
||||||
|
'documents' => $this->getDocuments(),
|
||||||
|
'expense_categories' => $this->getExpenseCategories(),
|
||||||
|
'task_statuses' => $this->getTaskStatuses(),
|
||||||
|
'expenses' => $this->getExpenses(),
|
||||||
|
'tasks' => $this->getTasks(),
|
||||||
|
'documents' => $this->getDocuments(),
|
||||||
|
'ninja_tokens' => $this->getNinjaToken(),
|
||||||
|
];
|
||||||
|
|
||||||
|
$localMigrationData['force'] = array_key_exists('force', $company);
|
||||||
|
|
||||||
|
Storage::makeDirectory('migrations');
|
||||||
|
$file = Storage::path("app/migrations/{$fileName}.zip");
|
||||||
|
|
||||||
|
//$file = storage_path("migrations/{$fileName}.zip");
|
||||||
|
|
||||||
|
ksort($localMigrationData);
|
||||||
|
|
||||||
|
$zip = new \ZipArchive();
|
||||||
|
$zip->open($file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
|
||||||
|
$zip->addFromString('migration.json', json_encode($localMigrationData, JSON_PRETTY_PRINT));
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
$localMigrationData['file'] = $file;
|
||||||
|
|
||||||
|
$migrationData[] = $localMigrationData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $migrationData;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue
|
||||||
/**
|
/**
|
||||||
* @var Invoice
|
* @var Invoice
|
||||||
*/
|
*/
|
||||||
protected $invoice;
|
public $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
|
|
||||||
|
|
@ -2,51 +2,53 @@
|
||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use App\Models\Traits\SerialisesDeletedModels;
|
||||||
|
use App\Models\User;
|
||||||
use App\Ninja\Mailers\UserMailer;
|
use App\Ninja\Mailers\UserMailer;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use App\Models\Traits\SerialisesDeletedModels;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SendInvoiceEmail.
|
* Class SendInvoiceEmail.
|
||||||
*/
|
*/
|
||||||
class SendNotificationEmail extends Job implements ShouldQueue
|
class SendNotificationEmail extends Job implements ShouldQueue
|
||||||
{
|
{
|
||||||
use InteractsWithQueue, SerializesModels, SerialisesDeletedModels {
|
use InteractsWithQueue;
|
||||||
SerialisesDeletedModels::getRestoredPropertyValue insteadof SerializesModels;
|
|
||||||
}
|
public $deleteWhenMissingModels = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var User
|
* @var User
|
||||||
*/
|
*/
|
||||||
protected $user;
|
public User $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Invoice
|
* @var Invoice
|
||||||
*/
|
*/
|
||||||
protected $invoice;
|
public Invoice $invoice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $type;
|
public $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Payment
|
* @var Payment
|
||||||
*/
|
*/
|
||||||
protected $payment;
|
public ?Payment $payment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $notes;
|
public $notes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $server;
|
public $server;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
|
|
@ -59,7 +61,7 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||||
* @param mixed $type
|
* @param mixed $type
|
||||||
* @param mixed $payment
|
* @param mixed $payment
|
||||||
*/
|
*/
|
||||||
public function __construct($user, $invoice, $type, $payment, $notes)
|
public function __construct(User $user, Invoice $invoice, $type, ?Payment $payment, $notes)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->invoice = $invoice;
|
$this->invoice = $invoice;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use Carbon;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeZone;
|
use DateTimeZone;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Input;
|
|
||||||
use Log;
|
use Log;
|
||||||
use Request;
|
use Request;
|
||||||
use Schema;
|
use Schema;
|
||||||
|
|
@ -437,7 +436,7 @@ class Utils
|
||||||
];
|
];
|
||||||
|
|
||||||
if (static::isNinja()) {
|
if (static::isNinja()) {
|
||||||
$data['url'] = Input::get('url', Request::url());
|
$data['url'] = \Request::input('url', Request::url());
|
||||||
$data['previous'] = url()->previous();
|
$data['previous'] = url()->previous();
|
||||||
} else {
|
} else {
|
||||||
$data['url'] = request()->path();
|
$data['url'] = request()->path();
|
||||||
|
|
|
||||||
|
|
@ -17,14 +17,10 @@ class DNSListener
|
||||||
|
|
||||||
public function addDNSRecord(SubdomainWasUpdated $event)
|
public function addDNSRecord(SubdomainWasUpdated $event)
|
||||||
{
|
{
|
||||||
if(env("CLOUDFLARE_DNS_ENABLED"))
|
|
||||||
Cloudflare::addDNSRecord($event->account);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function removeDNSRecord(SubdomainWasRemoved $event)
|
public function removeDNSRecord(SubdomainWasRemoved $event)
|
||||||
{
|
{
|
||||||
if(env("CLOUDFLARE_DNS_ENABLED"))
|
|
||||||
Cloudflare::removeDNSRecord($event->account);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
<?php namespace App\Listeners;
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Ninja\Mailers\UserMailer;
|
|
||||||
use App\Ninja\Mailers\ContactMailer;
|
|
||||||
use App\Events\InvoiceWasEmailed;
|
|
||||||
use App\Events\QuoteWasEmailed;
|
|
||||||
use App\Events\InvoiceInvitationWasViewed;
|
use App\Events\InvoiceInvitationWasViewed;
|
||||||
use App\Events\QuoteInvitationWasViewed;
|
use App\Events\InvoiceWasEmailed;
|
||||||
use App\Events\QuoteInvitationWasApproved;
|
|
||||||
use App\Events\PaymentWasCreated;
|
use App\Events\PaymentWasCreated;
|
||||||
use App\Services\PushService;
|
use App\Events\QuoteInvitationWasApproved;
|
||||||
|
use App\Events\QuoteInvitationWasViewed;
|
||||||
|
use App\Events\QuoteWasEmailed;
|
||||||
use App\Jobs\SendNotificationEmail;
|
use App\Jobs\SendNotificationEmail;
|
||||||
use App\Jobs\SendPaymentEmail;
|
use App\Jobs\SendPaymentEmail;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Ninja\Mailers\ContactMailer;
|
||||||
|
use App\Ninja\Mailers\UserMailer;
|
||||||
use App\Notifications\PaymentCreated;
|
use App\Notifications\PaymentCreated;
|
||||||
|
use App\Services\PushService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class NotificationListener
|
* Class NotificationListener
|
||||||
|
|
@ -49,7 +52,7 @@ class NotificationListener
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param null $payment
|
* @param null $payment
|
||||||
*/
|
*/
|
||||||
private function sendNotifications($invoice, $type, $payment = null, $notes = false)
|
private function sendNotifications(Invoice $invoice, $type, $payment = null, $notes = false)
|
||||||
{
|
{
|
||||||
foreach ($invoice->account->users as $user)
|
foreach ($invoice->account->users as $user)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
23
app/Logging/CustomizeSingleLogger.php
Normal file
23
app/Logging/CustomizeSingleLogger.php
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Logging;
|
||||||
|
|
||||||
|
class CustomizeSingleLogger
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Customize the given logger instance.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Log\Logger $logger
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __invoke($logger)
|
||||||
|
{
|
||||||
|
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log',
|
||||||
|
\Monolog\Logger::INFO, false));
|
||||||
|
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-warning.log',
|
||||||
|
\Monolog\Logger::WARNING, false));
|
||||||
|
$logger->pushHandler(new \Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log',
|
||||||
|
\Monolog\Logger::ERROR, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1123,7 +1123,13 @@ class Account extends Eloquent
|
||||||
Session::put(SESSION_DATE_FORMAT, $this->date_format ? $this->date_format->format : DEFAULT_DATE_FORMAT);
|
Session::put(SESSION_DATE_FORMAT, $this->date_format ? $this->date_format->format : DEFAULT_DATE_FORMAT);
|
||||||
Session::put(SESSION_DATE_PICKER_FORMAT, $this->date_format ? $this->date_format->picker_format : DEFAULT_DATE_PICKER_FORMAT);
|
Session::put(SESSION_DATE_PICKER_FORMAT, $this->date_format ? $this->date_format->picker_format : DEFAULT_DATE_PICKER_FORMAT);
|
||||||
|
|
||||||
$currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
|
//php 7.3
|
||||||
|
// $currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
|
||||||
|
//php 7.4
|
||||||
|
$currencyId = ($client && $client->currency_id) ? $client->currency_id : ($this->currency_id ?: DEFAULT_CURRENCY);
|
||||||
|
|
||||||
|
// $currencyId = ($client && $client->currency_id) ? $client->currency_id : $this->currency_id ?: DEFAULT_CURRENCY;
|
||||||
|
|
||||||
$locale = ($client && $client->language_id) ? $client->language->locale : ($this->language_id ? $this->Language->locale : DEFAULT_LOCALE);
|
$locale = ($client && $client->language_id) ? $client->language->locale : ($this->language_id ? $this->Language->locale : DEFAULT_LOCALE);
|
||||||
|
|
||||||
Session::put(SESSION_CURRENCY, $currencyId);
|
Session::put(SESSION_CURRENCY, $currencyId);
|
||||||
|
|
@ -1963,7 +1969,7 @@ Account::updated(function ($account) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::fire(new UserSettingsChanged());
|
Event::dispatch(new UserSettingsChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
Account::deleted(function ($account)
|
Account::deleted(function ($account)
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class Document extends EntityModel
|
||||||
'application/msword',
|
'application/msword',
|
||||||
'application/excel', 'application/vnd.ms-excel', 'application/x-excel', 'application/x-msexcel',
|
'application/excel', 'application/vnd.ms-excel', 'application/x-excel', 'application/x-msexcel',
|
||||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/postscript', 'image/svg+xml',
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/postscript',
|
||||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.ms-powerpoint',
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.ms-powerpoint',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -57,9 +57,6 @@ class Document extends EntityModel
|
||||||
'ai' => [
|
'ai' => [
|
||||||
'mime' => 'application/postscript',
|
'mime' => 'application/postscript',
|
||||||
],
|
],
|
||||||
'svg' => [
|
|
||||||
'mime' => 'image/svg+xml',
|
|
||||||
],
|
|
||||||
'jpeg' => [
|
'jpeg' => [
|
||||||
'mime' => 'image/jpeg',
|
'mime' => 'image/jpeg',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ class LookupModel extends Eloquent
|
||||||
abort(404, "Looked up {$className} not found: {$field} => {$value}");
|
abort(404, "Looked up {$className} not found: {$field} => {$value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::put($key, $server, 120);
|
Cache::put($key, $server, 120 * 60);
|
||||||
} else {
|
} else {
|
||||||
config(['database.default' => $current]);
|
config(['database.default' => $current]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ class Payment extends EntityModel
|
||||||
$this->payment_status_id = $this->refunded == $this->amount ? PAYMENT_STATUS_REFUNDED : PAYMENT_STATUS_PARTIALLY_REFUNDED;
|
$this->payment_status_id = $this->refunded == $this->amount ? PAYMENT_STATUS_REFUNDED : PAYMENT_STATUS_PARTIALLY_REFUNDED;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
Event::fire(new PaymentWasRefunded($this, $refund_change));
|
Event::dispatch(new PaymentWasRefunded($this, $refund_change));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -258,7 +258,7 @@ class Payment extends EntityModel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::fire(new PaymentWasVoided($this));
|
Event::dispatch(new PaymentWasVoided($this));
|
||||||
|
|
||||||
$this->refunded = $this->amount;
|
$this->refunded = $this->amount;
|
||||||
$this->payment_status_id = PAYMENT_STATUS_VOIDED;
|
$this->payment_status_id = PAYMENT_STATUS_VOIDED;
|
||||||
|
|
@ -271,7 +271,7 @@ class Payment extends EntityModel
|
||||||
{
|
{
|
||||||
$this->payment_status_id = PAYMENT_STATUS_COMPLETED;
|
$this->payment_status_id = PAYMENT_STATUS_COMPLETED;
|
||||||
$this->save();
|
$this->save();
|
||||||
Event::fire(new PaymentCompleted($this));
|
Event::dispatch(new PaymentCompleted($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -282,7 +282,7 @@ class Payment extends EntityModel
|
||||||
$this->payment_status_id = PAYMENT_STATUS_FAILED;
|
$this->payment_status_id = PAYMENT_STATUS_FAILED;
|
||||||
$this->gateway_error = $failureMessage;
|
$this->gateway_error = $failureMessage;
|
||||||
$this->save();
|
$this->save();
|
||||||
Event::fire(new PaymentFailed($this));
|
Event::dispatch(new PaymentFailed($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -220,11 +220,11 @@ class PaymentMethod extends EntityModel
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data)) {
|
if (! empty($data)) {
|
||||||
Cache::put('bankData:'.$routingNumber, $data, 5);
|
Cache::put('bankData:'.$routingNumber, $data, 5 * 60);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
Cache::put('bankData:'.$routingNumber, false, 5);
|
Cache::put('bankData:'.$routingNumber, false, 5 * 60);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ trait HasRecurrence
|
||||||
}
|
}
|
||||||
|
|
||||||
$account = $this->account;
|
$account = $this->account;
|
||||||
|
|
||||||
|
if (! $account) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$timezone = $account->getTimezone();
|
$timezone = $account->getTimezone();
|
||||||
|
|
||||||
if (! $this->start_date || Carbon::parse($this->start_date, $timezone)->isFuture()) {
|
if (! $this->start_date || Carbon::parse($this->start_date, $timezone)->isFuture()) {
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,10 @@ trait Inviteable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $hasValue ? implode($parts, '<br/>') : false;
|
return $hasValue ? implode('<br/>', $parts) : false;
|
||||||
|
|
||||||
|
// return $hasValue ? implode($parts, '<br/>') : false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -402,8 +402,8 @@ class ContactMailer extends Mailer
|
||||||
$day_hits_remaining = $day_hits_remaining >= 0 ? $day_hits_remaining : 0;
|
$day_hits_remaining = $day_hits_remaining >= 0 ? $day_hits_remaining : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::put("email_day_throttle:{$key}", $new_day_throttle, 60);
|
Cache::put("email_day_throttle:{$key}", $new_day_throttle, 60 * 60);
|
||||||
Cache::put("last_email_request:{$key}", time(), 60);
|
Cache::put("last_email_request:{$key}", time(), 60 * 60);
|
||||||
|
|
||||||
if ($new_day_throttle > $day) {
|
if ($new_day_throttle > $day) {
|
||||||
$errorEmail = env('ERROR_EMAIL');
|
$errorEmail = env('ERROR_EMAIL');
|
||||||
|
|
@ -414,7 +414,7 @@ class ContactMailer extends Mailer
|
||||||
->subject("Email throttle triggered for account " . $account->id);
|
->subject("Email throttle triggered for account " . $account->id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Cache::put("throttle_notified:{$key}", true, 60 * 24);
|
Cache::put("throttle_notified:{$key}", true, 60 * 24 * 60);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class UserMailer extends Mailer
|
||||||
User $user,
|
User $user,
|
||||||
Invoice $invoice,
|
Invoice $invoice,
|
||||||
$notificationType,
|
$notificationType,
|
||||||
Payment $payment = null,
|
?Payment $payment,
|
||||||
$notes = false
|
$notes = false
|
||||||
) {
|
) {
|
||||||
if (! $user->shouldNotify($invoice)) {
|
if (! $user->shouldNotify($invoice)) {
|
||||||
|
|
|
||||||
|
|
@ -794,9 +794,10 @@ class BasePaymentDriver
|
||||||
$payment->contact_id = $invitation->contact_id;
|
$payment->contact_id = $invitation->contact_id;
|
||||||
$payment->transaction_reference = $ref;
|
$payment->transaction_reference = $ref;
|
||||||
$payment->payment_date = $account->getDateTime()->format('Y-m-d');
|
$payment->payment_date = $account->getDateTime()->format('Y-m-d');
|
||||||
$payment->ip = Request::ip();
|
$payment->ip = \Request::ip();
|
||||||
|
|
||||||
$payment = $this->creatingPayment($payment, $paymentMethod);
|
//Laravel 6 upgrade - uncommented this line as it was causing a failure
|
||||||
|
// $payment = $this->creatingPayment($payment, $paymentMethod);
|
||||||
|
|
||||||
if ($paymentMethod) {
|
if ($paymentMethod) {
|
||||||
$payment->last4 = $paymentMethod->last4;
|
$payment->last4 = $paymentMethod->last4;
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||||
if ( ! empty($data['payment_intent'])) {
|
if ( ! empty($data['payment_intent'])) {
|
||||||
// Find the existing payment intent.
|
// Find the existing payment intent.
|
||||||
$intent = PaymentIntent::retrieve($data['payment_intent']);
|
$intent = PaymentIntent::retrieve($data['payment_intent']);
|
||||||
|
|
||||||
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
|
if ( ! $intent->amount == $data['amount'] * pow(10, $currency['precision'])) {
|
||||||
// Make sure that the provided payment intent matches the invoice amount.
|
// Make sure that the provided payment intent matches the invoice amount.
|
||||||
throw new Exception('Incorrect PaymentIntent amount.');
|
throw new Exception('Incorrect PaymentIntent amount.');
|
||||||
|
|
@ -270,8 +269,8 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||||
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
|
return $this->doOmnipayOnsitePurchase($data, $paymentMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$intent = PaymentIntent::create($params);
|
$intent = PaymentIntent::create($params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($intent)) {
|
if (empty($intent)) {
|
||||||
|
|
@ -282,6 +281,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||||
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
|
throw new PaymentActionRequiredException(['payment_intent' => $intent]);
|
||||||
} else if ($intent->status == 'succeeded') {
|
} else if ($intent->status == 'succeeded') {
|
||||||
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
|
$ref = ! empty($intent->charges->data) ? $intent->charges->data[0]->id : null;
|
||||||
|
|
||||||
$payment = $this->createPayment($ref, $paymentMethod);
|
$payment = $this->createPayment($ref, $paymentMethod);
|
||||||
|
|
||||||
if ($this->invitation->invoice->account->isNinjaAccount()) {
|
if ($this->invitation->invoice->account->isNinjaAccount()) {
|
||||||
|
|
@ -296,7 +296,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||||
$this->tokenResponse = $payment_method;
|
$this->tokenResponse = $payment_method;
|
||||||
parent::createToken();
|
parent::createToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);
|
throw new Exception('Invalid PaymentIntent status: ' . $intent->status);
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ class InvoiceReport extends AbstractReport
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
|
if (!Auth::user()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$statusIds = $this->options['status_ids'];
|
$statusIds = $this->options['status_ids'];
|
||||||
$exportFormat = $this->options['export_format'];
|
$exportFormat = $this->options['export_format'];
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ use App\Models\User;
|
||||||
use App\Models\UserAccount;
|
use App\Models\UserAccount;
|
||||||
use App\Models\LookupUser;
|
use App\Models\LookupUser;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Request;
|
use Request;
|
||||||
use Schema;
|
use Schema;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
@ -37,19 +36,19 @@ class AccountRepository
|
||||||
}
|
}
|
||||||
|
|
||||||
$company = new Company();
|
$company = new Company();
|
||||||
$company->utm_source = Input::get('utm_source');
|
$company->utm_source = \Request::input('utm_source');
|
||||||
$company->utm_medium = Input::get('utm_medium');
|
$company->utm_medium = \Request::input('utm_medium');
|
||||||
$company->utm_campaign = Input::get('utm_campaign');
|
$company->utm_campaign = \Request::input('utm_campaign');
|
||||||
$company->utm_term = Input::get('utm_term');
|
$company->utm_term = \Request::input('utm_term');
|
||||||
$company->utm_content = Input::get('utm_content');
|
$company->utm_content = \Request::input('utm_content');
|
||||||
$company->referral_code = Session::get(SESSION_REFERRAL_CODE);
|
$company->referral_code = Session::get(SESSION_REFERRAL_CODE);
|
||||||
|
|
||||||
if (Input::get('utm_campaign')) {
|
if (\Request::input('utm_campaign')) {
|
||||||
if (env('PROMO_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PROMO_CAMPAIGN'))) {
|
if (env('PROMO_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('PROMO_CAMPAIGN'))) {
|
||||||
$company->applyDiscount(.75);
|
$company->applyDiscount(.75);
|
||||||
} elseif (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
|
} elseif (env('PARTNER_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
|
||||||
$company->applyFreeYear();
|
$company->applyFreeYear();
|
||||||
} elseif (env('EDUCATION_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('EDUCATION_CAMPAIGN'))) {
|
} elseif (env('EDUCATION_CAMPAIGN') && hash_equals(\Request::input('utm_campaign'), env('EDUCATION_CAMPAIGN'))) {
|
||||||
$company->applyFreeYear(2);
|
$company->applyFreeYear(2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class PaymentCreated extends Notification implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
return ['slack'];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Form;
|
use Form;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Request;
|
use Request;
|
||||||
use URL;
|
use URL;
|
||||||
|
|
@ -26,6 +27,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Route::singularResourceParameters(false);
|
Route::singularResourceParameters(false);
|
||||||
|
Paginator::useBootstrapThree();
|
||||||
|
|
||||||
// support selecting job database
|
// support selecting job database
|
||||||
Queue::before(function (JobProcessing $event) {
|
Queue::before(function (JobProcessing $event) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ use App\Events\UserLoggedIn;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use App\Models\LookupUser;
|
use App\Models\LookupUser;
|
||||||
use Auth;
|
use Auth;
|
||||||
use Input;
|
|
||||||
use Session;
|
use Session;
|
||||||
use Socialite;
|
use Socialite;
|
||||||
use Utils;
|
use Utils;
|
||||||
|
|
@ -98,7 +97,7 @@ class AuthService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirectTo = Input::get('redirect_to') ? SITE_URL . '/' . ltrim(Input::get('redirect_to'), '/') : 'dashboard';
|
$redirectTo = \Request::input('redirect_to') ? SITE_URL . '/' . ltrim(\Request::input('redirect_to'), '/') : 'dashboard';
|
||||||
|
|
||||||
return redirect()->to($redirectTo);
|
return redirect()->to($redirectTo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,9 @@
|
||||||
|
|
||||||
namespace App\Services\Migration;
|
namespace App\Services\Migration;
|
||||||
|
|
||||||
use Unirest\Request;
|
use GuzzleHttp\RequestOptions;
|
||||||
use Unirest\Request\Body;
|
// use Unirest\Request;
|
||||||
|
// use Unirest\Request\Body;
|
||||||
|
|
||||||
class AuthService
|
class AuthService
|
||||||
{
|
{
|
||||||
|
|
@ -51,25 +52,57 @@ class AuthService
|
||||||
'password' => $this->password,
|
'password' => $this->password,
|
||||||
];
|
];
|
||||||
|
|
||||||
$body = Body::json($data);
|
$client = new \GuzzleHttp\Client([
|
||||||
|
'headers' => $this->getHeaders(),
|
||||||
|
]);
|
||||||
|
|
||||||
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
|
$response = $client->post($this->getUrl(),[
|
||||||
|
RequestOptions::JSON => $data,
|
||||||
|
RequestOptions::ALLOW_REDIRECTS => false
|
||||||
|
]);
|
||||||
|
|
||||||
if (in_array($response->code, [401])) {
|
|
||||||
info($response->raw_body);
|
|
||||||
|
|
||||||
|
if($response->getStatusCode() == 401){
|
||||||
|
info($response->getBody());
|
||||||
$this->isSuccessful = false;
|
$this->isSuccessful = false;
|
||||||
$this->processErrors($response->body->message);
|
$this->processErrors($response->getBody());
|
||||||
} elseif (in_array($response->code, [200])) {
|
} elseif ($response->getStatusCode() == 200) {
|
||||||
|
|
||||||
|
$message_body = json_decode($response->getBody(), true);
|
||||||
|
|
||||||
|
//info(print_r($message_body,1));
|
||||||
|
|
||||||
$this->isSuccessful = true;
|
$this->isSuccessful = true;
|
||||||
$this->token = $response->body->data[0]->token->token;
|
$this->token = $message_body['data'][0]['token']['token'];
|
||||||
} else {
|
} else {
|
||||||
info($response->raw_body);
|
info(json_decode($response->getBody()->getContents()));
|
||||||
|
|
||||||
$this->isSuccessful = false;
|
$this->isSuccessful = false;
|
||||||
$this->errors = [trans('texts.migration_went_wrong')];
|
$this->errors = [trans('texts.migration_went_wrong')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//return $response->getBody();
|
||||||
|
|
||||||
|
// $body = Body::json($data);
|
||||||
|
|
||||||
|
// $response = Request::post($this->getUrl(), $this->getHeaders(), $body);
|
||||||
|
|
||||||
|
// if (in_array($response->code, [401])) {
|
||||||
|
// info($response->raw_body);
|
||||||
|
|
||||||
|
// $this->isSuccessful = false;
|
||||||
|
// $this->processErrors($response->body->message);
|
||||||
|
// } elseif (in_array($response->code, [200])) {
|
||||||
|
// $this->isSuccessful = true;
|
||||||
|
// $this->token = $response->body->data[0]->token->token;
|
||||||
|
// } else {
|
||||||
|
// info($response->raw_body);
|
||||||
|
|
||||||
|
// $this->isSuccessful = false;
|
||||||
|
// $this->errors = [trans('texts.migration_went_wrong')];
|
||||||
|
// }
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
namespace App\Services\Migration;
|
namespace App\Services\Migration;
|
||||||
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use Unirest\Request;
|
|
||||||
use Unirest\Request\Body;
|
|
||||||
|
|
||||||
class CompanyService
|
class CompanyService
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
namespace App\Services\Migration;
|
namespace App\Services\Migration;
|
||||||
|
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Unirest\Request;
|
// use Unirest\Request;
|
||||||
|
|
||||||
class CompleteService
|
class CompleteService
|
||||||
{
|
{
|
||||||
|
|
@ -40,27 +41,53 @@ class CompleteService
|
||||||
|
|
||||||
public function start()
|
public function start()
|
||||||
{
|
{
|
||||||
|
|
||||||
$files = [];
|
$files = [];
|
||||||
|
|
||||||
foreach ($this->data as $companyKey => $companyData) {
|
foreach ($this->data as $companyKey => $companyData) {
|
||||||
|
|
||||||
$data[] = [
|
$data = [
|
||||||
'company_index' => $companyKey,
|
'company_index' => $companyKey,
|
||||||
'company_key' => $companyData['data']['company']['company_key'],
|
'company_key' => $companyData['data']['company']['company_key'],
|
||||||
'force' => $companyData['force'],
|
'force' => $companyData['force'],
|
||||||
|
'contents' => 'name',
|
||||||
|
'name' => $companyKey,
|
||||||
];
|
];
|
||||||
|
|
||||||
$files[$companyKey] = $companyData['file'];
|
$payload[$companyKey] = [
|
||||||
|
'contents' => json_encode($data),
|
||||||
|
'name' => $companyData['data']['company']['company_key'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$files[] = [
|
||||||
|
'name' => $companyKey,
|
||||||
|
'company_index' => $companyKey,
|
||||||
|
'company_key' => $companyData['data']['company']['company_key'],
|
||||||
|
'force' => $companyData['force'],
|
||||||
|
'contents' => file_get_contents($companyData['file']),
|
||||||
|
'filename' => basename($companyData['file']),
|
||||||
|
'Content-Type' => 'application/zip'
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = \Unirest\Request\Body::multipart(['companies' => json_encode($data)], $files);
|
$client = new \GuzzleHttp\Client(
|
||||||
|
[
|
||||||
|
'headers' => $this->getHeaders(),
|
||||||
|
]);
|
||||||
|
|
||||||
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
|
$payload_data = [
|
||||||
|
'multipart'=> array_merge($files, $payload),
|
||||||
|
];
|
||||||
|
|
||||||
|
// info(print_r($payload_data,1));
|
||||||
|
$response = $client->request("POST", $this->getUrl(),$payload_data);
|
||||||
|
|
||||||
|
if($response->getStatusCode() == 200){
|
||||||
|
|
||||||
if (in_array($response->code, [200])) {
|
|
||||||
$this->isSuccessful = true;
|
$this->isSuccessful = true;
|
||||||
|
return json_decode($response->getBody(),true);
|
||||||
}else {
|
}else {
|
||||||
info($response->raw_body);
|
// info($response->raw_body);
|
||||||
|
|
||||||
$this->isSuccessful = false;
|
$this->isSuccessful = false;
|
||||||
$this->errors = [
|
$this->errors = [
|
||||||
|
|
@ -69,6 +96,7 @@ class CompleteService
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSuccessful()
|
public function isSuccessful()
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Traits;
|
namespace App\Traits;
|
||||||
|
|
||||||
|
use App\Libraries\Utils;
|
||||||
use App\Models\AccountGateway;
|
use App\Models\AccountGateway;
|
||||||
use App\Models\AccountGatewaySettings;
|
use App\Models\AccountGatewaySettings;
|
||||||
use App\Models\AccountGatewayToken;
|
use App\Models\AccountGatewayToken;
|
||||||
|
|
@ -19,6 +20,7 @@ use App\Models\PaymentMethod;
|
||||||
use App\Models\PaymentTerm;
|
use App\Models\PaymentTerm;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use App\Models\RecurringExpense;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\TaskStatus;
|
use App\Models\TaskStatus;
|
||||||
use App\Models\TaxRate;
|
use App\Models\TaxRate;
|
||||||
|
|
@ -73,9 +75,19 @@ trait GenerateMigrationResources
|
||||||
{
|
{
|
||||||
info("get company");
|
info("get company");
|
||||||
|
|
||||||
|
$financial_year_start = null;
|
||||||
|
if($this->account->financial_year_start)
|
||||||
|
{
|
||||||
|
//2000-02-01 format
|
||||||
|
$exploded_date = explode("-", $this->account->financial_year_start);
|
||||||
|
|
||||||
|
$financial_year_start = (int)$exploded_date[1];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'first_day_of_week' => $this->account->start_of_week,
|
'first_day_of_week' => $this->account->start_of_week,
|
||||||
'first_month_of_year' => $this->account->financial_year_start,
|
'first_month_of_year' => $financial_year_start,
|
||||||
'version' => NINJA_VERSION,
|
'version' => NINJA_VERSION,
|
||||||
'referral_code' => $this->account->referral_code ?: '',
|
'referral_code' => $this->account->referral_code ?: '',
|
||||||
'account_id' => $this->account->id,
|
'account_id' => $this->account->id,
|
||||||
|
|
@ -90,6 +102,7 @@ info("get company");
|
||||||
'custom_surcharge_taxes1' => $this->account->custom_invoice_taxes1,
|
'custom_surcharge_taxes1' => $this->account->custom_invoice_taxes1,
|
||||||
'custom_surcharge_taxes2' => $this->account->custom_invoice_taxes2,
|
'custom_surcharge_taxes2' => $this->account->custom_invoice_taxes2,
|
||||||
'subdomain' => $this->account->subdomain,
|
'subdomain' => $this->account->subdomain,
|
||||||
|
'portal_mode' => 'subdomain',
|
||||||
'size_id' => $this->account->size_id,
|
'size_id' => $this->account->size_id,
|
||||||
'enable_modules' => $this->account->enabled_modules,
|
'enable_modules' => $this->account->enabled_modules,
|
||||||
'custom_fields' => $this->account->custom_fields,
|
'custom_fields' => $this->account->custom_fields,
|
||||||
|
|
@ -130,10 +143,17 @@ info("get company");
|
||||||
{
|
{
|
||||||
info("get co settings");
|
info("get co settings");
|
||||||
|
|
||||||
|
$timezone_id = $this->account->timezone_id ? $this->account->timezone_id : 15;
|
||||||
|
|
||||||
|
if($timezone_id > 57)
|
||||||
|
$timezone_id = (string)($timezone_id - 1);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'entity_send_time' => 6,
|
||||||
|
'auto_bill_date' => $this->account->auto_bill_on_due_date ? 'on_due_date' : 'on_send_date',
|
||||||
'auto_bill' => $this->transformAutoBill($this->account->token_billing_id),
|
'auto_bill' => $this->transformAutoBill($this->account->token_billing_id),
|
||||||
'payment_terms' => $this->account->payment_terms ? (string) $this->account->payment_terms : '',
|
'payment_terms' => $this->account->payment_terms ? (string) $this->account->payment_terms : '',
|
||||||
'timezone_id' => $this->account->timezone_id ? (string) $this->account->timezone_id : '15',
|
'timezone_id' => $timezone_id,
|
||||||
'date_format_id' => $this->account->date_format_id ? (string) $this->account->date_format_id : '1',
|
'date_format_id' => $this->account->date_format_id ? (string) $this->account->date_format_id : '1',
|
||||||
'currency_id' => $this->account->currency_id ? (string) $this->account->currency_id : '1',
|
'currency_id' => $this->account->currency_id ? (string) $this->account->currency_id : '1',
|
||||||
'name' => $this->account->name ?: trans('texts.untitled'),
|
'name' => $this->account->name ?: trans('texts.untitled'),
|
||||||
|
|
@ -171,7 +191,7 @@ info("get company");
|
||||||
'all_pages_footer' => $this->account->all_pages_footer ? (bool) $this->account->all_pages_footer : true,
|
'all_pages_footer' => $this->account->all_pages_footer ? (bool) $this->account->all_pages_footer : true,
|
||||||
'all_pages_header' => $this->account->all_pages_header ? (bool) $this->account->all_pages_header : true,
|
'all_pages_header' => $this->account->all_pages_header ? (bool) $this->account->all_pages_header : true,
|
||||||
'show_currency_code' => $this->account->show_currency_code ? (bool) $this->account->show_currency_code : false,
|
'show_currency_code' => $this->account->show_currency_code ? (bool) $this->account->show_currency_code : false,
|
||||||
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : true,
|
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : false,
|
||||||
'send_portal_password' => $this->account->send_portal_password ? (bool) $this->account->send_portal_password : false,
|
'send_portal_password' => $this->account->send_portal_password ? (bool) $this->account->send_portal_password : false,
|
||||||
'recurring_number_prefix' => $this->account->recurring_invoice_number_prefix ? $this->account->recurring_invoice_number_prefix : 'R',
|
'recurring_number_prefix' => $this->account->recurring_invoice_number_prefix ? $this->account->recurring_invoice_number_prefix : 'R',
|
||||||
'enable_client_portal' => $this->account->enable_client_portal ? (bool) $this->account->enable_client_portal : false,
|
'enable_client_portal' => $this->account->enable_client_portal ? (bool) $this->account->enable_client_portal : false,
|
||||||
|
|
@ -189,10 +209,9 @@ info("get company");
|
||||||
'client_number_pattern' => $this->account->client_number_pattern ?: '',
|
'client_number_pattern' => $this->account->client_number_pattern ?: '',
|
||||||
'payment_number_pattern' => '',
|
'payment_number_pattern' => '',
|
||||||
'payment_number_counter' => 0,
|
'payment_number_counter' => 0,
|
||||||
'payment_terms' => $this->account->payment_terms ?: '',
|
|
||||||
'reset_counter_frequency_id' => $this->account->reset_counter_frequency_id ? (string) $this->transformFrequencyId
|
'reset_counter_frequency_id' => $this->account->reset_counter_frequency_id ? (string) $this->transformFrequencyId
|
||||||
($this->account->reset_counter_frequency_id) : '0',
|
($this->account->reset_counter_frequency_id) : '0',
|
||||||
'payment_type_id' => $this->account->payment_type_id ? (string) $this->account->payment_type_id : '1',
|
'payment_type_id' => $this->account->payment_type_id ? (string) $this->transformPaymentType($this->account->payment_type_id) : '1',
|
||||||
'reset_counter_date' => $this->account->reset_counter_date ?: '',
|
'reset_counter_date' => $this->account->reset_counter_date ?: '',
|
||||||
'tax_name1' => $this->account->tax_name1 ?: '',
|
'tax_name1' => $this->account->tax_name1 ?: '',
|
||||||
'tax_rate1' => $this->account->tax_rate1 ?: 0,
|
'tax_rate1' => $this->account->tax_rate1 ?: 0,
|
||||||
|
|
@ -211,18 +230,88 @@ info("get company");
|
||||||
'auto_archive_quote' => $this->account->auto_archive_quote ? (bool) $this->account->auto_archive_quote : false,
|
'auto_archive_quote' => $this->account->auto_archive_quote ? (bool) $this->account->auto_archive_quote : false,
|
||||||
'auto_email_invoice' => $this->account->auto_email_invoice ? (bool) $this->account->auto_email_invoice : false,
|
'auto_email_invoice' => $this->account->auto_email_invoice ? (bool) $this->account->auto_email_invoice : false,
|
||||||
'counter_padding' => $this->account->invoice_number_padding ?: 4,
|
'counter_padding' => $this->account->invoice_number_padding ?: 4,
|
||||||
|
'reply_to_email' => $this->account->account_email_settings->reply_to_email ?: '',
|
||||||
|
'bcc_email' => $this->account->account_email_settings->bcc_email ?: '',
|
||||||
|
'email_subject_invoice' => $this->account->account_email_settings->email_subject_invoice ?: '',
|
||||||
|
'email_subject_quote' => $this->account->account_email_settings->email_subject_quote ?: '',
|
||||||
|
'email_subject_payment' => $this->account->account_email_settings->email_subject_payment ?: '',
|
||||||
|
'email_template_invoice' => $this->account->account_email_settings->email_template_invoice ?: '',
|
||||||
|
'email_template_quote' => $this->account->account_email_settings->email_template_quote ?: '',
|
||||||
|
'email_template_payment' => $this->account->account_email_settings->email_template_payment ?: '',
|
||||||
|
'email_subject_reminder1' => $this->account->account_email_settings->email_subject_reminder1 ?: '',
|
||||||
|
'email_subject_reminder2' => $this->account->account_email_settings->email_subject_reminder2 ?: '',
|
||||||
|
'email_subject_reminder3' => $this->account->account_email_settings->email_subject_reminder3 ?: '',
|
||||||
|
'email_subject_reminder_endless' => $this->account->account_email_settings->email_subject_reminder4 ?: '',
|
||||||
|
'email_template_reminder1' => $this->account->account_email_settings->email_template_reminder1 ?: '',
|
||||||
|
'email_template_reminder2' => $this->account->account_email_settings->email_template_reminder2 ?: '',
|
||||||
|
'email_template_reminder3' => $this->account->account_email_settings->email_template_reminder3 ?: '',
|
||||||
|
'email_template_reminder_endless' => $this->account->account_email_settings->email_template_reminder4 ?: '',
|
||||||
|
'late_fee_amount1' => $this->account->account_email_settings->late_fee1_amount ?: 0,
|
||||||
|
'late_fee_amount2' => $this->account->account_email_settings->late_fee2_amount ?: 0,
|
||||||
|
'late_fee_amount3' => $this->account->account_email_settings->late_fee3_amount ?: 0,
|
||||||
|
'late_fee_percent1' => $this->account->account_email_settings->late_fee1_percent ?: 0,
|
||||||
|
'late_fee_percent2' => $this->account->account_email_settings->late_fee2_percent ?: 0,
|
||||||
|
'late_fee_percent3' => $this->account->account_email_settings->late_fee3_percent ?: 0,
|
||||||
|
'enable_reminder1' => $this->account->enable_reminder1 ? true : false,
|
||||||
|
'enable_reminder2' => $this->account->enable_reminder2 ? true : false,
|
||||||
|
'enable_reminder3' => $this->account->enable_reminder3 ? true : false,
|
||||||
|
'enable_reminder_endless' => $this->account->enable_reminder4 ? true : false,
|
||||||
|
'num_days_reminder1' => $this->account->num_days_reminder1 ?: 0,
|
||||||
|
'num_days_reminder2' => $this->account->num_days_reminder2 ?: 0,
|
||||||
|
'num_days_reminder3' => $this->account->num_days_reminder3 ?: 0,
|
||||||
|
'schedule_reminder1' => $this->buildReminderString($this->account->direction_reminder1, $this->account->field_reminder1),
|
||||||
|
'schedule_reminder2' => $this->buildReminderString($this->account->direction_reminder2, $this->account->field_reminder2),
|
||||||
|
'schedule_reminder3' => $this->buildReminderString($this->account->direction_reminder3, $this->account->field_reminder3),
|
||||||
|
'endless_reminder_frequency_id' => $this->account->account_email_settings->reset_counter_frequency_id ? $this->transformFrequencyId($this->account->account_email_settings->reset_counter_frequency_id) : 0,
|
||||||
|
'email_signature' => $this->account->email_footer ?: '',
|
||||||
|
'email_style' => $this->getEmailStyle($this->account->email_design_id),
|
||||||
|
'custom_message_dashboard' => $this->account->customMessage('dashboard'),
|
||||||
|
'custom_message_unpaid_invoice' => $this->account->customMessage('unpaid_invoice'),
|
||||||
|
'custom_message_paid_invoice' => $this->account->customMessage('paid_invoice'),
|
||||||
|
'custom_message_unapproved_quote' => $this->account->customMessage('unapproved_quote'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getEmailStyle($id){
|
||||||
|
|
||||||
|
switch ($id) {
|
||||||
|
case 1:
|
||||||
|
return 'plain';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return 'light';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return 'dark';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 'light';
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildReminderString($direction, $field)
|
||||||
|
{
|
||||||
|
|
||||||
|
$direction_string = $direction == 1 ? "after_" : "before_";
|
||||||
|
$field_string = $field == 1 ? "due_date" : "invoice_date";
|
||||||
|
|
||||||
|
return $direction_string.$field_string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getTaxRates()
|
public function getTaxRates()
|
||||||
{
|
{
|
||||||
info("get tax rates");
|
|
||||||
|
|
||||||
|
|
||||||
$rates = TaxRate::where('account_id', $this->account->id)
|
$rates = TaxRate::where('account_id', $this->account->id)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get tax rates => " . $rates->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($rates as $rate) {
|
foreach ($rates as $rate) {
|
||||||
|
|
@ -241,10 +330,12 @@ info("get company");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getClients()
|
protected function getClients()
|
||||||
{info("get clients");
|
{
|
||||||
|
|
||||||
$clients = [];
|
$clients = [];
|
||||||
|
|
||||||
|
info("get clients => ". $this->account->clients()->count());
|
||||||
|
|
||||||
foreach ($this->account->clients()->withTrashed()->get() as $client) {
|
foreach ($this->account->clients()->withTrashed()->get() as $client) {
|
||||||
|
|
||||||
$number = $client->id_number;
|
$number = $client->id_number;
|
||||||
|
|
@ -293,8 +384,6 @@ info("get company");
|
||||||
|
|
||||||
private function getClientSettings($client)
|
private function getClientSettings($client)
|
||||||
{
|
{
|
||||||
info("get client settings");
|
|
||||||
|
|
||||||
|
|
||||||
$settings = new \stdClass();
|
$settings = new \stdClass();
|
||||||
$settings->currency_id = $client->currency_id ? (string) $client->currency_id : (string) $client->account->currency_id;
|
$settings->currency_id = $client->currency_id ? (string) $client->currency_id : (string) $client->account->currency_id;
|
||||||
|
|
@ -311,12 +400,13 @@ info("get company");
|
||||||
|
|
||||||
protected function getClientContacts($client)
|
protected function getClientContacts($client)
|
||||||
{
|
{
|
||||||
info("get client contacts");
|
|
||||||
|
|
||||||
$contacts = Contact::where('client_id', $client->id)->withTrashed()->get();
|
$contacts = Contact::where('client_id', $client->id)->withTrashed()->get();
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
info("Importing contacts => " . $contacts->count());
|
||||||
|
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $contact->id,
|
'id' => $contact->id,
|
||||||
|
|
@ -350,18 +440,39 @@ info("get company");
|
||||||
{
|
{
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
$ninja_client = Client::where('public_id', $this->account->id)->first();
|
if(!Utils::isNinja())
|
||||||
|
return $transformed;
|
||||||
|
|
||||||
|
$db = DB_NINJA_1;
|
||||||
|
$account_id = 20432;
|
||||||
|
|
||||||
|
if($this->account->id > 1000000){
|
||||||
|
$db = DB_NINJA_2;
|
||||||
|
$account_id = 1000002;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ninja_client = Client::on($db)->where('public_id', $this->account->id)->where('account_id', $account_id)->first();
|
||||||
|
|
||||||
if(!$ninja_client)
|
if(!$ninja_client)
|
||||||
return $transformed;
|
return $transformed;
|
||||||
|
|
||||||
$agts = AccountGatewayToken::where('client_id', $ninja_client->id)->get();
|
$agts = AccountGatewayToken::on($db)->where('client_id', $ninja_client->id)->get();
|
||||||
$is_default = true;
|
$is_default = true;
|
||||||
|
|
||||||
|
if(count($agts) == 0) {
|
||||||
|
$transformed[] = [
|
||||||
|
'client' => $ninja_client->toArray()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
foreach($agts as $agt) {
|
foreach($agts as $agt) {
|
||||||
|
|
||||||
$payment_method = $agt->default_payment_method;
|
$payment_method = $agt->default_payment_method;
|
||||||
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
|
|
||||||
|
if(!$payment_method)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$contact = Contact::on($db)->where('id', $payment_method->contact_id)->withTrashed()->first();
|
||||||
|
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $payment_method->id,
|
'id' => $payment_method->id,
|
||||||
|
|
@ -373,7 +484,7 @@ info("get company");
|
||||||
'gateway_type_id' => $payment_method->payment_type->gateway_type_id,
|
'gateway_type_id' => $payment_method->payment_type->gateway_type_id,
|
||||||
'is_default' => $is_default,
|
'is_default' => $is_default,
|
||||||
'meta' => $this->convertMeta($payment_method),
|
'meta' => $this->convertMeta($payment_method),
|
||||||
'client' => $contact->client->toArray(),
|
'client' => $ninja_client->toArray(),
|
||||||
'contacts' => $contact->client->contacts->toArray(),
|
'contacts' => $contact->client->contacts->toArray(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
@ -384,12 +495,13 @@ info("get company");
|
||||||
|
|
||||||
protected function getProducts()
|
protected function getProducts()
|
||||||
{
|
{
|
||||||
info("get products");
|
|
||||||
|
|
||||||
$products = Product::where('account_id', $this->account->id)
|
$products = Product::where('account_id', $this->account->id)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get products " . $products->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($products as $product) {
|
foreach ($products as $product) {
|
||||||
|
|
@ -418,12 +530,13 @@ info("get company");
|
||||||
|
|
||||||
public function getUsers()
|
public function getUsers()
|
||||||
{
|
{
|
||||||
info("get users");
|
|
||||||
|
|
||||||
$users = User::where('account_id', $this->account->id)
|
$users = User::where('account_id', $this->account->id)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get users " . $users->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
|
@ -432,12 +545,12 @@ info("get company");
|
||||||
'first_name' => $user->first_name ?: '',
|
'first_name' => $user->first_name ?: '',
|
||||||
'last_name' => $user->last_name ?: '',
|
'last_name' => $user->last_name ?: '',
|
||||||
'phone' => $user->phone ?: '',
|
'phone' => $user->phone ?: '',
|
||||||
'email' => $user->username,
|
'email' => str_contains($user->username, "@") ? $user->username : $user->email,
|
||||||
'confirmation_code' => $user->confirmation_code,
|
'confirmation_code' => $user->confirmation_code,
|
||||||
'failed_logins' => $user->failed_logins,
|
'failed_logins' => $user->failed_logins,
|
||||||
'referral_code' => $user->referral_code,
|
'referral_code' => $user->referral_code,
|
||||||
'oauth_user_id' => $user->oauth_user_id,
|
// 'oauth_user_id' => $user->oauth_user_id,
|
||||||
'oauth_provider_id' => $user->oauth_provider_id,
|
// 'oauth_provider_id' => $user->oauth_provider_id,
|
||||||
'google_2fa_secret' => '',
|
'google_2fa_secret' => '',
|
||||||
'accepted_terms_version' => $user->accepted_terms_version,
|
'accepted_terms_version' => $user->accepted_terms_version,
|
||||||
'password' => $user->password,
|
'password' => $user->password,
|
||||||
|
|
@ -454,52 +567,51 @@ info("get company");
|
||||||
|
|
||||||
private function getCreditsNotes()
|
private function getCreditsNotes()
|
||||||
{
|
{
|
||||||
info("get credit notes");
|
|
||||||
|
|
||||||
$credits = [];
|
$credits = [];
|
||||||
|
$export_credits = collect([]);
|
||||||
|
|
||||||
$export_credits = Invoice::where('account_id', $this->account->id)
|
$export_credits = Credit::where('account_id', $this->account->id)->where('amount', '>', 0)->whereIsDeleted(false)
|
||||||
->where('balance', '<', '0')
|
|
||||||
->where('invoice_type_id', '=', INVOICE_TYPE_STANDARD)
|
|
||||||
->where('is_public', true)
|
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get credit notes => " . $export_credits->count());
|
||||||
|
|
||||||
foreach ($export_credits as $credit) {
|
foreach ($export_credits as $credit) {
|
||||||
$credits[] = [
|
$credits[] = [
|
||||||
'id' => $credit->id,
|
'id' => $credit->id,
|
||||||
'client_id' => $credit->client_id,
|
'client_id' => $credit->client_id,
|
||||||
'user_id' => $credit->user_id,
|
'user_id' => $credit->user_id,
|
||||||
'company_id' => $credit->account_id,
|
'company_id' => $credit->account_id,
|
||||||
'status_id' => $credit->invoice_status_id,
|
'status_id' => 2,
|
||||||
'design_id' => $this->getDesignId($credit->invoice_design_id),
|
'design_id' => 2,
|
||||||
'number' => $credit->invoice_number,
|
'number' => $credit->credit_number ?: null,
|
||||||
'discount' => $credit->discount ? $credit->discount*-1: 0,
|
'discount' => 0,
|
||||||
'is_amount_discount' => $credit->is_amount_discount ?: false,
|
'is_amount_discount' => 0,
|
||||||
'po_number' => $credit->po_number ?: '',
|
'po_number' => '',
|
||||||
'date' => $credit->invoice_date,
|
'date' => $credit->date,
|
||||||
'last_sent_date' => $credit->last_sent_date,
|
'last_sent_date' => null,
|
||||||
'due_date' => $credit->due_date,
|
'due_date' => null,
|
||||||
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
|
'uses_inclusive_taxes' => $this->account->inclusive_taxes,
|
||||||
'is_deleted' => $credit->is_deleted,
|
'is_deleted' => $credit->is_deleted,
|
||||||
'footer' => $credit->invoice_footer ?: '',
|
'footer' => '',
|
||||||
'public_notes' => $credit->public_notes ?: '',
|
'public_notes' => $credit->public_notes,
|
||||||
'private_notes' => $credit->private_notes ?: '',
|
'private_notes' => $credit->private_notes,
|
||||||
'terms' => $credit->terms ?: '',
|
'terms' => '',
|
||||||
'tax_name1' => $credit->tax_name1,
|
'tax_name1' => '',
|
||||||
'tax_name2' => $credit->tax_name2,
|
'tax_name2' => '',
|
||||||
'tax_rate1' => $credit->tax_rate1,
|
'tax_rate1' => 0,
|
||||||
'tax_rate2' => $credit->tax_rate2,
|
'tax_rate2' => 0,
|
||||||
'tax_name3' => '',
|
'tax_name3' => '',
|
||||||
'tax_rate3' => 0,
|
'tax_rate3' => 0,
|
||||||
'custom_value1' => $credit->custom_value1 ?: '',
|
'custom_value1' => '',
|
||||||
'custom_value2' => $credit->custom_value2 ?: '',
|
'custom_value2' => '',
|
||||||
'next_send_date' => null,
|
'next_send_date' => null,
|
||||||
'amount' => $credit->amount ? $credit->amount * -1: 0,
|
'amount' => $credit->amount ? $credit->amount * -1: 0,
|
||||||
'balance' => $credit->balance ? $credit->balance * -1: 0,
|
'balance' => $credit->balance ? $credit->balance * -1: 0,
|
||||||
'partial' => $credit->partial ? $credit->partial * -1 : 0,
|
'partial' => 0,
|
||||||
'partial_due_date' => $credit->partial_due_date,
|
'partial_due_date' => null,
|
||||||
'line_items' => $this->getCreditItems($credit->invoice_items),
|
'line_items' => $this->getCreditItems($credit->balance),
|
||||||
'created_at' => $credit->created_at ? Carbon::parse($credit->created_at)->toDateString() : null,
|
'created_at' => $credit->created_at ? Carbon::parse($credit->created_at)->toDateString() : null,
|
||||||
'updated_at' => $credit->updated_at ? Carbon::parse($credit->updated_at)->toDateString() : null,
|
'updated_at' => $credit->updated_at ? Carbon::parse($credit->updated_at)->toDateString() : null,
|
||||||
'deleted_at' => $credit->deleted_at ? Carbon::parse($credit->deleted_at)->toDateString() : null,
|
'deleted_at' => $credit->deleted_at ? Carbon::parse($credit->deleted_at)->toDateString() : null,
|
||||||
|
|
@ -511,17 +623,19 @@ info("get company");
|
||||||
|
|
||||||
|
|
||||||
protected function getInvoices()
|
protected function getInvoices()
|
||||||
{ info("get invoices");
|
{
|
||||||
|
|
||||||
$invoices = [];
|
$invoices = [];
|
||||||
|
|
||||||
$export_invoices = Invoice::where('account_id', $this->account->id)
|
$export_invoices = Invoice::where('account_id', $this->account->id)
|
||||||
->where('amount', '>=', 0)
|
// ->where('amount', '>=', 0)
|
||||||
->where('invoice_type_id', INVOICE_TYPE_STANDARD)
|
->where('invoice_type_id', INVOICE_TYPE_STANDARD)
|
||||||
->where('is_recurring', false)
|
->where('is_recurring', false)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get invoices -> ". $export_invoices->count());
|
||||||
|
|
||||||
foreach ($export_invoices as $invoice) {
|
foreach ($export_invoices as $invoice) {
|
||||||
$invoices[] = [
|
$invoices[] = [
|
||||||
'id' => $invoice->id,
|
'id' => $invoice->id,
|
||||||
|
|
@ -566,6 +680,7 @@ info("get company");
|
||||||
'deleted_at' => $invoice->deleted_at ? Carbon::parse($invoice->deleted_at)->toDateString() : null,
|
'deleted_at' => $invoice->deleted_at ? Carbon::parse($invoice->deleted_at)->toDateString() : null,
|
||||||
'invitations' => $this->getResourceInvitations($invoice->invitations, 'invoice_id'),
|
'invitations' => $this->getResourceInvitations($invoice->invitations, 'invoice_id'),
|
||||||
'auto_bill_enabled' => $invoice->auto_bill,
|
'auto_bill_enabled' => $invoice->auto_bill,
|
||||||
|
'recurring_id' => $invoice->recurring_invoice_id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -591,10 +706,59 @@ info("get company");
|
||||||
return $design_id;
|
return $design_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getRecurringExpenses()
|
||||||
|
{
|
||||||
|
|
||||||
|
$expenses = [];
|
||||||
|
|
||||||
|
$export_expenses = RecurringExpense::where('account_id', $this->account->id)
|
||||||
|
->withTrashed()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
info("get recurring Expenses => " . $export_expenses->count());
|
||||||
|
|
||||||
|
foreach ($export_expenses as $expense) {
|
||||||
|
$expenses[] = [
|
||||||
|
'id' => $expense->id,
|
||||||
|
'amount' => $expense->amount,
|
||||||
|
'company_id' => $this->account->id,
|
||||||
|
'client_id' => $expense->client_id,
|
||||||
|
'user_id' => $expense->user_id,
|
||||||
|
'custom_value1' => '',
|
||||||
|
'custom_value2' => '',
|
||||||
|
'custom_value3' => '',
|
||||||
|
'custom_value4' => '',
|
||||||
|
'category_id' => $expense->expense_category_id,
|
||||||
|
'currency_id' => $expense->expense_currency_id,
|
||||||
|
'frequency_id' => $this->transformFrequencyId($expense->frequency_id),
|
||||||
|
'invoice_currency_id' => $expense->invoice_currency_id,
|
||||||
|
'private_notes' => $expense->private_notes,
|
||||||
|
'public_notes' => $expense->public_notes,
|
||||||
|
'should_be_invoiced' => $expense->should_be_invoiced,
|
||||||
|
'tax_name1' => $expense->tax_name1,
|
||||||
|
'tax_name2' => $expense->tax_name2,
|
||||||
|
'tax_name3' => '',
|
||||||
|
'tax_rate1' => $expense->tax_rate1,
|
||||||
|
'tax_rate2' => $expense->tax_rate2,
|
||||||
|
'tax_rate3' => 0,
|
||||||
|
'vendor_id' => $expense->vendor_id,
|
||||||
|
'is_deleted' => $expense->is_deleted,
|
||||||
|
'next_send_date' => $this->getNextSendDateForMigration($expense),
|
||||||
|
'remaining_cycles' => $this->getRemainingCycles($expense),
|
||||||
|
'created_at' => $expense->created_at ? Carbon::parse($expense->created_at)->toDateString() : null,
|
||||||
|
'updated_at' => $expense->updated_at ? Carbon::parse($expense->updated_at)->toDateString() : null,
|
||||||
|
'deleted_at' => $expense->deleted_at ? Carbon::parse($expense->deleted_at)->toDateString() : null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $expenses;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected function getRecurringInvoices()
|
protected function getRecurringInvoices()
|
||||||
{
|
{
|
||||||
info("get recurring invoices");
|
|
||||||
|
|
||||||
|
|
||||||
$invoices = [];
|
$invoices = [];
|
||||||
|
|
||||||
|
|
@ -604,6 +768,8 @@ info("get company");
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get recurring invoices => " . $export_invoices->count());
|
||||||
|
|
||||||
foreach ($export_invoices as $invoice) {
|
foreach ($export_invoices as $invoice) {
|
||||||
$invoices[] = [
|
$invoices[] = [
|
||||||
'id' => $invoice->id,
|
'id' => $invoice->id,
|
||||||
|
|
@ -648,7 +814,8 @@ info("get company");
|
||||||
'due_date_days' => $this->transformDueDate($invoice),
|
'due_date_days' => $this->transformDueDate($invoice),
|
||||||
'remaining_cycles' => $this->getRemainingCycles($invoice),
|
'remaining_cycles' => $this->getRemainingCycles($invoice),
|
||||||
'invitations' => $this->getResourceInvitations($invoice->invitations, 'recurring_invoice_id'),
|
'invitations' => $this->getResourceInvitations($invoice->invitations, 'recurring_invoice_id'),
|
||||||
'auto_bill_enabled' => $invoice->auto_bill,
|
'auto_bill_enabled' => $this->calcAutoBill($invoice),
|
||||||
|
'auto_bill' => $this->calcAutoBillEnabled($invoice),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -656,6 +823,29 @@ info("get company");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function calcAutoBillEnabled($invoice)
|
||||||
|
{
|
||||||
|
if($invoice->auto_bill === 1)
|
||||||
|
return 'off';
|
||||||
|
elseif($invoice->auto_bill === 2)
|
||||||
|
return 'optin';
|
||||||
|
elseif($invoice->auto_bill === 3)
|
||||||
|
return 'optout';
|
||||||
|
elseif($invoice->auto_bill === 4)
|
||||||
|
return 'always';
|
||||||
|
else
|
||||||
|
return 'off';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function calcAutoBill($invoice)
|
||||||
|
{
|
||||||
|
if($invoice->auto_bill == 4)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return $invoice->client_enable_auto_bill;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function getNextSendDateForMigration($invoice)
|
private function getNextSendDateForMigration($invoice)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -736,8 +926,13 @@ info("get company");
|
||||||
|
|
||||||
$due_date_parts = explode("-", $invoice->due_date);
|
$due_date_parts = explode("-", $invoice->due_date);
|
||||||
|
|
||||||
if(is_array($due_date_parts) && count($due_date_parts) >=3)
|
if(is_array($due_date_parts) && count($due_date_parts) >=3){
|
||||||
|
|
||||||
|
if($due_date_parts[2] == "00")
|
||||||
|
return "0";
|
||||||
|
|
||||||
return (string)$due_date_parts[2];
|
return (string)$due_date_parts[2];
|
||||||
|
}
|
||||||
|
|
||||||
return 'terms';
|
return 'terms';
|
||||||
}
|
}
|
||||||
|
|
@ -834,7 +1029,7 @@ info("get company");
|
||||||
if($invoice->is_public == 0)
|
if($invoice->is_public == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if($invoice->end_date < now())
|
if($invoice->end_date && $invoice->end_date < now())
|
||||||
return 4;
|
return 4;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -925,7 +1120,7 @@ info("get company");
|
||||||
|
|
||||||
public function getResourceInvitations($items, $resourceKeyId)
|
public function getResourceInvitations($items, $resourceKeyId)
|
||||||
{
|
{
|
||||||
info("get resource {$resourceKeyId} invitations");
|
// info("get resource {$resourceKeyId} invitations");
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
|
@ -955,50 +1150,40 @@ info("get company");
|
||||||
return $transformed;
|
return $transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCreditItems($items)
|
public function getCreditItems($balance)
|
||||||
{
|
{
|
||||||
info("get credit items");
|
info("get credit items");
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
|
||||||
|
|
||||||
// if($item->cost < 0)
|
|
||||||
// $item->cost = $item->cost * -1;
|
|
||||||
|
|
||||||
$item->qty = $item->qty * -1;
|
|
||||||
|
|
||||||
// if($item->discount < 0)
|
|
||||||
// $item->discount = $item->discount * -1;
|
|
||||||
|
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $item->id,
|
'id' => '',
|
||||||
'quantity' => (float) $item->qty,
|
'quantity' => (float) 1,
|
||||||
'cost' => (float) $item->cost,
|
'cost' => (float) $balance,
|
||||||
'product_key' => $item->product_key,
|
'product_key' => trans('texts.balance'),
|
||||||
'notes' => $item->notes,
|
'notes' => trans('texts.credit_balance'),
|
||||||
'discount' => (float) $item->discount,
|
'discount' => 0,
|
||||||
'tax_name1' => (string)$item->tax_name1,
|
'tax_name1' => '',
|
||||||
'tax_rate1' => (float) $item->tax_rate1,
|
'tax_rate1' => 0,
|
||||||
'tax_name2' => (string) $item->tax_name2,
|
'tax_name2' => '',
|
||||||
'tax_rate2' => (float) $item->tax_rate2,
|
'tax_rate2' => 0,
|
||||||
'tax_name3' => (string) '',
|
'tax_name3' => '',
|
||||||
'tax_rate3' => (float) 0,
|
'tax_rate3' => 0,
|
||||||
'date' => Carbon::parse($item->created_at)->toDateString(),
|
'date' => '',
|
||||||
'custom_value1' => $item->custom_value1 ?: '',
|
'custom_value1' => '',
|
||||||
'custom_value2' => $item->custom_value2 ?: '',
|
'custom_value2' => '',
|
||||||
'custom_value3' => '',
|
'custom_value3' => '',
|
||||||
'custom_value4' => '',
|
'custom_value4' => '',
|
||||||
'type_id' => (string)$item->invoice_item_type_id,
|
'type_id' => '1',
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
return $transformed;
|
return $transformed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInvoiceItems($items)
|
public function getInvoiceItems($items)
|
||||||
{
|
{
|
||||||
info("get invoice items");
|
// info("get invoice items");
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
|
@ -1030,8 +1215,6 @@ info("get company");
|
||||||
|
|
||||||
public function getQuotes()
|
public function getQuotes()
|
||||||
{
|
{
|
||||||
info("get quotes");
|
|
||||||
|
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
|
@ -1040,6 +1223,8 @@ info("get company");
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get quotes => " . $quotes->count());
|
||||||
|
|
||||||
foreach ($quotes as $quote) {
|
foreach ($quotes as $quote) {
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $quote->id,
|
'id' => $quote->id,
|
||||||
|
|
@ -1065,7 +1250,7 @@ info("get company");
|
||||||
'tax_name2' => $quote->tax_name2,
|
'tax_name2' => $quote->tax_name2,
|
||||||
'tax_rate1' => $quote->tax_rate1,
|
'tax_rate1' => $quote->tax_rate1,
|
||||||
'tax_rate2' => $quote->tax_rate2,
|
'tax_rate2' => $quote->tax_rate2,
|
||||||
'invoice_id' => $quote->quote_invoice_id,
|
'invoice_id' => Invoice::getPrivateId($quote->quote_invoice_id),
|
||||||
'custom_surcharge1' => $quote->custom_value1 ?: '',
|
'custom_surcharge1' => $quote->custom_value1 ?: '',
|
||||||
'custom_surcharge2' => $quote->custom_value2 ?: '',
|
'custom_surcharge2' => $quote->custom_value2 ?: '',
|
||||||
'custom_value1' => $quote->custom_text_value1 ?: '',
|
'custom_value1' => $quote->custom_text_value1 ?: '',
|
||||||
|
|
@ -1115,7 +1300,6 @@ info("get company");
|
||||||
|
|
||||||
public function getPayments()
|
public function getPayments()
|
||||||
{
|
{
|
||||||
info("get payments");
|
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
|
@ -1124,6 +1308,9 @@ info("get company");
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get payments => " . $payments->count());
|
||||||
|
|
||||||
|
|
||||||
foreach ($payments as $payment) {
|
foreach ($payments as $payment) {
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $payment->id,
|
'id' => $payment->id,
|
||||||
|
|
@ -1144,6 +1331,7 @@ info("get company");
|
||||||
'refunded' => $payment->refunded ?: 0,
|
'refunded' => $payment->refunded ?: 0,
|
||||||
'date' => $payment->payment_date,
|
'date' => $payment->payment_date,
|
||||||
'transaction_reference' => $payment->transaction_reference ?: '',
|
'transaction_reference' => $payment->transaction_reference ?: '',
|
||||||
|
'private_notes' => $payment->private_notes ?: '',
|
||||||
'payer_id' => $payment->payer_id,
|
'payer_id' => $payment->payer_id,
|
||||||
'is_deleted' => (bool)$payment->is_deleted,
|
'is_deleted' => (bool)$payment->is_deleted,
|
||||||
'exchange_rate' => $payment->exchange_rate ? number_format((float) $payment->exchange_rate, 6) : null,
|
'exchange_rate' => $payment->exchange_rate ? number_format((float) $payment->exchange_rate, 6) : null,
|
||||||
|
|
@ -1183,12 +1371,28 @@ info("get company");
|
||||||
const SEPA = 29;
|
const SEPA = 29;
|
||||||
const GOCARDLESS = 30;
|
const GOCARDLESS = 30;
|
||||||
const CRYPTO = 31;
|
const CRYPTO = 31;
|
||||||
|
|
||||||
|
const MOLLIE_BANK_TRANSFER = 34;
|
||||||
|
const KBC = 35;
|
||||||
|
const BANCONTACT = 36;
|
||||||
|
const IDEAL = 37;
|
||||||
|
const HOSTED_PAGE = 38;
|
||||||
|
const GIROPAY = 39;
|
||||||
|
const PRZELEWY24 = 40;
|
||||||
|
const EPS = 41;
|
||||||
|
const DIRECT_DEBIT = 42;
|
||||||
|
const BECS = 43;
|
||||||
|
const ACSS = 44;
|
||||||
|
const INSTANT_BANK_PAY = 45;
|
||||||
|
const FPX = 46;
|
||||||
*/
|
*/
|
||||||
private function transformPaymentType($payment_type_id)
|
private function transformPaymentType($payment_type_id)
|
||||||
{
|
{
|
||||||
switch ($payment_type_id) {
|
switch ($payment_type_id) {
|
||||||
|
case 4:
|
||||||
|
return 42;
|
||||||
case PAYMENT_TYPE_CREDIT:
|
case PAYMENT_TYPE_CREDIT:
|
||||||
return 1;
|
return 32;
|
||||||
case PAYMENT_TYPE_ACH:
|
case PAYMENT_TYPE_ACH:
|
||||||
return 4;
|
return 4;
|
||||||
case PAYMENT_TYPE_VISA:
|
case PAYMENT_TYPE_VISA:
|
||||||
|
|
@ -1209,6 +1413,8 @@ info("get company");
|
||||||
return 12;
|
return 12;
|
||||||
case PAYMENT_TYPE_PAYPAL:
|
case PAYMENT_TYPE_PAYPAL:
|
||||||
return 13;
|
return 13;
|
||||||
|
case 16:
|
||||||
|
return 15;
|
||||||
case PAYMENT_TYPE_CARTE_BLANCHE:
|
case PAYMENT_TYPE_CARTE_BLANCHE:
|
||||||
return 16;
|
return 16;
|
||||||
case PAYMENT_TYPE_UNIONPAY:
|
case PAYMENT_TYPE_UNIONPAY:
|
||||||
|
|
@ -1233,6 +1439,10 @@ info("get company");
|
||||||
return 30;
|
return 30;
|
||||||
case PAYMENT_TYPE_BITCOIN:
|
case PAYMENT_TYPE_BITCOIN:
|
||||||
return 31;
|
return 31;
|
||||||
|
case 2:
|
||||||
|
return 1;
|
||||||
|
case 3:
|
||||||
|
return 2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return $payment_type_id;
|
return $payment_type_id;
|
||||||
|
|
@ -1249,12 +1459,13 @@ info("get company");
|
||||||
|
|
||||||
private function getCredits()
|
private function getCredits()
|
||||||
{
|
{
|
||||||
info("get credits");
|
|
||||||
|
|
||||||
$credits = Credit::where('account_id', $this->account->id)->where('balance', '>', 0)->whereIsDeleted(false)
|
$credits = Credit::where('account_id', $this->account->id)->where('balance', '>', 0)->whereIsDeleted(false)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get credits => " . $credits->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($credits as $credit) {
|
foreach ($credits as $credit) {
|
||||||
|
|
@ -1279,10 +1490,12 @@ info("get company");
|
||||||
|
|
||||||
private function getDocuments()
|
private function getDocuments()
|
||||||
{
|
{
|
||||||
info("get documents");
|
|
||||||
|
|
||||||
$documents = Document::where('account_id', $this->account->id)->get();
|
$documents = Document::where('account_id', $this->account->id)->get();
|
||||||
|
|
||||||
|
info("get documents => " . $documents->count());
|
||||||
|
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($documents as $document) {
|
foreach ($documents as $document) {
|
||||||
|
|
@ -1322,12 +1535,9 @@ info("get company");
|
||||||
|
|
||||||
$fees_and_limits = $this->transformFeesAndLimits($gateway_type);
|
$fees_and_limits = $this->transformFeesAndLimits($gateway_type);
|
||||||
|
|
||||||
info("generated fees and limits = ");
|
|
||||||
info(print_r($fees_and_limits,1));
|
|
||||||
|
|
||||||
$translated_gateway_type = $this->translateGatewayTypeId($gateway_type);
|
$translated_gateway_type = $this->translateGatewayTypeId($gateway_type);
|
||||||
|
|
||||||
info("translated gateway_type = {$translated_gateway_type}");
|
|
||||||
|
|
||||||
$fees->{$translated_gateway_type} = $fees_and_limits;
|
$fees->{$translated_gateway_type} = $fees_and_limits;
|
||||||
}
|
}
|
||||||
|
|
@ -1337,10 +1547,11 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getCompanyGateways()
|
private function getCompanyGateways()
|
||||||
{
|
{
|
||||||
info("get get company gateways");
|
|
||||||
|
|
||||||
$account_gateways = AccountGateway::where('account_id', $this->account->id)->withTrashed()->get();
|
$account_gateways = AccountGateway::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get get company gateways => " . $account_gateways->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($account_gateways as $account_gateway) {
|
foreach ($account_gateways as $account_gateway) {
|
||||||
|
|
@ -1357,7 +1568,7 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
}
|
}
|
||||||
catch(\Exception $e){
|
catch(\Exception $e){
|
||||||
|
|
||||||
info($config);
|
// info($config);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1537,11 +1748,10 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
private function getClientGatewayTokens()
|
private function getClientGatewayTokens()
|
||||||
{
|
{
|
||||||
|
|
||||||
info("get client gateway tokens");
|
|
||||||
|
|
||||||
|
|
||||||
$payment_methods = PaymentMethod::where('account_id', $this->account->id)->withTrashed()->get();
|
$payment_methods = PaymentMethod::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get client gateway tokens => " . $payment_methods->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
$is_default = true;
|
$is_default = true;
|
||||||
|
|
@ -1550,6 +1760,9 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
|
$contact = Contact::where('id', $payment_method->contact_id)->withTrashed()->first();
|
||||||
$agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first();
|
$agt = AccountGatewayToken::where('id', $payment_method->account_gateway_token_id)->withTrashed()->first();
|
||||||
|
|
||||||
|
if(!$contact && !$agt)
|
||||||
|
continue;
|
||||||
|
|
||||||
$transformed[] = [
|
$transformed[] = [
|
||||||
'id' => $payment_method->id,
|
'id' => $payment_method->id,
|
||||||
'company_id' => $this->account->id,
|
'company_id' => $this->account->id,
|
||||||
|
|
@ -1560,6 +1773,9 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
'gateway_type_id' => $payment_method->payment_type->gateway_type_id,
|
'gateway_type_id' => $payment_method->payment_type->gateway_type_id,
|
||||||
'is_default' => $is_default,
|
'is_default' => $is_default,
|
||||||
'meta' => $this->convertMeta($payment_method),
|
'meta' => $this->convertMeta($payment_method),
|
||||||
|
'created_at' => $payment_method->created_at ? Carbon::parse($payment_method->created_at)->toDateString() : null,
|
||||||
|
'updated_at' => $payment_method->updated_at ? Carbon::parse($payment_method->updated_at)->toDateString() : null,
|
||||||
|
'deleted_at' => $payment_method->deleted_at ? Carbon::parse($payment_method->deleted_at)->toDateString() : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$is_default = false;
|
$is_default = false;
|
||||||
|
|
@ -1570,11 +1786,11 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getPaymentTerms()
|
private function getPaymentTerms()
|
||||||
{
|
{
|
||||||
info("get payment terms");
|
|
||||||
|
|
||||||
|
|
||||||
$payment_terms = PaymentTerm::where('account_id', 0)->orWhere('account_id', $this->account->id)->withTrashed()->get();
|
$payment_terms = PaymentTerm::where('account_id', 0)->orWhere('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get payment terms => " . $payment_terms->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach($payment_terms as $payment_term)
|
foreach($payment_terms as $payment_term)
|
||||||
|
|
@ -1601,10 +1817,10 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getTaskStatuses()
|
private function getTaskStatuses()
|
||||||
{
|
{
|
||||||
info("get task statuses");
|
|
||||||
|
|
||||||
$task_statuses = TaskStatus::where('account_id', $this->account->id)->withTrashed()->get();
|
$task_statuses = TaskStatus::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get task statuses => " . $task_statuses->count());
|
||||||
|
|
||||||
if($task_statuses->count() == 0)
|
if($task_statuses->count() == 0)
|
||||||
{
|
{
|
||||||
$defaults = [
|
$defaults = [
|
||||||
|
|
@ -1647,10 +1863,10 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getExpenseCategories()
|
private function getExpenseCategories()
|
||||||
{
|
{
|
||||||
info("get expense categories");
|
|
||||||
|
|
||||||
$expense_categories = ExpenseCategory::where('account_id', $this->account->id)->withTrashed()->get();
|
$expense_categories = ExpenseCategory::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get expense categories => " . $expense_categories->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($expense_categories as $category)
|
foreach ($expense_categories as $category)
|
||||||
|
|
@ -1672,10 +1888,10 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getExpenses()
|
private function getExpenses()
|
||||||
{
|
{
|
||||||
info("get expenses");
|
|
||||||
|
|
||||||
$expenses = Expense::where('account_id', $this->account->id)->withTrashed()->get();
|
$expenses = Expense::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get expenses => " . $expenses->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($expenses as $expense)
|
foreach ($expenses as $expense)
|
||||||
|
|
@ -1700,7 +1916,7 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
'invoice_documents' => $expense->invoice_documents,
|
'invoice_documents' => $expense->invoice_documents,
|
||||||
'invoice_id' => $expense->invoice_id,
|
'invoice_id' => $expense->invoice_id,
|
||||||
'payment_date' => $expense->payment_date,
|
'payment_date' => $expense->payment_date,
|
||||||
'payment_type_id' => $expense->payment_type_id,
|
'payment_type_id' => $this->transformPaymentType($expense->payment_type_id),
|
||||||
'private_notes' => $expense->private_notes,
|
'private_notes' => $expense->private_notes,
|
||||||
'public_notes' => $expense->public_notes,
|
'public_notes' => $expense->public_notes,
|
||||||
'recurring_expense_id' => $expense->recurring_expense_id,
|
'recurring_expense_id' => $expense->recurring_expense_id,
|
||||||
|
|
@ -1727,13 +1943,13 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getTasks()
|
private function getTasks()
|
||||||
{
|
{
|
||||||
info("get tasks");
|
|
||||||
|
|
||||||
|
|
||||||
$tasks = Task::where('account_id', $this->account->id)
|
$tasks = Task::where('account_id', $this->account->id)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get tasks => " . $tasks->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($tasks as $task)
|
foreach ($tasks as $task)
|
||||||
|
|
@ -1770,12 +1986,14 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
private function getProjects()
|
private function getProjects()
|
||||||
{
|
{
|
||||||
info("get projects");
|
|
||||||
|
|
||||||
$projects = Project::where('account_id', $this->account->id)
|
$projects = Project::where('account_id', $this->account->id)
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
info("get projects => " . $projects);
|
||||||
|
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
foreach ($projects as $project)
|
foreach ($projects as $project)
|
||||||
|
|
@ -1812,10 +2030,10 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
protected function getVendors()
|
protected function getVendors()
|
||||||
{
|
{
|
||||||
info("get vendors");
|
|
||||||
|
|
||||||
$vendor_query = Vendor::where('account_id', $this->account->id)->withTrashed()->get();
|
$vendor_query = Vendor::where('account_id', $this->account->id)->withTrashed()->get();
|
||||||
|
|
||||||
|
info("get vendors => " . $vendor_query->count());
|
||||||
|
|
||||||
$vendors = [];
|
$vendors = [];
|
||||||
|
|
||||||
foreach ($vendor_query as $vendor) {
|
foreach ($vendor_query as $vendor) {
|
||||||
|
|
@ -1859,7 +2077,7 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
|
|
||||||
protected function getVendorContacts($contacts)
|
protected function getVendorContacts($contacts)
|
||||||
{
|
{
|
||||||
info("get vendor contacts");
|
info("get vendor contacts => " . $contacts->count());
|
||||||
|
|
||||||
$transformed = [];
|
$transformed = [];
|
||||||
|
|
||||||
|
|
@ -1878,7 +2096,7 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
'custom_value4' => '',
|
'custom_value4' => '',
|
||||||
'email' => $contact->email,
|
'email' => $contact->email,
|
||||||
'is_primary' => (bool)$contact->is_primary,
|
'is_primary' => (bool)$contact->is_primary,
|
||||||
'send_email' => (bool)$contact->send_invoice ?: false,
|
'send_email' => (bool)$contact->send_invoice ?: true,
|
||||||
'confirmed' => $contact->confirmation_token ? true : false,
|
'confirmed' => $contact->confirmation_token ? true : false,
|
||||||
'email_verified_at' => $contact->created_at->toDateTimeString(),
|
'email_verified_at' => $contact->created_at->toDateTimeString(),
|
||||||
'last_login' => $contact->last_login,
|
'last_login' => $contact->last_login,
|
||||||
|
|
@ -1934,8 +2152,8 @@ info("translated gateway_type = {$translated_gateway_type}");
|
||||||
}
|
}
|
||||||
|
|
||||||
$fees_and_limits = new \stdClass();
|
$fees_and_limits = new \stdClass();
|
||||||
$fees_and_limits->min_limit = $ags->min_limit;
|
$fees_and_limits->min_limit = $ags->min_limit > 0 ? $ags->min_limit : -1;
|
||||||
$fees_and_limits->max_limit = $ags->max_limit;
|
$fees_and_limits->max_limit = $ags->max_limit > 0 ? $ags->max_limit : -1;
|
||||||
$fees_and_limits->fee_amount = $ags->fee_amount;
|
$fees_and_limits->fee_amount = $ags->fee_amount;
|
||||||
$fees_and_limits->fee_percent = $ags->fee_percent;
|
$fees_and_limits->fee_percent = $ags->fee_percent;
|
||||||
$fees_and_limits->fee_tax_name1 = $ags->tax_name1;
|
$fees_and_limits->fee_tax_name1 = $ags->tax_name1;
|
||||||
|
|
|
||||||
|
|
@ -58,14 +58,6 @@ if (strstr($_SERVER['HTTP_USER_AGENT'], 'PhantomJS') && Utils::isNinjaDev()) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$app->configureMonologUsing(function($monolog) {
|
|
||||||
if (config('app.log') == 'single') {
|
|
||||||
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log', Monolog\Logger::INFO, false));
|
|
||||||
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-warning.log', Monolog\Logger::WARNING, false));
|
|
||||||
$monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log', Monolog\Logger::ERROR, false));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Capture real IP if using cloudflare
|
// Capture real IP if using cloudflare
|
||||||
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
|
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
|
||||||
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
|
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
|
||||||
|
|
|
||||||
134
composer.json
134
composer.json
|
|
@ -13,96 +13,99 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1.0",
|
"php": ">=7.3.0",
|
||||||
"ext-gd": "*",
|
"ext-gd": "*",
|
||||||
"ext-gmp": "*",
|
"ext-gmp": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"ext-zip": "*",
|
"ext-zip": "*",
|
||||||
|
"abdala/omnipay-pagseguro": "0.2",
|
||||||
|
"agmscode/omnipay-agms": "~1.0",
|
||||||
"anahkiasen/former": "4.*",
|
"anahkiasen/former": "4.*",
|
||||||
|
"andreas22/omnipay-fasapay": "1.*",
|
||||||
"asgrim/ofxparser": "^1.1",
|
"asgrim/ofxparser": "^1.1",
|
||||||
"bacon/bacon-qr-code": "^1.0",
|
"bacon/bacon-qr-code": "^1.0",
|
||||||
"barracudanetworks/archivestream-php": "^1.0",
|
"barracudanetworks/archivestream-php": "^1.0",
|
||||||
"barryvdh/laravel-cors": "^0.9.1",
|
"barryvdh/laravel-cors": "^1.0.6",
|
||||||
"barryvdh/laravel-debugbar": "~3.0.1",
|
"barryvdh/laravel-debugbar": "~3.6.1",
|
||||||
"barryvdh/laravel-ide-helper": "~2.2",
|
"barryvdh/laravel-ide-helper": "~2.7",
|
||||||
"cerdic/css-tidy": "~v1.5",
|
|
||||||
"chumper/datatable": "dev-add-back-options",
|
|
||||||
"cleverit/ubl_invoice": "1.*",
|
|
||||||
"codedge/laravel-selfupdater": "2.2.0",
|
|
||||||
"collizo4sky/omnipay-wepay": "dev-address-fix#942f3e0",
|
|
||||||
"digitickets/omnipay-gocardlessv2": "dev-payment-fix",
|
|
||||||
"doctrine/dbal": "2.5.x",
|
|
||||||
"dompdf/dompdf": "0.6.2",
|
|
||||||
"ezyang/htmlpurifier": "~v4.7",
|
|
||||||
"fzaninotto/faker": "^1.5",
|
|
||||||
"google/apiclient": "^2.0",
|
|
||||||
"guzzlehttp/guzzle": "^6.3",
|
|
||||||
"intervention/image": "dev-master",
|
|
||||||
"jaybizzle/laravel-crawler-detect": "1.*",
|
|
||||||
"jlapp/swaggervel": "master-dev",
|
|
||||||
"jonnyw/php-phantomjs": "dev-fixes",
|
|
||||||
"laracasts/presenter": "dev-master",
|
|
||||||
"turbo124/framework": "5.5.51",
|
|
||||||
"laravel/legacy-encrypter": "^1.0",
|
|
||||||
"laravel/socialite": "3.0.x-dev",
|
|
||||||
"laravel/tinker": "^1.0",
|
|
||||||
"laravelcollective/html": "5.5.*",
|
|
||||||
"league/csv": "^9.1",
|
|
||||||
"league/flysystem-aws-s3-v3": "~1.0",
|
|
||||||
"league/flysystem-rackspace": "~1.0",
|
|
||||||
"league/fractal": "0.13.*",
|
|
||||||
"maatwebsite/excel": "~2.0",
|
|
||||||
"mashape/unirest-php": "^3.0",
|
|
||||||
"mpdf/mpdf": "7.1.7",
|
|
||||||
"nesbot/carbon": "^1.26",
|
|
||||||
"nwidart/laravel-modules": "2.0.*",
|
|
||||||
"omnipay/authorizenet": "dev-solution-id as 2.5.0",
|
|
||||||
"omnipay/firstdata": "^2.4",
|
|
||||||
"patricktalmadge/bootstrapper": "5.5.x",
|
|
||||||
"turbo124/google2fa-laravel": "0.1.2",
|
|
||||||
"predis/predis": "^1.1",
|
|
||||||
"simshaun/recurr": "dev-master",
|
|
||||||
"stripe/stripe-php": "^6.40",
|
|
||||||
"symfony/css-selector": "~3.1",
|
|
||||||
"turbo124/laravel-push-notification": "2.*",
|
|
||||||
"webpatser/laravel-countries": "dev-master#75992ad",
|
|
||||||
"websight/l5-google-cloud-storage": "dev-master",
|
|
||||||
"wepay/php-sdk": "^0.2",
|
|
||||||
"wildbit/postmark-php": "^2.5",
|
|
||||||
"abdala/omnipay-pagseguro": "0.2",
|
|
||||||
"agmscode/omnipay-agms": "~1.0",
|
|
||||||
"andreas22/omnipay-fasapay": "1.*",
|
|
||||||
"bramdevries/omnipay-paymill": "^1.0",
|
"bramdevries/omnipay-paymill": "^1.0",
|
||||||
"cardgate/omnipay-cardgate": "~2.0",
|
"cardgate/omnipay-cardgate": "~2.0",
|
||||||
|
"cerdic/css-tidy": "~v1.5",
|
||||||
|
"chumper/datatable": "dev-laravel6-support",
|
||||||
|
"cleverit/ubl_invoice": "1.*",
|
||||||
|
"codedge/laravel-selfupdater": "2.3.0",
|
||||||
|
"collizo4sky/omnipay-wepay": "dev-address-fix#942f3e0",
|
||||||
"delatbabel/omnipay-fatzebra": "dev-master",
|
"delatbabel/omnipay-fatzebra": "dev-master",
|
||||||
"dercoder/omnipay-ecopayz": "~1.0",
|
"dercoder/omnipay-ecopayz": "~1.0",
|
||||||
"dercoder/omnipay-paysafecard": "dev-master",
|
"dercoder/omnipay-paysafecard": "dev-master",
|
||||||
"digitickets/omnipay-barclays-epdq": "~3.0",
|
"digitickets/omnipay-barclays-epdq": "~3.0",
|
||||||
"digitickets/omnipay-datacash": "~3.0",
|
"digitickets/omnipay-datacash": "~3.0",
|
||||||
|
"digitickets/omnipay-gocardlessv2": "dev-payment-fix",
|
||||||
"digitickets/omnipay-realex": "~5.0",
|
"digitickets/omnipay-realex": "~5.0",
|
||||||
|
"doctrine/dbal": "2.6.x",
|
||||||
|
"dompdf/dompdf": "^2.0",
|
||||||
|
"ezyang/htmlpurifier": "~v4.7",
|
||||||
"fotografde/omnipay-checkoutcom": "~2.0",
|
"fotografde/omnipay-checkoutcom": "~2.0",
|
||||||
"fruitcakestudio/omnipay-sisow": "~2.0",
|
"fruitcakestudio/omnipay-sisow": "~2.0",
|
||||||
|
"fzaninotto/faker": "^1.5",
|
||||||
|
"google/apiclient": "^2.0",
|
||||||
|
"guzzlehttp/guzzle": "^6.5",
|
||||||
|
"guzzlehttp/psr7": "1.8.5",
|
||||||
|
"intervention/image": "dev-master",
|
||||||
|
"jaybizzle/laravel-crawler-detect": "1.*",
|
||||||
|
"jlapp/swaggervel": "master-dev",
|
||||||
|
"jonnyw/php-phantomjs": "dev-fixes",
|
||||||
"justinbusschau/omnipay-secpay": "~2.0",
|
"justinbusschau/omnipay-secpay": "~2.0",
|
||||||
|
"laracasts/presenter": "dev-master",
|
||||||
|
"laravel/framework": "^6.20",
|
||||||
|
"laravel/helpers": "^1.4",
|
||||||
|
"laravel/legacy-encrypter": "^1.0",
|
||||||
|
"laravel/socialite": "~4.4.1",
|
||||||
|
"laravel/tinker": "^1.0",
|
||||||
|
"laravelcollective/html": "^6.2",
|
||||||
|
"league/csv": "^9.1",
|
||||||
|
"league/flysystem-aws-s3-v3": "~1.0",
|
||||||
|
"league/flysystem-rackspace": "~1.0",
|
||||||
|
"league/fractal": "0.13.*",
|
||||||
"lokielse/omnipay-alipay": "~1.4",
|
"lokielse/omnipay-alipay": "~1.4",
|
||||||
|
"maatwebsite/excel": "dev-php-fix",
|
||||||
"meebio/omnipay-creditcall": "dev-master",
|
"meebio/omnipay-creditcall": "dev-master",
|
||||||
"meebio/omnipay-secure-trading": "dev-master",
|
"meebio/omnipay-secure-trading": "dev-master",
|
||||||
"mfauveau/omnipay-pacnet": "~2.0",
|
"mfauveau/omnipay-pacnet": "~2.0",
|
||||||
|
"mpdf/mpdf": "^8.0",
|
||||||
|
"nesbot/carbon": "^2.0",
|
||||||
|
"nwidart/laravel-modules": "2.0.*",
|
||||||
|
"omnipay/authorizenet": "dev-solution-id as 2.5.0",
|
||||||
"omnipay/bitpay": "dev-master",
|
"omnipay/bitpay": "dev-master",
|
||||||
"omnipay/braintree": "^1.1",
|
"omnipay/braintree": "^1.1",
|
||||||
|
"omnipay/common": "2.5.2",
|
||||||
|
"omnipay/firstdata": "^2.4",
|
||||||
"omnipay/gocardless": "dev-master",
|
"omnipay/gocardless": "dev-master",
|
||||||
"omnipay/mollie": "3.*",
|
"omnipay/mollie": "3.*",
|
||||||
"omnipay/omnipay": "~2.3",
|
"omnipay/omnipay": "~2.3",
|
||||||
"omnipay/payfast": "~2.0",
|
"omnipay/payfast": "~2.0",
|
||||||
"omnipay/stripe": "~2.0",
|
"omnipay/stripe": "~2.0",
|
||||||
|
"patricktalmadge/bootstrapper": "5.12.x",
|
||||||
|
"pragmarx/google2fa-laravel": "0.1.4",
|
||||||
|
"predis/predis": "^1.1",
|
||||||
|
"simshaun/recurr": "dev-master",
|
||||||
"softcommerce/omnipay-paytrace": "~1.0",
|
"softcommerce/omnipay-paytrace": "~1.0",
|
||||||
|
"stripe/stripe-php": "^7",
|
||||||
|
"superbalist/laravel-google-cloud-storage": "^2.2",
|
||||||
|
"symfony/css-selector": "~3.1",
|
||||||
|
"therobfonz/laravel-mandrill-driver": "~1.0",
|
||||||
|
"turbo124/laravel-push-notification": "dev-master",
|
||||||
|
"vemcogroup/laravel-sparkpost-driver": "~2.0",
|
||||||
"vink/omnipay-komoju": "~1.0",
|
"vink/omnipay-komoju": "~1.0",
|
||||||
"omnipay/common": "2.5.2"
|
"webpatser/laravel-countries": "dev-master#75992ad",
|
||||||
|
"wepay/php-sdk": "^0.2",
|
||||||
|
"wildbit/postmark-php": "^2.5"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/dom-crawler": "~3.1",
|
"symfony/dom-crawler": "~3.1",
|
||||||
"codeception/c3": "2.*",
|
"codeception/c3": "2.*",
|
||||||
"codeception/codeception": "2.*",
|
"codeception/codeception": "2.*",
|
||||||
"phpspec/phpspec": "~2.1",
|
"phpspec/phpspec": "~6.1",
|
||||||
"phpunit/phpunit": "~5.7"
|
"phpunit/phpunit": "~5.7"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
@ -157,7 +160,10 @@
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist",
|
"preferred-install": "dist",
|
||||||
"sort-packages": true,
|
"sort-packages": true,
|
||||||
"optimize-autoloader": true
|
"optimize-autoloader": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"codeception/c3": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
|
|
@ -174,11 +180,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/hillelcoren/datatable"
|
"url": "https://github.com/turbo124/chumper-datatable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/hillelcoren/php-phantomjs"
|
"url": "https://github.com/turbo124/php-phantomjs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
|
|
@ -187,6 +193,22 @@
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/hillelcoren/omnipay-authorizenet"
|
"url": "https://github.com/hillelcoren/omnipay-authorizenet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/turbo124/omnipay-common"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/turbo124/laravel-push-notification"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/turbo124/NotificationPusher"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/turbo124/Laravel-Excel"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7828
composer.lock
generated
7828
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -88,21 +88,6 @@ return [
|
||||||
|
|
||||||
'cipher' => env('APP_CIPHER', 'AES-256-CBC'),
|
'cipher' => env('APP_CIPHER', 'AES-256-CBC'),
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Logging Configuration
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may configure the log settings for your application. Out of
|
|
||||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
|
||||||
| you a variety of powerful log handlers / formatters to utilize.
|
|
||||||
|
|
|
||||||
| Available Settings: "single", "daily", "syslog", "errorlog"
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
'log' => env('LOG', 'single'),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Autoloaded Service Providers
|
| Autoloaded Service Providers
|
||||||
|
|
@ -155,11 +140,10 @@ return [
|
||||||
'Laravel\Socialite\SocialiteServiceProvider',
|
'Laravel\Socialite\SocialiteServiceProvider',
|
||||||
'Jlapp\Swaggervel\SwaggervelServiceProvider',
|
'Jlapp\Swaggervel\SwaggervelServiceProvider',
|
||||||
'Maatwebsite\Excel\ExcelServiceProvider',
|
'Maatwebsite\Excel\ExcelServiceProvider',
|
||||||
Websight\GcsProvider\CloudStorageServiceProvider::class,
|
Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider::class,
|
||||||
'Jaybizzle\LaravelCrawlerDetect\LaravelCrawlerDetectServiceProvider',
|
|
||||||
Codedge\Updater\UpdaterServiceProvider::class,
|
Codedge\Updater\UpdaterServiceProvider::class,
|
||||||
Nwidart\Modules\LaravelModulesServiceProvider::class,
|
Nwidart\Modules\LaravelModulesServiceProvider::class,
|
||||||
Barryvdh\Cors\ServiceProvider::class,
|
Fruitcake\Cors\CorsServiceProvider::class,
|
||||||
PragmaRX\Google2FALaravel\ServiceProvider::class,
|
PragmaRX\Google2FALaravel\ServiceProvider::class,
|
||||||
'Chumper\Datatable\DatatableServiceProvider',
|
'Chumper\Datatable\DatatableServiceProvider',
|
||||||
Laravel\Tinker\TinkerServiceProvider::class,
|
Laravel\Tinker\TinkerServiceProvider::class,
|
||||||
|
|
@ -175,7 +159,6 @@ return [
|
||||||
'App\Providers\RouteServiceProvider',
|
'App\Providers\RouteServiceProvider',
|
||||||
|
|
||||||
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
||||||
'Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider',
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -262,8 +245,7 @@ return [
|
||||||
'Rocketeer' => 'Rocketeer\Facades\Rocketeer',
|
'Rocketeer' => 'Rocketeer\Facades\Rocketeer',
|
||||||
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
|
'Socialite' => 'Laravel\Socialite\Facades\Socialite',
|
||||||
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
|
||||||
'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification',
|
'Crawler' => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class,
|
||||||
'Crawler' => 'Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect',
|
|
||||||
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
|
'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade',
|
||||||
'Updater' => Codedge\Updater\UpdaterFacade::class,
|
'Updater' => Codedge\Updater\UpdaterFacade::class,
|
||||||
'Module' => Nwidart\Modules\Facades\Module::class,
|
'Module' => Nwidart\Modules\Facades\Module::class,
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue