1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Fixes for restoring deleted user

This commit is contained in:
David Bomba 2024-03-21 08:01:13 +11:00
parent f49a78bdb4
commit ba4cd4508b
8 changed files with 32 additions and 14 deletions

View File

@ -133,12 +133,6 @@ class StorePaymentRequest extends Request
$input['idempotency_key'] = substr(sha1(json_encode($input)).time()."{$input['date']}{$input['amount']}{$user->id}", 0, 64);
}
nlog($input);
$i = \App\Models\Invoice::find($input['invoices'][0]['invoice_id']);
nlog($i->client_id);
nlog($i->id);
nlog($user->company()->id);
nlog($i->company_id);
$this->replace($input);
}

View File

@ -222,6 +222,8 @@ class RequiredClientInfo extends Component
$this->show_form = true;
$hash = Cache::get(request()->input('hash'));
/** @var \App\Models\Invoice $invoice */
$invoice = Invoice::find($this->decodePrimaryKey($hash['invoice_id']));
$this->invoice_terms = $invoice->terms;

View File

@ -202,7 +202,6 @@ class CompanyUser extends Pivot
*/
public function portalType(): bool
{
nlog(isset($this->react_settings->react_notification_link) && $this->react_settings->react_notification_link);
return isset($this->react_settings->react_notification_link) && $this->react_settings->react_notification_link;
}

View File

@ -252,6 +252,30 @@ class PaytracePaymentDriver extends BaseDriver
return false;
}
public function getClientRequiredFields(): array
{
$fields = parent::getClientRequiredFields();
nlog("a");
nlog($fields);
$fields[] = ['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_city', 'label' => ctrans('texts.city'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
nlog("b");
nlog($fields);
return $fields;
}
public function auth(): bool
{
try {

View File

@ -206,7 +206,8 @@ class UserRepository extends BaseRepository
->first();
$cu->restore();
$cu->tokens()->restore();
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}

View File

@ -13,7 +13,6 @@ namespace Tests\Feature\EInvoice;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Support\Facades\Storage;
use Tests\MockAccountData;
use Tests\TestCase;

View File

@ -11,7 +11,7 @@
namespace Tests\Feature\EInvoice;
use App\Services\EInvoicing\Standards\FatturaPA;
use App\Services\EDocument\Standards\FatturaPA;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Tests\MockAccountData;

View File

@ -420,10 +420,9 @@ class PaymentTest extends TestCase
public function testPaymentRESTEndPoints()
{
Payment::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
$Payment = Payment::all()->last();
$Payment = Payment::factory()->create(['user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id]);
$Payment->name = \Illuminate\Support\Str::random(54);
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,