mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01: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.
|
||||
|
||||
The current range of actions are as follows
|
||||
- clone_to_Quote
|
||||
- clone_to_quote
|
||||
- history
|
||||
- delivery_note
|
||||
@ -580,6 +579,8 @@ class QuoteController extends BaseController
|
||||
- download
|
||||
- archive
|
||||
- delete
|
||||
- convert
|
||||
- convert_to_invoice
|
||||
- email",
|
||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||
@ -640,6 +641,14 @@ class QuoteController extends BaseController
|
||||
private function performAction(Quote $quote, $action, $bulk = false)
|
||||
{
|
||||
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':
|
||||
|
||||
$this->entity_type = Invoice::class;
|
||||
|
@ -608,14 +608,19 @@ class UserController extends BaseController
|
||||
*/
|
||||
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)
|
||||
->whereCompanyId(auth()->user()->companyId())
|
||||
->withTrashed()
|
||||
->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();
|
||||
|
||||
if ($token) {
|
||||
|
@ -13,12 +13,14 @@ namespace App\Http\Requests\User;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\User;
|
||||
use App\Utils\Traits\ChecksEntityStatus;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class DetachCompanyUserRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
use ChecksEntityStatus;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
|
@ -22,10 +22,9 @@ class Subscription extends BaseModel
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'product_id',
|
||||
'product_ids',
|
||||
'recurring_product_ids',
|
||||
'company_id',
|
||||
'product_id',
|
||||
'is_recurring',
|
||||
'frequency_id',
|
||||
'auto_bill',
|
||||
'promo_code',
|
||||
@ -43,6 +42,7 @@ class Subscription extends BaseModel
|
||||
'refund_period',
|
||||
'webhook_configuration',
|
||||
'currency_id',
|
||||
'group_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
@ -148,9 +148,9 @@ class UserRepository extends BaseRepository
|
||||
|
||||
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
||||
|
||||
// $user->is_deleted = true;
|
||||
// $user->save();
|
||||
// $user->delete();
|
||||
$user->is_deleted = true;
|
||||
$user->save();
|
||||
$user->delete();
|
||||
|
||||
|
||||
return $user->fresh();
|
||||
@ -177,7 +177,17 @@ class UserRepository extends BaseRepository
|
||||
return;
|
||||
}
|
||||
|
||||
$user->is_deleted = false;
|
||||
$user->save();
|
||||
$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()));
|
||||
|
||||
|
@ -186,7 +186,7 @@ class PaymentMethod
|
||||
foreach ($child_array as $gateway_id => $gateway_type_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){
|
||||
|
||||
|
@ -106,7 +106,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": [
|
||||
"vendor/bin/snappdf download"
|
||||
"if [ '${IS_DOCKER:-false}' != 'true' ]; then vendor/bin/snappdf download; fi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"vendor/bin/snappdf download"
|
||||
|
@ -13,7 +13,7 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', ''),
|
||||
'app_version' => '5.1.31',
|
||||
'app_version' => '5.1.32',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', false),
|
||||
|
@ -21,10 +21,12 @@ class RefactorBillingScriptionsTable extends Migration
|
||||
$table->text('recurring_product_ids');
|
||||
$table->string('name');
|
||||
$table->unique(['company_id', 'name']);
|
||||
$table->unsignedInteger('group_id');
|
||||
});
|
||||
|
||||
Schema::table('subscriptions', function (Blueprint $table) {
|
||||
$table->renameColumn('product_id', 'product_ids');
|
||||
$table->dropColumn('is_recurring');
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class SubscriptionApiTest extends TestCase
|
||||
]);
|
||||
|
||||
$billing_subscription = Subscription::factory()->create([
|
||||
'product_id' => $product->id,
|
||||
'product_ids' => $product->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
@ -78,7 +78,7 @@ class SubscriptionApiTest extends TestCase
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'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);
|
||||
}
|
||||
@ -92,7 +92,7 @@ class SubscriptionApiTest extends TestCase
|
||||
|
||||
$response1 = $this
|
||||
->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)
|
||||
->json();
|
||||
|
||||
@ -123,7 +123,7 @@ class SubscriptionApiTest extends TestCase
|
||||
]);
|
||||
|
||||
$billing_subscription = Subscription::factory()->create([
|
||||
'product_id' => $product->id,
|
||||
'product_ids' => $product->id,
|
||||
'company_id' => $this->company->id,
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user