mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 11:24:36 -04:00
Fixes for unique invoice number rule
This commit is contained in:
parent
41fdbd7978
commit
2f07a36d76
@ -148,7 +148,7 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
$query->with(
|
$query->with(
|
||||||
[
|
[
|
||||||
'company' => function ($query) use($updated_at){$query->where('updated_at', '>=', 0);},
|
'company' => function ($query) use($updated_at){$query->whereNotNull('updated_at');},
|
||||||
'company.clients' =>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
'company.clients' =>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
||||||
'company.tax_rates'=>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
'company.tax_rates'=>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
||||||
'company.groups'=>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
'company.groups'=>function ($query) use($updated_at){$query->where('updated_at', '>=', $updated_at);},
|
||||||
|
@ -54,13 +54,17 @@ class UniqueInvoiceNumberRule implements Rule
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function checkIfInvoiceNumberUnique($value) : bool
|
private function checkIfInvoiceNumberUnique() : bool
|
||||||
{
|
{
|
||||||
|
|
||||||
return Invoice::where('client_id', $this->input['client_id'])
|
$invoice = Invoice::where('client_id', $this->input['client_id'])
|
||||||
->where('number', $this->input['number'])
|
->where('number', $this->input['number'])
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->exists();
|
->first();
|
||||||
|
|
||||||
|
if($invoice)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user