mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Changes for counters
This commit is contained in:
parent
1195cd5224
commit
269fff3fc8
@ -16,6 +16,7 @@ use App\Events\Invoice\InvoiceWasEmailed;
|
|||||||
use App\Jobs\Entity\EmailEntity;
|
use App\Jobs\Entity\EmailEntity;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Webhook;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Utils\Traits\MakesReminders;
|
use App\Utils\Traits\MakesReminders;
|
||||||
@ -25,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
|||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
use App\Jobs\Util\WebHookHandler;
|
||||||
|
|
||||||
class SendReminders implements ShouldQueue
|
class SendReminders implements ShouldQueue
|
||||||
{
|
{
|
||||||
@ -81,6 +83,7 @@ class SendReminders implements ShouldQueue
|
|||||||
|
|
||||||
if (in_array($reminder_template, ['reminder1', 'reminder2', 'reminder3', 'endless_reminder'])) {
|
if (in_array($reminder_template, ['reminder1', 'reminder2', 'reminder3', 'endless_reminder'])) {
|
||||||
$this->sendReminder($invoice, $reminder_template);
|
$this->sendReminder($invoice, $reminder_template);
|
||||||
|
WebHookHandler::dispatch(Webhook::EVENT_REMIND_INVOICE, $invoice, $invoice->company);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -81,4 +81,9 @@ class Expense extends BaseModel
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Company::class);
|
return $this->belongsTo(Company::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vendor()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Vendor::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,22 +601,37 @@ trait GeneratesCounter
|
|||||||
$replace[] = str_replace($format, $date, $matches[1]);
|
$replace[] = str_replace($format, $date, $matches[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entity instanceof Client || $entity instanceof Vendor) {
|
if ($entity instanceof Vendor) {
|
||||||
$search[] = '{$client_custom1}';
|
|
||||||
$replace[] = $entity->custom_value1;
|
|
||||||
|
|
||||||
$search[] = '{$client_custom2}';
|
$search[] = '{$vendor_id_number}';
|
||||||
$replace[] = $entity->custom_value2;
|
|
||||||
|
|
||||||
$search[] = '{$client_custom3}';
|
|
||||||
$replace[] = $entity->custom_value3;
|
|
||||||
|
|
||||||
$search[] = '{$client_custom4}';
|
|
||||||
$replace[] = $entity->custom_value4;
|
|
||||||
|
|
||||||
$search[] = '{$id_number}';
|
|
||||||
$replace[] = $entity->id_number;
|
$replace[] = $entity->id_number;
|
||||||
} else {
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($entity instanceof Expense) {
|
||||||
|
|
||||||
|
if($entity->vendor){
|
||||||
|
$search[] = '{$vendor_id_number}';
|
||||||
|
$replace[] = $entity->vendor->id_number;
|
||||||
|
|
||||||
|
$search[] = '{$vendor_custom1}';
|
||||||
|
$replace[] = $entity->vendor->custom_value1;
|
||||||
|
|
||||||
|
$search[] = '{$vendor_custom2}';
|
||||||
|
$replace[] = $entity->vendor->custom_value2;
|
||||||
|
|
||||||
|
$search[] = '{$vendor_custom3}';
|
||||||
|
$replace[] = $entity->vendor->custom_value3;
|
||||||
|
|
||||||
|
$search[] = '{$vendor_custom4}';
|
||||||
|
$replace[] = $entity->vendor->custom_value4;
|
||||||
|
}
|
||||||
|
|
||||||
|
$search[] = '{$expense_id_number}';
|
||||||
|
$replace[] = $entity->id_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($entity->client) {
|
||||||
$search[] = '{$client_custom1}';
|
$search[] = '{$client_custom1}';
|
||||||
$replace[] = $entity->client->custom_value1;
|
$replace[] = $entity->client->custom_value1;
|
||||||
|
|
||||||
@ -629,7 +644,7 @@ trait GeneratesCounter
|
|||||||
$search[] = '{$client_custom4}';
|
$search[] = '{$client_custom4}';
|
||||||
$replace[] = $entity->client->custom_value4;
|
$replace[] = $entity->client->custom_value4;
|
||||||
|
|
||||||
$search[] = '{$id_number}';
|
$search[] = '{$client_id_number}';
|
||||||
$replace[] = $entity->client->id_number;
|
$replace[] = $entity->client->id_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user