mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Updates for check_version
This commit is contained in:
parent
42da98a132
commit
045dbac6ff
@ -181,6 +181,9 @@ class SelfUpdateController extends BaseController
|
||||
|
||||
public function checkVersion()
|
||||
{
|
||||
if(Ninja::isHosted())
|
||||
return '5.10.SaaS';
|
||||
|
||||
return trim(file_get_contents(config('ninja.version_url')));
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,8 @@ class VendorRepository extends BaseRepository
|
||||
|
||||
$vendor->saveQuietly();
|
||||
|
||||
if ($vendor->number == '' || ! $vendor->number) {
|
||||
$vendor->number = $this->getNextVendorNumber($vendor);
|
||||
}
|
||||
|
||||
$vendor->saveQuietly();
|
||||
|
||||
$vendor->service()->applyNumber();
|
||||
|
||||
if (isset($data['contacts']) || $vendor->contacts()->count() == 0) {
|
||||
$this->contact_repo->save($data, $vendor);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class ClientService
|
||||
} catch (QueryException $e) {
|
||||
$x++;
|
||||
|
||||
if ($x > 10) {
|
||||
if ($x > 50) {
|
||||
$this->completed = false;
|
||||
}
|
||||
}
|
||||
|
45
app/Services/Vendor/VendorService.php
vendored
45
app/Services/Vendor/VendorService.php
vendored
@ -12,10 +12,55 @@
|
||||
namespace App\Services\Vendor;
|
||||
|
||||
use App\Models\Vendor;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class VendorService
|
||||
{
|
||||
|
||||
use GeneratesCounter;
|
||||
|
||||
private bool $completed = true;
|
||||
|
||||
public function __construct(public Vendor $vendor)
|
||||
{
|
||||
}
|
||||
|
||||
public function applyNumber(): self
|
||||
{
|
||||
$x = 1;
|
||||
|
||||
if(isset($this->vendor->number)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
do {
|
||||
try {
|
||||
$this->vendor->number = $this->getNextVendorNumber($this->vendor);
|
||||
$this->vendor->saveQuietly();
|
||||
|
||||
$this->completed = false;
|
||||
} catch (QueryException $e) {
|
||||
$x++;
|
||||
|
||||
if ($x > 50) {
|
||||
$this->completed = false;
|
||||
}
|
||||
}
|
||||
} while ($this->completed);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the vendor instance
|
||||
*
|
||||
* @return Vendor The Vendor Model
|
||||
*/
|
||||
public function save(): Vendor
|
||||
{
|
||||
$this->vendor->saveQuietly();
|
||||
|
||||
return $this->vendor->fresh();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user