1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Support updating invoices through the API

This commit is contained in:
Hillel Coren 2015-07-30 17:44:47 +03:00
parent 914334511e
commit 4fa4f65005
33 changed files with 240 additions and 209 deletions

View File

@ -19,5 +19,3 @@ MAIL_USERNAME
MAIL_FROM_ADDRESS
MAIL_FROM_NAME
MAIL_PASSWORD
ALLOW_NEW_ACCOUNTS

View File

@ -75,18 +75,18 @@ class AccountController extends BaseController
public function getStarted()
{
$user = false;
$guestKey = Input::get('guest_key'); // local storage key to login until registered
$prevUserId = Session::pull(PREV_USER_ID); // last user id used to link to new account
if (Auth::check()) {
return Redirect::to('invoices/create');
}
if (!Utils::isNinja() && !Utils::allowNewAccounts() && Account::count() > 0) {
if (!Utils::isNinja() && (Account::count() > 0 && !$prevUserId)) {
return Redirect::to('/login');
}
$user = false;
$guestKey = Input::get('guest_key'); // local storage key to login until registered
$prevUserId = Session::pull(PREV_USER_ID); // last user id used to link to new account
if ($guestKey && !$prevUserId) {
$user = User::where('password', '=', $guestKey)->first();
@ -149,6 +149,7 @@ class AccountController extends BaseController
public function showSection($section = ACCOUNT_DETAILS, $subSection = false)
{
if ($section == ACCOUNT_DETAILS) {
$primaryUser = Auth::user()->account->users()->orderBy('id')->first();
$data = [
'account' => Account::with('users')->findOrFail(Auth::user()->account_id),
'countries' => Cache::get('countries'),
@ -159,8 +160,9 @@ class AccountController extends BaseController
'datetimeFormats' => Cache::get('datetimeFormats'),
'currencies' => Cache::get('currencies'),
'languages' => Cache::get('languages'),
'showUser' => Auth::user()->id === Auth::user()->account->users()->first()->id,
'showUser' => Auth::user()->id === $primaryUser->id,
'title' => trans('texts.company_details'),
'primaryUser' => $primaryUser,
];
return View::make('accounts.details', $data);
@ -639,7 +641,7 @@ class AccountController extends BaseController
'name' => 'required',
);
$user = Auth::user()->account->users()->first();
$user = Auth::user()->account->users()->orderBy('id')->first();
if (Auth::user()->id === $user->id) {
$rules['email'] = 'email|required|unique:users,email,'.$user->id.',id';

View File

@ -88,9 +88,7 @@ class AppController extends BaseController
"MAIL_HOST={$mail['host']}\n".
"MAIL_USERNAME={$mail['username']}\n".
"MAIL_FROM_NAME={$mail['from']['name']}\n".
"MAIL_PASSWORD={$mail['password']}\n\n".
"ADMIN_USER_ID=1\n".
"ALLOW_NEW_ACCOUNTS\n";
"MAIL_PASSWORD={$mail['password']}";
// Write Config Settings
$fp = fopen(base_path()."/.env", 'w');
@ -178,7 +176,7 @@ class AppController extends BaseController
public function update()
{
if (!Utils::isNinja()) {
if (!Utils::isNinja() && Auth::check()) {
try {
Artisan::call('migrate', array('--force' => true));
Artisan::call('db:seed', array('--force' => true, '--class' => 'PaymentLibrariesSeeder'));

View File

@ -110,7 +110,7 @@ class DashboardController extends BaseController
->where('contacts.deleted_at', '=', null)
->where('contacts.is_primary', '=', true)
->select(['payments.payment_date', 'payments.amount', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id'])
->orderBy('payments.payment_date', 'asc')
->orderBy('payments.id', 'desc')
->take(50)
->get();

View File

@ -43,7 +43,7 @@ class HomeController extends BaseController
public function invoiceNow()
{
if (Auth::check() && Input::get('new_account')) {
if (Auth::check() && Input::get('new_company')) {
Session::put(PREV_USER_ID, Auth::user()->id);
Auth::user()->clearSession();
Auth::logout();

View File

@ -50,12 +50,14 @@ class InvoiceApiController extends Controller
$error = null;
// check if the invoice number is set and unique
if (!isset($data['invoice_number'])) {
if (!isset($data['invoice_number']) && !isset($data['id'])) {
$data['invoice_number'] = Auth::user()->account->getNextInvoiceNumber();
} else {
} else if (isset($data['invoice_number'])) {
$invoice = Invoice::scope()->where('invoice_number', '=', $data['invoice_number'])->first();
if ($invoice) {
$error = trans('validation.unique', ['attribute' => 'texts.invoice_number']);
} else {
$data['id'] = $invoice->public_id;
}
}
@ -98,13 +100,15 @@ class InvoiceApiController extends Controller
} else {
$data = self::prepareData($data);
$data['client_id'] = $client->id;
$invoice = $this->invoiceRepo->save(false, $data, false);
$invoice = $this->invoiceRepo->save(isset($data['id']) ? $data['id'] : false, $data, false);
if (!isset($data['id'])) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $client->contacts[0]->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
}
if (isset($data['email_invoice']) && $data['email_invoice']) {
$this->mailer->sendInvoice($invoice);

View File

@ -86,11 +86,12 @@ class InvoiceController extends BaseController
}
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
$account = $invitation->account;
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
$data = [
'color' => $color,
'hideLogo' => Session::get('white_label'),
'hideLogo' => $account->isWhiteLabel(),
'title' => trans('texts.invoices'),
'entityType' => ENTITY_INVOICE,
'columns' => Utils::trans(['invoice_number', 'invoice_date', 'invoice_total', 'balance_due', 'due_date']),
@ -205,7 +206,6 @@ class InvoiceController extends BaseController
Session::set($invitationKey, true);
Session::set('invitation_key', $invitationKey);
Session::set('white_label', $account->isWhiteLabel());
$account->loadLocalizationSettings();

View File

@ -61,11 +61,12 @@ class PaymentController extends BaseController
}
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
$account = $invitation->account;
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
$data = [
'color' => $color,
'hideLogo' => Session::get('white_label'),
'hideLogo' => $account->isWhiteLabel(),
'entityType' => ENTITY_PAYMENT,
'title' => trans('texts.payments'),
'columns' => Utils::trans(['invoice', 'transaction_reference', 'method', 'payment_amount', 'payment_date'])
@ -336,7 +337,7 @@ class PaymentController extends BaseController
'acceptedCreditCardTypes' => $acceptedCreditCardTypes,
'countries' => Cache::get('countries'),
'currencyId' => $client->getCurrencyId(),
'currencyCode' => $client->currency->code,
'currencyCode' => $client->currency ? $client->currency->code : ($account->currency ? $account->currency->code : 'USD'),
'account' => $client->account,
'hideLogo' => $account->isWhiteLabel(),
'showAddress' => $accountGateway->show_address,

View File

@ -75,11 +75,12 @@ class QuoteController extends BaseController
}
$invitation = Invitation::with('account')->where('invitation_key', '=', $invitationKey)->first();
$color = $invitation->account->primary_color ? $invitation->account->primary_color : '#0b4d78';
$account = $invitation->account;
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
$data = [
'color' => $color,
'hideLogo' => Session::get('white_label'),
'hideLogo' => $account->isWhiteLabel(),
'title' => trans('texts.quotes'),
'entityType' => ENTITY_QUOTE,
'columns' => Utils::trans(['quote_number', 'quote_date', 'quote_total', 'due_date']),

View File

@ -61,7 +61,7 @@ class Utils
public static function allowNewAccounts()
{
return Utils::isNinja() || (isset($_ENV['ALLOW_NEW_ACCOUNTS']) && $_ENV['ALLOW_NEW_ACCOUNTS'] == 'true');
return Utils::isNinja() || Auth::check();
}
public static function isPro()
@ -400,10 +400,12 @@ class Utils
}
$object = new stdClass();
$object->accountId = Auth::user()->account_id;
$object->url = $url;
$object->name = ucwords($type).': '.$name;
$data = [];
$counts = [];
for ($i = 0; $i<count($viewed); $i++) {
$item = $viewed[$i];
@ -412,12 +414,22 @@ class Utils
continue;
}
// temporary fix to check for new property in session
if (!property_exists($item, 'accountId')) {
continue;
}
array_unshift($data, $item);
if (isset($counts[$item->accountId])) {
$counts[$item->accountId]++;
} else {
$counts[$item->accountId] = 1;
}
}
array_unshift($data, $object);
if (count($data) > RECENTLY_VIEWED_LIMIT) {
if (isset($counts[Auth::user()->account_id]) && $counts[Auth::user()->account_id] > RECENTLY_VIEWED_LIMIT) {
array_pop($data);
}

View File

@ -176,38 +176,37 @@ class Account extends Eloquent
{
$counter = $isQuote && !$this->share_counter ? $this->quote_number_counter : $this->invoice_number_counter;
$prefix .= $isQuote ? $this->quote_number_prefix : $this->invoice_number_prefix;
$counterOffset = 0;
// confirm the invoice number isn't already taken
do {
$number = $prefix.str_pad($counter, 4, "0", STR_PAD_LEFT);
$check = Invoice::scope(false, $this->id)->whereInvoiceNumber($number)->withTrashed()->first();
$counter++;
$counterOffset++;
} while ($check);
// update the invoice counter to be caught up
if ($counterOffset > 1) {
if ($isQuote && !$this->share_counter) {
$this->quote_number_counter += $counterOffset - 1;
} else {
$this->invoice_number_counter += $counterOffset - 1;
}
$this->save();
}
return $number;
}
public function incrementCounter($invoiceNumber, $isQuote = false, $isRecurring)
public function incrementCounter($isQuote = false)
{
// check if the user modified the invoice number
if (!$isRecurring && $invoiceNumber != $this->getNextInvoiceNumber($isQuote)) {
// remove the prefix
$prefix = $isQuote ? $this->quote_number_prefix : $this->invoice_number_prefix;
$invoiceNumber = preg_replace('/^'.$prefix.'/', '', $invoiceNumber);
$invoiceNumber = intval(preg_replace('/[^0-9]/', '', $invoiceNumber));
if ($isQuote && !$this->share_counter) {
$this->quote_number_counter = $invoiceNumber + 1;
} else {
$this->invoice_number_counter = $invoiceNumber + 1;
}
// otherwise, just increment the counter
} else {
if ($isQuote && !$this->share_counter) {
$this->quote_number_counter += 1;
} else {
$this->invoice_number_counter += 1;
}
}
$this->save();
}
@ -315,12 +314,12 @@ class Account extends Eloquent
public function isWhiteLabel()
{
if (Utils::isNinjaProd()) {
return false;
}
if (Utils::isNinja()) {
return self::isPro();
} else {
return $this->pro_plan_paid == NINJA_DATE;
}
}
public function getSubscription($eventId)
{

View File

@ -258,7 +258,7 @@ class Invoice extends EntityModel
}
Invoice::creating(function ($invoice) {
$invoice->account->incrementCounter($invoice->invoice_number, $invoice->is_quote, $invoice->recurring_invoice_id);
$invoice->account->incrementCounter($invoice->is_quote);
});
Invoice::created(function ($invoice) {

View File

@ -47,7 +47,7 @@ class UserMailer extends Mailer
'clientName' => $invoice->client->getDisplayName(),
'accountName' => $invoice->account->getDisplayName(),
'userName' => $user->getDisplayName(),
'invoiceAmount' => Utils::formatMoney($invoice->amount, $invoice->client->getCurrencyId()),
'invoiceAmount' => Utils::formatMoney($invoice->getRequestedAmount(), $invoice->client->getCurrencyId()),
'invoiceNumber' => $invoice->invoice_number,
'invoiceLink' => SITE_URL."/{$entityType}s/{$invoice->public_id}",
];

View File

@ -266,15 +266,18 @@ class InvoiceRepository
$account->save();
}
$invoice->client_id = $data['client_id'];
if (isset($data['invoice_number'])) {
$invoice->invoice_number = trim($data['invoice_number']);
}
$invoice->discount = round(Utils::parseFloat($data['discount']), 2);
$invoice->is_amount_discount = $data['is_amount_discount'] ? true : false;
$invoice->invoice_number = trim($data['invoice_number']);
$invoice->partial = round(Utils::parseFloat($data['partial']), 2);
$invoice->invoice_date = isset($data['invoice_date_sql']) ? $data['invoice_date_sql'] : Utils::toSqlDate($data['invoice_date']);
$invoice->has_tasks = isset($data['has_tasks']) ? $data['has_tasks'] : false;
if (!$publicId) {
$invoice->client_id = $data['client_id'];
$invoice->is_recurring = $data['is_recurring'] && !Utils::isDemo() ? true : false;
}
@ -543,8 +546,9 @@ class InvoiceRepository
->whereClientId($clientId)
->whereIsQuote(false)
->whereIsRecurring(false)
->whereDeletedAt(null)
->whereHasTasks(true)
->where('balance', '>', 0)
->where('invoice_status_id', '<', 5)
->select(['public_id', 'invoice_number'])
->get();
}

View File

@ -31599,7 +31599,10 @@ NINJA.decodeJavascript = function(invoice, javascript)
field = match.substring(2, match.indexOf('Label'));
field = toSnakeCase(field);
var value = getDescendantProp(invoice, field);
if (match.indexOf('?') < 0) {
if (match.indexOf('?') < 0 || value) {
if (invoice.partial && field == 'balance_due') {
field = 'amount_due';
}
var label = invoiceLabels[field];
if (match.indexOf('UC') >= 0) {
if (!label) console.log('match: ' + field);
@ -31773,8 +31776,9 @@ NINJA.subtotals = function(invoice, removeBalance)
}
if (!removeBalance) {
var isPartial = NINJA.parseFloat(invoice.partial);
data.push([
{text:invoice.is_quote ? invoiceLabels.balance_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
{text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
{text: formatMoney(invoice.balance_amount, invoice.client.currency_id), style:['balanceDue']}
]);
}
@ -31823,7 +31827,7 @@ NINJA.invoiceDetails = function(invoice) {
{text: invoice.po_number}
],
[
{text: invoiceLabels.invoice_date},
{text: (invoice.is_quote ? invoiceLabels.quote_date : invoiceLabels.invoice_date)},
{text: invoice.invoice_date}
],
[
@ -31832,22 +31836,23 @@ NINJA.invoiceDetails = function(invoice) {
]
];
var isPartial = NINJA.parseFloat(invoice.partial);
if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) {
data.push([
{text: invoiceLabels.total},
{text: formatMoney(invoice.amount, invoice.client.currency_id)}
]);
}
if (NINJA.parseFloat(invoice.partial)) {
} else if (isPartial) {
data.push([
{text: invoiceLabels.balance},
{text: invoiceLabels.total},
{text: formatMoney(invoice.total_amount, invoice.client.currency_id)}
]);
}
data.push([
{text: invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
{text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
{text: formatMoney(invoice.balance_amount, invoice.client.currency_id), style: ['invoiceDetailBalanceDue']}
])

View File

@ -122,7 +122,10 @@ NINJA.decodeJavascript = function(invoice, javascript)
field = match.substring(2, match.indexOf('Label'));
field = toSnakeCase(field);
var value = getDescendantProp(invoice, field);
if (match.indexOf('?') < 0) {
if (match.indexOf('?') < 0 || value) {
if (invoice.partial && field == 'balance_due') {
field = 'amount_due';
}
var label = invoiceLabels[field];
if (match.indexOf('UC') >= 0) {
if (!label) console.log('match: ' + field);
@ -296,8 +299,9 @@ NINJA.subtotals = function(invoice, removeBalance)
}
if (!removeBalance) {
var isPartial = NINJA.parseFloat(invoice.partial);
data.push([
{text:invoice.is_quote ? invoiceLabels.balance_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
{text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style:['balanceDueLabel']},
{text: formatMoney(invoice.balance_amount, invoice.client.currency_id), style:['balanceDue']}
]);
}
@ -346,7 +350,7 @@ NINJA.invoiceDetails = function(invoice) {
{text: invoice.po_number}
],
[
{text: invoiceLabels.invoice_date},
{text: (invoice.is_quote ? invoiceLabels.quote_date : invoiceLabels.invoice_date)},
{text: invoice.invoice_date}
],
[
@ -355,22 +359,23 @@ NINJA.invoiceDetails = function(invoice) {
]
];
var isPartial = NINJA.parseFloat(invoice.partial);
if (NINJA.parseFloat(invoice.balance) < NINJA.parseFloat(invoice.amount)) {
data.push([
{text: invoiceLabels.total},
{text: formatMoney(invoice.amount, invoice.client.currency_id)}
]);
}
if (NINJA.parseFloat(invoice.partial)) {
} else if (isPartial) {
data.push([
{text: invoiceLabels.balance},
{text: invoiceLabels.total},
{text: formatMoney(invoice.total_amount, invoice.client.currency_id)}
]);
}
data.push([
{text: invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
{text: isPartial ? invoiceLabels.amount_due : invoiceLabels.balance_due, style: ['invoiceDetailBalanceDueLabel']},
{text: formatMoney(invoice.balance_amount, invoice.client.currency_id), style: ['invoiceDetailBalanceDue']}
])

View File

@ -698,9 +698,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -688,9 +688,9 @@ return array(
'email_receipt' => 'Zahlungsbestätigung an Kunden per E-Mail senden',
'created_payment_emailed_client' => 'Zahlung erfolgreich erstellt und Kunde per E-Mail benachrichtigt',
'add_account' => 'Konto hinzufügen',
'add_company' => 'Konto hinzufügen',
'untitled' => 'Unbenannt',
'new_account' => 'Neues Konto',
'new_company' => 'Neues Konto',
'associated_accounts' => 'Konten erfolgreich verlinkt',
'unlinked_account' => 'Konten erfolgreich getrennt',
'login' => 'Login',

View File

@ -696,9 +696,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -668,9 +668,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -697,9 +697,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -689,9 +689,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Paiement crée avec succès et envoyé au client',
'add_account' => 'Ajouter compte',
'add_company' => 'Ajouter compte',
'untitled' => 'Sans titre',
'new_account' => 'Nouveau compte',
'new_company' => 'Nouveau compte',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Connexion',

View File

@ -690,9 +690,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -692,9 +692,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -699,9 +699,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -697,9 +697,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -692,9 +692,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -692,9 +692,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -695,9 +695,9 @@ return array(
'email_receipt' => 'Email payment receipt to the client',
'created_payment_emailed_client' => 'Successfully created payment and emailed client',
'add_account' => 'Add Account',
'add_company' => 'Add Company',
'untitled' => 'Untitled',
'new_account' => 'New Account',
'new_company' => 'New Company',
'associated_accounts' => 'Successfully linked accounts',
'unlinked_account' => 'Successfully unlinked accounts',
'login' => 'Login',

View File

@ -18,12 +18,12 @@
{{ Former::populate($account) }}
@if ($showUser)
{{ Former::populateField('first_name', $account->users()->first()->first_name) }}
{{ Former::populateField('last_name', $account->users()->first()->last_name) }}
{{ Former::populateField('email', $account->users()->first()->email) }}
{{ Former::populateField('phone', $account->users()->first()->phone) }}
{{ Former::populateField('first_name', $primaryUser->first_name) }}
{{ Former::populateField('last_name', $primaryUser->last_name) }}
{{ Former::populateField('email', $primaryUser->email) }}
{{ Former::populateField('phone', $primaryUser->phone) }}
@if (Utils::isNinja())
{{ Former::populateField('dark_mode', intval($account->users()->first()->dark_mode)) }}
{{ Former::populateField('dark_mode', intval($primaryUser->dark_mode)) }}
@endif
@endif

View File

@ -79,11 +79,11 @@
{!! Former::hidden('remember')->raw() !!}
</p>
<p>{!! Button::success(trans(Input::get('new_account') && Utils::allowNewAccounts() ? 'texts.login' : 'texts.lets_go'))->large()->submit()->block() !!}</p>
<p>{!! Button::success(trans(Input::get('new_company') ? 'texts.login' : 'texts.lets_go'))->large()->submit()->block() !!}</p>
@if (Input::get('new_account') && Utils::allowNewAccounts())
@if (Input::get('new_company') && Utils::allowNewAccounts())
<center><p>- {{ trans('texts.or') }} -</p></center>
<p>{!! Button::primary(trans('texts.new_account'))->asLinkTo(URL::to('/invoice_now?new_account=true'))->large()->submit()->block() !!}</p>
<p>{!! Button::primary(trans('texts.new_company'))->asLinkTo(URL::to('/invoice_now?new_company=true&sign_up=true'))->large()->submit()->block() !!}</p>
@endif

View File

@ -427,7 +427,7 @@
@endif
<li class="divider"></li>
@if (!session(SESSION_USER_ACCOUNTS) || count(session(SESSION_USER_ACCOUNTS)) < 5)
<li>{!! link_to('/login?new_account=true', trans('texts.add_account')) !!}</li>
<li>{!! link_to('/login?new_company=true', trans('texts.add_company')) !!}</li>
@endif
<li>{!! link_to('#', trans('texts.logout'), array('onclick'=>'logout()')) !!}</li>
</ul>
@ -462,7 +462,9 @@
<li><a href="#">{{ trans('texts.no_items') }}</a></li>
@else
@foreach (Session::get(RECENTLY_VIEWED) as $link)
@if (property_exists($link, 'accountId') && $link->accountId == Auth::user()->account_id)
<li><a href="{{ $link->url }}">{{ $link->name }}</a></li>
@endif
@endforeach
@endif
</ul>

View File

@ -6,7 +6,7 @@
@endif
@if (isset($show_remove) && $show_remove)
<div class="pull-right glyphicon glyphicon-remove remove" onclick="return showUnlink({{ $user_account_id }}, {{ $user_id }})"></div>
<div class="pull-right glyphicon glyphicon-remove remove" onclick="return showUnlink({{ $user_account_id }}, {{ $user_id }})" title="{{ trans('texts.unlink') }}"></div>
@endif
@if (file_exists('logo/'.$account_key.'.jpg'))