mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge branch 'yodlee' of https://github.com/turbo124/invoiceninja into yodlee
This commit is contained in:
commit
3a0ed494ef
@ -65,7 +65,7 @@ class VendorContactKeyLogin
|
||||
return redirect($this->setRedirectPath());
|
||||
}
|
||||
} elseif ($request->segment(3) && config('ninja.db.multi_db_enabled')) {
|
||||
if (MultiDB::findAndSetDbByContactKey($request->segment(3))) {
|
||||
if (MultiDB::findAndSetDbByVendorContactKey($request->segment(3))) {
|
||||
if ($vendor_contact = VendorContact::where('contact_key', $request->segment(3))->first()) {
|
||||
if (empty($vendor_contact->email)) {
|
||||
$vendor_contact->email = Str::random(6).'@example.com';
|
||||
|
@ -18,6 +18,7 @@ use App\Models\Company;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Document;
|
||||
use App\Models\User;
|
||||
use App\Models\VendorContact;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@ -364,6 +365,23 @@ class MultiDB
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByVendorContactKey($contact_key) :bool
|
||||
{
|
||||
$current_db = config('database.default');
|
||||
|
||||
foreach (self::$dbs as $db) {
|
||||
if (VendorContact::on($db)->where('contact_key', $contact_key)->exists()) {
|
||||
self::setDb($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
self::setDB($current_db);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function findAndSetDbByClientHash($client_hash) :bool
|
||||
{
|
||||
$current_db = config('database.default');
|
||||
|
@ -84,7 +84,6 @@ class ActivityRepository extends BaseRepository
|
||||
$entity->load('client');
|
||||
$contact = $entity->client->primary_contact()->first();
|
||||
$backup->html_backup = '';
|
||||
// $backup->html_backup = $this->generateHtml($entity);
|
||||
$backup->amount = $entity->amount;
|
||||
$backup->activity_id = $activity->id;
|
||||
$backup->json_backup = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user