mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 12:44:31 -04:00
Label reminder activity records
This commit is contained in:
parent
b6b5ba154d
commit
6ff1c79db3
@ -17,14 +17,20 @@ class InvoiceInvitationWasEmailed extends Event
|
|||||||
*/
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var String
|
||||||
|
*/
|
||||||
|
public $notes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @param Invitation $invitation
|
* @param Invitation $invitation
|
||||||
*/
|
*/
|
||||||
public function __construct(Invitation $invitation)
|
public function __construct(Invitation $invitation, $notes)
|
||||||
{
|
{
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
|
$this->notes = $notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,20 @@ class QuoteInvitationWasEmailed extends Event
|
|||||||
*/
|
*/
|
||||||
public $invitation;
|
public $invitation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var String
|
||||||
|
*/
|
||||||
|
public $notes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new event instance.
|
* Create a new event instance.
|
||||||
*
|
*
|
||||||
* @param Invitation $invitation
|
* @param Invitation $invitation
|
||||||
*/
|
*/
|
||||||
public function __construct(Invitation $invitation)
|
public function __construct(Invitation $invitation, $notes)
|
||||||
{
|
{
|
||||||
$this->invitation = $invitation;
|
$this->invitation = $invitation;
|
||||||
|
$this->notes = $notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ class DashboardController extends BaseController
|
|||||||
$expenses = $dashboardRepo->expenses($accountId, $userId, $viewAll);
|
$expenses = $dashboardRepo->expenses($accountId, $userId, $viewAll);
|
||||||
$tasks = $dashboardRepo->tasks($accountId, $userId, $viewAll);
|
$tasks = $dashboardRepo->tasks($accountId, $userId, $viewAll);
|
||||||
|
|
||||||
$showBlueVinePromo = ! $account->company->bluevine_status
|
$showBlueVinePromo = env('BLUEVINE_PARTNER_UNIQUE_ID')
|
||||||
&& env('BLUEVINE_PARTNER_UNIQUE_ID')
|
&& ! $account->company->bluevine_status
|
||||||
&& $account->created_at <= date( 'Y-m-d', strtotime( '-1 month' ));
|
&& $account->created_at <= date( 'Y-m-d', strtotime( '-1 month' ));
|
||||||
|
|
||||||
$showWhiteLabelExpired = Utils::isSelfHost() && $account->company->hasExpiredPlan(PLAN_WHITE_LABEL);
|
$showWhiteLabelExpired = Utils::isSelfHost() && $account->company->hasExpiredPlan(PLAN_WHITE_LABEL);
|
||||||
|
@ -196,7 +196,8 @@ class ActivityListener
|
|||||||
ACTIVITY_TYPE_EMAIL_INVOICE,
|
ACTIVITY_TYPE_EMAIL_INVOICE,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$event->invitation
|
$event->invitation,
|
||||||
|
$event->notes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +295,8 @@ class ActivityListener
|
|||||||
ACTIVITY_TYPE_EMAIL_QUOTE,
|
ACTIVITY_TYPE_EMAIL_QUOTE,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
$event->invitation
|
$event->invitation,
|
||||||
|
$event->notes
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,14 +395,14 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
/**
|
/**
|
||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
*/
|
*/
|
||||||
public function markInvitationsSent($notify = false)
|
public function markInvitationsSent($notify = false, $reminder = false)
|
||||||
{
|
{
|
||||||
if ( ! $this->relationLoaded('invitations')) {
|
if ( ! $this->relationLoaded('invitations')) {
|
||||||
$this->load('invitations');
|
$this->load('invitations');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->invitations as $invitation) {
|
foreach ($this->invitations as $invitation) {
|
||||||
$this->markInvitationSent($invitation, false, $notify);
|
$this->markInvitationSent($invitation, false, $notify, $reminder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
* @param bool $messageId
|
* @param bool $messageId
|
||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
*/
|
*/
|
||||||
public function markInvitationSent($invitation, $messageId = false, $notify = true)
|
public function markInvitationSent($invitation, $messageId = false, $notify = true, $notes = false)
|
||||||
{
|
{
|
||||||
if (!$this->isSent()) {
|
if (!$this->isSent()) {
|
||||||
$this->invoice_status_id = INVOICE_STATUS_SENT;
|
$this->invoice_status_id = INVOICE_STATUS_SENT;
|
||||||
@ -442,9 +442,9 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isType(INVOICE_TYPE_QUOTE)) {
|
if ($this->isType(INVOICE_TYPE_QUOTE)) {
|
||||||
event(new QuoteInvitationWasEmailed($invitation));
|
event(new QuoteInvitationWasEmailed($invitation, $notes));
|
||||||
} else {
|
} else {
|
||||||
event(new InvoiceInvitationWasEmailed($invitation));
|
event(new InvoiceInvitationWasEmailed($invitation, $notes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,9 @@ trait GeneratesNumbers
|
|||||||
public function incrementCounter($entity)
|
public function incrementCounter($entity)
|
||||||
{
|
{
|
||||||
if ($entity->isEntityType(ENTITY_CLIENT)) {
|
if ($entity->isEntityType(ENTITY_CLIENT)) {
|
||||||
|
if ($this->client_number_counter) {
|
||||||
$this->client_number_counter += 1;
|
$this->client_number_counter += 1;
|
||||||
|
}
|
||||||
} elseif ($entity->isType(INVOICE_TYPE_QUOTE) && ! $this->share_counter) {
|
} elseif ($entity->isType(INVOICE_TYPE_QUOTE) && ! $this->share_counter) {
|
||||||
$this->quote_number_counter += 1;
|
$this->quote_number_counter += 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,7 +32,13 @@ class ActivityDatatable extends EntityDatatable
|
|||||||
'expense' => $model->expense_public_id ? link_to('/expenses/' . $model->expense_public_id, substr($model->expense_public_notes, 0, 30).'...') : null,
|
'expense' => $model->expense_public_id ? link_to('/expenses/' . $model->expense_public_id, substr($model->expense_public_notes, 0, 30).'...') : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
return trans("texts.activity_{$model->activity_type_id}", $data);
|
$str = trans("texts.activity_{$model->activity_type_id}", $data);
|
||||||
|
|
||||||
|
if ($model->notes) {
|
||||||
|
$str .= ' - ' . trans("texts.notes_{$model->notes}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -107,7 +107,7 @@ class ContactMailer extends Mailer
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($invoice->invitations as $invitation) {
|
foreach ($invoice->invitations as $invitation) {
|
||||||
$response = $this->sendInvitation($invitation, $invoice, $emailTemplate, $emailSubject, $pdfString, $documentStrings);
|
$response = $this->sendInvitation($invitation, $invoice, $emailTemplate, $emailSubject, $pdfString, $documentStrings, $reminder);
|
||||||
if ($response === true) {
|
if ($response === true) {
|
||||||
$sent = true;
|
$sent = true;
|
||||||
}
|
}
|
||||||
@ -142,7 +142,8 @@ class ContactMailer extends Mailer
|
|||||||
$body,
|
$body,
|
||||||
$subject,
|
$subject,
|
||||||
$pdfString,
|
$pdfString,
|
||||||
$documentStrings
|
$documentStrings,
|
||||||
|
$reminder
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -197,6 +198,7 @@ class ContactMailer extends Mailer
|
|||||||
'client' => $client,
|
'client' => $client,
|
||||||
'invoice' => $invoice,
|
'invoice' => $invoice,
|
||||||
'documents' => $documentStrings,
|
'documents' => $documentStrings,
|
||||||
|
'notes' => $reminder,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($account->attachPDF()) {
|
if ($account->attachPDF()) {
|
||||||
|
@ -21,11 +21,6 @@ class Mailer
|
|||||||
*/
|
*/
|
||||||
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [])
|
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [])
|
||||||
{
|
{
|
||||||
// check the username is set
|
|
||||||
if ( ! env('POSTMARK_API_TOKEN') && ! env('MAIL_USERNAME')) {
|
|
||||||
return trans('texts.invalid_mail_config');
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't send emails to dummy addresses
|
// don't send emails to dummy addresses
|
||||||
if (stristr($toEmail, '@example.com')) {
|
if (stristr($toEmail, '@example.com')) {
|
||||||
return true;
|
return true;
|
||||||
@ -89,7 +84,8 @@ class Mailer
|
|||||||
$messageId = $json->MessageID;
|
$messageId = $json->MessageID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$invoice->markInvitationSent($invitation, $messageId);
|
$notes = isset($data['notes']) ? $data['notes']: false;
|
||||||
|
$invoice->markInvitationSent($invitation, $messageId, true, $notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -10,7 +10,7 @@ use App\Models\Invitation;
|
|||||||
|
|
||||||
class ActivityRepository
|
class ActivityRepository
|
||||||
{
|
{
|
||||||
public function create($entity, $activityTypeId, $balanceChange = 0, $paidToDateChange = 0, $altEntity = null)
|
public function create($entity, $activityTypeId, $balanceChange = 0, $paidToDateChange = 0, $altEntity = null, $notes = false)
|
||||||
{
|
{
|
||||||
if ($entity instanceof Client) {
|
if ($entity instanceof Client) {
|
||||||
$client = $entity;
|
$client = $entity;
|
||||||
@ -29,6 +29,7 @@ class ActivityRepository
|
|||||||
$activity->adjustment = $balanceChange;
|
$activity->adjustment = $balanceChange;
|
||||||
$activity->client_id = $client ? $client->id : 0;
|
$activity->client_id = $client ? $client->id : 0;
|
||||||
$activity->balance = $client ? ($client->balance + $balanceChange) : 0;
|
$activity->balance = $client ? ($client->balance + $balanceChange) : 0;
|
||||||
|
$activity->notes = $notes ?: '';
|
||||||
|
|
||||||
$keyField = $entity->getKeyField();
|
$keyField = $entity->getKeyField();
|
||||||
$activity->$keyField = $entity->id;
|
$activity->$keyField = $entity->id;
|
||||||
@ -53,11 +54,8 @@ class ActivityRepository
|
|||||||
} else {
|
} else {
|
||||||
$activity->user_id = $entity->user_id;
|
$activity->user_id = $entity->user_id;
|
||||||
$activity->account_id = $entity->account_id;
|
$activity->account_id = $entity->account_id;
|
||||||
|
|
||||||
if ( ! $entity instanceof Invitation) {
|
|
||||||
$activity->is_system = true;
|
$activity->is_system = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$activity->token_id = session('token_id');
|
$activity->token_id = session('token_id');
|
||||||
|
|
||||||
@ -89,6 +87,7 @@ class ActivityRepository
|
|||||||
'activities.is_system',
|
'activities.is_system',
|
||||||
'activities.balance',
|
'activities.balance',
|
||||||
'activities.adjustment',
|
'activities.adjustment',
|
||||||
|
'activities.notes',
|
||||||
'users.first_name as user_first_name',
|
'users.first_name as user_first_name',
|
||||||
'users.last_name as user_last_name',
|
'users.last_name as user_last_name',
|
||||||
'users.email as user_email',
|
'users.email as user_email',
|
||||||
|
@ -35,6 +35,10 @@ class AddInclusiveTaxes extends Migration
|
|||||||
$table->text('client_number_pattern')->nullable();
|
$table->text('client_number_pattern')->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('activities', function ($table)
|
||||||
|
{
|
||||||
|
$table->text('notes')->nullable();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,5 +66,10 @@ class AddInclusiveTaxes extends Migration
|
|||||||
$table->dropColumn('client_number_counter');
|
$table->dropColumn('client_number_counter');
|
||||||
$table->dropColumn('client_number_pattern');
|
$table->dropColumn('client_number_pattern');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::table('activities', function ($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('notes');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2301,6 +2301,9 @@ $LANG = array(
|
|||||||
'client_number_help' => 'Specify a prefix or use a custom pattern to dynamically set the client number.',
|
'client_number_help' => 'Specify a prefix or use a custom pattern to dynamically set the client number.',
|
||||||
'next_client_number' => 'The next client number is :number.',
|
'next_client_number' => 'The next client number is :number.',
|
||||||
'generated_numbers' => 'Generated Numbers',
|
'generated_numbers' => 'Generated Numbers',
|
||||||
|
'notes_reminder1' => 'First Reminder',
|
||||||
|
'notes_reminder2' => 'Second Reminder',
|
||||||
|
'notes_reminder3' => 'Third Reminder',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<iframe id="theFrame" style="display:block" frameborder="1" width="100%" height="{{ isset($pdfHeight) ? $pdfHeight : 1180 }}px"></iframe>
|
<iframe id="theFrame" style="display:block" frameborder="1" width="100%" height="{{ isset($pdfHeight) ? $pdfHeight : 1180 }}px"></iframe>
|
||||||
<div style="width:100%;background-color:#525659;border:solid 2px #9a9a9a;padding-top:40px;text-align:center">
|
<div id="theCanvasDiv" style="display:none;width:100%;background-color:#525659;border:solid 2px #9a9a9a;padding-top:40px;text-align:center">
|
||||||
<canvas id="theCanvas" style="display:none;max-width:100%;border:solid 1px #CCCCCC;"></canvas>
|
<canvas id="theCanvas" style="max-width:100%;border:solid 1px #CCCCCC;"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (!Utils::isNinja() || !Utils::isPro())
|
@if (!Utils::isNinja() || !Utils::isPro())
|
||||||
@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
page.render({canvasContext: context, viewport: viewport});
|
page.render({canvasContext: context, viewport: viewport});
|
||||||
$('#theFrame').hide();
|
$('#theFrame').hide();
|
||||||
$('#theCanvas').show();
|
$('#theCanvasDiv').show();
|
||||||
isRefreshing = false;
|
isRefreshing = false;
|
||||||
if (needsRefresh) {
|
if (needsRefresh) {
|
||||||
needsRefresh = false;
|
needsRefresh = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user