1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Merge branch 'release-2.5.0.2'

Conflicts:
	app/Http/Controllers/ClientApiController.php
This commit is contained in:
Hillel Coren 2016-02-17 00:03:23 +02:00
commit 8735409753
24 changed files with 856 additions and 819 deletions

View File

@ -92,13 +92,19 @@ class BaseAPIController extends Controller
protected function response($response)
{
$index = Request::get('index') ?: 'data';
$meta = isset($response['meta']) ? $response['meta'] : null;
$response = [
$index => $response
];
if ($meta) {
$response['meta'] = $meta;
unset($response[$index]['meta']);
if ($index == 'none') {
unset($response['meta']);
} else {
$meta = isset($response['meta']) ? $response['meta'] : null;
$response = [
$index => $response
];
if ($meta) {
$response['meta'] = $meta;
unset($response[$index]['meta']);
}
}
$response = json_encode($response, JSON_PRETTY_PRINT);

View File

@ -137,7 +137,7 @@ class ClientApiController extends BaseAPIController
if ($request->action == ACTION_ARCHIVE) {
try {
$client = Client::scope($publicId)->firstOrFail();
$client = Client::scope($publicId)->withTrashed()->firstOrFail();
} catch (ModelNotFoundException $e) {
return $this->errorResponse(['message'=>'Record not found'], 400);
}
@ -149,6 +149,20 @@ class ClientApiController extends BaseAPIController
return $this->response($data);
}
else if ($request->action == ACTION_RESTORE){
$client = Client::scope($publicId)->withTrashed()->first();
if(!$client)
return $this->errorResponse(['message'=>'Client not found.']);
$this->clientRepo->restore($client);
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($client, $transformer, ENTITY_CLIENT);
return $this->response($data);
}
$data = $request->input();
$data['public_id'] = $publicId;
@ -158,6 +172,9 @@ class ClientApiController extends BaseAPIController
->with('country', 'contacts', 'industry', 'size', 'currency')
->first();
if(!$client)
return $this->errorResponse(['message'=>'Client not found.']);
$transformer = new ClientTransformer(Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($client, $transformer, ENTITY_CLIENT);

View File

@ -12,6 +12,7 @@ use App\Models\Contact;
use App\Models\Product;
use App\Models\Invitation;
use App\Ninja\Repositories\ClientRepository;
use App\Ninja\Repositories\PaymentRepository;
use App\Ninja\Repositories\InvoiceRepository;
use App\Ninja\Mailers\ContactMailer as Mailer;
use App\Http\Controllers\BaseAPIController;
@ -23,12 +24,13 @@ class InvoiceApiController extends BaseAPIController
{
protected $invoiceRepo;
public function __construct(InvoiceRepository $invoiceRepo, ClientRepository $clientRepo, Mailer $mailer)
public function __construct(InvoiceRepository $invoiceRepo, ClientRepository $clientRepo, PaymentRepository $paymentRepo, Mailer $mailer)
{
parent::__construct();
$this->invoiceRepo = $invoiceRepo;
$this->clientRepo = $clientRepo;
$this->paymentRepo = $paymentRepo;
$this->mailer = $mailer;
}
@ -123,14 +125,26 @@ class InvoiceApiController extends BaseAPIController
}
$clientData = ['contact' => ['email' => $email]];
foreach (['name', 'private_notes'] as $field) {
foreach ([
'name',
'address1',
'address2',
'city',
'state',
'postal_code',
'private_notes',
] as $field) {
if (isset($data[$field])) {
$clientData[$field] = $data[$field];
}
}
foreach (['first_name', 'last_name'] as $field) {
foreach ([
'first_name',
'last_name',
'phone',
] as $field) {
if (isset($data[$field])) {
$clientData[$field] = $data[$field];
$clientData['contact'][$field] = $data[$field];
}
}
@ -143,6 +157,16 @@ class InvoiceApiController extends BaseAPIController
$data = self::prepareData($data, $client);
$data['client_id'] = $client->id;
$invoice = $this->invoiceRepo->save($data);
$payment = false;
// Optionally create payment with invoice
if (isset($data['paid']) && $data['paid']) {
$payment = $this->paymentRepo->save([
'invoice_id' => $invoice->id,
'client_id' => $client->id,
'amount' => $data['paid']
]);
}
if (!isset($data['id'])) {
$invitation = Invitation::createNew();
@ -153,7 +177,11 @@ class InvoiceApiController extends BaseAPIController
}
if (isset($data['email_invoice']) && $data['email_invoice']) {
$this->mailer->sendInvoice($invoice);
if ($payment) {
$this->mailer->sendPaymentConfirmation($payment);
} else {
$this->mailer->sendInvoice($invoice);
}
}
$invoice = Invoice::scope($invoice->public_id)->with('client', 'invoice_items', 'invitations')->first();

View File

@ -509,7 +509,7 @@ if (!defined('CONTACT_EMAIL')) {
define('NINJA_GATEWAY_CONFIG', 'NINJA_GATEWAY_CONFIG');
define('NINJA_WEB_URL', 'https://www.invoiceninja.com');
define('NINJA_APP_URL', 'https://app.invoiceninja.com');
define('NINJA_VERSION', '2.5.0.1');
define('NINJA_VERSION', '2.5.0.2');
define('NINJA_DATE', '2000-01-01');
define('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja');

View File

@ -686,7 +686,7 @@ class Utils
return EVENT_CREATE_PAYMENT;
} elseif ($eventName == 'create_vendor') {
return EVENT_CREATE_VENDOR;
}else {
} else {
return false;
}
}
@ -694,7 +694,7 @@ class Utils
public static function notifyZapier($subscription, $data)
{
$curl = curl_init();
$jsonEncodedData = json_encode($data->toPublicArray());
$jsonEncodedData = json_encode($data);
$opts = [
CURLOPT_URL => $subscription->target_url,
@ -717,37 +717,6 @@ class Utils
}
}
public static function hideIds($data, $mapped = false)
{
$publicId = null;
if (!$mapped) {
$mapped = [];
}
foreach ($data as $key => $val) {
if (is_array($val)) {
if ($key == 'account' || isset($mapped[$key])) {
// do nothing
} else {
$mapped[$key] = true;
$data[$key] = Utils::hideIds($val, $mapped);
}
} elseif ($key == 'id' || strpos($key, '_id')) {
if ($key == 'public_id') {
$publicId = $val;
}
unset($data[$key]);
}
}
if ($publicId) {
$data['id'] = $publicId;
}
return $data;
}
public static function getApiHeaders($count = 0)
{
return [

View File

@ -12,50 +12,68 @@ use App\Events\PaymentWasCreated;
use App\Events\VendorWasCreated;
use App\Events\ExpenseWasCreated;
use App\Ninja\Transformers\InvoiceTransformer;
use App\Ninja\Transformers\ClientTransformer;
use App\Ninja\Transformers\PaymentTransformer;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use App\Ninja\Serializers\ArraySerializer;
class SubscriptionListener
{
public function createdClient(ClientWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client);
$transformer = new ClientTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CLIENT, $event->client, $transformer);
}
public function createdQuote(QuoteWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote);
$transformer = new InvoiceTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_QUOTE, $event->quote, $transformer, ENTITY_CLIENT);
}
public function createdPayment(PaymentWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment);
$transformer = new PaymentTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_PAYMENT, $event->payment, $transformer, [ENTITY_CLIENT, ENTITY_INVOICE]);
}
public function createdCredit(CreditWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_CREDIT, $event->credit);
}
public function createdInvoice(InvoiceWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice);
}
private function checkSubscriptions($activityTypeId, $entity)
{
$subscription = $entity->account->getSubscription($activityTypeId);
if ($subscription) {
Utils::notifyZapier($subscription, $entity);
}
$transformer = new InvoiceTransformer(Auth::user()->account);
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_INVOICE, $event->invoice, $transformer, ENTITY_CLIENT);
}
public function createdVendor(VendorWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_VENDOR, $event->vendor);
}
public function createdExpense(ExpenseWasCreated $event)
{
$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
//$this->checkSubscriptions(ACTIVITY_TYPE_CREATE_EXPENSE, $event->expense);
}
private function checkSubscriptions($activityTypeId, $entity, $transformer, $include = '')
{
$subscription = $entity->account->getSubscription($activityTypeId);
if ($subscription) {
$manager = new Manager();
$manager->setSerializer(new ArraySerializer());
$manager->parseIncludes($include);
$resource = new Item($entity, $transformer, $entity->getEntityType());
$data = $manager->createData($resource)->toArray();
Utils::notifyZapier($subscription, $data);
}
}
}

View File

@ -726,6 +726,10 @@ class Account extends Eloquent
public function isTrial()
{
if (!Utils::isNinjaProd()) {
return false;
}
if ($this->pro_plan_paid && $this->pro_plan_paid != '0000-00-00') {
return false;
}

View File

@ -3,8 +3,6 @@
use Utils;
use DB;
use Carbon;
use App\Events\ClientWasCreated;
use App\Events\ClientWasUpdated;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
@ -299,14 +297,6 @@ Client::creating(function ($client) {
$client->setNullValues();
});
Client::created(function ($client) {
event(new ClientWasCreated($client));
});
Client::updating(function ($client) {
$client->setNullValues();
});
Client::updated(function ($client) {
event(new ClientWasUpdated($client));
});

View File

@ -91,30 +91,6 @@ class EntityModel extends Eloquent
return $this->getName();
}
// Remap ids to public_ids and show name
public function toPublicArray()
{
$data = $this->toArray();
foreach ($this->attributes as $key => $val) {
if (strpos($key, '_id')) {
list($field, $id) = explode('_', $key);
if ($field == 'account') {
// do nothing
} else {
$entity = @$this->$field;
if ($entity) {
$data["{$field}_name"] = $entity->getName();
}
}
}
}
$data = Utils::hideIds($data);
return $data;
}
public function setNullValues()
{
foreach ($this->fillable as $field) {

View File

@ -75,26 +75,26 @@ class AccountRepository
->where('clients.deleted_at', '=', null)
->where('clients.account_id', '=', \Auth::user()->account_id)
->whereRaw("clients.name <> ''")
->select(\DB::raw("'" . trans('texts.clients') . "' as type, clients.public_id, clients.name, '' as token"));
->select(\DB::raw("'clients' as type, '" . trans('texts.clients') . "' as trans_type, clients.public_id, clients.name, '' as token"));
$contacts = \DB::table('clients')
->join('contacts', 'contacts.client_id', '=', 'clients.id')
->where('clients.deleted_at', '=', null)
->where('clients.account_id', '=', \Auth::user()->account_id)
->whereRaw("CONCAT(contacts.first_name, contacts.last_name, contacts.email) <> ''")
->select(\DB::raw("'" . trans('texts.contacts') . "' as type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token"));
->select(\DB::raw("'clients' as type, '" . trans('texts.contacts') . "' as trans_type, clients.public_id, CONCAT(contacts.first_name, ' ', contacts.last_name, ' ', contacts.email) as name, '' as token"));
$invoices = \DB::table('clients')
->join('invoices', 'invoices.client_id', '=', 'clients.id')
->where('clients.account_id', '=', \Auth::user()->account_id)
->where('clients.deleted_at', '=', null)
->where('invoices.deleted_at', '=', null)
->select(\DB::raw("'" . trans('texts.invoices') . "' as type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token"));
->select(\DB::raw("'invoices' as type, '" . trans('texts.invoices') . "' as trans_type, invoices.public_id, CONCAT(invoices.invoice_number, ': ', clients.name) as name, invoices.invoice_number as token"));
$data = [];
foreach ($clients->union($contacts)->union($invoices)->get() as $row) {
$type = $row->type;
$type = $row->trans_type;
if (!isset($data[$type])) {
$data[$type] = [];
@ -111,6 +111,7 @@ class AccountRepository
'value' => $row->name,
'public_id' => $row->public_id,
'tokens' => $tokens,
'entity_type' => $row->type,
];
}

View File

@ -5,6 +5,8 @@ use App\Ninja\Repositories\BaseRepository;
use App\Models\Client;
use App\Models\Contact;
use App\Models\Activity;
use App\Events\ClientWasCreated;
use App\Events\ClientWasUpdated;
class ClientRepository extends BaseRepository
{
@ -97,6 +99,12 @@ class ClientRepository extends BaseRepository
}
}
if (!$publicId || $publicId == '-1') {
event(new ClientWasCreated($client));
} else {
event(new ClientWasUpdated($client));
}
return $client;
}
}

View File

@ -40,8 +40,11 @@ class ClientTransformer extends EntityTransformer
* @SWG\Property(property="language_id", type="integer", example=1)
*/
protected $availableIncludes = [
protected $defaultIncludes = [
'contacts',
];
protected $availableIncludes = [
'invoices',
'credits',
];
@ -92,7 +95,9 @@ class ClientTransformer extends EntityTransformer
'vat_number' => $client->vat_number,
'id_number' => $client->id_number,
'language_id' => (int) $client->language_id,
'currency_id' => (int) $client->currency_id
'currency_id' => (int) $client->currency_id,
'custom_value1' => $client->custom_value1,
'custom_value2' => $client->custom_value2,
];
}
}

View File

@ -22,11 +22,12 @@ class InvoiceTransformer extends EntityTransformer
protected $defaultIncludes = [
'invoice_items',
'payments'
];
protected $availableIncludes = [
'invitations',
'payments',
'client',
];
public function includeInvoiceItems(Invoice $invoice)
@ -47,6 +48,12 @@ class InvoiceTransformer extends EntityTransformer
return $this->includeCollection($invoice->payments, $transformer, ENTITY_PAYMENT);
}
public function includeClient(Invoice $invoice)
{
$transformer = new ClientTransformer($this->account, $this->serializer);
return $this->includeItem($invoice->client, $transformer, 'client');
}
public function transform(Invoice $invoice)
{
return [
@ -89,6 +96,8 @@ class InvoiceTransformer extends EntityTransformer
'custom_taxes2' => (bool) $invoice->custom_taxes2,
'has_expenses' => (bool) $invoice->has_expenses,
'quote_invoice_id' => (int) $invoice->quote_invoice_id,
'custom_text_value1' => $invoice->custom_text_value1,
'custom_text_value2' => $invoice->custom_text_value2,
];
}
}

View File

@ -20,6 +20,11 @@ class PaymentTransformer extends EntityTransformer
*/
protected $defaultIncludes = [];
protected $availableIncludes = [
'client',
'invoice',
];
public function __construct(Account $account)
{

View File

@ -30311,7 +30311,7 @@ if (window.ko) {
function getContactDisplayName(contact)
{
if (contact.first_name || contact.last_name) {
return contact.first_name + ' ' + contact.last_name;
return (contact.first_name || '') + ' ' + (contact.last_name || '');
} else {
return contact.email;
}
@ -30967,11 +30967,11 @@ function GetPdfMake(invoice, javascript, callback) {
if (invoice.is_pro) {
if (key === 'header') {
return function(page, pages) {
return page === 1 || account.all_pages_header ? val : '';
return page === 1 || invoice.account.all_pages_header == '1' ? val : '';
}
} else if (key === 'footer') {
return function(page, pages) {
return page === pages || account.all_pages_footer ? val : '';
return page === pages || invoice.account.all_pages_footer == '1' ? val : '';
}
}
}

View File

@ -2626,10 +2626,6 @@ border-radius: 3px;
/*new*/
div {
word-break: break-word;
}
div.input-group {
word-break: normal;
}

View File

@ -275,10 +275,6 @@ border-radius: 3px;
/*new*/
div {
word-break: break-word;
}
div.input-group {
word-break: normal;
}

View File

@ -58,11 +58,11 @@ function GetPdfMake(invoice, javascript, callback) {
if (invoice.is_pro) {
if (key === 'header') {
return function(page, pages) {
return page === 1 || account.all_pages_header ? val : '';
return page === 1 || invoice.account.all_pages_header == '1' ? val : '';
}
} else if (key === 'footer') {
return function(page, pages) {
return page === pages || account.all_pages_footer ? val : '';
return page === pages || invoice.account.all_pages_footer == '1' ? val : '';
}
}
}

View File

@ -430,7 +430,7 @@ if (window.ko) {
function getContactDisplayName(contact)
{
if (contact.first_name || contact.last_name) {
return contact.first_name + ' ' + contact.last_name;
return (contact.first_name || '') + ' ' + (contact.last_name || '');
} else {
return contact.email;
}

View File

@ -55,7 +55,7 @@ There are two options:
* [Feature Roadmap](https://trello.com/b/63BbiVVe/)
### Pull Requests
We're using the [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) model of branching and releasing, **please create pull requests against the develop branch**.
We're using the [Git-Flow](http://nvie.com/posts/a-successful-git-branching-model/) model of branching and releasing, **please create pull requests against the develop branch**.
### Contributors
* [Troels Liebe Bentsen](https://github.com/tlbdk)

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,10 @@
</div>
<div class="list-group">
@foreach ($settings as $section)
<a href="{{ URL::to("settings/{$section}") }}" class="list-group-item {{ $selected === $section ? 'selected' : '' }}"
style="width:100%;text-align:left">{{ trans("texts.{$section}") }}</a>
@if ($section != ACCOUNT_CLIENT_PORTAL || !Utils::isNinjaProd())
<a href="{{ URL::to("settings/{$section}") }}" class="list-group-item {{ $selected === $section ? 'selected' : '' }}"
style="width:100%;text-align:left">{{ trans("texts.{$section}") }}</a>
@endif
@endforeach
@if ($type === ADVANCED_SETTINGS && !Utils::isNinjaProd())
<a href="{{ URL::to("settings/system_settings") }}" class="list-group-item {{ $selected === 'system_settings' ? 'selected' : '' }}"

View File

@ -258,20 +258,12 @@
localStorage.setItem('auth_provider', provider);
}
$(function() {
window.setTimeout(function() {
$(".alert-hide").fadeOut();
}, 3000);
$('#search').blur(function(){
$('#search').css('width', '110px');
$('ul.navbar-right').show();
});
$('#search').focus(function(){
$('#search').css('width', '224px');
$('ul.navbar-right').hide();
if (!window.hasOwnProperty('searchData')) {
function showSearch() {
$('#search-form').show();
$('#navbar-options').hide();
if (window.hasOwnProperty('searchData')) {
$('#search').focus();
} else {
trackEvent('/activity', '/search');
$.get('{{ URL::route('getSearchData') }}', function(data) {
window.searchData = true;
@ -290,12 +282,26 @@
}
$('#search').typeahead(datasets).on('typeahead:selected', function(element, datum, name) {
var type = name == 'Contacts' ? 'clients' : name.toLowerCase();
window.location = '{{ URL::to('/') }}' + '/' + type + '/' + datum.public_id;
}).focus().typeahead('setQuery', $('#search').val());
window.location = '{{ URL::to('/') }}' + '/' + datum.entity_type + '/' + datum.public_id;
}).focus().typeahead('setQuery', $('#search').val());
});
}
});
}
}
function hideSearch() {
$('#search').typeahead('setQuery', '');
$('#search-form').hide();
$('#navbar-options').show();
}
$(function() {
window.setTimeout(function() {
$(".alert-hide").fadeOut();
}, 3000);
$('#search').blur(function(){
hideSearch();
});
if (isStorageSupported()) {
@if (Auth::check() && !Auth::user()->registered)
@ -378,18 +384,19 @@
{!! HTML::menu_link('payment') !!}
</ul>
<div id="navbar-options">
<div class="navbar-form navbar-right">
@if (Auth::check())
@if (!Auth::user()->registered)
{!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal'))->small() !!} &nbsp;
{!! Button::success(trans('texts.sign_up'))->withAttributes(array('id' => 'signUpButton', 'data-toggle'=>'modal', 'data-target'=>'#signUpModal', 'style' => 'max-width:100px;;overflow:hidden'))->small() !!} &nbsp;
@elseif (Utils::isNinjaProd() && (!Auth::user()->isPro() || Auth::user()->isTrial()))
{!! Button::success(trans('texts.go_pro'))->withAttributes(array('id' => 'proPlanButton', 'onclick' => 'showProPlan("")'))->small() !!} &nbsp;
{!! Button::success(trans('texts.go_pro'))->withAttributes(array('id' => 'proPlanButton', 'onclick' => 'showProPlan("")', 'style' => 'max-width:100px;overflow:hidden'))->small() !!} &nbsp;
@endif
@endif
<div class="btn-group user-dropdown">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<div id="myAccountButton" class="ellipsis" style="max-width:100px">
<div id="myAccountButton" class="ellipsis" style="max-width:{{ Utils::isPro() && ! Utils::isTrial() ? '100' : '70' }}px">
@if (session(SESSION_USER_ACCOUNTS) && count(session(SESSION_USER_ACCOUNTS)))
{{ Auth::user()->account->getDisplayName() }}
@else
@ -478,14 +485,21 @@
</li>
</ul>
<form class="navbar-form navbar-right" role="search">
<ul class="nav navbar-nav navbar-right navbar-settings">
<li class="dropdown">
<a href="#" onclick="showSearch()">
<span class="glyphicon glyphicon-search" title="{{ trans('texts.search') }}"/>
</a>
</li>
</ul>
</div>
<form id="search-form" class="navbar-form navbar-right" role="search" style="display:none">
<div class="form-group">
<input type="text" id="search" style="width: 110px;padding-top:0px;padding-bottom:0px"
<input type="text" id="search" style="width: 300px;padding-top:0px;padding-bottom:0px"
class="form-control" placeholder="{{ trans('texts.search') }}">
</div>
</form>
</div><!-- /.navbar-collapse -->

View File

@ -626,7 +626,7 @@ function ContactModel(data) {
self.displayName = ko.computed(function() {
var str = '';
if (self.first_name() || self.last_name()) {
str += self.first_name() + ' ' + self.last_name() + '\n';
str += (self.first_name() || '') + ' ' + (self.last_name() || '') + '\n';
}
if (self.email()) {
str += self.email() + '\n';
@ -637,8 +637,9 @@ function ContactModel(data) {
self.email.display = ko.computed(function() {
var str = '';
if (self.first_name() || self.last_name()) {
str += self.first_name() + ' ' + self.last_name() + '<br/>';
str += (self.first_name() || '') + ' ' + (self.last_name() || '') + '<br/>';
}
if (self.email()) {
str += self.email() + '<br/>';
@ -786,14 +787,7 @@ function ItemModel(data) {
this.totals.total = ko.computed(function() {
var total = self.totals.rawTotal();
return total ? model.invoice().formatMoney(total) : '';
/*
if (window.hasOwnProperty('model') && model.invoice && model.invoice() && model.invoice().client()) {
return total ? model.invoice().formatMoney(total) : '';
} else {
return total ? model.invoice().formatMoney(total, 1) : '';
}
*/
return window.hasOwnProperty('model') && total ? model.invoice().formatMoney(total) : '';
});
this.hideActions = function() {