mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 00:11:35 +02:00
Merge branch 'master' of https://github.com/hillelcoren/invoice-ninja
Merged from parent.
This commit is contained in:
commit
55d1ec415c
@ -370,9 +370,9 @@ class AccountController extends \BaseController {
|
||||
$csv->heading = false;
|
||||
$csv->auto($name);
|
||||
|
||||
if (count($csv->data) + Client::scope()->count() > MAX_NUM_CLIENTS)
|
||||
if (count($csv->data) + Client::scope()->count() > Auth::user()->getMaxNumClients())
|
||||
{
|
||||
$message = Utils::pluralize('limit_clients', MAX_NUM_CLIENTS);
|
||||
$message = Utils::pluralize('limit_clients', Auth::user()->getMaxNumClients());
|
||||
Session::flash('error', $message);
|
||||
return Redirect::to('company/import_export');
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ class ClientController extends \BaseController {
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
if (Client::scope()->count() > MAX_NUM_CLIENTS)
|
||||
if (Client::scope()->count() > Auth::user()->getMaxNumClients())
|
||||
{
|
||||
return View::make('error', ['error' => "Sorry, you've exceeded the limit of " . MAX_NUM_CLIENTS . " clients"]);
|
||||
return View::make('error', ['error' => "Sorry, you've exceeded the limit of " . Auth::user()->getMaxNumClients() . " clients"]);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
|
@ -142,6 +142,7 @@ class InvoiceController extends \BaseController {
|
||||
|
||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||
$invoice->is_pro = $client->account->isPro();
|
||||
|
||||
$data = array(
|
||||
'showBreadcrumbs' => false,
|
||||
@ -162,6 +163,7 @@ class InvoiceController extends \BaseController {
|
||||
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||
$invoice->start_date = Utils::fromSqlDate($invoice->start_date);
|
||||
$invoice->end_date = Utils::fromSqlDate($invoice->end_date);
|
||||
$invoice->is_pro = Auth::user()->isPro();
|
||||
|
||||
$contactIds = DB::table('invitations')
|
||||
->join('contacts', 'contacts.id', '=','invitations.contact_id')
|
||||
|
@ -116,12 +116,10 @@ class PaymentController extends \BaseController
|
||||
$gateway->$function($val);
|
||||
}
|
||||
|
||||
/*
|
||||
if (!Utils::isProd())
|
||||
{
|
||||
$gateway->setTestMode(true);
|
||||
}
|
||||
*/
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
@ -427,6 +425,13 @@ class PaymentController extends \BaseController
|
||||
|
||||
$payment->save();
|
||||
|
||||
if ($invoice->account->account_key == NINJA_ACCOUNT_KEY)
|
||||
{
|
||||
$account = Account::find($invoice->client->public_id);
|
||||
$account->pro_plan_paid = date_create()->format('Y-m-d');
|
||||
$account->save();
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ class UserController extends BaseController {
|
||||
if ($invoice = $this->accountRepo->enableProPlan())
|
||||
{
|
||||
$this->contactMailer->sendInvoice($invoice);
|
||||
$notice_msg = trans('texts.pro_plan_succes');
|
||||
$notice_msg = trans('texts.pro_plan_success');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,4 +306,9 @@ return array(
|
||||
'invoice_subject' => 'Neue Rechnung von :account',
|
||||
'close' => 'Schließen',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -307,7 +307,7 @@ return array(
|
||||
'password' => 'Password',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan',
|
||||
'pro_plan_succes' => 'Thanks for joining! Once the invoice is paid your membership will begin.',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
);
|
||||
|
@ -305,5 +305,9 @@ return array(
|
||||
'erase_data' => 'This will permanently erase your data.',
|
||||
'password' => 'Password',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -102,25 +102,25 @@ return array(
|
||||
'no_items' => 'Aucun élément',
|
||||
|
||||
// recurring invoices
|
||||
'recurring_invoices' => 'Recurring Invoices',
|
||||
'recurring_help' => '<p>Automatically send clients the same invoices weekly, bi-monthly, monthly, quarterly or annually. </p>
|
||||
<p>Use :MONTH, :QUARTER or :YEAR for dynamic dates. Basic math works as well, for example :MONTH-1.</p>
|
||||
<p>Examples of dynamic invoice variables:</p>
|
||||
'recurring_invoices' => 'Factures récurrentes',
|
||||
'recurring_help' => '<p>Envoyer automatiquement la même facture à vos clients de façon hebdomadaire, bimensuelle, mensuelle, trimestrielle ou annuelle.</p>
|
||||
<p>Utiliser :MONTH, :QUARTER ou :YEAR pour des dates dynamiques. Les opérations simples fonctionnent également, par exemple :MONTH-1.</p>
|
||||
<p>Exemples de variables dynamiques pour les factures:</p>
|
||||
<ul>
|
||||
<li>"Gym membership for the month of :MONTH" => "Gym membership for the month of July"</li>
|
||||
<li>":YEAR+1 yearly subscription" => "2015 Yearly Subscription"</li>
|
||||
<li>"Retainer payment for :QUARTER+1" => "Retainer payment for Q2"</li>
|
||||
<li>"Adhésion au club de gym pour le mois de :MONTH" => "Adhésion au club de gym pour le mois de Juillet"</li>
|
||||
<li>":YEAR+1 - abonnement annuel" => "2015 - abonnement annuel"</li>
|
||||
<li>"Acompte pour le :QUARTER+1" => "Acompte pour le Q2"</li>
|
||||
</ul>',
|
||||
|
||||
// dashboard
|
||||
'in_total_revenue' => 'in total revenue',
|
||||
'billed_client' => 'billed client',
|
||||
'billed_clients' => 'billed clients',
|
||||
'active_client' => 'active client',
|
||||
'active_clients' => 'active clients',
|
||||
'invoices_past_due' => 'Invoices Past Due',
|
||||
'upcoming_invoices' => 'Upcoming invoices',
|
||||
'average_invoice' => 'Average invoice',
|
||||
'in_total_revenue' => 'de bénéfice total',
|
||||
'billed_client' => 'client facturé',
|
||||
'billed_clients' => 'clients facturés',
|
||||
'active_client' => 'client actif',
|
||||
'active_clients' => 'clients actifs',
|
||||
'invoices_past_due' => 'Date limite de paiement dépassée',
|
||||
'upcoming_invoices' => 'Factures à venir',
|
||||
'average_invoice' => 'Moyenne de facturation',
|
||||
|
||||
// list pages
|
||||
'archive' => 'Archive',
|
||||
@ -306,5 +306,9 @@ return array(
|
||||
'erase_data' => 'This will permanently erase your data.',
|
||||
'password' => 'Password',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -306,5 +306,9 @@ return array(
|
||||
'erase_data' => 'Questo eliminerà definitivamente i tuoi dati.',
|
||||
'password' => 'Password',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -306,4 +306,9 @@ return array(
|
||||
'invoice_subject' => 'Nieuwe factuur van :account',
|
||||
'close' => 'Sluiten',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -293,4 +293,10 @@ return array(
|
||||
'close' => 'Fechar',
|
||||
'invoice_subject' => 'Nova fatura de :account',
|
||||
'payment_subject' => 'Recebido Pagamento de',
|
||||
|
||||
'pro_plan_product' => 'Pro Plan',
|
||||
'pro_plan_description' => 'One year enrollment in the Invoice Ninja Pro Plan.',
|
||||
'pro_plan_success' => 'Thanks for joining! Once the invoice is paid your Pro Plan membership will begin.',
|
||||
|
||||
|
||||
);
|
||||
|
@ -220,11 +220,6 @@ class Account extends Eloquent
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Auth::check())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$datePaid = $this->pro_plan_paid;
|
||||
|
||||
if (!$datePaid || $datePaid == '0000-00-00')
|
||||
|
@ -133,4 +133,9 @@ class User extends ConfideUser implements UserInterface, RemindableInterface
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMaxNumClients()
|
||||
{
|
||||
return $this->isPro() ? MAX_NUM_CLIENTS_PRO : MAX_NUM_CLIENTS;
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ use Auth;
|
||||
use Invitation;
|
||||
use Invoice;
|
||||
use InvoiceItem;
|
||||
use AccountGateway;
|
||||
|
||||
class AccountRepository
|
||||
{
|
||||
@ -104,19 +105,18 @@ class AccountRepository
|
||||
}
|
||||
|
||||
$account = Auth::user()->account;
|
||||
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
|
||||
$publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1;
|
||||
|
||||
$ninjaAccount = $this->getNinjaAccount();
|
||||
$ninjaAccount = $this->getNinjaAccount($publicId);
|
||||
$ninjaClient = $this->getNinjaClient($ninjaAccount);
|
||||
$invoice = $this->createNinjaInvoice($ninjaAccount, $ninjaClient);
|
||||
$invoice = $this->createNinjaInvoice($publicId, $ninjaAccount, $ninjaClient);
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
private function createNinjaInvoice($account, $client)
|
||||
private function createNinjaInvoice($publicId, $account, $client)
|
||||
{
|
||||
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
|
||||
$publicId = $lastInvoice ? ($lastInvoice->public_id + 1) : 1;
|
||||
|
||||
$invoice = new Invoice();
|
||||
$invoice->account_id = $account->id;
|
||||
$invoice->user_id = $account->users()->first()->id;
|
||||
@ -150,7 +150,7 @@ class AccountRepository
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
private function getNinjaAccount()
|
||||
private function getNinjaAccount($publicId)
|
||||
{
|
||||
$account = Account::whereAccountKey(NINJA_ACCOUNT_KEY)->first();
|
||||
|
||||
@ -168,7 +168,6 @@ class AccountRepository
|
||||
$account->save();
|
||||
|
||||
$random = str_random(RANDOM_KEY_LENGTH);
|
||||
|
||||
$user = new User();
|
||||
$user->registered = true;
|
||||
$user->confirmed = true;
|
||||
@ -181,6 +180,13 @@ class AccountRepository
|
||||
$user->notify_sent = false;
|
||||
$user->notify_paid = false;
|
||||
$account->users()->save($user);
|
||||
|
||||
$accountGateway = new AccountGateway();
|
||||
$accountGateway->user_id = $user->id;
|
||||
$accountGateway->gateway_id = NINJA_GATEWAY_ID;
|
||||
$accountGateway->public_id = $publicId;
|
||||
$accountGateway->config = isset($_ENV['NINJA_GATEWAY_CONFIG']) ? $_ENV['NINJA_GATEWAY_CONFIG'] : null;
|
||||
$account->account_gateways()->save($accountGateway);
|
||||
}
|
||||
|
||||
return $account;
|
||||
|
@ -200,6 +200,7 @@ define('RECENTLY_VIEWED_LIMIT', 8);
|
||||
define('LOGGED_ERROR_LIMIT', 100);
|
||||
define('RANDOM_KEY_LENGTH', 32);
|
||||
define('MAX_NUM_CLIENTS', 1000);
|
||||
define('MAX_NUM_CLIENTS_PRO', 5000);
|
||||
|
||||
define('INVOICE_STATUS_DRAFT', 1);
|
||||
define('INVOICE_STATUS_SENT', 2);
|
||||
@ -236,21 +237,27 @@ define('DEFAULT_LOCALE', 'en');
|
||||
define('RESULT_SUCCESS', 'success');
|
||||
define('RESULT_FAILURE', 'failure');
|
||||
|
||||
define('GATEWAY_PAYPAL_EXPRESS', 17);
|
||||
define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
|
||||
define('PRO_PLAN_PRICE', 40);
|
||||
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
|
||||
|
||||
define('PAYMENT_LIBRARY_OMNIPAY', 1);
|
||||
define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2);
|
||||
|
||||
define('GATEWAY_PAYPAL_EXPRESS', 17);
|
||||
define('GATEWAY_BEANSTREAM', 29);
|
||||
define('GATEWAY_PSIGATE', 30);
|
||||
|
||||
define('PRO_PLAN_PRICE', 40);
|
||||
define('REQUESTED_PRO_PLAN', 'REQUESTED_PRO_PLAN');
|
||||
define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
|
||||
define('NINJA_GATEWAY_ID', GATEWAY_PAYPAL_EXPRESS);
|
||||
|
||||
|
||||
/*
|
||||
define('GATEWAY_AMAZON', 30);
|
||||
define('GATEWAY_BLUEPAY', 31);
|
||||
define('GATEWAY_BRAINTREE', 32);
|
||||
define('GATEWAY_GOOGLE', 33);
|
||||
define('GATEWAY_PSIGATE', 34);
|
||||
define('GATEWAY_QUICKBOOKS', 35);
|
||||
*/
|
||||
|
||||
if (Auth::check() && !Session::has(SESSION_TIMEZONE))
|
||||
{
|
||||
|
@ -5,9 +5,6 @@
|
||||
|
||||
{{ Former::open()->addClass('col-md-8 col-md-offset-2') }}
|
||||
{{ Former::populate($account) }}
|
||||
{{ Former::populateField('notify_sent', intval(Auth::user()->notify_sent)) }}
|
||||
{{ Former::populateField('notify_viewed', intval(Auth::user()->notify_viewed)) }}
|
||||
{{ Former::populateField('notify_paid', intval(Auth::user()->notify_paid)) }}
|
||||
|
||||
{{ Former::legend('Payment Gateway') }}
|
||||
|
||||
@ -24,10 +21,9 @@
|
||||
@endif
|
||||
|
||||
<div class="two-column">
|
||||
{{ Former::radios('recommendedGateway_id')
|
||||
->label('Recommended Gateways')
|
||||
->radios($recommendedGateways)
|
||||
->class('recommended-gateway')}}
|
||||
{{ Former::radios('recommendedGateway_id')->label('Recommended Gateways')
|
||||
->radios($recommendedGateways)->class('recommended-gateway')
|
||||
}}
|
||||
</div>
|
||||
|
||||
{{ Former::select('gateway_id')->label('PayPal & Other Gateways')->addOption('', '')
|
||||
|
@ -633,6 +633,7 @@
|
||||
|
||||
function createInvoiceModel() {
|
||||
var invoice = ko.toJS(model).invoice;
|
||||
invoice.is_pro = {{ Auth::user()->isPro() }};
|
||||
|
||||
@if (file_exists($account->getLogoPath()))
|
||||
invoice.image = "{{ HTML::image_data($account->getLogoPath()) }}";
|
||||
@ -640,10 +641,6 @@
|
||||
invoice.imageHeight = {{ $account->getLogoHeight() }};
|
||||
@endif
|
||||
|
||||
|
||||
//define logo images
|
||||
|
||||
|
||||
invoice.imageLogo1 = "{{ HTML::image_data('images/report_logo1.jpg') }}";
|
||||
invoice.imageLogoWidth1 =120;
|
||||
invoice.imageLogoHeight1 = 40
|
||||
@ -1019,7 +1016,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clients.length > {{ MAX_NUM_CLIENTS}})
|
||||
if (clients.length > {{ Auth::user()->getMaxNumClients() }})
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
@ -97,9 +97,10 @@ function GetReportTemplate4(doc, invoice, layout, checkMath) {
|
||||
var totalX = layout.headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize());
|
||||
doc.text(totalX, y, total);
|
||||
|
||||
|
||||
if (!invoice.is_pro) {
|
||||
doc.setFontType("normal");
|
||||
doc.text(layout.marginLeft, 790, "Created by InvoiceNinja.com");
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
@ -688,7 +689,7 @@ function GetReportTemplate1(doc, invoice, layout, checkMath)
|
||||
doc.addImage(invoice.image, 'JPEG', layout.marginLeft, 30);
|
||||
}
|
||||
|
||||
if (invoice.imageLogo1)
|
||||
if (!invoice.is_pro && invoice.imageLogo1)
|
||||
{
|
||||
pageHeight=820;
|
||||
y=pageHeight-invoice.imageLogoHeight1;
|
||||
@ -1043,7 +1044,7 @@ function Report2AddFooter (invoice,doc)
|
||||
doc.rect(x1, y1, w2, h2, 'FD');
|
||||
|
||||
|
||||
if (invoice.imageLogo2)
|
||||
if (!invoice.is_pro && invoice.imageLogo2)
|
||||
{
|
||||
pageHeight=820;
|
||||
var left = 250;//headerRight ;
|
||||
@ -1084,7 +1085,7 @@ function Report3AddFooter (invoice, account, doc, layout)
|
||||
doc.rect(x1, y1, w2, h2, 'FD');
|
||||
|
||||
|
||||
if (invoice.imageLogo3)
|
||||
if (!invoice.is_pro && invoice.imageLogo3)
|
||||
{
|
||||
pageHeight=820;
|
||||
// var left = 25;//250;//headerRight ;
|
||||
|
Loading…
Reference in New Issue
Block a user