Merge pull request #8192 from turbo124/preview

Preview
This commit is contained in:
David Bomba 2023-01-22 16:59:48 +11:00 committed by GitHub
commit 554aa25a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
298 changed files with 252877 additions and 248475 deletions

View File

@ -7,35 +7,35 @@ assignees: ''
---
**What version of Invoice Ninja are you running? ie v4.5.25 / v5.0.30**
<!-- Before posting please check our "Troubleshooting" category in the docs:
https://invoiceninja.github.io/docs/self-host-troubleshooting/ -->
**What environment are you running?**
Docker
Shared Hosting
ZIP
Other
## Setup
- Version: <!-- i.e. v4.5.25 / v5.0.30 -->
- Environment: <!-- Docker/Shared Hosting/ZIP/Other -->
**Have you checked log files (storage/logs/) Please provide redacted output**
## Checklist
- Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com pr https://react.invoicing.co/demo?
- Have you searched existing issues?
- Have you reported this to Slack/forum before posting?
**Have you searched existing issues?**
## Describe the bug
<!-- A clear and concise description of the bug. -->
**Have you reported this to Slack/forum before posting?**
### Steps To Reproduce
<!-- Please list the steps to reproduce the issue. -->
**Describe the bug**
A clear and concise description of what the bug is.
### Expected Behavior
<!-- A clear and concise description of what you expected to happen. -->
**Steps To Reproduce**
Please list the steps to reproduce the issue
## Additional context
<!-- Add any other context about the problem here. -->
**Expected behavior**
A clear and concise description of what you expected to happen.
### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->
**Screenshots**
If applicable, add screenshots to help explain your problem.
### Logs
<!-- Please check the log files (storage/logs/) and provide redacted output -->
```
**Additional context**
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/) -->
**(v5) Can you replicate the issue on our demo site? https://demo.invoiceninja.com**
```

View File

@ -13,8 +13,12 @@ jobs:
strategy:
matrix:
operating-system: ['ubuntu-20.04', 'ubuntu-22.04']
php-versions: ['8.1']
php-versions: ['8.1','8.2']
phpunit-versions: ['latest']
ci_node_total: [ 8 ]
ci_node_index: [ 0, 1, 2, 3, 4, 5, 6, 7]
laravel: [9.*]
dependency-version: [prefer-stable]
env:
DB_DATABASE1: ninja
@ -25,13 +29,14 @@ jobs:
DB_USERNAME: root
DB_PASSWORD: ninja
DB_HOST: '127.0.0.1'
REDIS_PORT: 6379
BROADCAST_DRIVER: log
CACHE_DRIVER: file
QUEUE_CONNECTION: sync
SESSION_DRIVER: file
CACHE_DRIVER: redis
QUEUE_CONNECTION: redis
SESSION_DRIVER: redis
NINJA_ENVIRONMENT: hosted
MULTI_DB_ENABLED: false
NINJA_LICENSE: 123456
NINJA_LICENSE: ${{ secrets.ninja_license }}
TRAVIS: true
MAIL_MAILER: log
@ -47,13 +52,18 @@ jobs:
MYSQL_DATABASE: ninja
MYSQL_ROOT_PASSWORD: ninja
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
redis:
image: redis
ports:
- 6379/tcp
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 ninja.test" | sudo tee -a /etc/hosts
- name: Start mysql service
- name: Start MariaDB service
run: |
sudo systemctl start mysql.service
- name: Verify MariaDB connection
@ -65,11 +75,11 @@ jobs:
while ! mysqladmin ping -h"127.0.0.1" -P"$DB_PORT" --silent; do
sleep 1
done
- name: Setup PHP
- name: Setup PHP shivammathur/setup-php@v2
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml
extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml, redis
- uses: actions/checkout@v1
with:
@ -79,32 +89,50 @@ jobs:
- name: Copy .env
run: |
cp .env.ci .env
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-composer-
# - name: Cache dependencies actions/cache@v3
# uses: actions/cache@v3
# with:
# path: ~/.composer/cache/files
# key: dependencies-${{ matrix.dependency-version }}-laravel-${{ matrix.laravel }}-php-${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json') }}
- name: Install composer dependencies
run: |
composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install
- name: Prepare Laravel Application
env:
REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
run: |
php artisan key:generate
php artisan optimize
php artisan cache:clear
php artisan config:cache
- name: Create DB and schemas
run: |
mkdir -p database
touch database/database.sqlite
php artisan ninja:post-update
- name: Migrate Database
run: |
php artisan migrate:fresh --seed --force && php artisan db:seed --force
- name: Prepare JS/CSS assets
run: |
npm i
npm run production
- name: Run Testsuite
run: |
cat .env
vendor/bin/snappdf download
vendor/bin/phpunit --testdox
tests/ci
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
PHP_CS_FIXER_IGNORE_ENV: true
CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
CI_NODE_INDEX: ${{ matrix.ci_node_index }}

119
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,119 @@
# Contributing to CONTRIBUTING.md
First off, thanks for taking the time to contribute!
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions.
> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about:
> - Star the project
> - Tweet about it
> - Refer this project in your project's readme
> - Mention the project at local meetups and tell your friends/colleagues
## Table of Contents
- [Code of Conduct](#code-of-conduct)
- [I Have a Question](#i-have-a-question)
- [I Want To Contribute](#i-want-to-contribute)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Your First Code Contribution](#your-first-code-contribution)
- [Improving The Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)
- [Join The Project Team](#join-the-project-team)
## Code of Conduct
This project and everyone participating in it is governed by the
[CONTRIBUTING.md Code of Conduct](blob/v5-stable/CODE_OF_CONDUCT.md).
By participating, you are expected to uphold this code. Please report unacceptable behavior
to <>.
## I Have a Question
> If you want to ask a question, we assume that you have read the available [Documentation](https://invoiceninja.github.io), Searched the [Forum](https://forum.invoiceninja.com), or tried chatting with us on [Slack](https://invoiceninja.slack.com) [generate a slack invite here](http://slack.invoiceninja.com)
Please reserve issues for bugs, general questions posted in the issues section will be closed and redirected to other support venues.
## I Want To Contribute
> ### Legal Notice
> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. Please note that you'll need to sign the CLA for any PRs to be accepted
### Reporting Bugs
#### Before Submitting a Bug Report
A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible.
- Make sure that you are using the latest version.
- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://invoiceninja.github.io). If you are looking for support, you might want to check [this section](#i-have-a-question)).
- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug).
- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue.
- Collect information about the bug:
- Stack trace (Traceback)
- OS, Platform and Version (Windows, Linux, macOS, x86, ARM)
- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant.
- Possibly your input and the output
- Can you reliably reproduce the issue? And can you also reproduce it with older versions?
#### How Do I Submit a Good Bug Report?
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>.
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
- Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
- Explain the behavior you would expect and the actual behavior.
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
- Provide the information you collected in the previous section.
Once it's filed:
- The project team will label the issue accordingly.
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution).
### Suggesting Enhancements
This section guides you through submitting an enhancement suggestion for CONTRIBUTING.md, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions.
#### Before Submitting an Enhancement
- Make sure that you are using the latest version.
- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration.
- Perform a [search](/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one.
- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library.
#### How Do I Submit a Good Enhancement Suggestion?
Enhancement suggestions are tracked as [GitHub issues](/issues).
- Use a **clear and descriptive title** for the issue to identify the suggestion.
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.
- **Explain why this enhancement would be useful** to most CONTRIBUTING.md users. You may also want to point out the other projects that solved it better and which could serve as inspiration.
### Your First Code Contribution
All PRs should be created against the v5-develop branch.
## Attribution
This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)!

200
README.md
View File

@ -1,97 +1,103 @@
<p align="center">
<img src="https://raw.githubusercontent.com/hillelcoren/invoice-ninja/master/public/images/round_logo.png" alt="Sublime's custom image"/>
</p>
![v5-develop phpunit](https://github.com/invoiceninja/invoiceninja/workflows/phpunit/badge.svg?branch=v5-develop)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d16c78aad8574466bf83232b513ef4fb)](https://www.codacy.com/gh/turbo124/invoiceninja/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=turbo124/invoiceninja&amp;utm_campaign=Badge_Grade)
<a href="https://cla-assistant.io/invoiceninja/invoiceninja"><img src="https://cla-assistant.io/readme/badge/invoiceninja/invoiceninja" alt="CLA assistant" /></a>
# Invoice Ninja 5
## [Hosted](https://www.invoiceninja.com) | [Self-Hosted](https://www.invoiceninja.org)
### We're on Slack, join us at [slack.invoiceninja.com](http://slack.invoiceninja.com), [forum.invoiceninja.com](https://forum.invoiceninja.com) or if you like [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
Just make sure to add the `invoice-ninja` tag to your question.
## Introduction
Version 5 of Invoice Ninja is here! We've taken the best parts of version 4 and bolted on all of the most requested features to produce a invoicing application like no other.
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.
* [Videos](https://www.youtube.com/@appinvoiceninja)
* [API Documentation](https://app.swaggerhub.com/apis/invoiceninja/invoiceninja)
* [APP Documentation](https://invoiceninja.github.io/)
* [Support Forum](https://forum.invoiceninja.com)
* [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
## Mobile Apps
* [iPhone](https://apps.apple.com/app/id1503970375?platform=iphone)
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app)
## Desktop Apps
* [macOS](https://apps.apple.com/app/id1503970375?platform=mac)
* [Windows](https://microsoft.com/en-us/p/invoice-ninja/9n3f2bbcfdr6)
* [Linux](https://snapcraft.io/invoiceninja)
## Installation Options
* [Docker File](https://hub.docker.com/r/invoiceninja/invoiceninja/)
* [Cloudron](https://cloudron.io/store/com.invoiceninja.cloudronapp.html)
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja)
## Recommended Providers
* [Stripe](https://stripe.com/)
* [Postmark](https://postmarkapp.com/)
## Quick Start
```bash
git clone https://github.com/invoiceninja/invoiceninja.git
git checkout v5-stable
cp .env.example .env
composer update
php artisan key:generate
```
Please Note: Your APP_KEY in the .env file is used to encrypt data, if you lose this you will not be able to run the application.
Run if you want to load sample data, remember to configure .env
```
php artisan migrate:fresh --seed && php artisan db:seed && php artisan ninja:create-test-data
```
To run the web server
```
php artisan serve
```
Navigate to (replace ninja.test as required)
```
http://ninja.test:8000/setup - To setup your configuration if you didn't load sample data.
http://ninja.test:8000/ - For Administrator Logon
user: small@example.com
pass: password
http://ninja.test:8000/client/login - For Client Portal
user: user@example.com
pass: password
```
## Credits
* [Hillel Coren](https://hillelcoren.com/)
* [David Bomba](https://github.com/turbo124)
* [Benjamin Beganović](https://github.com/beganovich)
* [All contributors](https://github.com/invoiceninja/invoiceninja/graphs/contributors)
## Security
If you find a security issue with this application please send an email to contact@invoiceninja.com Please follow responsible disclosure procedures if you detect an issue. For further information on responsible disclosure please read [here](https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html)
## License
Invoice Ninja is released under the Elastic License.
See [LICENSE](LICENSE) for details.
<p align="center">
<img src="https://raw.githubusercontent.com/hillelcoren/invoice-ninja/master/public/images/round_logo.png" alt="Sublime's custom image"/>
</p>
![v5-develop phpunit](https://github.com/invoiceninja/invoiceninja/workflows/phpunit/badge.svg?branch=v5-develop)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d16c78aad8574466bf83232b513ef4fb)](https://www.codacy.com/gh/turbo124/invoiceninja/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=turbo124/invoiceninja&amp;utm_campaign=Badge_Grade)
<a href="https://cla-assistant.io/invoiceninja/invoiceninja"><img src="https://cla-assistant.io/readme/badge/invoiceninja/invoiceninja" alt="CLA assistant" /></a>
# Invoice Ninja 5
## [Hosted](https://www.invoiceninja.com) | [Self-Hosted](https://www.invoiceninja.org)
Join us on [Slack](http://slack.invoiceninja.com), [Discourse](https://forum.invoiceninja.com) -
or [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/) if you like,
just make sure to add the `invoice-ninja` tag to your question.
## Introduction
Version 5 of Invoice Ninja is here!
We took the best parts of version 4 and add the most requested features
to produce a invoicing application like no other.
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.
* [Videos](https://www.youtube.com/@appinvoiceninja)
* [API Documentation](https://app.swaggerhub.com/apis/invoiceninja/invoiceninja)
* [APP Documentation](https://invoiceninja.github.io/)
* [Support Forum](https://forum.invoiceninja.com)
* [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/)
## Setup
### Mobile Apps
* [iPhone](https://apps.apple.com/app/id1503970375?platform=iphone)
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app)
### Desktop Apps
* [macOS](https://apps.apple.com/app/id1503970375?platform=mac)
* [Windows](https://microsoft.com/en-us/p/invoice-ninja/9n3f2bbcfdr6)
* [Linux](https://snapcraft.io/invoiceninja)
### Installation Options
* [Docker File](https://hub.docker.com/r/invoiceninja/invoiceninja/)
* [Cloudron](https://cloudron.io/store/com.invoiceninja.cloudronapp.html)
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja)
### Recommended Providers
* [Stripe](https://stripe.com/)
* [Postmark](https://postmarkapp.com/)
## Quick Hosting Setup
```sh
git clone https://github.com/invoiceninja/invoiceninja.git
git checkout v5-stable
cp .env.example .env
composer update
php artisan key:generate
```
Please Note:
Your APP_KEY in the .env file is used to encrypt data, if you lose this you will not be able to run the application.
Run if you want to load sample data, remember to configure .env
```sh
php artisan migrate:fresh --seed && php artisan db:seed && php artisan ninja:create-test-data
```
To run the web server
```sh
php artisan serve
```
Navigate to (replace localhost with the appropriate domain)
```
http://localhost:8000/setup - To setup your configuration if you did not load sample data.
http://localhost:8000/ - For Administrator Logon
user: small@example.com
pass: password
http://localhost:8000/client/login - For Client Portal
user: user@example.com
pass: password
```
## Credits
* [Hillel Coren](https://hillelcoren.com/)
* [David Bomba](https://github.com/turbo124)
* [Benjamin Beganović](https://github.com/beganovich)
* [All Contributors](https://github.com/invoiceninja/invoiceninja/graphs/contributors)
## Security
If you find a security issue with this application, please send an email to contact@invoiceninja.com.
Please follow responsible disclosure procedures if you detect an issue.
For further information on responsible disclosure please read [here](https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html).
## License
Invoice Ninja is released under the Elastic License.
See [LICENSE](LICENSE) for details.

View File

@ -1 +1 @@
5.5.55
5.5.58

View File

@ -15,6 +15,7 @@ use App;
use App\DataMapper\ClientSettings;
use App\Factory\ClientContactFactory;
use App\Factory\VendorContactFactory;
use App\Jobs\Company\CreateCompanyToken;
use App\Models\Account;
use App\Models\Client;
use App\Models\ClientContact;
@ -28,10 +29,14 @@ use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Models\Payment;
use App\Models\Paymentable;
use App\Models\PurchaseOrder;
use App\Models\PurchaseOrderInvitation;
use App\Models\Quote;
use App\Models\QuoteInvitation;
use App\Models\RecurringInvoiceInvitation;
use App\Models\User;
use App\Models\Vendor;
use App\Models\VendorContact;
use App\Utils\Ninja;
use Exception;
use Illuminate\Console\Command;
@ -120,7 +125,8 @@ class CheckData extends Command
$this->checkOauthSanity();
$this->checkVendorSettings();
$this->checkClientSettings();
$this->checkCompanyTokens();
if(Ninja::isHosted()){
$this->checkAccountStatuses();
$this->checkNinjaPortalUrls();
@ -153,6 +159,25 @@ class CheckData extends Command
$this->log .= $str."\n";
}
private function checkCompanyTokens()
{
CompanyUser::doesnthave('token')->cursor()->each(function ($cu){
if($cu->user){
$this->logMessage("Creating missing company token for user # {$cu->user->id} for company id # {$cu->company->id}");
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
}
else {
$this->logMessage("Dangling User ID # {$cu->id}");
}
});
}
private function checkOauthSanity()
{
User::where('oauth_provider_id', '1')->cursor()->each(function ($user){
@ -397,29 +422,58 @@ class CheckData extends Command
QuoteInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
CreditInvitation::where('deleted_at',"0000-00-00 00:00:00.000000")->withTrashed()->update(['deleted_at' => null]);
$entities = ['invoice', 'quote', 'credit', 'recurring_invoice'];
foreach($entities as $entity)
{
$table = "{$entity}s";
$invitation_table = "{$entity}_invitations";
collect([Invoice::class, Quote::class, Credit::class, PurchaseOrder::class])->each(function ($entity){
$entities = DB::table($table)
->leftJoin($invitation_table, function ($join) use($invitation_table, $table, $entity){
$join->on("{$invitation_table}.{$entity}_id", '=', "{$table}.id");
// ->whereNull("{$invitation_table}.deleted_at");
})
->groupBy("{$table}.id", "{$table}.user_id", "{$table}.company_id", "{$table}.client_id")
->havingRaw("count({$invitation_table}.id) = 0")
->get(["{$table}.id", "{$table}.user_id", "{$table}.company_id", "{$table}.client_id"]);
if($entity::doesntHave('invitations')->count() > 0)
{
$entity::doesntHave('invitations')->cursor()->each(function ($entity) {
$this->logMessage($entities->count()." {$table} without any invitations");
$client_vendor_key = 'client_id';
$contact_id = 'client_contact_id';
$contact_class = ClientContact::class;
if ($this->option('fix') == 'true')
$this->fixInvitations($entities, $entity);
$entity_key = \Illuminate\Support\Str::of(class_basename($entity))->snake()->append('_id')->value;
$entity_obj = get_class($entity).'Invitation';
}
if($entity instanceof PurchaseOrder){
$client_vendor_key = 'vendor_id';
$contact_id = 'vendor_contact_id';
$contact_class = VendorContact::class;
}
$invitation = false;
//check contact exists!
if($contact_class::where('company_id', $entity->company_id)->where($client_vendor_key,$entity->{$client_vendor_key})->exists())
{
$invitation = new $entity_obj();
$invitation->company_id = $entity->company_id;
$invitation->user_id = $entity->user_id;
$invitation->{$entity_key} = $entity->id;
$invitation->{$contact_id} = $contact_class::where('company_id', $entity->company_id)->where($client_vendor_key,$entity->{$client_vendor_key})->first()->id;
$invitation->key = Str::random(config('ninja.key_length'));
$this->logMessage("Add invitation for {$entity_key} - {$entity->id}");
}
else
$this->logMessage("No contact present, so cannot add invitation for {$entity_key} - {$entity->id}");
try{
if($invitation)
$invitation->save();
}
catch(\Exception $e){
$this->logMessage($e->getMessage());
$invitation = null;
}
});
}
});
}

View File

@ -134,6 +134,9 @@ class CreateAccount extends Command
(new CreateCompanyPaymentTerms($company, $user))->handle();
(new CreateCompanyTaskStatuses($company, $user))->handle();
(new VersionCheck())->handle();
$this->warmCache();
}
private function warmCache()
@ -142,25 +145,20 @@ class CreateAccount extends Command
$cached_tables = config('ninja.cached_tables');
foreach ($cached_tables as $name => $class) {
if (! Cache::has($name)) {
// check that the table exists in case the migration is pending
if (! Schema::hasTable((new $class())->getTable())) {
continue;
}
if ($name == 'payment_terms') {
$orderBy = 'num_days';
} elseif ($name == 'fonts') {
$orderBy = 'sort_order';
} elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
$orderBy = 'name';
} else {
$orderBy = 'id';
}
$tableData = $class::orderBy($orderBy)->get();
if ($tableData->count()) {
Cache::forever($name, $tableData);
}
if ($name == 'payment_terms') {
$orderBy = 'num_days';
} elseif ($name == 'fonts') {
$orderBy = 'sort_order';
} elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
$orderBy = 'name';
} else {
$orderBy = 'id';
}
$tableData = $class::orderBy($orderBy)->get();
if ($tableData->count()) {
Cache::forever($name, $tableData);
}
}
}
}

View File

@ -80,10 +80,7 @@ class CreateSingleAccount extends Command
public function handle()
{
if(config('ninja.is_docker'))
return;
if (!$this->confirm('Are you sure you want to inject dummy data?'))
if (Ninja::isHosted() || config('ninja.is_docker') || !$this->confirm('Are you sure you want to inject dummy data?'))
return;
$this->invoice_repo = new InvoiceRepository();
@ -105,6 +102,11 @@ class CreateSingleAccount extends Command
{
$this->info('Creating Small Account and Company');
if($user = User::where('email','small@example.com')->first())
{
$user->account->delete();
}
$account = Account::factory()->create();
$company = Company::factory()->create([
'account_id' => $account->id,

View File

@ -437,7 +437,7 @@ class CreateTestData extends Command
'company_id' => $client->company->id,
]);
Document::factory()->count(5)->create([
Document::factory()->count(1)->create([
'user_id' => $client->user->id,
'company_id' => $client->company_id,
'documentable_type' => Vendor::class,

View File

@ -13,11 +13,14 @@ namespace App\Console\Commands;
use App\Jobs\Util\VersionCheck;
use App\Utils\Ninja;
use App\Utils\Traits\AppSetup;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class PostUpdate extends Command
{
use AppSetup;
/**
* The name and signature of the console command.
*
@ -83,6 +86,8 @@ class PostUpdate extends Command
info('queue restarted');
$this->buildCache(true);
VersionCheck::dispatch();
info('Sent for version check');

View File

@ -71,7 +71,7 @@ class Kernel extends ConsoleKernel
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping()->name('recurring-invoice-job')->onOneServer();
/* Stale Invoice Cleanup*/
$schedule->job(new CleanStaleInvoiceOrder)->hourly()->withoutOverlapping()->name('stale-invoice-job')->onOneServer();
$schedule->job(new CleanStaleInvoiceOrder)->hourlyAt(30)->withoutOverlapping()->name('stale-invoice-job')->onOneServer();
/* Sends recurring invoices*/
$schedule->job(new RecurringExpensesCron)->dailyAt('00:10')->withoutOverlapping()->name('recurring-expense-job')->onOneServer();
@ -89,13 +89,11 @@ class Kernel extends ConsoleKernel
$schedule->job(new SchedulerCheck)->dailyAt('01:10')->withoutOverlapping();
/* Checks for scheduled tasks */
$schedule->job(new TaskScheduler())->dailyAt('06:50')->withoutOverlapping()->name('task-scheduler-job')->onOneServer();
$schedule->job(new TaskScheduler())->hourlyAt(10)->withoutOverlapping()->name('task-scheduler-job')->onOneServer();
/* Performs system maintenance such as pruning the backup table */
$schedule->job(new SystemMaintenance)->sundays()->at('02:30')->withoutOverlapping()->name('system-maintenance-job')->onOneServer();
/* Pulls in bank transactions from third party services */
$schedule->job(new BankTransactionSync)->dailyAt('04:10')->withoutOverlapping()->name('bank-trans-sync-job')->onOneServer();
if (Ninja::isSelfHost()) {
@ -110,6 +108,9 @@ class Kernel extends ConsoleKernel
$schedule->job(new AdjustEmailQuota)->dailyAt('23:30')->withoutOverlapping();
/* Pulls in bank transactions from third party services */
$schedule->job(new BankTransactionSync)->dailyAt('04:10')->withoutOverlapping()->name('bank-trans-sync-job')->onOneServer();
//not used @deprecate
// $schedule->job(new SendFailedEmails)->daily()->withoutOverlapping();

View File

@ -12,15 +12,16 @@
namespace App\DataMapper;
/**
* ClientSettings.
* BaseSettings.
*/
class BaseSettings
{
//@deprecated
public function __construct($obj)
{
foreach ($obj as $key => $value) {
$obj->{$key} = $value;
}
// foreach ($obj as $key => $value) {
// $obj->{$key} = $value;
// }
}
public static function setCasts($obj, $casts)
@ -57,7 +58,4 @@ class BaseSettings
}
}
public static function castSingleAttribute($key, $data)
{
}
}

View File

@ -447,7 +447,19 @@ class CompanySettings extends BaseSettings
public $mailgun_domain = '';
public $auto_bill_standard_invoices = false;
public $email_alignment = 'center'; // center , left, right
public $show_email_footer = true;
public $company_logo_size = '65%';
public static $casts = [
'company_logo_size' => 'string',
'show_email_footer' => 'bool',
'email_alignment' => 'string',
'auto_bill_standard_invoices' => 'bool',
'postmark_secret' => 'string',
'mailgun_secret' => 'string',
'mailgun_domain' => 'string',
@ -724,8 +736,9 @@ class CompanySettings extends BaseSettings
* and always ensure an up to date class is returned.
*
* @param $obj
* @deprecated
*/
public function __construct($obj)
public function __construct()
{
// parent::__construct($obj);
}

View File

@ -235,12 +235,17 @@ class EmailTemplateDefaults
public static function emailStatementSubject()
{
return '';
return ctrans('texts.your_statement');
}
public static function emailStatementTemplate()
{
return '';
$statement_message = '<p>$client<br><br>'.self::transformText('client_statement_body').'<br></p>';
return $statement_message;
// return ctrans('texts.client_statement_body', ['start_date' => '$start_date', 'end_date' => '$end_date']);
}
private static function transformText($string)

View File

@ -0,0 +1,96 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\Schedule;
use App\Models\Client;
use stdClass;
class ClientStatement
{
/**
* Defines the template name
*
* @var string
*/
public string $template = 'client_statement';
/**
* An array of clients hashed_ids
*
* Leave blank if this action should apply to all clients
*
* @var array
*/
public array $clients = [];
/**
* The consts to be used to define the date_range variable of the statement
*/
public const THIS_MONTH = 'this_month';
public const THIS_QUARTER = 'this_quarter';
public const THIS_YEAR = 'this_year';
public const PREVIOUS_MONTH = 'previous_month';
public const PREVIOUS_QUARTER = 'previous_quarter';
public const PREVIOUS_YEAR = 'previous_year';
public const CUSTOM_RANGE = "custom_range";
/**
* The date range the statement should include
*
* @var string
*/
public string $date_range = 'this_month';
/**
* If a custom range is select for the date range then
* the start_date should be supplied in Y-m-d format
*
* @var string
*/
public string $start_date = '';
/**
* If a custom range is select for the date range then
* the end_date should be supplied in Y-m-d format
*
* @var string
*/
public string $end_date = '';
/**
* Flag which allows the payment table
* to be shown
*
* @var boolean
*/
public bool $show_payments_table = true;
/**
* Flag which allows the aging table
* to be shown
*
* @var boolean
*/
public bool $show_aging_table = true;
/**
* String const which defines whether
* the invoices to be shown are either
* paid or unpaid
*
* @var string
*/
public string $status = 'paid'; // paid | unpaid
}

View File

@ -16,12 +16,10 @@ use App\Exceptions\InternalPDFFailure;
use App\Exceptions\PhantomPDFFailure;
use App\Exceptions\StripeConnectFailure;
use App\Utils\Ninja;
use Exception;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
use Illuminate\Database\Eloquent\RelationNotFoundException;
use Illuminate\Database\QueryException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
use Illuminate\Http\Request;
@ -34,11 +32,11 @@ use Illuminate\Validation\ValidationException;
use PDOException;
use Sentry\Laravel\Integration;
use Sentry\State\Scope;
use Swift_TransportException;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Symfony\Component\Debug\Exception\FatalThrowableError;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use League\Flysystem\UnableToCreateDirectory;
use Throwable;
class Handler extends ExceptionHandler
@ -50,7 +48,30 @@ class Handler extends ExceptionHandler
*/
protected $dontReport = [
PDOException::class,
//Swift_TransportException::class,
MaxAttemptsExceededException::class,
CommandNotFoundException::class,
ValidationException::class,
ModelNotFoundException::class,
NotFoundHttpException::class,
];
protected $selfHostDontReport = [
FilePermissionsFailure::class,
PDOException::class,
MaxAttemptsExceededException::class,
CommandNotFoundException::class,
ValidationException::class,
ModelNotFoundException::class,
NotFoundHttpException::class,
UnableToCreateDirectory::class,
GuzzleHttp\Exception\ConnectException::class,
Symfony\Component\Process\Exception\RuntimeException::class,
InvalidArgumentException::class,
RuntimeException::class,
];
protected $hostedDontReport = [
PDOException::class,
MaxAttemptsExceededException::class,
CommandNotFoundException::class,
ValidationException::class,
@ -80,11 +101,10 @@ class Handler extends ExceptionHandler
{
if (! Schema::hasTable('accounts')) {
info('account table not found');
return;
}
if (Ninja::isHosted() && ! ($exception instanceof ValidationException)) {
if (Ninja::isHosted()) {
Integration::configureScope(function (Scope $scope): void {
$name = 'hosted@invoiceninja.com';
@ -105,8 +125,11 @@ class Handler extends ExceptionHandler
]);
});
Integration::captureUnhandledException($exception);
} elseif (app()->bound('sentry') && $this->shouldReport($exception)) {
if ($this->validException($exception) && $this->sentryShouldReport($exception)) {
Integration::captureUnhandledException($exception);
}
} elseif (app()->bound('sentry')) {
Integration::configureScope(function (Scope $scope): void {
if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
$scope->setUser([
@ -123,7 +146,7 @@ class Handler extends ExceptionHandler
}
});
if ($this->validException($exception)) {
if ($this->validException($exception) && $this->sentryShouldReport($exception)) {
Integration::captureUnhandledException($exception);
}
}
@ -160,6 +183,23 @@ class Handler extends ExceptionHandler
return true;
}
/**
* Determine if the exception is in the "do not report" list.
*
* @param \Throwable $e
* @return bool
*/
protected function sentryShouldReport(Throwable $e)
{
if(Ninja::isHosted())
$dontReport = array_merge($this->hostedDontReport, $this->internalDontReport);
else
$dontReport = array_merge($this->selfHostDontReport, $this->internalDontReport);
return is_null(Arr::first($dontReport, fn ($type) => $e instanceof $type));
}
/**
* Render an exception into an HTTP response.
*
@ -180,8 +220,8 @@ class Handler extends ExceptionHandler
return response()->json(['message' => $exception->getMessage()], 500);
} elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) {
return response()->json(['message'=>'Too many requests'], 429);
} elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
return response()->json(['message'=>'Fatal error'], 500);
// } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
// return response()->json(['message'=>'Fatal error'], 500); //@deprecated
} elseif ($exception instanceof AuthorizationException) {
return response()->json(['message'=> $exception->getMessage()], 401);
} elseif ($exception instanceof TokenMismatchException) {
@ -196,7 +236,6 @@ class Handler extends ExceptionHandler
} elseif ($exception instanceof MethodNotAllowedHttpException && $request->expectsJson()) {
return response()->json(['message'=>'Method not supported for this route'], 404);
} elseif ($exception instanceof ValidationException && $request->expectsJson()) {
// nlog($exception->validator->getMessageBag());
return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422);
} elseif ($exception instanceof RelationNotFoundException && $request->expectsJson()) {
return response()->json(['message' => "Relation `{$exception->relation}` is not a valid include."], 400);
@ -208,13 +247,6 @@ class Handler extends ExceptionHandler
return response()->json(['message' => $exception->getMessage()], 400);
}
// elseif ($exception instanceof QueryException) {
// return response()->json(['message' => 'We had a problem executing this query. Please retry.'], 500);
// }
return parent::render($request, $exception);
}

View File

@ -0,0 +1,34 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Factory;
use App\Models\Scheduler;
class SchedulerFactory
{
public static function create($company_id, $user_id) :Scheduler
{
$scheduler = new Scheduler;
$scheduler->name = '';
$scheduler->company_id = $company_id;
$scheduler->user_id = $user_id;
$scheduler->parameters = [];
$scheduler->is_paused = false;
$scheduler->is_deleted = false;
$scheduler->template = '';
$scheduler->next_run = now()->format('Y-m-d');
$scheduler->next_run_client = now()->format('Y-m-d');
return $scheduler;
}
}

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\BankIntegration;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* BankIntegrationFilters.
@ -68,28 +64,22 @@ class BankIntegrationFilters extends QueryFilters
return $this->builder;
}
$table = 'bank_integrations';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
return $this->builder->where(function ($query) use ($filters) {
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
$query->orWhereNull('deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
$query->orWhere(function ($query) {
$query->whereNotNull('deleted_at');
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
$query->orWhere('is_deleted', 1);
}
});
}
@ -107,19 +97,6 @@ class BankIntegrationFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -12,10 +12,7 @@
namespace App\Filters;
use App\Models\BankTransaction;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* BankTransactionFilters.
@ -77,89 +74,49 @@ class BankTransactionFilters extends QueryFilters
$status_parameters = explode(',', $value);
$status_array = [];
$debit_or_withdrawal_array = [];
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('unmatched', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_UNMATCHED;
// $this->builder->orWhere('status_id', BankTransaction::STATUS_UNMATCHED);
}
$this->builder->where(function ($query) use ($status_parameters){
if (in_array('matched', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_MATCHED;
// $this->builder->where('status_id', BankTransaction::STATUS_MATCHED);
}
$status_array = [];
$debit_or_withdrawal_array = [];
if (in_array('converted', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_CONVERTED;
// $this->builder->where('status_id', BankTransaction::STATUS_CONVERTED);
}
if (in_array('unmatched', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_UNMATCHED;
}
if (in_array('deposits', $status_parameters)) {
$debit_or_withdrawal_array[] = 'CREDIT';
// $this->builder->where('base_type', 'CREDIT');
}
if (in_array('matched', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_MATCHED;
}
if (in_array('withdrawals', $status_parameters)) {
$debit_or_withdrawal_array[] = 'DEBIT';
// $this->builder->where('base_type', 'DEBIT');
}
if (in_array('converted', $status_parameters)) {
$status_array[] = BankTransaction::STATUS_CONVERTED;
}
if(count($status_array) >=1) {
$this->builder->whereIn('status_id', $status_array);
}
if (in_array('deposits', $status_parameters)) {
$debit_or_withdrawal_array[] = 'CREDIT';
}
if(count($debit_or_withdrawal_array) >=1) {
$this->builder->orWhereIn('base_type', $debit_or_withdrawal_array);
}
if (in_array('withdrawals', $status_parameters)) {
$debit_or_withdrawal_array[] = 'DEBIT';
}
if(count($status_array) >=1) {
$query->whereIn('status_id', $status_array);
}
if(count($debit_or_withdrawal_array) >=1) {
$query->orWhereIn('base_type', $debit_or_withdrawal_array);
}
});
return $this->builder;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'bank_transactions';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -188,19 +145,6 @@ class BankTransactionFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*
@ -208,7 +152,6 @@ class BankTransactionFilters extends QueryFilters
*/
public function entityFilter()
{
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
return $this->builder->company();
}
}

View File

@ -55,45 +55,6 @@ class BankTransactionRuleFilters extends QueryFilters
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'bank_transaction_rules';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*

View File

@ -108,56 +108,17 @@ class ClientFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('clients.name', 'like', '%'.$filter.'%')
->orWhere('clients.id_number', 'like', '%'.$filter.'%')
$query->where('name', 'like', '%'.$filter.'%')
->orWhere('id_number', 'like', '%'.$filter.'%')
->orWhereHas('contacts', function ($query) use ($filter) {
$query->where('first_name', 'like', '%'.$filter.'%');
$query->orWhere('last_name', 'like', '%'.$filter.'%');
$query->orWhere('email', 'like', '%'.$filter.'%');
})
->orWhere('clients.custom_value1', 'like', '%'.$filter.'%')
->orWhere('clients.custom_value2', 'like', '%'.$filter.'%')
->orWhere('clients.custom_value3', 'like', '%'.$filter.'%')
->orWhere('clients.custom_value4', 'like', '%'.$filter.'%');
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'clients';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -176,59 +137,7 @@ class ClientFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('clients')
->join('companies', 'companies.id', '=', 'clients.company_id')
->join('client_contacts', 'client_contacts.client_id', '=', 'clients.id')
->where('clients.company_id', '=', $company_id)
->where('client_contacts.is_primary', '=', true)
->where('client_contacts.deleted_at', '=', null)
->select(
DB::raw('COALESCE(clients.country_id, companies.country_id) country_id'),
DB::raw("CONCAT(COALESCE(client_contacts.first_name, ''), ' ', COALESCE(client_contacts.last_name, '')) contact"),
'clients.id',
'clients.name',
'clients.private_notes',
'client_contacts.first_name',
'client_contacts.last_name',
'clients.custom_value1',
'clients.custom_value2',
'clients.custom_value3',
'clients.custom_value4',
'clients.balance',
'clients.last_login',
'clients.created_at',
'clients.created_at as client_created_at',
'client_contacts.phone',
'client_contacts.email',
'clients.deleted_at',
'clients.is_deleted',
'clients.user_id',
'clients.id_number',
'clients.settings'
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Client::class)) {
$query->where('clients.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*
@ -238,4 +147,14 @@ class ClientFilters extends QueryFilters
{
return $this->builder->company();
}
public function filter_details(string $filter = '')
{
if($filter == 'true')
return $this->builder->select('id', 'name', 'number', 'id_number');
return $this->builder;
}
}

View File

@ -37,45 +37,6 @@ class CompanyGatewayFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'company_gateways';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -89,19 +50,6 @@ class CompanyGatewayFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*

View File

@ -13,9 +13,7 @@
namespace App\Filters;
use App\Models\Credit;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
class CreditFilters extends QueryFilters
{
@ -44,20 +42,20 @@ class CreditFilters extends QueryFilters
return $this->builder;
}
if (in_array('draft', $status_parameters)) {
$this->builder->where('status_id', Credit::STATUS_DRAFT);
}
if (in_array('partial', $status_parameters)) {
$this->builder->where('status_id', Credit::STATUS_PARTIAL);
}
$credit_filters = [];
if (in_array('applied', $status_parameters)) {
$this->builder->where('status_id', Credit::STATUS_APPLIED);
}
if (in_array('draft', $status_parameters))
$credit_filters[] = Credit::STATUS_DRAFT;
if (in_array('partial', $status_parameters))
$credit_filters[] = Credit::STATUS_PARTIAL;
//->where('due_date', '>', Carbon::now())
//->orWhere('partial_due_date', '>', Carbon::now());
if (in_array('applied', $status_parameters))
$credit_filters[] = Credit::STATUS_APPLIED;
if(count($credit_filters) >=1)
$this->builder->whereIn('status_id', $credit_filters);
return $this->builder;
}
@ -88,45 +86,6 @@ class CreditFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted - legacy from V1.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'credits';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -140,19 +99,6 @@ class CreditFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
// ..
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\Design;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* DesignFilters.
@ -27,9 +23,10 @@ class DesignFilters extends QueryFilters
*
* @param string query filter
* @return Builder
*
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -40,91 +37,21 @@ class DesignFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'designs';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
*
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
if(is_array($sort_col))
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('designs')
->join('companies', 'companies.id', '=', 'designs.company_id')
->where('designs.company_id', '=', $company_id)
->select(
'designs.id',
'designs.name',
'designs.design',
'designs.created_at',
'designs.created_at as design_created_at',
'designs.deleted_at',
'designs.is_deleted',
'designs.user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Design::class)) {
$query->where('designs.user_id', '=', $user->id);
}
return $query;
return $this->builder;
}
/**
@ -132,7 +59,7 @@ class DesignFilters extends QueryFilters
*
* @return Illuminate\Database\Query\Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
return $this->builder->where('company_id', auth()->user()->company()->id)->orWhere('company_id', null)->orderBy('id','asc');

View File

@ -12,7 +12,6 @@
namespace App\Filters;
use App\Models\Company;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -27,7 +26,7 @@ class DocumentFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -36,8 +35,15 @@ class DocumentFilters extends QueryFilters
return $this->builder;
}
/* If client ID passed to this entity, simply return */
public function client_id(string $client_id = '') :Builder
/**
* Overriding method as client_id does
* not exist on this model, just pass
* back the builder
* @param string $client_id The client hashed id.
*
* @return Builder
*/
public function client_id(string $client_id = ''): Builder
{
return $this->builder;
}
@ -48,11 +54,14 @@ class DocumentFilters extends QueryFilters
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort = '') : Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
if(is_array($sort_col))
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
return $this->builder;
}
@ -64,19 +73,6 @@ class DocumentFilters extends QueryFilters
return $this->builder;
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\Expense;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* ExpenseCategoryFilters.
@ -35,49 +31,10 @@ class ExpenseCategoryFilters extends QueryFilters
return $this->builder;
}
return $this->builder->where('expense_categories.name', 'like', '%'.$filter.'%');
return $this->builder->where('name', 'like', '%'.$filter.'%');
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'expense_categories';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -88,28 +45,13 @@ class ExpenseCategoryFilters extends QueryFilters
{
$sort_col = explode('|', $sort);
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['name'])) {
if (is_array($sort_col) && in_array($sort_col[1], ['asc', 'desc']) && in_array($sort_col[0], ['name']))
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
return $this->builder;
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*
@ -117,8 +59,6 @@ class ExpenseCategoryFilters extends QueryFilters
*/
public function entityFilter()
{
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
return $this->builder->company();
}
}

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\Expense;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* ExpenseFilters.
@ -36,11 +32,11 @@ class ExpenseFilters extends QueryFilters
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('expenses.public_notes', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value1', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value2', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value3', 'like', '%'.$filter.'%')
->orWhere('expenses.custom_value4', 'like', '%'.$filter.'%');
$query->where('public_notes', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -69,14 +65,15 @@ class ExpenseFilters extends QueryFilters
return $this->builder;
}
$this->builder->whereNested(function ($query) use($status_parameters){
$this->builder->where(function ($query) use($status_parameters){
if (in_array('logged', $status_parameters)) {
$query->orWhere(function ($query){
$query->where('amount', '>', 0)
->whereNull('invoice_id')
->whereNull('payment_date');
->whereNull('payment_date')
->where('should_be_invoiced',false);
});
}
@ -135,46 +132,6 @@ class ExpenseFilters extends QueryFilters
return $this->builder;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'expenses';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -192,46 +149,6 @@ class ExpenseFilters extends QueryFilters
return $this->builder;
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('expenses')
->join('companies', 'companies.id', '=', 'expenses.company_id')
->where('expenses.company_id', '=', $company_id)
->select(
DB::raw('COALESCE(expenses.country_id, companies.country_id) country_id'),
DB::raw("CONCAT(COALESCE(expense_contacts.first_name, ''), ' ', COALESCE(expense_contacts.last_name, '')) contact"),
'expenses.id',
'expenses.private_notes',
'expenses.custom_value1',
'expenses.custom_value2',
'expenses.custom_value3',
'expenses.custom_value4',
'expenses.created_at',
'expenses.created_at as expense_created_at',
'expenses.deleted_at',
'expenses.is_deleted',
'expenses.user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Expense::class)) {
$query->where('expenses.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*

View File

@ -12,7 +12,6 @@
namespace App\Filters;
use App\Models\Invoice;
use App\Models\User;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
@ -47,36 +46,42 @@ class InvoiceFilters extends QueryFilters
$status_parameters = explode(',', $value);
$invoice_filters = [];
if (in_array('all', $status_parameters)) {
return $this->builder;
}
if (in_array('paid', $status_parameters)) {
$invoice_filters[] = Invoice::STATUS_PAID;
}
$this->builder->where(function ($query) use($status_parameters){
if (in_array('unpaid', $status_parameters)) {
$invoice_filters[] = Invoice::STATUS_SENT;
$invoice_filters[] = Invoice::STATUS_PARTIAL;
}
$invoice_filters = [];
if(count($invoice_filters) >0){
$this->builder->whereIn('status_id', $invoice_filters);
}
if (in_array('overdue', $status_parameters)) {
$this->builder->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('due_date', '<', Carbon::now())
->orWhere('partial_due_date', '<', Carbon::now());
}
if (in_array('paid', $status_parameters)) {
$invoice_filters[] = Invoice::STATUS_PAID;
}
if (in_array('unpaid', $status_parameters)) {
$invoice_filters[] = Invoice::STATUS_SENT;
$invoice_filters[] = Invoice::STATUS_PARTIAL;
}
if(count($invoice_filters) >0){
$query->whereIn('status_id', $invoice_filters);
}
if (in_array('overdue', $status_parameters)) {
$query->orWhereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('due_date', '<', Carbon::now())
->orWhere('partial_due_date', '<', Carbon::now());
}
});
return $this->builder;
}
public function number(string $number = '') :Builder
{
if(strlen($number) == 0)
return $this->builder;
return $this->builder->where('number', $number);
}
@ -106,45 +111,6 @@ class InvoiceFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted - legacy from V1.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'invoices';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* @return Builder
* @throws RuntimeException
@ -221,18 +187,6 @@ class InvoiceFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -42,45 +41,6 @@ class PaymentFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'payments';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Returns a list of payments that can be matched to bank transactions
*/
@ -88,11 +48,13 @@ class PaymentFilters extends QueryFilters
{
if($value == 'true'){
return $this->builder
->where('is_deleted',0)
->where(function ($query){
$query->whereNull('transaction_id')
->orWhere("transaction_id","");
->orWhere("transaction_id","")
->company();
});
}
@ -110,7 +72,10 @@ class PaymentFilters extends QueryFilters
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
if(is_array($sort_col))
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
return true;
}
public function number(string $number) : Builder
@ -118,18 +83,6 @@ class PaymentFilters extends QueryFilters
return $this->builder->where('number', $number);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\Design;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* PaymentTermFilters.
@ -29,7 +25,7 @@ class PaymentTermFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -40,80 +36,26 @@ class PaymentTermFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'payment_terms';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
// return $this->builder->whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null);
}
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -53,45 +52,6 @@ class ProductFilters extends QueryFilters
return $this->builder->where('product_key', $filter);
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'products';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -108,18 +68,6 @@ class ProductFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\Project;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* ProjectFilters.
@ -42,45 +38,6 @@ class ProjectFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'projects';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -91,44 +48,8 @@ class ProjectFilters extends QueryFilters
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('projects')
->join('companies', 'companies.id', '=', 'projects.company_id')
->where('projects.company_id', '=', $company_id)
->select(
'projects.id',
'projects.name',
'projects.public_notes',
'projects.private_notes',
'projects.created_at',
'projects.created_at as project_created_at',
'projects.deleted_at',
'projects.is_deleted',
'projects.user_id',
'projects.assigned_user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Project::class)) {
$query->where('projects.user_id', '=', $user->id);
}
return $query;
if(is_array($sort_col))
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
@ -138,8 +59,6 @@ class ProjectFilters extends QueryFilters
*/
public function entityFilter()
{
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
// return $this->builder->whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null);
return $this->builder->company();
}
}

View File

@ -12,7 +12,6 @@
namespace App\Filters;
use App\Models\PurchaseOrder;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
class PurchaseOrderFilters extends QueryFilters
@ -42,27 +41,35 @@ class PurchaseOrderFilters extends QueryFilters
return $this->builder;
}
$po_status = [];
$this->builder->where(function ($query) use ($status_parameters){
if (in_array('draft', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_DRAFT;
}
$po_status = [];
if (in_array('sent', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_SENT;
}
if (in_array('draft', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_DRAFT;
}
if (in_array('accepted', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_ACCEPTED;
}
if (in_array('sent', $status_parameters)) {
$query->orWhere(function ($q){
$q->where('status_id', PurchaseOrder::STATUS_SENT)
->whereNull('due_date')
->orWhere('due_date', '>=', now()->toDateString());
});
}
if (in_array('cancelled', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_CANCELLED;
}
if (in_array('accepted', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_ACCEPTED;
}
if(count($status_parameters) >=1) {
$this->builder->whereIn('status_id', $status_parameters);
}
if (in_array('cancelled', $status_parameters)) {
$po_status[] = PurchaseOrder::STATUS_CANCELLED;
}
if(count($status_parameters) >=1) {
$query->whereIn('status_id', $status_parameters);
}
});
return $this->builder;
}
@ -93,45 +100,6 @@ class PurchaseOrderFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted - legacy from V1.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'purchase_orders';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -145,19 +113,6 @@ class PurchaseOrderFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
// ..
}
/**
* Filters the query by the users company ID.
*

View File

@ -129,6 +129,38 @@ abstract class QueryFilters
return $parts;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters) {
if (in_array(self::STATUS_ACTIVE, $filters)) {
$query->orWhereNull('deleted_at');
}
if (in_array(self::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) {
$query->whereNotNull('deleted_at')->where('is_deleted',0);
});
}
if (in_array(self::STATUS_DELETED, $filters)) {
$query->orWhere('is_deleted', 1);
}
});
}
/**
* String to operator convertor.
*

View File

@ -12,7 +12,6 @@
namespace App\Filters;
use App\Models\Quote;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -66,83 +65,52 @@ class QuoteFilters extends QueryFilters
return $this->builder;
}
$quote_filters = [];
$this->builder->where(function ($query) use ($status_parameters){
if (in_array('draft', $status_parameters)) {
$quote_filters[] = Quote::STATUS_DRAFT;
}
if (in_array('sent', $status_parameters)) {
$query->orWhere(function ($q){
$q->where('status_id', Quote::STATUS_SENT)
->whereNull('due_date')
->orWhere('due_date', '>=', now()->toDateString());
});
}
$quote_filters = [];
if (in_array('sent', $status_parameters)) {
$quote_filters[] = Quote::STATUS_SENT;
}
if (in_array('draft', $status_parameters)) {
$quote_filters[] = Quote::STATUS_DRAFT;
}
if (in_array('approved', $status_parameters)) {
$quote_filters[] = Quote::STATUS_APPROVED;
}
if (in_array('approved', $status_parameters)) {
$quote_filters[] = Quote::STATUS_APPROVED;
}
if(count($quote_filters) >=1){
$this->builder->whereIn('status_id', $quote_filters);
}
if(count($quote_filters) >0){
$query->orWhereIn('status_id', $quote_filters);
}
if (in_array('expired', $status_parameters)) {
$this->builder->orWhere(function ($query){
$query->where('status_id', Quote::STATUS_SENT)
->whereNotNull('due_date')
->where('due_date', '<=', now()->toDateString());
});
}
if (in_array('expired', $status_parameters)) {
$query->orWhere(function ($q){
$q->where('status_id', Quote::STATUS_SENT)
->whereNotNull('due_date')
->where('due_date', '<=', now()->toDateString());
});
}
if (in_array('upcoming', $status_parameters)) {
$this->builder->orWhere(function ($query){
$query->where('status_id', Quote::STATUS_SENT)
->where('due_date', '>=', now()->toDateString())
->orderBy('due_date', 'DESC');
});
}
if (in_array('upcoming', $status_parameters)) {
$query->orWhere(function ($q){
$q->where('status_id', Quote::STATUS_SENT)
->where('due_date', '>=', now()->toDateString())
->orderBy('due_date', 'DESC');
});
}
});
return $this->builder;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'quotes';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
public function number($number = '')
{
return $this->builder->where('number', 'like', '%'.$number.'%');
@ -164,18 +132,6 @@ class QuoteFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\RecurringExpense;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* RecurringExpenseFilters.
@ -29,58 +25,18 @@ class RecurringExpenseFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('recurring_expenses.name', 'like', '%'.$filter.'%')
->orWhere('recurring_expenses.id_number', 'like', '%'.$filter.'%')
->orWhere('recurring_expenses.custom_value1', 'like', '%'.$filter.'%')
->orWhere('recurring_expenses.custom_value2', 'like', '%'.$filter.'%')
->orWhere('recurring_expenses.custom_value3', 'like', '%'.$filter.'%')
->orWhere('recurring_expenses.custom_value4', 'like', '%'.$filter.'%');
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'recurring_expenses';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('public_notes', 'like', '%'.$filter.'%')
->orWhere('custom_value1', 'like', '%'.$filter.'%')
->orWhere('custom_value2', 'like', '%'.$filter.'%')
->orWhere('custom_value3', 'like', '%'.$filter.'%')
->orWhere('custom_value4', 'like', '%'.$filter.'%');
});
}
@ -90,52 +46,13 @@ class RecurringExpenseFilters extends QueryFilters
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('recurring_expenses')
->join('companies', 'companies.id', '=', 'recurring_expenses.company_id')
->where('recurring_expenses.company_id', '=', $company_id)
->select(
DB::raw('COALESCE(recurring_expenses.country_id, companies.country_id) country_id'),
'recurring_expenses.id',
'recurring_expenses.private_notes',
'recurring_expenses.custom_value1',
'recurring_expenses.custom_value2',
'recurring_expenses.custom_value3',
'recurring_expenses.custom_value4',
'recurring_expenses.created_at',
'recurring_expenses.created_at as expense_created_at',
'recurring_expenses.deleted_at',
'recurring_expenses.is_deleted',
'recurring_expenses.user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', RecurringExpense::class)) {
$query->where('recurring_expenses.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*

View File

@ -12,7 +12,6 @@
namespace App\Filters;
use App\Models\RecurringInvoice;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -65,59 +64,23 @@ class RecurringInvoiceFilters extends QueryFilters
return $this->builder;
}
if (in_array('active', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_ACTIVE);
}
$recurring_filters = [];
if (in_array('paused', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_PAUSED);
}
if (in_array('active', $status_parameters))
$recurring_filters[] = RecurringInvoice::STATUS_ACTIVE;
if (in_array('completed', $status_parameters)) {
$this->builder->where('status_id', RecurringInvoice::STATUS_COMPLETED);
}
if (in_array('paused', $status_parameters))
$recurring_filters[] = RecurringInvoice::STATUS_PAUSED;
if (in_array('completed', $status_parameters))
$recurring_filters[] = RecurringInvoice::STATUS_COMPLETED;
if(count($recurring_filters) >= 1)
return $this->builder->whereIn('status_id', $recurring_filters);
return $this->builder;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'recurring_invoices';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
@ -133,18 +96,6 @@ class RecurringInvoiceFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -26,7 +25,7 @@ class RecurringQuoteFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -40,76 +39,25 @@ class RecurringQuoteFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'recurring_';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\User;
use App\Models\Webhook;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* SubscriptionFilters.
@ -29,7 +25,7 @@ class SubscriptionFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -40,89 +36,25 @@ class SubscriptionFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'subscriptions';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('subscriptions')
->join('companies', 'companies.id', '=', 'subscriptions.company_id')
->where('subscriptions.company_id', '=', $company_id);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Webhook::class)) {
$query->where('subscriptions.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -63,24 +62,12 @@ class SystemLogFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Builder;
@ -29,7 +28,7 @@ class TaskFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -55,7 +54,7 @@ class TaskFilters extends QueryFilters
* @param string client_status The invoice status as seen by the client
* @return Builder
*/
public function client_status(string $value = '') :Builder
public function client_status(string $value = ''): Builder
{
if (strlen($value) == 0) {
return $this->builder;
@ -74,46 +73,6 @@ class TaskFilters extends QueryFilters
return $this->builder;
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'tasks';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
public function project_tasks($project)
{
@ -130,31 +89,19 @@ class TaskFilters extends QueryFilters
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -26,7 +25,7 @@ class TaskStatusFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -37,45 +36,6 @@ class TaskStatusFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'task_statuses';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -89,25 +49,12 @@ class TaskStatusFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -37,45 +36,6 @@ class TaxRateFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'tax_rates';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -89,25 +49,12 @@ class TaxRateFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
return $this->builder;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,10 +11,7 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* TokenFilters.
@ -39,45 +36,6 @@ class TokenFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'company_tokens';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
@ -90,48 +48,13 @@ class TokenFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('company_tokens')
->join('companies', 'companies.id', '=', 'company_tokens.company_id')
->where('company_tokens.company_id', '=', $company_id)
->select(
'company_tokens.id',
'company_tokens.name',
'company_tokens.token',
'company_tokens.created_at',
'company_tokens.created_at as token_created_at',
'company_tokens.deleted_at',
'company_tokens.is_deleted',
'company_tokens.user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', CompanyToken::class)) {
$query->where('company_tokens.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -11,7 +11,6 @@
namespace App\Filters;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
/**
@ -40,44 +39,6 @@ class UserFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'users';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
@ -92,18 +53,6 @@ class UserFilters extends QueryFilters
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
}
/**
* Filters the query by the users company ID.
*
@ -111,10 +60,29 @@ class UserFilters extends QueryFilters
*/
public function entityFilter()
{
//return $this->builder->user_companies()->whereCompanyId(auth()->user()->company()->id);
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
return $this->builder->whereHas('company_users', function ($q) {
$q->where('company_id', '=', auth()->user()->company()->id);
});
}
/**
* Overrides the base with() function as no company ID
* exists on the user table
*
* @param string $value Hashed ID of the user to return back in the dataset
*
* @return Builder
*/
public function with(string $value = ''): Builder
{
if(strlen($value) == 0)
return $this->builder;
return $this->builder
->orWhere($this->with_property, $value)
->orderByRaw("{$this->with_property} = ? DESC", [$value])
->where('account_id', auth()->user()->account_id);
}
}

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\User;
use App\Models\Vendor;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* VendorFilters.
@ -29,7 +25,7 @@ class VendorFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
@ -50,120 +46,26 @@ class VendorFilters extends QueryFilters
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'vendors';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
});
}
/**
* Sorts the list based on $sort.
*
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('vendors')
->join('companies', 'companies.id', '=', 'vendors.company_id')
->join('vendor_contacts', 'vendor_contacts.vendor_id', '=', 'vendors.id')
->where('vendors.company_id', '=', $company_id)
->where('vendor_contacts.is_primary', '=', true)
->where('vendor_contacts.deleted_at', '=', null)
->select(
// DB::raw('COALESCE(vendors.currency_id, companies.currency_id) currency_id'),
DB::raw('COALESCE(vendors.country_id, companies.country_id) country_id'),
DB::raw("CONCAT(COALESCE(vendor_contacts.first_name, ''), ' ', COALESCE(vendor_contacts.last_name, '')) contact"),
'vendors.id',
'vendors.name',
'vendors.private_notes',
'vendor_contacts.first_name',
'vendor_contacts.last_name',
'vendors.custom_value1',
'vendors.custom_value2',
'vendors.custom_value3',
'vendors.custom_value4',
'vendors.balance',
'vendors.last_login',
'vendors.created_at',
'vendors.created_at as vendor_created_at',
'vendor_contacts.phone',
'vendor_contacts.email',
'vendors.deleted_at',
'vendors.is_deleted',
'vendors.user_id',
'vendors.id_number',
'vendors.settings'
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Vendor::class)) {
$query->where('vendors.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
//return $this->builder->whereCompanyId(auth()->user()->company()->id);
return $this->builder->company();
}
}

View File

@ -11,11 +11,7 @@
namespace App\Filters;
use App\Models\User;
use App\Models\Webhook;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
/**
* TokenFilters.
@ -29,53 +25,14 @@ class WebhookFilters extends QueryFilters
* @return Builder
* @deprecated
*/
public function filter(string $filter = '') : Builder
public function filter(string $filter = ''): Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
return $this->builder->where(function ($query) use ($filter) {
$query->where('webhooks.target_url', 'like', '%'.$filter.'%');
});
}
/**
* Filters the list based on the status
* archived, active, deleted.
*
* @param string filter
* @return Builder
*/
public function status(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
$table = 'webhooks';
$filters = explode(',', $filter);
return $this->builder->where(function ($query) use ($filters, $table) {
$query->whereNull($table.'.id');
if (in_array(parent::STATUS_ACTIVE, $filters)) {
$query->orWhereNull($table.'.deleted_at');
}
if (in_array(parent::STATUS_ARCHIVED, $filters)) {
$query->orWhere(function ($query) use ($table) {
$query->whereNotNull($table.'.deleted_at');
if (! in_array($table, ['users'])) {
$query->where($table.'.is_deleted', '=', 0);
}
});
}
if (in_array(parent::STATUS_DELETED, $filters)) {
$query->orWhere($table.'.is_deleted', '=', 1);
}
$query->where('target_url', 'like', '%'.$filter.'%');
});
}
@ -85,54 +42,19 @@ class WebhookFilters extends QueryFilters
* @param string sort formatted as column|asc
* @return Builder
*/
public function sort(string $sort) : Builder
public function sort(string $sort): Builder
{
$sort_col = explode('|', $sort);
return $this->builder->orderBy($sort_col[0], $sort_col[1]);
}
/**
* Returns the base query.
*
* @param int company_id
* @param User $user
* @return Builder
* @deprecated
*/
public function baseQuery(int $company_id, User $user) : Builder
{
$query = DB::table('webhooks')
->join('companies', 'companies.id', '=', 'webhooks.company_id')
->where('webhooks.company_id', '=', $company_id)
->select(
'webhooks.id',
'webhooks.target_url',
'webhooks.event_id',
'webhooks.created_at',
'webhooks.created_at as token_created_at',
'webhooks.deleted_at',
'webhooks.format',
'webhooks.user_id',
);
/*
* If the user does not have permissions to view all invoices
* limit the user to only the invoices they have created
*/
if (Gate::denies('view-list', Webhook::class)) {
$query->where('webhooks.user_id', '=', $user->id);
}
return $query;
}
/**
* Filters the query by the users company ID.
*
* @return Illuminate\Database\Query\Builder
* @return Builder
*/
public function entityFilter()
public function entityFilter(): Builder
{
return $this->builder->company();
}

View File

@ -24,6 +24,9 @@ use Illuminate\View\View;
function isActive($page, bool $boolean = false)
{
$current_page = Route::currentRouteName();
$action = Route::currentRouteAction(); // string
$show = str_replace(['.show','payment_methodss','documentss','subscriptionss','paymentss'],['s.index','payment_methods','documents','subscriptions','payments'], $current_page);
if ($page == $current_page && $boolean) {
return true;
@ -33,6 +36,12 @@ function isActive($page, bool $boolean = false)
return 'bg-gray-200';
}
if(($page == $show) && $boolean){
return true;
}
return false;
}

View File

@ -65,8 +65,20 @@ class GmailTransport extends AbstractTransport
$body->setRaw($this->base64_encode($bcc_list.$message->toString()));
$service->users_messages->send('me', $body, []);
try{
$service->users_messages->send('me', $body, []);
}
catch(Google\Service\Exception $e) {
/* Need to slow down */
if($e->getCode() == '429') {
sleep(5);
$service->users_messages->send('me', $body, []);
}
}
}
private function base64_encode($data)

View File

@ -87,10 +87,10 @@ class SwissQrGenerator
$qrBill->setUltimateDebtor(
QrBill\DataGroup\Element\StructuredAddress::createWithStreet(
substr($this->client->present()->name(), 0 , 70),
$this->client->address1 ? substr($this->client->address1, 0 , 70) : '_',
$this->client->address2 ? substr($this->client->address2, 0 , 16) : '_',
$this->client->postal_code ? substr($this->client->postal_code, 0, 16) : '_',
$this->client->city ? substr($this->client->city, 0, 35) : '_',
$this->client->address1 ? substr($this->client->address1, 0 , 70) : ' ',
$this->client->address2 ? substr($this->client->address2, 0 , 16) : ' ',
$this->client->postal_code ? substr($this->client->postal_code, 0, 16) : ' ',
$this->client->city ? substr($this->client->city, 0, 35) : ' ',
'CH'
));

View File

@ -67,7 +67,6 @@ class AccountController extends BaseController
* tags={"signup"},
* summary="Attempts a new account signup",
* description="Attempts a new account signup and returns a CompanyUser object on success",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
* name="token_name",

View File

@ -46,7 +46,6 @@ class ActivityController extends BaseController
* tags={"actvities"},
* summary="Gets a list of actvities",
* description="Lists all activities",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -92,6 +91,10 @@ class ActivityController extends BaseController
->take($default_activities);
if ($request->has('react')) {
if(!auth()->user()->isAdmin())
return response()->json(['data' => []], 200);
$system = ctrans('texts.system');
$data = $activities->cursor()->map(function ($activity) use ($system) {
@ -131,7 +134,6 @@ class ActivityController extends BaseController
* tags={"actvities"},
* summary="Gets a PDF for the given activity",
* description="Gets a PDF for the given activity",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(

View File

@ -56,7 +56,7 @@ class LoginController extends BaseController
* description="Authentication",
* @OA\ExternalDocumentation(
* description="Find out more",
* url="http://docs.invoiceninja.com"
* url="https://invoiceninja.github.io"
* )
* )
*/
@ -249,7 +249,6 @@ class LoginController extends BaseController
* tags={"refresh"},
* summary="Refreshes the dataset",
* description="Refreshes the dataset",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -127,7 +127,6 @@ class YodleeController extends BaseController
* tags={"yodlee"},
* summary="Processing webhooks from Yodlee",
* description="Notifies the system when a data point can be refreshed",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -15,6 +15,7 @@ use App\Factory\BankIntegrationFactory;
use App\Filters\BankIntegrationFilters;
use App\Helpers\Bank\Yodlee\Yodlee;
use App\Http\Requests\BankIntegration\AdminBankIntegrationRequest;
use App\Http\Requests\BankIntegration\BulkBankIntegrationRequest;
use App\Http\Requests\BankIntegration\CreateBankIntegrationRequest;
use App\Http\Requests\BankIntegration\DestroyBankIntegrationRequest;
use App\Http\Requests\BankIntegration\EditBankIntegrationRequest;
@ -54,7 +55,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Gets a list of bank_integrations",
* description="Lists all bank integrations",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -115,7 +115,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Shows a bank_integration",
* description="Displays a bank_integration by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -171,7 +170,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Shows a bank_integration for editing",
* description="Displays a bank_integration by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -227,7 +225,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Updates a bank_integration",
* description="Handles the updating of a bank_integration by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -286,7 +283,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Gets a new blank bank_integration object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -332,7 +328,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Adds a bank_integration",
* description="Adds an bank_integration to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -380,7 +375,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Deletes a bank_integration",
* description="Handles the deletion of a bank_integration by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -434,7 +428,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Performs bulk actions on an array of bank_integrations",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -473,21 +466,16 @@ class BankIntegrationController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkBankIntegrationRequest $request)
{
$action = request()->input('action');
if(!in_array($action, ['archive', 'restore', 'delete']))
return response()->json(['message' => 'Unsupported action.'], 400);
$ids = request()->input('ids');
$bank_integrations = BankIntegration::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
$bank_integrations->each(function ($bank_integration, $key) use ($action) {
if (auth()->user()->can('edit', $bank_integration)) {
$this->bank_integration_repo->{$action}($bank_integration);
}
$this->bank_integration_repo->{$action}($bank_integration);
});
/* Need to understand which permission are required for the given bulk action ie. view / edit */
@ -507,7 +495,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Gets the list of accounts from the remote server",
* description="Adds an bank_integration to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -599,7 +586,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Removes an account from the integration",
* description="Removes an account from the integration",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -633,7 +619,7 @@ class BankIntegrationController extends BaseController
if(!$bank_account_id)
return response()->json(['message' => 'Not yet authenticated with Bank Integration service'], 400);
$bi = BankIntegration::withTrashed()->where('bank_account_id', $acc_id)->where('company_id', auth()->user()->company()->id)->firstOrFail();
$bi = BankIntegration::withTrashed()->where('bank_account_id', $acc_id)->company()->firstOrFail();
$yodlee = new Yodlee($bank_account_id);
$res = $yodlee->deleteAccount($acc_id);
@ -657,7 +643,6 @@ class BankIntegrationController extends BaseController
* tags={"bank_integrations"},
* summary="Retrieve transactions for a account",
* description="Retrieve transactions for a account",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -15,6 +15,7 @@ use App\Factory\BankTransactionFactory;
use App\Filters\BankTransactionFilters;
use App\Helpers\Bank\Yodlee\Yodlee;
use App\Http\Requests\BankTransaction\AdminBankTransactionRequest;
use App\Http\Requests\BankTransaction\BulkBankTransactionRequest;
use App\Http\Requests\BankTransaction\CreateBankTransactionRequest;
use App\Http\Requests\BankTransaction\DestroyBankTransactionRequest;
use App\Http\Requests\BankTransaction\EditBankTransactionRequest;
@ -58,7 +59,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Gets a list of bank_transactions",
* description="Lists all bank integrations",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -119,7 +119,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Shows a bank_transaction",
* description="Displays a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -175,7 +174,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Shows a bank_transaction for editing",
* description="Displays a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -231,7 +229,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Updates a bank_transaction",
* description="Handles the updating of a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -290,7 +287,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Gets a new blank bank_transaction object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -336,7 +332,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Adds a bank_transaction",
* description="Adds an bank_transaction to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -384,7 +379,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Deletes a bank_transaction",
* description="Handles the deletion of a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -438,7 +432,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Performs bulk actions on an array of bank_transations",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -477,12 +470,9 @@ class BankTransactionController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkBankTransactionRequest $request)
{
$action = request()->input('action');
if(!in_array($action, ['archive', 'restore', 'delete', 'convert_matched']))
return response()->json(['message' => 'Unsupported action.'], 400);
$action = $request->input('action');
$ids = request()->input('ids');
@ -490,19 +480,14 @@ class BankTransactionController extends BaseController
if($action == 'convert_matched') //catch this action
{
if(auth()->user()->isAdmin())
{
$this->bank_transaction_repo->convert_matched($bank_transactions);
}
else
return;
$this->bank_transaction_repo->convert_matched($bank_transactions);
}
else {
$bank_transactions->each(function ($bank_transaction, $key) use ($action) {
if (auth()->user()->can('edit', $bank_transaction)) {
$this->bank_transaction_repo->{$action}($bank_transaction);
}
});
}
@ -523,7 +508,6 @@ class BankTransactionController extends BaseController
* tags={"bank_transactions"},
* summary="Performs match actions on an array of bank_transactions",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),

View File

@ -16,6 +16,7 @@ use App\Factory\BankTransactionRuleFactory;
use App\Filters\BankTransactionFilters;
use App\Filters\BankTransactionRuleFilters;
use App\Helpers\Bank\Yodlee\Yodlee;
use App\Http\Requests\BankTransactionRule\BulkBankTransactionRuleRequest;
use App\Http\Requests\BankTransactionRule\CreateBankTransactionRuleRequest;
use App\Http\Requests\BankTransactionRule\DestroyBankTransactionRuleRequest;
use App\Http\Requests\BankTransactionRule\EditBankTransactionRuleRequest;
@ -61,7 +62,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Gets a list of bank_transaction_rules",
* description="Lists all bank transaction rules",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -122,7 +122,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Shows a bank_transaction",
* description="Displays a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -178,7 +177,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Shows a bank_transaction for editing",
* description="Displays a bank_transaction by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -234,7 +232,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Updates a bank_transaction Rule",
* description="Handles the updating of a bank_transaction rule by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -293,7 +290,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Gets a new blank bank_transaction rule object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -335,11 +331,10 @@ class BankTransactionRuleController extends BaseController
*
* @OA\Post(
* path="/api/v1/bank_transaction_rules",
* operationId="storeBankTransaction",
* operationId="storeBankTransactionRule",
* tags={"bank_transaction_rules"},
* summary="Adds a bank_transaction rule",
* description="Adds an bank_transaction to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -387,7 +382,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Deletes a bank_transaction rule",
* description="Handles the deletion of a bank_transaction rule by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -441,7 +435,6 @@ class BankTransactionRuleController extends BaseController
* tags={"bank_transaction_rules"},
* summary="Performs bulk actions on an array of bank_transation rules",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -480,25 +473,21 @@ class BankTransactionRuleController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkBankTransactionRuleRequest $request)
{
$action = request()->input('action');
$action = $request->input('action');
if(!in_array($action, ['archive', 'restore', 'delete']))
return response()->json(['message' => 'Unsupported action.'], 400);
$ids = request()->input('ids');
$ids = $request->input('ids');
$bank_transaction_rules = BankTransactionRule::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
$bank_transaction_rules->each(function ($bank_transaction_rule, $key) use ($action) {
if (auth()->user()->can('edit', $bank_transaction_rule)) {
$this->bank_transaction_repo->{$action}($bank_transaction_rule);
}
});
$bank_transaction_rules = BankTransactionRule::withTrashed()
->whereIn('id', $this->transformKeys($ids))
->company()
->cursor()
->each(function ($bank_transaction_rule, $key) use ($action) {
$this->bank_transaction_repo->{$action}($bank_transaction_rule);
});
/* Need to understand which permission are required for the given bulk action ie. view / edit */
return $this->listResponse(BankTransactionRule::withTrashed()->whereIn('id', $this->transformKeys($ids))->company());
}

View File

@ -12,9 +12,20 @@
namespace App\Http\Controllers;
use App\Models\Account;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
use App\Models\BankTransactionRule;
use App\Models\ClientGatewayToken;
use App\Models\Company;
use App\Models\CompanyGateway;
use App\Models\Design;
use App\Models\ExpenseCategory;
use App\Models\GroupSetting;
use App\Models\PaymentTerm;
use App\Models\Scheduler;
use App\Models\TaxRate;
use App\Models\User;
use App\Models\Webhook;
use App\Transformers\ArraySerializer;
use App\Transformers\EntityTransformer;
use App\Utils\Ninja;
@ -109,6 +120,7 @@ class BaseController extends Controller
'company.bank_integrations',
'company.bank_transactions',
'company.bank_transaction_rules',
'company.task_schedulers',
];
private $mini_load = [
@ -128,6 +140,7 @@ class BaseController extends Controller
'company.subscriptions',
'company.bank_integrations',
'company.bank_transaction_rules',
'company.task_schedulers',
];
public function __construct()
@ -221,6 +234,7 @@ class BaseController extends Controller
}
$transformer = new $this->entity_transformer($this->serializer);
$updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0;
if ($user->getCompany()->is_large && $updated_at == 0) {
@ -238,7 +252,6 @@ class BaseController extends Controller
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens', 'documents');
if (! $user->hasPermission('view_client')) {
// $query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
@ -257,7 +270,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_credit')) {
// $query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
@ -278,7 +290,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_expense')) {
// $query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
@ -288,14 +299,11 @@ class BaseController extends Controller
'company.groups' => function ($query) use ($updated_at, $user) {
$query->whereNotNull('updated_at')->with('documents');
// if(!$user->isAdmin())
// $query->where('group_settings.user_id', $user->id);
},
'company.invoices'=> function ($query) use ($updated_at, $user) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_invoice')) {
// $query->where('invoices.user_id', $user->id)->orWhere('invoices.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
@ -308,7 +316,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('paymentables', 'documents');
if (! $user->hasPermission('view_payment')) {
// $query->where('payments.user_id', $user->id)->orWhere('payments.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('payments.user_id', $user->id)->orWhere('payments.assigned_user_id', $user->id);
@ -327,13 +334,11 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_product')) {
// $query->where('products.user_id', $user->id)->orWhere('products.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('products.user_id', $user->id)->orWhere('products.assigned_user_id', $user->id);
});
}
},
@ -341,7 +346,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_project')) {
// $query->where('projects.user_id', $user->id)->orWhere('projects.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('projects.user_id', $user->id)->orWhere('projects.assigned_user_id', $user->id);
@ -353,8 +357,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_purchase_order')) {
// $query->where('purchase_orders.user_id', $user->id)->orWhere('purchase_orders.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('purchase_orders.user_id', $user->id)->orWhere('purchase_orders.assigned_user_id', $user->id);
@ -366,8 +368,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_quote')) {
// $query->where('quotes.user_id', $user->id)->orWhere('quotes.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('quotes.user_id', $user->id)->orWhere('quotes.assigned_user_id', $user->id);
@ -379,7 +379,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents', 'client.gateway_tokens', 'client.group_settings', 'client.company');
if (! $user->hasPermission('view_recurring_invoice')) {
// $query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
@ -391,7 +390,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_recurring_expense')) {
// $query->where('recurring_expenses.user_id', $user->id)->orWhere('recurring_expenses.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('recurring_expenses.user_id', $user->id)->orWhere('recurring_expenses.assigned_user_id', $user->id);
@ -403,7 +401,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('documents');
if (! $user->hasPermission('view_task')) {
// $query->where('tasks.user_id', $user->id)->orWhere('tasks.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('tasks.user_id', $user->id)->orWhere('tasks.assigned_user_id', $user->id);
@ -418,7 +415,6 @@ class BaseController extends Controller
$query->where('updated_at', '>=', $updated_at)->with('contacts', 'documents');
if (! $user->hasPermission('view_vendor')) {
// $query->where('vendors.user_id', $user->id)->orWhere('vendors.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('vendors.user_id', $user->id)->orWhere('vendors.assigned_user_id', $user->id);
@ -465,6 +461,13 @@ class BaseController extends Controller
$query->where('bank_transaction_rules.user_id', $user->id);
}
},
'company.task_schedulers'=> function ($query) use ($updated_at, $user) {
$query->where('updated_at', '>=', $updated_at);
if (! $user->isAdmin()) {
$query->where('schedulers.user_id', $user->id);
}
},
]
);
@ -545,6 +548,12 @@ class BaseController extends Controller
$query->where('bank_transaction_rules.user_id', $user->id);
}
},
'company.task_schedulers'=> function ($query) use ($user) {
if (! $user->isAdmin()) {
$query->where('schedulers.user_id', $user->id);
}
},
]
);
@ -596,7 +605,6 @@ class BaseController extends Controller
$query->where('clients.created_at', '>=', $created_at)->with('contacts.company', 'gateway_tokens', 'documents');
if (! $user->hasPermission('view_client')) {
// $query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('clients.user_id', $user->id)->orWhere('clients.assigned_user_id', $user->id);
@ -615,7 +623,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_credit')) {
// $query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('credits.user_id', $user->id)->orWhere('credits.assigned_user_id', $user->id);
@ -629,13 +636,10 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_expense')) {
// $query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('expenses.user_id', $user->id)->orWhere('expenses.assigned_user_id', $user->id);
});
}
},
'company.groups' => function ($query) use ($created_at, $user) {
@ -645,7 +649,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_invoice')) {
// $query->where('invoices.user_id', $user->id)->orWhere('invoices.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('invoices.user_id', $user->id)->orWhere('invoices.assigned_user_id', $user->id);
@ -657,7 +660,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('paymentables', 'documents');
if (! $user->hasPermission('view_payment')) {
// $query->where('payments.user_id', $user->id)->orWhere('payments.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('payments.user_id', $user->id)->orWhere('payments.assigned_user_id', $user->id);
@ -672,7 +674,7 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_product')) {
// $query->where('products.user_id', $user->id)->orWhere('products.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('products.user_id', $user->id)->orWhere('products.assigned_user_id', $user->id);
});
@ -682,7 +684,7 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_project')) {
// $query->where('projects.user_id', $user->id)->orWhere('projects.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('projects.user_id', $user->id)->orWhere('projects.assigned_user_id', $user->id);
});
@ -692,7 +694,7 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_purchase_order')) {
// $query->where('purchase_orders.user_id', $user->id)->orWhere('purchase_orders.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('purchase_orders.user_id', $user->id)->orWhere('purchase_orders.assigned_user_id', $user->id);
});
@ -703,7 +705,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents');
if (! $user->hasPermission('view_quote')) {
// $query->where('quotes.user_id', $user->id)->orWhere('quotes.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('quotes.user_id', $user->id)->orWhere('quotes.assigned_user_id', $user->id);
@ -715,7 +716,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('invitations', 'documents', 'client.gateway_tokens', 'client.group_settings', 'client.company');
if (! $user->hasPermission('view_recurring_invoice')) {
// $query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('recurring_invoices.user_id', $user->id)->orWhere('recurring_invoices.assigned_user_id', $user->id);
@ -727,7 +727,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_task')) {
// $query->where('tasks.user_id', $user->id)->orWhere('tasks.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('tasks.user_id', $user->id)->orWhere('tasks.assigned_user_id', $user->id);
@ -742,7 +741,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('contacts', 'documents');
if (! $user->hasPermission('view_vendor')) {
// $query->where('vendors.user_id', $user->id)->orWhere('vendors.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('vendors.user_id', $user->id)->orWhere('vendors.assigned_user_id', $user->id);
@ -781,7 +779,6 @@ class BaseController extends Controller
$query->where('created_at', '>=', $created_at)->with('documents');
if (! $user->hasPermission('view_recurring_expense')) {
// $query->where('recurring_expenses.user_id', $user->id)->orWhere('recurring_expenses.assigned_user_id', $user->id);
$query->whereNested(function($query) use ($user) {
$query->where('recurring_expenses.user_id', $user->id)->orWhere('recurring_expenses.assigned_user_id', $user->id);
@ -803,6 +800,13 @@ class BaseController extends Controller
$query->where('bank_transactions.user_id', $user->id);
}
},
'company.task_schedulers'=> function ($query) use ($created_at, $user) {
$query->where('created_at', '>=', $created_at);
if (! $user->isAdmin()) {
$query->where('schedulers.user_id', $user->id);
}
},
]
);
@ -832,8 +836,10 @@ class BaseController extends Controller
$query->with($includes);
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
// 28-03-2022 this is definitely correct here, do not append _ to the view, it resolved correctly when snake cased
/*Restore here if refactor produces unexpected edge cases*/
/*
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
//06-10-2022 - some entities do not have assigned_user_id - this becomes an issue when we have a large company and low permission users
if(lcfirst(class_basename(Str::snake($this->entity_type))) == 'user')
@ -849,6 +855,30 @@ class BaseController extends Controller
$query->where('user_id', '=', auth()->user()->id)->orWhere('assigned_user_id', auth()->user()->id);
}
*/
/*21-01-2023*/
/**/
// 10-01-2022 need to ensure we snake case properly here to ensure permissions work as expected
// 28-03-2022 this is definitely correct here, do not append _ to the view, it resolved correctly when snake cased
if (auth()->user() && ! auth()->user()->hasPermission('view'.lcfirst(class_basename(Str::snake($this->entity_type))))) {
//06-10-2022 - some entities do not have assigned_user_id - this becomes an issue when we have a large company and low permission users
if(in_array($this->entity_type, [User::class])){
$query->where('id', auth()->user()->id);
}
elseif(in_array($this->entity_type, [BankTransactionRule::class,CompanyGateway::class, TaxRate::class, BankIntegration::class, Scheduler::class, BankTransaction::class, Webhook::class, ExpenseCategory::class])){ //table without assigned_user_id
$query->where('user_id', '=', auth()->user()->id);
}
elseif(in_array($this->entity_type,[Design::class, GroupSetting::class, PaymentTerm::class])){
// nlog($this->entity_type);
}
else
$query->where('user_id', '=', auth()->user()->id)->orWhere('assigned_user_id', auth()->user()->id);
}
/**/
// $query->exclude(['balance','credit_balance','paid_to_date']);
if (request()->has('updated_at') && request()->input('updated_at') > 0) {
$query->where('updated_at', '>=', date('Y-m-d H:i:s', intval(request()->input('updated_at'))));
@ -984,6 +1014,9 @@ class BaseController extends Controller
//pass report errors bool to front end
$data['report_errors'] = Ninja::isSelfHost() ? $account->report_errors : true;
//pass whitelabel bool to front end
$data['white_label'] = Ninja::isSelfHost() ? $account->isPaid() : false;
//pass referral code to front end
$data['rc'] = request()->has('rc') ? request()->input('rc') : '';
$data['build'] = request()->has('build') ? request()->input('build') : '';

View File

@ -30,7 +30,6 @@ class ChartController extends BaseController
* tags={"charts"},
* summary="Get chart data",
* description="Get chart data",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -16,6 +16,7 @@ use App\Events\Client\ClientWasUpdated;
use App\Factory\ClientFactory;
use App\Filters\ClientFilters;
use App\Http\Requests\Client\AdjustClientLedgerRequest;
use App\Http\Requests\Client\BulkClientRequest;
use App\Http\Requests\Client\CreateClientRequest;
use App\Http\Requests\Client\DestroyClientRequest;
use App\Http\Requests\Client\EditClientRequest;
@ -79,7 +80,6 @@ class ClientController extends BaseController
* description="Lists clients, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the clients, these are handled by the ClientFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -129,7 +129,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Shows a client",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -184,7 +183,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Shows a client for editting",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -240,7 +238,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Updates a client",
* description="Handles the updating of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -305,7 +302,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Gets a new blank client object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -351,7 +347,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Adds a client",
* description="Adds an client to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -409,7 +404,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Deletes a client",
* description="Handles the deletion of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -463,7 +457,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Performs bulk actions on an array of clients",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -502,24 +495,22 @@ class ClientController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkClientRequest $request)
{
$action = request()->input('action');
$ids = request()->input('ids');
$clients = Client::withTrashed()->whereIn('id', $this->transformKeys($ids))->cursor();
$action = $request->action;
if (! in_array($action, ['restore', 'archive', 'delete'])) {
return response()->json(['message' => 'That action is not available.'], 400);
}
$clients = Client::withTrashed()
->company()
->whereIn('id', $request->ids)
->cursor()
->each(function ($client) use ($action) {
if (auth()->user()->can('edit', $client)) {
$this->client_repo->{$action}($client);
}
});
$clients->each(function ($client, $key) use ($action) {
if (auth()->user()->can('edit', $client)) {
$this->client_repo->{$action}($client);
}
});
return $this->listResponse(Client::withTrashed()->whereIn('id', $this->transformKeys($ids)));
return $this->listResponse(Client::withTrashed()->company()->whereIn('id', $request->ids));
}
/**
@ -537,7 +528,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Uploads a document to a client",
* description="Handles the uploading of a document to a client",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -601,7 +591,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Purges a client from the system",
* description="Handles purging a client",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -674,7 +663,6 @@ class ClientController extends BaseController
* tags={"clients"},
* summary="Merges two clients",
* description="Handles merging 2 clients",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -18,6 +18,7 @@ use App\Filters\ClientGatewayTokenFilters;
use App\Http\Requests\ClientGatewayToken\CreateClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\DestroyClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\EditClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\ListClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\ShowClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\StoreClientGatewayTokenRequest;
use App\Http\Requests\ClientGatewayToken\UpdateClientGatewayTokenRequest;
@ -76,7 +77,6 @@ class ClientGatewayTokenController extends BaseController
* description="Lists client_gateway_tokens, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the client_gateway_tokens, these are handled by the ClientGatewayTokenFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -103,7 +103,7 @@ class ClientGatewayTokenController extends BaseController
* @param ClientGatewayTokenFilters $filters
* @return Response|mixed
*/
public function index(Request $request)
public function index(ListClientGatewayTokenRequest $request)
{
$client_gateway_token_gateway_tokens = ClientGatewayToken::scope();
@ -124,7 +124,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Shows a client",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -179,7 +178,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Shows a client for editting",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -235,7 +233,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Updates a client",
* description="Handles the updating of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -292,7 +289,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Gets a new blank client object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -340,7 +336,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Adds a client",
* description="Adds an client to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -389,7 +384,6 @@ class ClientGatewayTokenController extends BaseController
* tags={"client_gateway_tokens"},
* summary="Deletes a client",
* description="Handles the deletion of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -148,6 +148,7 @@ class NinjaPlanController extends Controller
$account->plan_term = 'month';
$account->plan_started = now();
$account->plan_expires = now()->addDays(14);
$account->is_trial=true;
$account->save();
}
@ -216,7 +217,7 @@ class NinjaPlanController extends Controller
if ($account) {
//offer the option to have a free trial
if (! $account->trial_started && ! $account->plan) {
if (!$account->is_trial) {
return $this->trial();
}

View File

@ -160,7 +160,7 @@ class PaymentController extends Controller
}
if (property_exists($payment_hash->data, 'billing_context')) {
$billing_subscription = \App\Models\Subscription::find($payment_hash->data->billing_context->subscription_id);
$billing_subscription = \App\Models\Subscription::find($this->decodePrimaryKey($payment_hash->data->billing_context->subscription_id));
return (new SubscriptionService($billing_subscription))->completePurchase($payment_hash);
}

View File

@ -51,6 +51,7 @@ class RecurringInvoiceController extends Controller
*
* @param ShowRecurringInvoiceRequest $request
* @param RecurringInvoice $recurring_invoice
*
* @return Factory|View
*/
public function show(ShowRecurringInvoiceRequest $request, RecurringInvoice $recurring_invoice)
@ -60,20 +61,24 @@ class RecurringInvoiceController extends Controller
]);
}
/**
* Handle the request cancellation notification
*
* @param RequestCancellationRequest $request [description]
* @param RecurringInvoice $recurring_invoice [description]
*
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
*/
public function requestCancellation(RequestCancellationRequest $request, RecurringInvoice $recurring_invoice)
{
nlog('outside cancellation');
if ($recurring_invoice->subscription?->allow_cancellation) {
nlog('inside the cancellation');
$nmo = new NinjaMailerObject;
$nmo->mailable = (new NinjaMailer((new ClientContactRequestCancellationObject($recurring_invoice, auth()->user()))->build()));
$nmo->mailable = (new NinjaMailer((new ClientContactRequestCancellationObject($recurring_invoice, auth()->user(), false))->build()));
$nmo->company = $recurring_invoice->company;
$nmo->settings = $recurring_invoice->company->settings;
// $notifiable_users = $this->filterUsersByPermissions($recurring_invoice->company->company_users, $recurring_invoice, ['recurring_cancellation']);
$recurring_invoice->company->company_users->each(function ($company_user) use ($nmo) {
$methods = $this->findCompanyUserNotificationType($company_user, ['recurring_cancellation', 'all_notifications']);
@ -86,15 +91,6 @@ class RecurringInvoiceController extends Controller
}
});
// $notifiable_users->each(function ($company_user) use($nmo){
// $nmo->to_user = $company_user->user;
// NinjaMailerJob::dispatch($nmo);
// });
//$recurring_invoice->user->notify(new ClientContactRequestCancellation($recurring_invoice, auth()->user()));
return $this->render('recurring_invoices.cancellation.index', [
'invoice' => $recurring_invoice,
]);

View File

@ -47,7 +47,6 @@ class ClientStatementController extends BaseController
* tags={"clients"},
* summary="Return a PDF of the client statement",
* description="Return a PDF of the client statement",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -109,16 +108,24 @@ class ClientStatementController extends BaseController
*/
public function statement(CreateStatementRequest $request)
{
$send_email = false;
if($request->has('send_email') && $request->send_email == 'true')
$send_email = true;
$pdf = $request->client()->service()->statement(
$request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table', 'status'])
$request->only(['start_date', 'end_date', 'show_payments_table', 'show_aging_table', 'status']), $send_email
);
if($send_email)
return response()->json(['message' => ctrans('texts.email_queued')], 200);
if ($pdf) {
return response()->streamDownload(function () use ($pdf) {
echo $pdf;
}, ctrans('texts.statement').'.pdf', ['Content-Type' => 'application/pdf']);
}
return response()->json(['message' => 'Something went wrong. Please check logs.']);
return response()->json(['message' => ctrans('texts.error_title')], 500);
}
}

View File

@ -91,7 +91,6 @@ class CompanyController extends BaseController
* description="Lists companies, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the companies, these are handled by the CompanyFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -137,7 +136,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Gets a new blank company object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -183,7 +181,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Adds a company",
* description="Adds an company to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -267,7 +264,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Shows an company",
* description="Displays an company by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -322,7 +318,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Shows an company for editting",
* description="Displays an company by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -377,7 +372,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Updates an company",
* description="Handles the updating of an company by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -447,7 +441,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Deletes a company",
* description="Handles the deletion of an company by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -551,7 +544,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Uploads a document to a company",
* description="Handles the uploading of a document to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -615,7 +607,6 @@ class CompanyController extends BaseController
* tags={"companies"},
* summary="Sets the company as the default company.",
* description="Sets the company as the default company.",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers;
use App\DataMapper\FeesAndLimits;
use App\Factory\CompanyGatewayFactory;
use App\Filters\CompanyGatewayFilters;
use App\Http\Requests\CompanyGateway\BulkCompanyGatewayRequest;
use App\Http\Requests\CompanyGateway\CreateCompanyGatewayRequest;
use App\Http\Requests\CompanyGateway\DestroyCompanyGatewayRequest;
use App\Http\Requests\CompanyGateway\EditCompanyGatewayRequest;
@ -75,7 +76,6 @@ class CompanyGatewayController extends BaseController
* description="Lists company_gateways, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the company_gateways, these are handled by the CompanyGatewayFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -121,7 +121,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Gets a new blank CompanyGateway object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -167,7 +166,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Adds a CompanyGateway",
* description="Adds an CompanyGateway to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -232,7 +230,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Shows an CompanyGateway",
* description="Displays an CompanyGateway by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -287,7 +284,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Shows an CompanyGateway for editting",
* description="Displays an CompanyGateway by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -342,7 +338,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Updates an CompanyGateway",
* description="Handles the updating of an CompanyGateway by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -408,7 +403,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Deletes a CompanyGateway",
* description="Handles the deletion of an CompanyGateway by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -465,7 +459,6 @@ class CompanyGatewayController extends BaseController
* tags={"company_gateways"},
* summary="Performs bulk actions on an array of company_gateways",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -504,20 +497,18 @@ class CompanyGatewayController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkCompanyGatewayRequest $request)
{
$action = request()->input('action');
$action = $request->input('action');
$ids = request()->input('ids');
$company_gateways = CompanyGateway::withTrashed()
->whereIn('id', $request->ids)
->company()
->cursor()
->each(function ($company_gateway, $key) use ($action) {
$this->company_repo->{$action}($company_gateway);
});
$company_gateways = CompanyGateway::withTrashed()->find($this->transformKeys($ids));
$company_gateways->each(function ($company_gateway, $key) use ($action) {
if (auth()->user()->can('edit', $company_gateway)) {
$this->company_repo->{$action}($company_gateway);
}
});
return $this->listResponse(CompanyGateway::withTrashed()->whereIn('id', $this->transformKeys($ids)));
return $this->listResponse(CompanyGateway::withTrashed()->company()->whereIn('id', $request->ids));
}
}

View File

@ -39,7 +39,6 @@ class CompanyLedgerController extends BaseController
* tags={"company_ledger"},
* summary="Gets a list of company_ledger",
* description="Lists the company_ledger.",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -65,7 +64,7 @@ class CompanyLedgerController extends BaseController
*/
public function index(ShowCompanyLedgerRequest $request)
{
$company_ledger = CompanyLedger::whereCompanyId(auth()->user()->company()->id)->orderBy('id', 'ASC');
$company_ledger = CompanyLedger::where('company_id', auth()->user()->company()->id)->orderBy('id', 'ASC');
return $this->listResponse($company_ledger);
}

View File

@ -11,11 +11,11 @@
namespace App\Http\Controllers;
use App\Exceptions\ModelNotFoundException;
use App\Http\Requests\CompanyUser\UpdateCompanyUserRequest;
use App\Models\CompanyUser;
use App\Models\User;
use App\Transformers\CompanyUserTransformer;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Response;
class CompanyUserController extends BaseController
@ -83,7 +83,6 @@ class CompanyUserController extends BaseController
* tags={"company_user"},
* summary="Update a company user record",
* description="Attempts to update a company user record. A company user can modify only their settings fields. Full access for Admin users",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -50,7 +50,6 @@ class ConnectedAccountController extends BaseController
* tags={"connected_account"},
* summary="Connect an oauth user to an existing user",
* description="Refreshes the dataset",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -17,6 +17,7 @@ use App\Factory\CloneCreditFactory;
use App\Factory\CreditFactory;
use App\Filters\CreditFilters;
use App\Http\Requests\Credit\ActionCreditRequest;
use App\Http\Requests\Credit\BulkCreditRequest;
use App\Http\Requests\Credit\CreateCreditRequest;
use App\Http\Requests\Credit\DestroyCreditRequest;
use App\Http\Requests\Credit\EditCreditRequest;
@ -78,7 +79,6 @@ class CreditController extends BaseController
* description="Lists credits, search and filters allow fine grained lists to be generated.
*
* Query parameters can be added to performed more fine grained filtering of the credits, these are handled by the CreditFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -124,7 +124,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Gets a new blank credit object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -170,7 +169,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Adds a credit",
* description="Adds an credit to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -231,7 +229,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Shows an credit",
* description="Displays an credit by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -286,7 +283,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Shows an credit for editting",
* description="Displays an credit by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -342,7 +338,6 @@ class CreditController extends BaseController
* tags={"Credits"},
* summary="Updates an Credit",
* description="Handles the updating of an Credit by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -410,7 +405,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Deletes a credit",
* description="Handles the deletion of an credit by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -463,7 +457,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Performs bulk actions on an array of credits",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -502,16 +495,17 @@ class CreditController extends BaseController
* ),
* )
*/
public function bulk()
public function bulk(BulkCreditRequest $request)
{
$action = request()->input('action');
$ids = request()->input('ids');
$action = $request->input('action');
if(Ninja::isHosted() && (stripos($action, 'email') !== false) && !auth()->user()->company()->account->account_sms_verified)
return response(['message' => 'Please verify your account to send emails.'], 400);
$credits = Credit::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
$credits = Credit::withTrashed()
->whereIn('id', $request->ids)
->company()
->get();
if (! $credits) {
return response()->json(['message' => ctrans('texts.no_credits_found')]);
@ -555,7 +549,7 @@ class CreditController extends BaseController
}
});
return $this->listResponse(Credit::withTrashed()->whereIn('id', $this->transformKeys($ids)));
return $this->listResponse(Credit::withTrashed()->company()->whereIn('id', $request->ids));
}
public function action(ActionCreditRequest $request, Credit $credit, $action)
@ -682,7 +676,6 @@ class CreditController extends BaseController
* tags={"credits"},
* summary="Uploads a document to a credit",
* description="Handles the uploading of a document to a credit",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -59,7 +59,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Gets a list of designs",
* description="Lists designs",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -107,7 +106,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Shows a design",
* description="Displays a design by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -162,7 +160,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Shows a design for editting",
* description="Displays a design by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -218,7 +215,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Updates a design",
* description="Handles the updating of a design by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -280,7 +276,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Gets a new blank design object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -326,7 +321,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Adds a design",
* description="Adds an design to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -425,7 +419,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Deletes a design",
* description="Handles the deletion of a design by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -483,7 +476,6 @@ class DesignController extends BaseController
* tags={"designs"},
* summary="Performs bulk actions on an array of designs",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -528,7 +520,7 @@ class DesignController extends BaseController
$ids = request()->input('ids');
$designs = Design::withTrashed()->find($this->transformKeys($ids));
$designs = Design::withTrashed()->company()->whereIn('id', $this->transformKeys($ids));
$designs->each(function ($design, $key) use ($action) {
if (auth()->user()->can('edit', $design)) {
@ -536,7 +528,7 @@ class DesignController extends BaseController
}
});
return $this->listResponse(Design::withTrashed()->whereIn('id', $this->transformKeys($ids)));
return $this->listResponse(Design::withTrashed()->company()->whereIn('id', $this->transformKeys($ids)));
}
public function default(DefaultDesignRequest $request)

View File

@ -47,7 +47,6 @@ class DocumentController extends BaseController
* description="Lists documents, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the documents, these are handled by the DocumentsFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -57,7 +57,6 @@ class EmailController extends BaseController
* tags={"emails"},
* summary="Sends an email for an entity",
* description="Sends an email for an entity",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\RequestBody(
* description="The template subject and body",

View File

@ -104,7 +104,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Gets a new blank Expens Category object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
@ -150,7 +149,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Adds a expense category",
* description="Adds an expense category to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -198,7 +196,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Shows a Expens Category",
* description="Displays an ExpenseCategory by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -252,7 +249,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Shows a Expens Category for editting",
* description="Displays a Expens Category by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -307,7 +303,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Updates a tax rate",
* description="Handles the updating of a tax rate by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -365,7 +360,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Deletes a ExpenseCategory",
* description="Handles the deletion of an ExpenseCategory by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -420,7 +414,6 @@ class ExpenseCategoryController extends BaseController
* tags={"expense_categories"},
* summary="Performs bulk actions on an array of ExpenseCategorys",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),

View File

@ -74,7 +74,6 @@ class ExpenseController extends BaseController
* description="Lists expenses, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the expenses, these are handled by the ExpenseFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -122,7 +121,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Shows a client",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -177,7 +175,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Shows a client for editting",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -233,7 +230,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Updates a client",
* description="Handles the updating of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -298,7 +294,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Gets a new blank client object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -344,7 +339,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Adds a client",
* description="Adds an client to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -393,7 +387,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Deletes a client",
* description="Handles the deletion of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -447,7 +440,6 @@ class ExpenseController extends BaseController
* tags={"expenses"},
* summary="Performs bulk actions on an array of expenses",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -527,7 +519,6 @@ class ExpenseController extends BaseController
* tags={"expense"},
* summary="Uploads a document to a expense",
* description="Handles the uploading of a document to a expense",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -32,7 +32,6 @@ class ExportController extends BaseController
* tags={"export"},
* summary="Export data from the system",
* description="Export data from the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -64,7 +64,6 @@ class GroupSettingController extends BaseController
* description="Lists group_settings, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the group_settings, these are handled by the GroupSettingFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -110,7 +109,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Gets a new blank GroupSetting object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -156,7 +154,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Adds a GroupSetting",
* description="Adds an GroupSetting to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -209,7 +206,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Shows an GroupSetting",
* description="Displays an GroupSetting by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -264,7 +260,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Shows an GroupSetting for editting",
* description="Displays an GroupSetting by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -319,7 +314,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Updates an GroupSetting",
* description="Handles the updating of an GroupSetting by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -383,7 +377,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Deletes a GroupSetting",
* description="Handles the deletion of an GroupSetting by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -436,7 +429,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Performs bulk actions on an array of group_settings",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -516,7 +508,6 @@ class GroupSettingController extends BaseController
* tags={"group_settings"},
* summary="Uploads a document to a group setting",
* description="Handles the uploading of a document to a group setting",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -35,7 +35,6 @@ class ImportController extends Controller
* tags={"imports"},
* summary="Pre Import checks - returns a reference to the job and the headers of the CSV",
* description="Pre Import checks - returns a reference to the job and the headers of the CSV",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -39,7 +39,6 @@ class ImportJsonController extends BaseController
* tags={"import"},
* summary="Import data from the system",
* description="Import data from the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -33,7 +33,6 @@ class AppleController extends BaseController
* tags={"postmark"},
* summary="Processing webhooks from Apple for in app purchases",
* description="Adds an credit to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -73,7 +72,6 @@ class AppleController extends BaseController
* tags={"postmark"},
* summary="Processing event webhooks from Apple for in purchase / subscription status update",
* description="Adds an credit to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -98,7 +98,6 @@ class InvoiceController extends BaseController
* description="Lists invoices, search and filters allow fine grained lists to be generated.
*
* Query parameters can be added to performed more fine grained filtering of the invoices, these are handled by the InvoiceFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -145,7 +144,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Gets a new blank invoice object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -191,7 +189,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Adds a invoice",
* description="Adds an invoice to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -260,7 +257,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Shows an invoice",
* description="Displays an invoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -315,7 +311,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Shows an invoice for editting",
* description="Displays an invoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -371,7 +366,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Updates an invoice",
* description="Handles the updating of an invoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -456,7 +450,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Deletes a invoice",
* description="Handles the deletion of an invoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -509,7 +502,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Performs bulk actions on an array of invoices",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -637,7 +629,6 @@ class InvoiceController extends BaseController
* - archive
* - delete
* - email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -826,7 +817,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Download a specific invoice by invitation key",
* description="Downloads a specific invoice",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -894,7 +884,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Download a specific invoice delivery notes",
* description="Downloads a specific invoice delivery notes",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -955,7 +944,6 @@ class InvoiceController extends BaseController
* tags={"invoices"},
* summary="Uploads a document to a invoice",
* description="Handles the uploading of a document to a invoice",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -36,7 +36,6 @@ class LicenseController extends BaseController
* tags={"claim_license"},
* summary="Attempts to claim a white label license",
* description="Attempts to claim a white label license",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
* name="license_key",

View File

@ -31,7 +31,6 @@ class LogoutController extends BaseController
* tags={"logout"},
* summary="Gets a list of logout",
* description="Lists all logout",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -46,7 +46,6 @@ class MigrationController extends BaseController
* tags={"migration"},
* summary="Attempts to purge a company record and all its child records",
* description="Attempts to purge a company record and all its child records",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -137,7 +136,6 @@ class MigrationController extends BaseController
* tags={"migration"},
* summary="Attempts to purge a companies child records but save the company record and its settings",
* description="Attempts to purge a companies child records but save the company record and its settings",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(
@ -221,7 +219,6 @@ class MigrationController extends BaseController
* tags={"migration"},
* summary="Starts the migration from previous version of Invoice Ninja",
* description="Starts the migration from previous version of Invoice Ninja",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Password"),

View File

@ -43,7 +43,6 @@ class OneTimeTokenController extends BaseController
* tags={"one_time_token"},
* summary="Attempts to create a one time token",
* description="Attempts to create a one time token",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -19,8 +19,8 @@
* url="https://ninja.test",
* ),
* @OA\ExternalDocumentation(
* description="http://docs.invoiceninja.com",
* url="http://docs.invoiceninja.com"
* description="https://invoiceninja.github.io",
* url="https://invoiceninja.github.io"
* ),
* ),
*/

View File

@ -80,7 +80,6 @@ class PaymentController extends BaseController
* description="Lists payments, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the payments, these are handled by the PaymentFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -127,7 +126,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Gets a new blank Payment object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -174,7 +172,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Adds a Payment",
* description="Adds an Payment to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -226,7 +223,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Shows an Payment",
* description="Displays an Payment by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -282,7 +278,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Shows an Payment for editting",
* description="Displays an Payment by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -338,7 +333,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Updates an Payment",
* description="Handles the updating of an Payment by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -403,7 +397,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Deletes a Payment",
* description="Handles the deletion of an Payment by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -457,7 +450,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Performs bulk actions on an array of payments",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -535,7 +527,6 @@ class PaymentController extends BaseController
- archive
- delete
- email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -648,7 +639,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Adds a Refund",
* description="Adds an Refund to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -702,7 +692,6 @@ class PaymentController extends BaseController
* tags={"payments"},
* summary="Uploads a document to a payment",
* description="Handles the uploading of a document to a payment",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -48,7 +48,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Gets a list of payment terms",
* description="Lists payment terms",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -96,7 +95,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Gets a new blank PaymentTerm object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -143,7 +141,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Adds a Payment",
* description="Adds a Payment Term to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -189,7 +186,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Shows a Payment Term",
* description="Displays an Payment Term by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -240,7 +236,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Shows an Payment Term for editting",
* description="Displays an Payment Term by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -299,7 +294,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Updates a Payment Term",
* description="Handles the updating of an Payment Termby id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -359,7 +353,6 @@ class PaymentTermController extends BaseController
* tags={"payment_termss"},
* summary="Deletes a Payment Term",
* description="Handles the deletion of an PaymentTerm by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -413,7 +406,6 @@ class PaymentTermController extends BaseController
* tags={"payment_terms"},
* summary="Performs bulk actions on an array of payment terms",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),

View File

@ -28,7 +28,6 @@ class PingController extends BaseController
* tags={"ping"},
* summary="Attempts to ping the API",
* description="Attempts to ping the API",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,
@ -60,7 +59,6 @@ class PingController extends BaseController
* tags={"health_check"},
* summary="Attempts to get a health check from the API",
* description="Attempts to get a health check from the API",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -47,7 +47,6 @@ class PostMarkController extends BaseController
* tags={"postmark"},
* summary="Processing webhooks from PostMark",
* description="Adds an credit to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -16,7 +16,6 @@ use App\Factory\CreditFactory;
use App\Factory\InvoiceFactory;
use App\Factory\QuoteFactory;
use App\Factory\RecurringInvoiceFactory;
use App\Http\Requests\Invoice\StoreInvoiceRequest;
use App\Http\Requests\Preview\PreviewInvoiceRequest;
use App\Jobs\Util\PreviewPdf;
use App\Libraries\MultiDB;
@ -44,7 +43,6 @@ use App\Utils\Traits\MakesInvoiceHtml;
use App\Utils\Traits\Pdf\PageNumbering;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Response;
use Turbo124\Beacon\Facades\LightLogs;
@ -70,7 +68,6 @@ class PreviewController extends BaseController
* tags={"preview"},
* summary="Returns a pdf preview",
* description="Returns a pdf preview.",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,
@ -109,8 +106,6 @@ class PreviewController extends BaseController
$class = "App\Models\\$entity";
$pdf_class = "App\Jobs\\$entity\\Create{$entity}Pdf";
$entity_obj = $class::whereId($this->decodePrimaryKey(request()->input('entity_id')))->company()->first();
if (! $entity_obj) {
@ -214,6 +209,12 @@ class PreviewController extends BaseController
->first();
}
if($request->has('footer') && !$request->filled('footer') && $request->input('entity') == 'recurring_invoice')
$request->merge(['footer' => $company->settings->invoice_footer]);
if($request->has('terms') && !$request->filled('terms') && $request->input('entity') == 'recurring_invoice')
$request->merge(['terms' => $company->settings->invoice_terms]);
$entity_obj = $repo->save($request->all(), $entity_obj);
if (! $request->has('entity_id')) {
@ -404,8 +405,8 @@ class PreviewController extends BaseController
'user_id' => auth()->user()->id,
'company_id' => auth()->user()->company()->id,
'client_id' => $client->id,
'terms' => 'Sample Terms',
'footer' => 'Sample Footer',
'terms' => auth()->user()->company()->settings->invoice_terms,
'footer' => auth()->user()->company()->settings->invoice_footer,
'public_notes' => 'Sample Public Notes',
]);

View File

@ -79,7 +79,6 @@ class PreviewPurchaseOrderController extends BaseController
* tags={"preview"},
* summary="Returns a pdf preview for purchase order",
* description="Returns a pdf preview for purchase order.",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Response(
* response=200,

View File

@ -60,7 +60,6 @@ class ProductController extends BaseController
* description="Lists products, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the products, these are handled by the ProductFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -107,7 +106,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Gets a new blank Product object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -153,7 +151,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Adds a Product",
* description="Adds an Product to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -199,7 +196,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Shows an Product",
* description="Displays an Product by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -253,7 +249,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Shows an Product for editting",
* description="Displays an Product by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -308,7 +303,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Updates an Product",
* description="Handles the updating of an Product by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -370,7 +364,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Deletes a Product",
* description="Handles the deletion of an Product by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -424,7 +417,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Performs bulk actions on an array of products",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -496,7 +488,6 @@ class ProductController extends BaseController
* tags={"products"},
* summary="Uploads a document to a product",
* description="Handles the uploading of a document to a product",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -63,7 +63,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Gets a list of projects",
* description="Lists projects",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -111,7 +110,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Shows a project",
* description="Displays a project by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -166,7 +164,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Shows a project for editting",
* description="Displays a project by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -222,7 +219,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Updates a project",
* description="Handles the updating of a project by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -289,7 +285,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Gets a new blank project object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -335,7 +330,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Adds a project",
* description="Adds an project to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -393,7 +387,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Deletes a project",
* description="Handles the deletion of a project by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -450,7 +443,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Performs bulk actions on an array of projects",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -521,7 +513,6 @@ class ProjectController extends BaseController
* tags={"projects"},
* summary="Uploads a document to a project",
* description="Handles the uploading of a document to a project",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -71,7 +71,6 @@ class PurchaseOrderController extends BaseController
* description="Lists purchase orders, search and filters allow fine grained lists to be generated.
*
* Query parameters can be added to performed more fine grained filtering of the purchase orders, these are handled by the PurchaseOrderFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -116,7 +115,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Gets a new blank purchase order object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -161,7 +159,6 @@ class PurchaseOrderController extends BaseController
* tags={"purhcase_orders"},
* summary="Adds a purchase order",
* description="Adds an purchase order to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -215,7 +212,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Shows an purcase orders",
* description="Displays an purchase order by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -269,7 +265,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Shows an purchase order for editting",
* description="Displays an purchase order by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -324,7 +319,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Updates an purchase order",
* description="Handles the updating of an purchase order by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -391,7 +385,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Deletes a purchase order",
* description="Handles the deletion of an purchase orders by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -444,7 +437,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Performs bulk actions on an array of purchase_orders",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -502,7 +494,6 @@ class PurchaseOrderController extends BaseController
/*
* Download Purchase Order/s
*/
if ($action == 'bulk_download' && $purchase_orders->count() >= 1) {
$purchase_orders->each(function ($purchase_order) {
if (auth()->user()->cannot('view', $purchase_order)) {
@ -558,7 +549,6 @@ class PurchaseOrderController extends BaseController
* - archive
* - delete
* - email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -724,7 +714,6 @@ class PurchaseOrderController extends BaseController
* tags={"purchase_orders"},
* summary="Uploads a document to a purchase_orders",
* description="Handles the uploading of a document to a purchase_order",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -95,7 +95,6 @@ class QuoteController extends BaseController
* description="Lists quotes, search and filters allow fine grained lists to be generated.
*
* Query parameters can be added to performed more fine grained filtering of the quotes, these are handled by the QuoteFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -140,7 +139,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Gets a new blank Quote object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -187,7 +185,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Adds a Quote",
* description="Adds an Quote to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -243,7 +240,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Shows an Quote",
* description="Displays an Quote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -299,7 +295,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Shows an Quote for editting",
* description="Displays an Quote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -355,7 +350,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Updates an Quote",
* description="Handles the updating of an Quote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -424,7 +418,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Deletes a Quote",
* description="Handles the deletion of an Quote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -478,7 +471,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Performs bulk actions on an array of quotes",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -635,7 +627,6 @@ class QuoteController extends BaseController
- convert
- convert_to_invoice
- email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -822,7 +813,6 @@ class QuoteController extends BaseController
* tags={"quotes"},
* summary="Uploads a document to a quote",
* description="Handles the uploading of a document to a quote",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -74,7 +74,6 @@ class RecurringExpenseController extends BaseController
* description="Lists recurring_expenses, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the recurring_expenses, these are handled by the RecurringExpenseFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -122,7 +121,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Shows a client",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -177,7 +175,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Shows a client for editting",
* description="Displays a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -233,7 +230,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Updates a client",
* description="Handles the updating of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -299,7 +295,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Gets a new blank client object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -345,7 +340,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Adds a client",
* description="Adds an client to a company",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -395,7 +389,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Deletes a client",
* description="Handles the deletion of a client by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -449,7 +442,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expenses"},
* summary="Performs bulk actions on an array of recurring_expenses",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -567,7 +559,6 @@ class RecurringExpenseController extends BaseController
* tags={"recurring_expense"},
* summary="Uploads a document to a recurring_expense",
* description="Handles the uploading of a document to a recurring_expense",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -81,7 +81,6 @@ class RecurringInvoiceController extends BaseController
* description="Lists recurring_invoices, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the recurring_invoices, these are handled by the RecurringInvoiceFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -128,7 +127,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Gets a new blank RecurringInvoice object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -175,7 +173,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Adds a RecurringInvoice",
* description="Adds an RecurringInvoice to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -228,7 +225,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Shows an RecurringInvoice",
* description="Displays an RecurringInvoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -284,7 +280,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Shows an RecurringInvoice for editting",
* description="Displays an RecurringInvoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -340,7 +335,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Updates an RecurringInvoice",
* description="Handles the updating of an RecurringInvoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -410,7 +404,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Deletes a RecurringInvoice",
* description="Handles the deletion of an RecurringInvoice by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -459,7 +452,6 @@ class RecurringInvoiceController extends BaseController
* tags={"invoices"},
* summary="Download a specific invoice by invitation key",
* description="Downloads a specific invoice",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -521,7 +513,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Performs bulk actions on an array of recurring_invoices",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -599,7 +590,6 @@ class RecurringInvoiceController extends BaseController
- archive
- delete
- email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -727,7 +717,6 @@ class RecurringInvoiceController extends BaseController
* tags={"recurring_invoices"},
* summary="Uploads a document to a recurring_invoice",
* description="Handles the uploading of a document to a recurring_invoice",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

View File

@ -77,7 +77,6 @@ class RecurringQuoteController extends BaseController
* description="Lists recurring_quotes, search and filters allow fine grained lists to be generated.
Query parameters can be added to performed more fine grained filtering of the recurring_quotes, these are handled by the RecurringQuoteFilters class which defines the methods available",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -123,7 +122,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Gets a new blank RecurringQuote object",
* description="Returns a blank object with default values",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -169,7 +167,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Adds a RecurringQuote",
* description="Adds an RecurringQuote to the system",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -216,7 +213,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Shows an RecurringQuote",
* description="Displays an RecurringQuote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -272,7 +268,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Shows an RecurringQuote for editting",
* description="Displays an RecurringQuote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -328,7 +323,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Updates an RecurringQuote",
* description="Handles the updating of an RecurringQuote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -391,7 +385,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Deletes a RecurringQuote",
* description="Handles the deletion of an RecurringQuote by id",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),
@ -445,7 +438,6 @@ class RecurringQuoteController extends BaseController
* tags={"recurring_quotes"},
* summary="Performs bulk actions on an array of recurring_quotes",
* description="",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/index"),
@ -524,7 +516,6 @@ class RecurringQuoteController extends BaseController
- archive
- delete
- email",
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
* @OA\Parameter(ref="#/components/parameters/include"),

Some files were not shown because too many files have changed in this diff Show More