mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
4f78b39edc
@ -1 +1 @@
|
|||||||
5.1.31
|
5.1.32
|
@ -572,7 +572,6 @@ class QuoteController extends BaseController
|
|||||||
* description="Performs a custom action on an Quote.
|
* description="Performs a custom action on an Quote.
|
||||||
|
|
||||||
The current range of actions are as follows
|
The current range of actions are as follows
|
||||||
- clone_to_Quote
|
|
||||||
- clone_to_quote
|
- clone_to_quote
|
||||||
- history
|
- history
|
||||||
- delivery_note
|
- delivery_note
|
||||||
@ -580,6 +579,8 @@ class QuoteController extends BaseController
|
|||||||
- download
|
- download
|
||||||
- archive
|
- archive
|
||||||
- delete
|
- delete
|
||||||
|
- convert
|
||||||
|
- convert_to_invoice
|
||||||
- email",
|
- email",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
@ -640,6 +641,14 @@ class QuoteController extends BaseController
|
|||||||
private function performAction(Quote $quote, $action, $bulk = false)
|
private function performAction(Quote $quote, $action, $bulk = false)
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
case 'convert':
|
||||||
|
case 'convert_to_invoice':
|
||||||
|
|
||||||
|
$this->entity_type = Invoice::class;
|
||||||
|
$this->entity_transformer = InvoiceTransformer::class;
|
||||||
|
return $this->itemResponse($quote->service()->convertToInvoice());
|
||||||
|
|
||||||
|
break;
|
||||||
case 'clone_to_invoice':
|
case 'clone_to_invoice':
|
||||||
|
|
||||||
$this->entity_type = Invoice::class;
|
$this->entity_type = Invoice::class;
|
||||||
|
@ -608,14 +608,19 @@ class UserController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function detach(DetachCompanyUserRequest $request, User $user)
|
public function detach(DetachCompanyUserRequest $request, User $user)
|
||||||
{
|
{
|
||||||
if($user->isOwner())
|
|
||||||
return response()->json(['message', 'Cannot detach owner.'],400);
|
if ($request->entityIsDeleted($user)) {
|
||||||
|
return $request->disallowUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
$company_user = CompanyUser::whereUserId($user->id)
|
$company_user = CompanyUser::whereUserId($user->id)
|
||||||
->whereCompanyId(auth()->user()->companyId())
|
->whereCompanyId(auth()->user()->companyId())
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
if($company_user->is_owner)
|
||||||
|
return response()->json(['message', 'Cannot detach owner.'], 401);
|
||||||
|
|
||||||
$token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
|
$token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
|
||||||
|
|
||||||
if ($token) {
|
if ($token) {
|
||||||
|
@ -13,11 +13,13 @@ namespace App\Http\Requests\User;
|
|||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Utils\Traits\ChecksEntityStatus;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class DetachCompanyUserRequest extends Request
|
class DetachCompanyUserRequest extends Request
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use ChecksEntityStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
|
@ -22,10 +22,9 @@ class Subscription extends BaseModel
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'product_id',
|
'product_ids',
|
||||||
|
'recurring_product_ids',
|
||||||
'company_id',
|
'company_id',
|
||||||
'product_id',
|
|
||||||
'is_recurring',
|
|
||||||
'frequency_id',
|
'frequency_id',
|
||||||
'auto_bill',
|
'auto_bill',
|
||||||
'promo_code',
|
'promo_code',
|
||||||
@ -43,6 +42,7 @@ class Subscription extends BaseModel
|
|||||||
'refund_period',
|
'refund_period',
|
||||||
'webhook_configuration',
|
'webhook_configuration',
|
||||||
'currency_id',
|
'currency_id',
|
||||||
|
'group_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
@ -148,9 +148,9 @@ class UserRepository extends BaseRepository
|
|||||||
|
|
||||||
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
||||||
|
|
||||||
// $user->is_deleted = true;
|
$user->is_deleted = true;
|
||||||
// $user->save();
|
$user->save();
|
||||||
// $user->delete();
|
$user->delete();
|
||||||
|
|
||||||
|
|
||||||
return $user->fresh();
|
return $user->fresh();
|
||||||
@ -177,7 +177,17 @@ class UserRepository extends BaseRepository
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user->is_deleted = false;
|
||||||
|
$user->save();
|
||||||
$user->restore();
|
$user->restore();
|
||||||
|
// $user->company_user->restore();
|
||||||
|
|
||||||
|
$cu = CompanyUser::withTrashed()
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->where('company_id', auth()->user()->company()->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$cu->restore();
|
||||||
|
|
||||||
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class PaymentMethod
|
|||||||
foreach ($child_array as $gateway_id => $gateway_type_id) {
|
foreach ($child_array as $gateway_id => $gateway_type_id) {
|
||||||
$gateway = CompanyGateway::find($gateway_id);
|
$gateway = CompanyGateway::find($gateway_id);
|
||||||
|
|
||||||
$fee_label = $gateway->calcGatewayFeeLabel($this->amount, $this->client);
|
$fee_label = $gateway->calcGatewayFeeLabel($this->amount, $this->client, $gateway_type_id);
|
||||||
|
|
||||||
if(!$gateway_type_id){
|
if(!$gateway_type_id){
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-install-cmd": [
|
"post-install-cmd": [
|
||||||
"vendor/bin/snappdf download"
|
"if [ '${IS_DOCKER:-false}' != 'true' ]; then vendor/bin/snappdf download; fi"
|
||||||
],
|
],
|
||||||
"post-update-cmd": [
|
"post-update-cmd": [
|
||||||
"vendor/bin/snappdf download"
|
"vendor/bin/snappdf download"
|
||||||
|
@ -13,7 +13,7 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', ''),
|
'app_domain' => env('APP_DOMAIN', ''),
|
||||||
'app_version' => '5.1.31',
|
'app_version' => '5.1.32',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', false),
|
'api_secret' => env('API_SECRET', false),
|
||||||
|
@ -21,10 +21,12 @@ class RefactorBillingScriptionsTable extends Migration
|
|||||||
$table->text('recurring_product_ids');
|
$table->text('recurring_product_ids');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->unique(['company_id', 'name']);
|
$table->unique(['company_id', 'name']);
|
||||||
|
$table->unsignedInteger('group_id');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('subscriptions', function (Blueprint $table) {
|
Schema::table('subscriptions', function (Blueprint $table) {
|
||||||
$table->renameColumn('product_id', 'product_ids');
|
$table->renameColumn('product_id', 'product_ids');
|
||||||
|
$table->dropColumn('is_recurring');
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ class SubscriptionApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$billing_subscription = Subscription::factory()->create([
|
$billing_subscription = Subscription::factory()->create([
|
||||||
'product_id' => $product->id,
|
'product_ids' => $product->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ class SubscriptionApiTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/subscriptions', ['product_id' => $product->id, 'allow_cancellation' => true]);
|
])->post('/api/v1/subscriptions', ['product_ids' => $product->id, 'allow_cancellation' => true]);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ class SubscriptionApiTest extends TestCase
|
|||||||
|
|
||||||
$response1 = $this
|
$response1 = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
||||||
->post('/api/v1/subscriptions', ['product_id' => $product->id])
|
->post('/api/v1/subscriptions', ['product_ids' => $product->id])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class SubscriptionApiTest extends TestCase
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$billing_subscription = Subscription::factory()->create([
|
$billing_subscription = Subscription::factory()->create([
|
||||||
'product_id' => $product->id,
|
'product_ids' => $product->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user