mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-21 00:41:34 +02:00
commit
8b91c0718e
@ -23,7 +23,9 @@ class WebhookFactory
|
||||
$webhook->target_url = '';
|
||||
$webhook->event_id = 1;
|
||||
$webhook->format = 'JSON';
|
||||
|
||||
$webhook->rest_method = 'post';
|
||||
$webhook->headers = [];
|
||||
|
||||
return $webhook;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class StoreSubscriptionRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
$rules = [
|
||||
'product_id' => ['sometimes'],
|
||||
'assigned_user_id' => ['sometimes'],
|
||||
'is_recurring' => ['sometimes'],
|
||||
@ -55,12 +55,17 @@ class StoreSubscriptionRequest extends Request
|
||||
'webhook_configuration' => ['array'],
|
||||
'name' => ['required', Rule::unique('subscriptions')->where('company_id', auth()->user()->company()->id)]
|
||||
];
|
||||
|
||||
return $this->globalRules($rules);
|
||||
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,20 @@ class UpdateSubscriptionRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
$rules = [
|
||||
//
|
||||
];
|
||||
|
||||
return $this->globalRules($rules);
|
||||
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
$input = $this->decodePrimaryKeys($input);
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ class UpdateOrCreateProduct implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDB($this->company->db);
|
||||
|
||||
if(strval($this->invoice->client->getSetting('currency_id')) != strval($this->company->settings->currency_id))
|
||||
return;
|
||||
|
||||
/*
|
||||
* If the invoice was generated from a Task or Expense then
|
||||
* we do NOT update the product details this short block we
|
||||
|
@ -227,6 +227,8 @@ class Import implements ShouldQueue
|
||||
CompanySizeCheck::dispatch();
|
||||
|
||||
info('Completed🚀🚀🚀🚀🚀 at '.now());
|
||||
|
||||
unlink($this->file_path);
|
||||
}
|
||||
|
||||
private function setInitialCompanyLedgerBalances()
|
||||
|
@ -41,6 +41,8 @@ class InvoiceArchivedActivity implements ShouldQueue
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$event->invoice->service()->deletePdf();
|
||||
|
||||
$fields = new stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -57,6 +57,15 @@ class Webhook extends BaseModel
|
||||
'target_url',
|
||||
'format',
|
||||
'event_id',
|
||||
'rest_method',
|
||||
'headers',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'headers' => 'array',
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
];
|
||||
|
||||
public function user()
|
||||
|
@ -82,6 +82,7 @@ class UpdateInvoicePayment
|
||||
->updateBalance($paid_amount * -1)
|
||||
->updatePaidToDate($paid_amount)
|
||||
->updateStatus()
|
||||
->deletePdf()
|
||||
->save();
|
||||
|
||||
InvoiceWorkflowSettings::dispatchNow($invoice);
|
||||
|
@ -34,6 +34,8 @@ class WebhookTransformer extends EntityTransformer
|
||||
'target_url' => $webhook->target_url ? (string) $webhook->target_url : '',
|
||||
'event_id' => (string) $webhook->event_id,
|
||||
'format' => (string) $webhook->format,
|
||||
'rest_method' => (string) $webhook->rest_method ?: '',
|
||||
'headers' => $webhook->headers ?: [],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddRestFieldsToWebhooksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('webhooks', function (Blueprint $table) {
|
||||
$table->text('rest_method')->nullable();
|
||||
$table->text('headers')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('webhooks', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
@ -55,4 +55,36 @@ class CompanySettingsTest extends TestCase
|
||||
|
||||
$this->assertEquals(1, count($diff));
|
||||
}
|
||||
|
||||
public function testStringEquivalence()
|
||||
{
|
||||
|
||||
$value = (strval(4) != strval(3));
|
||||
|
||||
$this->assertTrue($value);
|
||||
|
||||
$value = (strval(4) != strval(4));
|
||||
|
||||
$this->assertFalse($value);
|
||||
|
||||
$value = (strval('4') != strval(4));
|
||||
$this->assertFalse($value);
|
||||
|
||||
$value = (strval('4') != strval('4'));
|
||||
|
||||
$this->assertFalse($value);
|
||||
|
||||
$value = (strval('4') != strval(3));
|
||||
|
||||
$this->assertTrue($value);
|
||||
|
||||
$value = (strval(4) != strval('3'));
|
||||
|
||||
$this->assertTrue($value);
|
||||
|
||||
$value = (strval('4') != strval('3'));
|
||||
|
||||
$this->assertTrue($value);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user