Merge pull request #11234 from turbo124/v5-develop

v5.12.21
This commit is contained in:
David Bomba 2025-08-28 08:04:19 +10:00 committed by GitHub
commit 7db1402cb4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 382 additions and 402 deletions

View File

@ -1,4 +0,0 @@
# Invoice Ninja Code of Conduct
The development team has invested a tremendous amount of time and energy into this project. While we appreciate that bugs can be frustrating we ask that our community refrain from insults and snide remarks. We're happy to provide support to both our hosted and selfhosted communities but ask that feedback is always polite.

View File

@ -1,119 +0,0 @@
# 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/)!

182
README.md
View File

@ -1,182 +0,0 @@
<p align="center">
<a href ="https://www.youtube.com/watch?v=CxGxXiotv0I" target="_blank" title="Invoice Ninja Overview Video"><img src="https://raw.githubusercontent.com/hillelcoren/invoice-ninja/master/public/images/round_logo.png" alt="Sublime's custom image"/></a>
</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
Invoice Ninja Version 5 is here! We've taken the best parts of version 4 and added the most requested features to create an invoicing application like no other. Check the [Invoice Ninja YouTube Channel](https://www.youtube.com/@appinvoiceninja) to get up to speed, or try the [Demo](https://react.invoicing.co/demo) now.
**Choose your setup**
- [Hosted](https://www.invoiceninja.com): Our hosted version is a Software as a Service (SaaS) solution. You're up and running in under 5 minutes, with no need to worry about hosting or server infrastructure.
- [Self-Hosted](https://www.invoiceninja.org): For those who prefer to manage their own hosting and server infrastructure. This version gives you full control and flexibility.
All Pro and Enterprise features from the hosted app are included in the source-available code. We offer a $30 per year white-label license to remove the Invoice Ninja branding from client-facing parts of the app.
#### Get social with us
* [Support Forum](https://forum.invoiceninja.com)
* [Slack](http://slack.invoiceninja.com)
* [Discord](https://discord.gg/ZwEdtfCwXA)
* [Instagram](https://www.instagram.com/appinvoiceninja)
#### Documentation
* [Invoice Ninja - API](https://api-docs.invoicing.co/)
* [Invoice Ninja - Developer Guide](https://invoiceninja.github.io/en/developer-guide/)
* [Invoice Ninja - User Guide](https://invoiceninja.github.io/en/user-guide/)
* [Invoice Ninja - Self-Hosted Installation Guide](https://invoiceninja.github.io/en/self-host-installation/)
## Installation Options and Clients
### Mobile Apps
* [iPhone](https://apps.apple.com/app/id1503970375?platform=iphone)
* [Android](https://play.google.com/store/apps/details?id=com.invoiceninja.app)
* [F-Droid](https://f-droid.org/en/packages/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 - Snap](https://snapcraft.io/invoiceninja)
* [Linux - Flatpak](https://flathub.org/apps/com.invoiceninja.InvoiceNinja)
### Self-Hosted Server Installation
**Note:** The self-hosted options do support the desktop and mobile apps.
* [Server or VM](https://invoiceninja.github.io/en/self-host-installation/)
* [Docker File](https://hub.docker.com/r/invoiceninja/invoiceninja/)
* [Cloudron](https://www.cloudron.io/store/com.invoiceninja.cloudronapp2.html)
* [Softaculous](https://www.softaculous.com/apps/ecommerce/Invoice_Ninja)
* [Elestio](https://elest.io/open-source/invoiceninja)
* [YunoHost](https://apps.yunohost.org/app/invoiceninja5)
### Recommended Providers
* [Stripe](https://stripe.com/)
* [Postmark](https://postmarkapp.com/)
## [Advanced] Quick Hosting Setup
In addition to the official [Invoice Ninja - Self-Hosted Installation Guide](https://invoiceninja.github.io/en/self-host-installation/) we have a few commands for you.
```sh
git clone --depth 1 -b v5.11.53 https://github.com/invoiceninja/invoiceninja.git
cp .env.example .env
composer i -o --no-dev
```
**Note** replace v5.11.53 with the latest tag version, you will also want to ensure that when performing updates, you use the latest tag version rather than a particular branch, ie v5-develop. This will ensure that you are not pulling in work in progress code.
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
```
## Developers Guide
In addition to the official [Invoice Ninja - Developer Guide](https://invoiceninja.github.io/en/developer-guide/) we've got your back with some insights.
### App Design
The API and client portal have been developed using [Laravel](https://laravel.com) if you wish to contribute to this project familiarity with Laravel is essential.
When inspecting functionality of the API, the best place to start would be in the routes/api.php file which describes all of the availabe API endpoints. The controller methods then describe all the entry points into each domain of the application, ie InvoiceController / QuoteController
The average API request follows this path into the application.
* Middleware processes the request initially inspecting the domain being requested + provides the authentication layer.
* The request then passes into a Form Request (Type hinted in the controller methods) which is used to provide authorization and also validation of the request. If successful, the request is then passed into the controller method where it is digested, here is an example:
```php
public function store(StoreInvoiceRequest $request)
{
$invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
$invoice = $invoice->service()
->fillDefaults()
->triggeredActions($request)
->adjustInventory()
->save();
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
return $this->itemResponse($invoice);
}
```
Here for example we are storing a new invoice, we pass the validated request along with a factory into the invoice repository where it is processed and saved.
The returned invoice then passes through its service class (app/Services/Invoice) where various actions are performed.
A event is then fired which notifies listeners in the application (app/Providers/EventServiceProvider) which perform non blocking sub tasks
Finally the invoice is transformed (app/Transformers/) and returned as a response via Fractal.
### Developer environment
Using the Quick Hosting Setup describe above you can quickly get started building out your development environment. Instead of using
```
composer i -o --no-dev
```
use
```
composer i -o
```
This provides the developer tools including phpunit which allows the test suite to be run.
If you are considering contributing back to the main repository, please add in any tests for new functionality / modifications. This will greatly increase the chances of your PR being accepted
Also, if you plan any additions for the main repository, you may want to discuss this with us first on Slack where we can assist with any technical information and provide advice.
## 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)
## Want More?
Checkout our other projects here!
[Event Schedule](https://www.eventschedule.com/)
## 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,5 +0,0 @@
## 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).

View File

@ -1 +1 @@
5.12.20 5.12.21

View File

@ -231,7 +231,7 @@ class CompanySettings extends BaseSettings
public $require_quote_signature = false; //@TODO ben to confirm public $require_quote_signature = false; //@TODO ben to confirm
//email settings //email settings
public $email_sending_method = 'default'; //enum 'default','gmail','office365' 'client_postmark', 'client_mailgun', 'mailgun', 'client_brevo', 'client_ses' //@implemented public $email_sending_method = 'default'; //enum 'default','gmail','office365' 'client_postmark', 'client_mailgun', 'mailgun', 'client_brevo', 'client_ses', 'ses' //@implemented
public $gmail_sending_user_id = '0'; //@implemented public $gmail_sending_user_id = '0'; //@implemented

View File

@ -69,21 +69,21 @@ class ReportExportController extends BaseController
} }
private function isXlsxData($fileData) // private function isXlsxData($fileData)
{ // {
// Check minimum size (XLSX files are typically > 1KB) // // Check minimum size (XLSX files are typically > 1KB)
if (strlen($fileData) < 1024) { // if (strlen($fileData) < 1024) {
return false; // return false;
} // }
// Check ZIP signature // // Check ZIP signature
$header = substr($fileData, 0, 4); // $header = substr($fileData, 0, 4);
if ($header !== 'PK' . chr(3) . chr(4)) { // if ($header !== 'PK' . chr(3) . chr(4)) {
return false; // return false;
} // }
// Check for XLSX-specific content // // Check for XLSX-specific content
return strpos($fileData, '[Content_Types].xml') !== false; // return strpos($fileData, '[Content_Types].xml') !== false;
} // }
} }

View File

@ -22,6 +22,7 @@ use App\Http\ValidationRules\ValidSettingsRule;
use App\Http\ValidationRules\Company\ValidSubdomain; use App\Http\ValidationRules\Company\ValidSubdomain;
use App\Http\ValidationRules\Company\ValidExpenseMailbox; use App\Http\ValidationRules\Company\ValidExpenseMailbox;
use App\Http\ValidationRules\EInvoice\ValidCompanyScheme; use App\Http\ValidationRules\EInvoice\ValidCompanyScheme;
use App\Rules\CommaSeparatedEmails;
class UpdateCompanyRequest extends Request class UpdateCompanyRequest extends Request
{ {
@ -110,9 +111,11 @@ class UpdateCompanyRequest extends Request
// }, // },
// ]; // ];
$rules['settings.ses_secret_key'] = 'required_if:settings.email_sending_method,client_ses'; $rules['settings.ses_secret_key'] = 'required_if:settings.email_sending_method,client_ses'; //ses specific rules
$rules['settings.ses_access_key'] = 'required_if:settings.email_sending_method,client_ses'; $rules['settings.ses_access_key'] = 'required_if:settings.email_sending_method,client_ses'; //ses specific rules
$rules['settings.ses_region'] = 'required_if:settings.email_sending_method,client_ses'; $rules['settings.ses_region'] = 'required_if:settings.email_sending_method,client_ses'; //ses specific rules
$rules['settings.reply_to_email'] = 'sometimes|nullable|email'; // ensures that the reply to email address is a valid email address
$rules['settings.bcc_email'] = ['sometimes', 'nullable', new \App\Rules\CommaSeparatedEmails]; //ensure that the BCC's are valid comma separated emails
return $rules; return $rules;
} }

View File

@ -399,6 +399,10 @@ class NinjaMailerJob implements ShouldQueue
$this->mailer = 'mailgun'; $this->mailer = 'mailgun';
$this->setHostedMailgunMailer(); $this->setHostedMailgunMailer();
return $this; return $this;
case 'ses':
$this->mailer = 'ses';
$this->setHostedSesMailer();
return $this;
case 'gmail': case 'gmail':
$this->mailer = 'gmail'; $this->mailer = 'gmail';
$this->setGmailMailer(); $this->setGmailMailer();
@ -580,6 +584,20 @@ class NinjaMailerJob implements ShouldQueue
} }
private function setHostedSesMailer()
{
if (property_exists($this->nmo->settings, 'email_from_name') && strlen($this->nmo->settings->email_from_name) > 1) {
$email_from_name = $this->nmo->settings->email_from_name;
} else {
$email_from_name = $this->company->present()->name();
}
$this->nmo
->mailable
->from(config('services.ses.from.address'), $email_from_name);
}
/** /**
* Configures Mailgun using client supplied secret * Configures Mailgun using client supplied secret
* as the Mailer * as the Mailer

View File

@ -93,80 +93,80 @@ class InvoiceTransactionEventEntryCash
* *
* @param mixed $invoice * @param mixed $invoice
*/ */
private function getCancelledMetaData($invoice) // private function getCancelledMetaData($invoice)
{ // {
$calc = $invoice->calc(); // $calc = $invoice->calc();
$details = []; // $details = [];
$taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); // $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray());
foreach ($taxes as $tax) { // foreach ($taxes as $tax) {
$tax_detail = [ // $tax_detail = [
'tax_name' => $tax['name'], // 'tax_name' => $tax['name'],
'tax_rate' => $tax['tax_rate'], // 'tax_rate' => $tax['tax_rate'],
'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), // 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(),
'tax_amount' => $this->calculateRatio($tax['total']), // 'tax_amount' => $this->calculateRatio($tax['total']),
'tax_amount_paid' => $this->calculateRatio($tax['total']), // 'tax_amount_paid' => $this->calculateRatio($tax['total']),
'tax_amount_remaining' => 0, // 'tax_amount_remaining' => 0,
]; // ];
$details[] = $tax_detail; // $details[] = $tax_detail;
} // }
return new TransactionEventMetadata([ // return new TransactionEventMetadata([
'tax_report' => [ // 'tax_report' => [
'tax_details' => $details, // 'tax_details' => $details,
'payment_history' => $this->payments->toArray(), // 'payment_history' => $this->payments->toArray(),
'tax_summary' => [ // 'tax_summary' => [
'total_taxes' => $invoice->total_taxes, // 'total_taxes' => $invoice->total_taxes,
'total_paid' => $this->getTotalTaxPaid($invoice), // 'total_paid' => $this->getTotalTaxPaid($invoice),
'status' => 'cancelled', // 'status' => 'cancelled',
], // ],
], // ],
]); // ]);
} // }
/** /**
* Set all tax details to 0 * Set all tax details to 0
* *
* @param mixed $invoice * @param mixed $invoice
*/ */
private function getDeletedMetaData($invoice) // private function getDeletedMetaData($invoice)
{ // {
$calc = $invoice->calc(); // $calc = $invoice->calc();
$details = []; // $details = [];
$taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray()); // $taxes = array_merge($calc->getTaxMap()->merge($calc->getTotalTaxMap())->toArray());
foreach ($taxes as $tax) { // foreach ($taxes as $tax) {
$tax_detail = [ // $tax_detail = [
'tax_name' => $tax['name'], // 'tax_name' => $tax['name'],
'tax_rate' => $tax['tax_rate'], // 'tax_rate' => $tax['tax_rate'],
'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(), // 'taxable_amount' => $tax['base_amount'] ?? $calc->getNetSubtotal(),
'tax_amount' => $tax['total'], // 'tax_amount' => $tax['total'],
'tax_amount_paid' => $this->calculateRatio($tax['total']), // 'tax_amount_paid' => $this->calculateRatio($tax['total']),
'tax_amount_remaining' => 0, // 'tax_amount_remaining' => 0,
]; // ];
$details[] = $tax_detail; // $details[] = $tax_detail;
} // }
return new TransactionEventMetadata([ // return new TransactionEventMetadata([
'tax_report' => [ // 'tax_report' => [
'tax_details' => $details, // 'tax_details' => $details,
'payment_history' => $this->payments->toArray(), // 'payment_history' => $this->payments->toArray(),
'tax_summary' => [ // 'tax_summary' => [
'total_taxes' => $invoice->total_taxes, // 'total_taxes' => $invoice->total_taxes,
'total_paid' => $this->getTotalTaxPaid($invoice),0, // 'total_paid' => $this->getTotalTaxPaid($invoice),0,
'status' => 'deleted', // 'status' => 'deleted',
], // ],
], // ],
]); // ]);
} // }
private function getMetadata($invoice) private function getMetadata($invoice)
{ {

View File

@ -108,6 +108,7 @@ use Illuminate\Contracts\Translation\HasLocalePreference;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\SystemLog> $system_logs * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\SystemLog> $system_logs
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoice> $recurring_invoices * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoice> $recurring_invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Location> $locations
* @method static \Illuminate\Database\Eloquent\Builder|Client exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|Client exclude($columns)
* @method static \Database\Factories\ClientFactory factory($count = null, $state = []) * @method static \Database\Factories\ClientFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|Client filter(\App\Filters\QueryFilters $filters) * @method static \Illuminate\Database\Eloquent\Builder|Client filter(\App\Filters\QueryFilters $filters)

View File

@ -93,6 +93,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string|null $reminder3_sent * @property string|null $reminder3_sent
* @property string|null $reminder_last_sent * @property string|null $reminder_last_sent
* @property float $paid_to_date * @property float $paid_to_date
* @property int|null $location_id
* @property object|null $e_invoice
* @property object|null $tax_data
* @property int|null $subscription_id * @property int|null $subscription_id
* @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities * @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property int|null $activities_count * @property int|null $activities_count

View File

@ -45,6 +45,7 @@ use App\Utils\Number;
* @property int $status_id * @property int $status_id
* @property int|null $project_id * @property int|null $project_id
* @property int|null $vendor_id * @property int|null $vendor_id
* @property int|null $location_id
* @property int|null $recurring_id * @property int|null $recurring_id
* @property int|null $design_id * @property int|null $design_id
* @property string|null $number * @property string|null $number

View File

@ -22,6 +22,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int $id * @property int $id
* @property int $company_id * @property int $company_id
* @property int $user_id * @property int $user_id
* @property int|null $vendor_id
* @property int|null $client_id
* @property int|null $assigned_user_id * @property int|null $assigned_user_id
* @property string|null $name * @property string|null $name
* @property string|null $website * @property string|null $website

View File

@ -93,6 +93,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment>|\Illuminate\Support\Collection $paymentables * @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment>|\Illuminate\Support\Collection $paymentables
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @mixin \Eloquent * @mixin \Eloquent
*/ */
class Payment extends BaseModel class Payment extends BaseModel

View File

@ -57,6 +57,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed() * @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks * @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Expense> $expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Quote> $quotes
* @mixin \Eloquent * @mixin \Eloquent
*/ */
class Project extends BaseModel class Project extends BaseModel

View File

@ -42,6 +42,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int $status_id * @property int $status_id
* @property int|null $project_id * @property int|null $project_id
* @property int|null $vendor_id * @property int|null $vendor_id
* @property int|null $location_id
* @property int|null $recurring_id * @property int|null $recurring_id
* @property int|null $design_id * @property int|null $design_id
* @property int|null $invoice_id * @property int|null $invoice_id

View File

@ -36,6 +36,7 @@ use App\Models\Presenters\RecurringInvoicePresenter;
* @property int|null $project_id * @property int|null $project_id
* @property int|null $vendor_id * @property int|null $vendor_id
* @property int $status_id * @property int $status_id
* @property int|null $location_id
* @property string|null $number * @property string|null $number
* @property float $discount * @property float $discount
* @property bool $is_amount_discount * @property bool $is_amount_discount

View File

@ -0,0 +1,114 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
/**
* Custom validation rule for comma-separated email addresses
*
* This rule validates that a string contains valid email addresses
* separated by commas, with optional whitespace around commas.
*
* Usage examples:
* - new CommaSeparatedEmails() - basic validation (max 10 emails)
* - new CommaSeparatedEmails(5) - max 5 emails
* - new CommaSeparatedEmails(10, [';', ',']) - max 10 emails, separated by ; or ,
*
* Example input formats:
* - "user@example.com"
* - "user1@example.com, user2@example.com"
* - "user1@example.com,user2@example.com,user3@example.com"
* - " user1@example.com , user2@example.com " (whitespace is trimmed)
*/
class CommaSeparatedEmails implements ValidationRule
{
/**
* Maximum number of email addresses allowed
*/
protected int $maxEmails;
/**
* Array of valid separators
*/
protected array $separators;
/**
* Create a new rule instance.
*/
public function __construct(int $maxEmails = 10, array $separators = [','])
{
$this->maxEmails = $maxEmails;
$this->separators = $separators;
}
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
// If the value is null or empty, it's valid (nullable rule handles this)
if (empty($value)) {
return;
}
// Split the value by the first separator and trim whitespace
$emails = array_map('trim', explode($this->separators[0], $value));
// Filter out empty strings
$emails = array_filter($emails);
// If no valid emails after splitting, fail validation
if (empty($emails)) {
$fail('The :attribute must contain at least one valid email address.');
return;
}
// Check if we exceed the maximum number of emails
if (count($emails) > $this->maxEmails) {
$fail("The :attribute cannot contain more than {$this->maxEmails} email addresses.");
return;
}
// Validate each email address
foreach ($emails as $email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$fail("The email address '{$email}' in :attribute is not valid.");
return;
}
}
}
/**
* Get the validation error message.
*/
public function message(): string
{
return 'The :attribute must contain valid email addresses separated by commas.';
}
/**
* Static method to parse comma-separated emails into an array
* Useful for processing the validated data
*/
public static function parseEmails(string $emailString): array
{
if (empty($emailString)) {
return [];
}
$emails = array_map('trim', explode(',', $emailString));
return array_filter($emails);
}
/**
* Static method to validate a single email address
*/
public static function isValidEmail(string $email): bool
{
return filter_var(trim($email), FILTER_VALIDATE_EMAIL) !== false;
}
}

View File

@ -546,6 +546,19 @@ class Email implements ShouldQueue
} }
private function setHostedSesMailer()
{
if (property_exists($this->email_object->settings, 'email_from_name') && strlen($this->email_object->settings->email_from_name) > 1) {
$email_from_name = $this->email_object->settings->email_from_name;
} else {
$email_from_name = $this->company->present()->name();
}
$this->mailable
->from(config('services.ses.from.address'), $email_from_name);
}
/** /**
* Sets the mail driver to use and applies any specific configuration * Sets the mail driver to use and applies any specific configuration
@ -601,6 +614,10 @@ class Email implements ShouldQueue
$this->mailer = 'mailgun'; $this->mailer = 'mailgun';
$this->setHostedMailgunMailer(); $this->setHostedMailgunMailer();
return $this; return $this;
case 'ses':
$this->mailer = 'ses';
$this->setHostedSesMailer();
return $this;
case 'gmail': case 'gmail':
$this->mailer = 'gmail'; $this->mailer = 'gmail';
$this->setGmailMailer(); $this->setGmailMailer();

View File

@ -17,6 +17,7 @@ use setasign\Fpdi\Fpdi;
class PDF extends FPDI class PDF extends FPDI
{ {
public $text_alignment = 'L'; public $text_alignment = 'L';
public $x_offset = 0; // New property for X-axis offset
public function Footer() public function Footer()
{ {
@ -33,16 +34,26 @@ class PDF extends FPDI
// Set Y position // Set Y position
$this->SetY(config('ninja.pdf_page_numbering_y_alignment')); $this->SetY(config('ninja.pdf_page_numbering_y_alignment'));
// Calculate X position with offset
$base_x = config('ninja.pdf_page_numbering_x_alignment');
$x_position = $base_x + $this->x_offset;
// Set X position based on alignment // Set X position based on alignment
if ($this->text_alignment == 'L') { if ($this->text_alignment == 'L') {
$this->SetX(5); $this->SetX($x_position);
$this->Cell($this->GetPageWidth() - 10, 5, $trans, 0, 0, 'L'); // Adjust cell width to account for X offset
$cell_width = $this->GetPageWidth() - $x_position - 10;
$this->Cell($cell_width, 5, $trans, 0, 0, 'L');
} elseif ($this->text_alignment == 'R') { } elseif ($this->text_alignment == 'R') {
$this->SetX(0); $this->SetX($x_position);
$this->Cell($this->GetPageWidth(), 5, $trans, 0, 0, 'R'); // For right alignment, calculate width from X position to right edge
$cell_width = $this->GetPageWidth() - $x_position;
$this->Cell($cell_width, 5, $trans, 0, 0, 'R');
} else { } else {
$this->SetX(0); $this->SetX($x_position);
$this->Cell($this->GetPageWidth(), 5, $trans, 0, 0, 'C'); // For center alignment, calculate appropriate width
$cell_width = $this->GetPageWidth() - ($x_position * 2);
$this->Cell($cell_width, 5, $trans, 0, 0, 'C');
} }
} }

12
composer.lock generated
View File

@ -19003,16 +19003,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "11.0.10", "version": "11.0.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "1a800a7446add2d79cc6b3c01c45381810367d76" "reference": "4f7722aa9a7b76aa775e2d9d4e95d1ea16eeeef4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1a800a7446add2d79cc6b3c01c45381810367d76", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4f7722aa9a7b76aa775e2d9d4e95d1ea16eeeef4",
"reference": "1a800a7446add2d79cc6b3c01c45381810367d76", "reference": "4f7722aa9a7b76aa775e2d9d4e95d1ea16eeeef4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -19069,7 +19069,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/show" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.11"
}, },
"funding": [ "funding": [
{ {
@ -19089,7 +19089,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-06-18T08:56:18+00:00" "time": "2025-08-27T14:37:49+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.12.20'), 'app_version' => env('APP_VERSION', '5.12.21'),
'app_tag' => env('APP_TAG', '5.12.20'), 'app_tag' => env('APP_TAG', '5.12.21'),
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false), 'api_secret' => env('API_SECRET', false),
@ -257,7 +257,7 @@ return [
'storecove_email_catchall' => env('STORECOVE_CATCHALL_EMAIL',false), 'storecove_email_catchall' => env('STORECOVE_CATCHALL_EMAIL',false),
'qvalia_api_key' => env('QVALIA_API_KEY', false), 'qvalia_api_key' => env('QVALIA_API_KEY', false),
'qvalia_partner_number' => env('QVALIA_PARTNER_NUMBER', false), 'qvalia_partner_number' => env('QVALIA_PARTNER_NUMBER', false),
'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', 5), 'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', 0),
'pdf_page_numbering_y_alignment' => env('PDF_PAGE_NUMBER_Y', -6), 'pdf_page_numbering_y_alignment' => env('PDF_PAGE_NUMBER_Y', -6),
'hosted_einvoice_secret' => env('HOSTED_EINVOICE_SECRET', null), 'hosted_einvoice_secret' => env('HOSTED_EINVOICE_SECRET', null),
'e_invoice_quota_warning' => env('E_INVOICE_QUOTA_WARNING', 15), 'e_invoice_quota_warning' => env('E_INVOICE_QUOTA_WARNING', 15),

View File

@ -77,6 +77,9 @@ return [
'secret' => env('SES_AWS_SECRET_ACCESS_KEY'), 'secret' => env('SES_AWS_SECRET_ACCESS_KEY'),
'region' => env('SES_REGION', 'us-east-1'), 'region' => env('SES_REGION', 'us-east-1'),
'topic_arn' => env('SES_TOPIC_ARN', ''), 'topic_arn' => env('SES_TOPIC_ARN', ''),
'from' => [
'address' => env('SES_FROM_ADDRESS', ''),
],
], ],
'sparkpost' => [ 'sparkpost' => [

1
public/build/assets/app-9454bf28.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -385,7 +385,7 @@
"src": "resources/js/setup/setup.js" "src": "resources/js/setup/setup.js"
}, },
"resources/sass/app.scss": { "resources/sass/app.scss": {
"file": "assets/app-c818527d.css", "file": "assets/app-9454bf28.css",
"isEntry": true, "isEntry": true,
"src": "resources/sass/app.scss" "src": "resources/sass/app.scss"
} }

View File

@ -0,0 +1,111 @@
<?php
namespace Tests\Unit\Rules;
use App\Rules\CommaSeparatedEmails;
use PHPUnit\Framework\TestCase;
class CommaSeparatedEmailsTest extends TestCase
{
public function test_validates_single_email()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', 'test@example.com', function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed);
}
public function test_validates_multiple_emails()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', 'test1@example.com, test2@example.com, test3@example.com', function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed);
}
public function test_validates_emails_with_whitespace()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', ' test1@example.com , test2@example.com ', function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed);
}
public function test_fails_with_invalid_email()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$errorMessage = '';
$rule->validate('emails', 'invalid-email, test@example.com', function($message) use (&$failed, &$errorMessage) {
$failed = true;
$errorMessage = $message;
});
$this->assertTrue($failed);
$this->assertStringContainsString('invalid-email', $errorMessage);
}
public function test_fails_with_empty_emails()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', 'test@example.com, , test2@example.com', function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed); // Empty emails are filtered out
}
public function test_fails_when_exceeding_max_emails()
{
$rule = new CommaSeparatedEmails(2); // Max 2 emails
$failed = false;
$errorMessage = '';
$rule->validate('emails', 'test1@example.com, test2@example.com, test3@example.com', function($message) use (&$failed, &$errorMessage) {
$failed = true;
$errorMessage = $message;
});
$this->assertTrue($failed);
$this->assertStringContainsString('cannot contain more than 2', $errorMessage);
}
public function test_validates_null_value()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', null, function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed);
}
public function test_validates_empty_string()
{
$rule = new CommaSeparatedEmails();
$failed = false;
$rule->validate('emails', '', function() use (&$failed) {
$failed = true;
});
$this->assertFalse($failed);
}
}