mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #6285 from turbo124/v5-develop
Fixes for shared counters
This commit is contained in:
commit
9d84e5b4c3
@ -126,7 +126,7 @@ trait GeneratesCounter
|
|||||||
break;
|
break;
|
||||||
case Quote::class:
|
case Quote::class:
|
||||||
|
|
||||||
if ($this->hasSharedCounter($client))
|
if ($this->hasSharedCounter($client, 'quote'))
|
||||||
return 'invoice_number_counter';
|
return 'invoice_number_counter';
|
||||||
|
|
||||||
return 'quote_number_counter';
|
return 'quote_number_counter';
|
||||||
@ -138,7 +138,7 @@ trait GeneratesCounter
|
|||||||
return 'payment_number_counter';
|
return 'payment_number_counter';
|
||||||
break;
|
break;
|
||||||
case Credit::class:
|
case Credit::class:
|
||||||
if ($this->hasSharedCounter($client))
|
if ($this->hasSharedCounter($client, 'credit'))
|
||||||
return 'invoice_number_counter';
|
return 'invoice_number_counter';
|
||||||
|
|
||||||
return 'credit_number_counter';
|
return 'credit_number_counter';
|
||||||
@ -318,9 +318,13 @@ trait GeneratesCounter
|
|||||||
*
|
*
|
||||||
* @return bool True if has shared counter, False otherwise.
|
* @return bool True if has shared counter, False otherwise.
|
||||||
*/
|
*/
|
||||||
public function hasSharedCounter(Client $client) : bool
|
public function hasSharedCounter(Client $client, string $type = 'quote') : bool
|
||||||
{
|
{
|
||||||
return (bool) $client->getSetting('shared_invoice_quote_counter') || (bool) $client->getSetting('shared_invoice_credit_counter');
|
if($type == 'quote')
|
||||||
|
return (bool) $client->getSetting('shared_invoice_quote_counter');
|
||||||
|
|
||||||
|
if($type == 'credit')
|
||||||
|
return (bool) $client->getSetting('shared_invoice_credit_counter');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,7 +108,7 @@ class GeneratesCounterTest extends TestCase
|
|||||||
|
|
||||||
public function testHasSharedCounter()
|
public function testHasSharedCounter()
|
||||||
{
|
{
|
||||||
$this->assertFalse($this->hasSharedCounter($this->client));
|
$this->assertFalse($this->hasSharedCounter($this->client,));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHasTrueSharedCounter()
|
public function testHasTrueSharedCounter()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user