mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 11:14:31 -04:00
Bug fixes
This commit is contained in:
parent
b11ab39a9f
commit
55a8ef4951
@ -156,7 +156,7 @@ class InvoiceController extends \BaseController {
|
|||||||
|
|
||||||
public function edit($publicId)
|
public function edit($publicId)
|
||||||
{
|
{
|
||||||
$invoice = Invoice::scope($publicId)->withTrashed()->with('account.country', 'client.contacts', 'client.country', 'invoice_items')->firstOrFail();
|
$invoice = Invoice::scope($publicId)->withTrashed()->with('invitations', 'account.country', 'client.contacts', 'client.country', 'invoice_items')->firstOrFail();
|
||||||
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->getDisplayName(), ENTITY_INVOICE);
|
Utils::trackViewed($invoice->invoice_number . ' - ' . $invoice->client->getDisplayName(), ENTITY_INVOICE);
|
||||||
|
|
||||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||||
@ -165,12 +165,12 @@ class InvoiceController extends \BaseController {
|
|||||||
$invoice->end_date = Utils::fromSqlDate($invoice->end_date);
|
$invoice->end_date = Utils::fromSqlDate($invoice->end_date);
|
||||||
$invoice->is_pro = Auth::user()->isPro();
|
$invoice->is_pro = Auth::user()->isPro();
|
||||||
|
|
||||||
$contactIds = DB::table('invitations')
|
$contactIds = DB::table('invitations')
|
||||||
->join('contacts', 'contacts.id', '=','invitations.contact_id')
|
->join('contacts', 'contacts.id', '=','invitations.contact_id')
|
||||||
->where('invitations.invoice_id', '=', $invoice->id)
|
->where('invitations.invoice_id', '=', $invoice->id)
|
||||||
->where('invitations.account_id', '=', Auth::user()->account_id)
|
->where('invitations.account_id', '=', Auth::user()->account_id)
|
||||||
->where('invitations.deleted_at', '=', null)
|
->where('invitations.deleted_at', '=', null)
|
||||||
->select('contacts.public_id')->lists('public_id');
|
->select('contacts.public_id')->lists('public_id');
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
@ -183,6 +183,27 @@ class InvoiceController extends \BaseController {
|
|||||||
'title' => '- ' . $invoice->invoice_number,
|
'title' => '- ' . $invoice->invoice_number,
|
||||||
'client' => $invoice->client);
|
'client' => $invoice->client);
|
||||||
$data = array_merge($data, self::getViewModel());
|
$data = array_merge($data, self::getViewModel());
|
||||||
|
|
||||||
|
// Set the invitation link on the client's contacts
|
||||||
|
$clients = $data['clients'];
|
||||||
|
foreach ($clients as $client)
|
||||||
|
{
|
||||||
|
if ($client->id == $invoice->client->id)
|
||||||
|
{
|
||||||
|
foreach ($invoice->invitations as $invitation)
|
||||||
|
{
|
||||||
|
foreach ($client->contacts as $contact)
|
||||||
|
{
|
||||||
|
if ($invitation->contact_id == $contact->id)
|
||||||
|
{
|
||||||
|
$contact->invitation_link = $invitation->getLink();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return View::make('invoices.edit', $data);
|
return View::make('invoices.edit', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +332,10 @@ class InvoiceController extends \BaseController {
|
|||||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
||||||
$invitation->save();
|
$invitation->save();
|
||||||
}
|
}
|
||||||
|
else if (!in_array($contact->id, $sendInvoiceIds) && $invitation)
|
||||||
|
{
|
||||||
|
$invitation->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = trans($publicId ? 'texts.updated_invoice' : 'texts.created_invoice');
|
$message = trans($publicId ? 'texts.updated_invoice' : 'texts.created_invoice');
|
||||||
|
@ -317,6 +317,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -324,7 +324,7 @@ return array(
|
|||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
'set_name' => 'Set your company name',
|
'set_name' => 'Set your company name',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,6 +316,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -317,6 +317,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -317,6 +317,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -317,6 +317,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -305,6 +305,6 @@ return array(
|
|||||||
'field_label' => 'Field Label',
|
'field_label' => 'Field Label',
|
||||||
'field_value' => 'Field Value',
|
'field_value' => 'Field Value',
|
||||||
'edit' => 'Edit',
|
'edit' => 'Edit',
|
||||||
|
'view_invoice' => 'View invoice',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -16,4 +16,9 @@ class Invitation extends EntityModel
|
|||||||
{
|
{
|
||||||
return $this->belongsTo('User');
|
return $this->belongsTo('User');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLink()
|
||||||
|
{
|
||||||
|
return URL::to('view') . '/' . $this->invitation_key;
|
||||||
|
}
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ class ContactMailer extends Mailer {
|
|||||||
$invitation->save();
|
$invitation->save();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'link' => URL::to('view') . '/' . $invitation->invitation_key,
|
'link' => $invitation->getLink(),
|
||||||
'clientName' => $invoice->client->getDisplayName(),
|
'clientName' => $invoice->client->getDisplayName(),
|
||||||
'accountName' => $invoice->account->getDisplayName(),
|
'accountName' => $invoice->account->getDisplayName(),
|
||||||
'contactName' => $invitation->contact->getDisplayName(),
|
'contactName' => $invitation->contact->getDisplayName(),
|
||||||
|
@ -174,8 +174,8 @@ class AccountRepository
|
|||||||
$user->username = $random;
|
$user->username = $random;
|
||||||
$user->first_name = 'Invoice';
|
$user->first_name = 'Invoice';
|
||||||
$user->last_name = 'Ninja';
|
$user->last_name = 'Ninja';
|
||||||
$user->notify_sent = false;
|
$user->notify_sent = true;
|
||||||
$user->notify_paid = false;
|
$user->notify_paid = true;
|
||||||
$account->users()->save($user);
|
$account->users()->save($user);
|
||||||
|
|
||||||
$accountGateway = new AccountGateway();
|
$accountGateway = new AccountGateway();
|
||||||
|
@ -1245,15 +1245,21 @@
|
|||||||
self.email = ko.observable('');
|
self.email = ko.observable('');
|
||||||
self.phone = ko.observable('');
|
self.phone = ko.observable('');
|
||||||
self.send_invoice = ko.observable(false);
|
self.send_invoice = ko.observable(false);
|
||||||
|
self.invitation_link = ko.observable('');
|
||||||
|
|
||||||
self.email.display = ko.computed(function() {
|
self.email.display = ko.computed(function() {
|
||||||
var str = '';
|
var str = '';
|
||||||
if (self.first_name() || self.last_name()) {
|
if (self.first_name() || self.last_name()) {
|
||||||
str += self.first_name() + ' ' + self.last_name() + '<br/>';
|
str += self.first_name() + ' ' + self.last_name() + '<br/>';
|
||||||
}
|
}
|
||||||
return str + self.email();
|
str += self.email();
|
||||||
});
|
|
||||||
|
|
||||||
|
if (self.invitation_link()) {
|
||||||
|
str += '<br/><a href="' + self.invitation_link() + '" target="_blank">{{ trans('texts.view_invoice') }}</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
});
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
ko.mapping.fromJS(data, {}, this);
|
ko.mapping.fromJS(data, {}, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user