1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Rebase Dev

This commit is contained in:
David Bomba 2019-01-30 22:00:26 +11:00
parent d6424fdf7c
commit ade15ec390
1924 changed files with 49570 additions and 2155 deletions

0
CONTRIBUTING.md Normal file → Executable file
View File

0
Gruntfile.js Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

13
README.md Normal file → Executable file
View File

@ -4,7 +4,7 @@
# Invoice Ninja
[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=master)](https://travis-ci.org/invoiceninja/invoiceninja)
[![Build Status](https://travis-ci.org/invoiceninja/invoiceninja.svg?branch=develop)](https://travis-ci.org/invoiceninja/invoiceninja)
[![Docs](https://readthedocs.org/projects/invoice-ninja/badge/?version=latest)](https://invoice-ninja.readthedocs.io/en/latest/?badge=latest)
## [Hosted](https://www.invoiceninja.com) | [Self-Hosted](https://www.invoiceninja.org)
@ -19,7 +19,6 @@ The self-host zip includes all third party libraries whereas downloading the cod
* [Videos](https://www.youtube.com/channel/UCXAHcBvhW05PDtWYIq7WDFA/videos)
* [User Guide](https://invoice-ninja.readthedocs.io/en/latest/)
* [Support Forum](https://www.invoiceninja.com/forums/forum/support/)
* [Roadmap](https://trello.com/b/63BbiVVe/)
## Affiliates Programs
* Referral Program (we pay you)
@ -65,10 +64,10 @@ The self-host zip includes all third party libraries whereas downloading the cod
* [Shopping Cart](https://github.com/Scifabric/invoiceninjashoppingcart)
## Third Party Developers
* [Some Techie](https://www.sometechie.com/customize-invoice-ninja/)
* [Bold Compass](https://boldcompass.com/customize-invoice-ninja/)
## Contributing
All contributors are welcome!
All contributors are welcome!
For information on how contribute to Invoice Ninja, please see our [contributing guide](CONTRIBUTING.md).
## Credits
@ -80,13 +79,15 @@ For information on how contribute to Invoice Ninja, please see our [contributing
* [Troels Liebe Bentsen](https://github.com/tlbdk)
* [Jeramy Simpson](https://github.com/JeramyMywork) - [MyWork](https://www.mywork.com.au)
* [Sigitas Limontas](https://lt.linkedin.com/in/sigitaslimontas)
* [Joshua Dwire](https://github.com/joshuadwire) - [Some Techie](https://www.sometechie.com)
* [Joshua Dwire](https://github.com/joshuadwire) - [Bold Compass](https://boldcompass.com/)
* [Holger Lösken](https://github.com/codedge) - [codedge](http://codedge.de)
* [Samuel Laulhau](https://github.com/lalop) - [Lalop](http://lalop.co/)
* [Alexander Zamponi](https://github.com/alexz707)
* [Matthieu Calie](https://github.com/Matth--)
* [Christopher Di Carlo](https://github.com/dicarlosystems) - [Di Carlo Systems Inc.](https://www.dicarlosystems.ca)
* [Kristian Feldsam](https://github.com/feldsam) - [FeldHost™](https://www.feldhost.net)
* [Suhas Sunil Gaikwad](https://github.com/Suhas-Gaikwad) - (Security)
## License
Invoice Ninja is released under the Attribution Assurance License.
Invoice Ninja is released under the Attribution Assurance License.
See [LICENSE](LICENSE) for details.

0
app/Commands/Command.php Normal file → Executable file
View File

0
app/Console/Commands/CalculatePayouts.php Normal file → Executable file
View File

0
app/Console/Commands/ChargeRenewalInvoices.php Normal file → Executable file
View File

2
app/Console/Commands/CheckData.php Normal file → Executable file
View File

@ -91,7 +91,7 @@ class CheckData extends Command
if (! $this->option('client_id')) {
$this->checkOAuth();
$this->checkInvitations();
//$this->checkInvitations();
$this->checkAccountData();
$this->checkLookupData();
$this->checkFailedJobs();

0
app/Console/Commands/CreateLuisData.php Normal file → Executable file
View File

91
app/Console/Commands/CreateTestData.php Normal file → Executable file
View File

@ -2,11 +2,16 @@
namespace App\Console\Commands;
use App\Models\Ticket;
use App\Models\TicketCategory;
use App\Models\TicketComment;
use App\Models\TicketTemplate;
use App\Ninja\Repositories\AccountRepository;
use App\Ninja\Repositories\ClientRepository;
use App\Ninja\Repositories\ExpenseRepository;
use App\Ninja\Repositories\InvoiceRepository;
use App\Ninja\Repositories\PaymentRepository;
use App\Ninja\Repositories\TicketRepository;
use App\Ninja\Repositories\VendorRepository;
use App\Ninja\Repositories\TaskRepository;
use App\Ninja\Repositories\ProjectRepository;
@ -15,6 +20,7 @@ use App\Models\TaxRate;
use App\Models\Project;
use App\Models\ExpenseCategory;
use Auth;
use Carbon\Carbon;
use Faker\Factory;
use Illuminate\Console\Command;
use Utils;
@ -48,8 +54,12 @@ class CreateTestData extends Command
* @param ExpenseRepository $expenseRepo
* @param TaskRepository $taskRepo
* @param AccountRepository $accountRepo
* @param TicketRepository $ticketRepo
* @param ProjectRepository $projectRepo
*/
public function __construct(
TicketRepository $ticketRepo,
ClientRepository $clientRepo,
InvoiceRepository $invoiceRepo,
PaymentRepository $paymentRepo,
@ -71,6 +81,7 @@ class CreateTestData extends Command
$this->taskRepo = $taskRepo;
$this->projectRepo = $projectRepo;
$this->accountRepo = $accountRepo;
$this->ticketRepo = $ticketRepo;
}
/**
@ -103,6 +114,8 @@ class CreateTestData extends Command
Auth::loginUsingId(1);
}
//$this->createTicketStubs();
//$this->createTicketTemplates();
$this->createClients();
$this->createVendors();
$this->createOtherObjects();
@ -134,6 +147,84 @@ class CreateTestData extends Command
$this->createInvoices($client);
$this->createInvoices($client, true);
$this->createTasks($client);
$this->createTickets($client);
}
}
private function createTicketTemplates()
{
$ticketTemplate = TicketTemplate::createNew();
$ticketTemplate->name = 'Default response';
$ticketTemplate->description = $this->faker->realText(50);
$ticketTemplate->save();
$ticketTemplate = TicketTemplate::createNew();
$ticketTemplate->name = 'Updated ticket';
$ticketTemplate->description = $this->faker->realText(50);
$ticketTemplate->save();
$ticketTemplate = TicketTemplate::createNew();
$ticketTemplate->name = 'Ticket closed';
$ticketTemplate->description = $this->faker->realText(50);
$ticketTemplate->save();
$ticketTemplate = TicketTemplate::createNew();
$ticketTemplate->name = 'Generic response';
$ticketTemplate->description = $this->faker->realText(50);
$ticketTemplate->save();
}
/**
* @param $client
*/
private function createTickets($client)
{
$this->info('creating tickets');
for ($i = 0; $i < $this->count; $i++)
{
$maxTicketNumber = Ticket::getNextTicketNumber(Auth::user()->account->id);
$this->info('next ticket number = '.$maxTicketNumber);
$data = [
'priority_id'=> TICKET_PRIORITY_LOW,
'category_id'=> 1,
'client_id' => $client->id,
'is_deleted'=> 0,
'is_internal'=> (bool)random_int(0, 1),
'status_id'=> random_int(1,3),
'category_id'=> 1,
'subject'=> $this->faker->realText(10),
'description'=> $this->faker->realText(50),
'tags'=> json_encode($this->faker->words($nb = 5, $asText = false)),
'private_notes'=> $this->faker->realText(50),
'ccs'=> json_encode([]),
'contact_key'=> $client->getPrimaryContact()->contact_key,
'due_date'=> Carbon::now(),
'ticket_number' => $maxTicketNumber ? $maxTicketNumber : 1,
'action' => TICKET_SAVE_ONLY,
];
$ticket = $this->ticketRepo->save($data);
$ticketComment = TicketComment::createNew($ticket);
$ticketComment->description = $this->faker->realText(70);
$ticketComment->contact_key = $client->getPrimaryContact()->contact_key;
$ticket->comments()->save($ticketComment);
$ticketComment = TicketComment::createNew($ticket);
$ticketComment->description = $this->faker->realText(40);
$ticketComment->user_id = 1;
$ticket->comments()->save($ticketComment);
$this->info("Ticket: - {$ticket->ticket_number} - {$client->account->account_ticket_settings->ticket_number_start} - {$maxTicketNumber}");
}
}

1
app/Console/Commands/InitLookup.php Normal file → Executable file
View File

@ -362,6 +362,7 @@ class InitLookup extends Command
DB::statement('truncate lookup_invitations');
DB::statement('truncate lookup_proposal_invitations');
DB::statement('truncate lookup_account_tokens');
DB::statement('truncate lookup_ticket_invitations');
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
}

0
app/Console/Commands/MakeClass.php Normal file → Executable file
View File

0
app/Console/Commands/MakeModule.php Normal file → Executable file
View File

View File

@ -0,0 +1,113 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Nwidart\Modules\Commands\GeneratorCommand;
use Nwidart\Modules\Support\Stub;
use Nwidart\Modules\Traits\ModuleCommandTrait;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
class MakeModuleSettings extends GeneratorCommand
{
use ModuleCommandTrait;
/**
* The name and signature of the console command.
*
* @var string
*/
// protected $signature = 'ninja:make-module-settings {name : Module name} {--route : Add routes }';
protected $name = 'ninja:make-module-settings';
protected $argumentName = 'module';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create module settings';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function getTemplateContents()
{
$module = $this->laravel['modules']->findOrFail($this->getModuleName());
$path = str_replace('/', '\\', config('modules.paths.generator.module-settings-view'));
return (new Stub('/module-settings-view.stub', [
'MODULE_NAME' => $module->getName(),
'LOWER_NAME' => $module->getLowerName(),
'SHOW_ROUTES' => $this->option('route') ? true : false
]))->render();
}
public function fire() {
$this->info('Creating settings view template for ' . $this->getModuleName());
$module = $this->laravel['modules']->findOrFail($this->getModuleName());
parent::fire();
// add default routes if option specified
$route = $this->option('route');
if ($route) {
file_put_contents(
$this->getModuleRoutesFilePath(),
(new Stub('/module-settings-routes.stub', [
'MODULE_NAME' => $module->getName(),
'LOWER_NAME' => $module->getLowerName(),
]))->render(),
FILE_APPEND
);
$this->info('Added routes to module routes.php.');
}
}
protected function getModuleRoutesFilePath() {
$path = $this->laravel['modules']->getModulePath($this->getModuleName());
$seederPath = $this->laravel['modules']->config('paths.generator.module-settings-routes');
return $path . $seederPath . '/routes.php';
}
public function getDestinationFilePath()
{
$path = $this->laravel['modules']->getModulePath($this->getModuleName());
$seederPath = $this->laravel['modules']->config('paths.generator.module-settings-view');
return $path . $seederPath . '/' . $this->getFileName();
}
protected function getArguments()
{
return [
['module', InputArgument::REQUIRED, 'The name of the module.']
];
}
protected function getOptions()
{
return [
['route', null, InputOption::VALUE_NONE, 'Add default routes.', null]
];
}
/**
* @return string
*/
protected function getFileName()
{
return 'settings.blade.php';
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\DbServer;
use App\Models\User;
use App\Models\Company;
use App\Libraries\CurlUtils;
class MobileLocalization extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ninja:mobile-localization {--type=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Generate mobile localization resources';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$type = strtolower($this->option('type'));
switch ($type) {
case 'laravel':
$this->laravelResources();
break;
default:
$this->flutterResources();
break;
}
}
private function laravelResources()
{
$resources = $this->getResources();
foreach ($resources as $key => $val) {
$transKey = "texts.{$key}";
if (trans($transKey) == $transKey) {
echo "'$key' => '$val',\n";
}
}
}
private function flutterResources()
{
$languages = cache('languages');
$resources = $this->getResources();
foreach ($languages as $language) {
if ($language->locale == 'en') {
continue;
}
echo "'{$language->locale}': {\n";
foreach ($resources as $key => $val) {
$text = trim(addslashes(trans("texts.{$key}", [], $language->locale)));
echo "'$key': '$text',\n";
}
echo "},\n";
}
}
private function getResources()
{
$url = 'https://raw.githubusercontent.com/invoiceninja/flutter-mobile/develop/lib/utils/localization.dart';
$data = CurlUtils::get($url);
$start = strpos($data, '\'en\': {') + 8;
$end = strpos($data, '},', $start);
$data = substr($data, $start, $end - $start - 6);
$data = str_replace("\n", "", $data);
$data = str_replace("'", "\"", $data);
return json_decode('{' . $data . '}');
}
protected function getOptions()
{
return [
['type', null, InputOption::VALUE_OPTIONAL, 'Type', null],
];
}
}

0
app/Console/Commands/PruneData.php Normal file → Executable file
View File

0
app/Console/Commands/RemoveOrphanedDocuments.php Normal file → Executable file
View File

0
app/Console/Commands/ResetData.php Normal file → Executable file
View File

View File

@ -0,0 +1,79 @@
<?php
namespace App\Console\Commands;
use App\Jobs\SendOverdueTicketNotification;
use App\Models\Ticket;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
/**
* Class SendOverdueTickets.
*/
class SendOverdueTickets extends Command
{
/**
* @var string
*/
protected $name = 'ninja:send-overdue-tickets';
/**
* @var string
*/
protected $description = 'Send overdue tickets';
public function __construct()
{
parent::__construct();
}
public function fire()
{
$this->info(date('r') . ' Running SendOverdueTickets...');
if ($database = $this->option('database'))
config(['database.default' => $database]);
$this->sendReminders();
$this->info(date('r') . ' Done');
}
private function sendReminders()
{
$tickets = Ticket::with('account', 'account.account_ticket_settings')
->where('due_date', '<', Carbon::now())
->whereIn('status_id', [1,2])
->where('overdue_notification_sent', '=', 0)
->whereHas('account.account_ticket_settings', function ($query) {
$query->where('alert_ticket_overdue_agent_id', '>', '0');
})->get();
foreach($tickets as $ticket)
dispatch(new SendOverdueTicketNotification($ticket));
}
/**
* @return array
*/
protected function getArguments()
{
return [];
}
/**
* @return array
*/
protected function getOptions()
{
return [
['database', null, InputOption::VALUE_OPTIONAL, 'Database', null],
];
}
}

0
app/Console/Commands/SendRecurringInvoices.php Normal file → Executable file
View File

17
app/Console/Commands/SendReminders.php Normal file → Executable file
View File

@ -240,13 +240,24 @@ class SendReminders extends Command
if (config('ninja.exchange_rates_enabled')) {
$this->info(date('r') . ' Loading latest exchange rates...');
$response = CurlUtils::get(config('ninja.exchange_rates_url'));
$url = config('ninja.exchange_rates_url');
$apiKey = config('ninja.exchange_rates_api_key');
$url = str_replace('{apiKey}', $apiKey, $url);
$response = CurlUtils::get($url);
$data = json_decode($response);
if ($data && property_exists($data, 'rates')) {
Currency::whereCode(config('ninja.exchange_rates_base'))->update(['exchange_rate' => 1]);
if ($data && property_exists($data, 'rates') && property_exists($data, 'base')) {
$base = config('ninja.exchange_rates_base');
// should calculate to different base
$recalculate = ($data->base != $base);
foreach ($data->rates as $code => $rate) {
if($recalculate) {
$rate = 1 / $data->rates->{$base} * $rate;
}
Currency::whereCode($code)->update(['exchange_rate' => $rate]);
}
} else {

0
app/Console/Commands/SendRenewalInvoices.php Normal file → Executable file
View File

0
app/Console/Commands/TestOFX.php Normal file → Executable file
View File

0
app/Console/Commands/UpdateKey.php Normal file → Executable file
View File

0
app/Console/Commands/stubs/api-controller.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/auth-provider.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/createrequest.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/datatable.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/lang.stub Normal file → Executable file
View File

View File

@ -0,0 +1,8 @@
Route::group(['middleware' => ['web', 'lookup:user', 'auth:user'], 'namespace' => 'Modules\Manufacturer\Http\Controllers'], function()
{
Route::get('settings/$LOWER_NAME$', function() {
return view('$LOWER_NAME$::settings');
});
Route::post('settings/$LOWER_NAME$', '$MODULE_NAME$Controller@saveSettings');
});

View File

@ -0,0 +1,31 @@
@extends('header')
@section('content')
@parent
@include('accounts.nav', ['selected' => '$MODULE_NAME$'])
<div class="row">
<div class="col-md-12">
{!! Former::open('settings/$MODULE_NAME$') !!}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">$MODULE_NAME$ Settings</h3>
</div>
<div class="panel-group">
<div class="form-group"></div>
<div class="form-group">
<label class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-8 col-sm-8">
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
</div>
</div>
</div>
</div>
{!! Former::close() !!}
</div>
</div>
@stop

0
app/Console/Commands/stubs/policy.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/presenter.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/repository.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/transformer.stub Normal file → Executable file
View File

0
app/Console/Commands/stubs/updaterequest.stub Normal file → Executable file
View File

7
app/Console/Kernel.php Normal file → Executable file
View File

@ -30,6 +30,9 @@ class Kernel extends ConsoleKernel
'App\Console\Commands\InitLookup',
'App\Console\Commands\CalculatePayouts',
'App\Console\Commands\UpdateKey',
'App\Console\Commands\MobileLocalization',
'App\Console\Commands\SendOverdueTickets',
'App\Console\Commands\MakeModuleSettings',
];
/**
@ -44,13 +47,13 @@ class Kernel extends ConsoleKernel
$logFile = storage_path() . '/logs/cron.log';
$schedule
->command('ninja:send-invoices --force')
->command('ninja:send-invoices')
->sendOutputTo($logFile)
->withoutOverlapping()
->hourly();
$schedule
->command('ninja:send-reminders --force')
->command('ninja:send-reminders')
->sendOutputTo($logFile)
->daily();
}

70
app/Constants.php Normal file → Executable file
View File

@ -19,6 +19,7 @@ if (! defined('APP_NAME')) {
define('ENTITY_INVOICE_ITEM', 'invoice_item');
define('ENTITY_INVITATION', 'invitation');
define('ENTITY_RECURRING_INVOICE', 'recurring_invoice');
define('ENTITY_RECURRING_QUOTE', 'recurring_quote');
define('ENTITY_PAYMENT', 'payment');
define('ENTITY_CREDIT', 'credit');
define('ENTITY_QUOTE', 'quote');
@ -47,6 +48,13 @@ if (! defined('APP_NAME')) {
define('ENTITY_PROPOSAL_SNIPPET', 'proposal_snippet');
define('ENTITY_PROPOSAL_CATEGORY', 'proposal_category');
define('ENTITY_PROPOSAL_INVITATION', 'proposal_invitation');
define('ENTITY_TICKET', 'ticket');
define('ENTITY_TICKET_COMMENT', 'ticket_comment');
define('ENTITY_TICKET_STATUS', 'ticket_status');
define('ENTITY_TICKET_CATEGORY', 'ticket_category');
define('ENTITY_TICKET_RELATION', 'ticket_relation');
define('ENTITY_TICKET_TEMPLATE', 'ticket_template');
define('ENTITY_TICKET_INVITATION', 'ticket_invitation');
$permissionEntities = [
ENTITY_CLIENT,
@ -59,10 +67,11 @@ if (! defined('APP_NAME')) {
ENTITY_PROJECT,
ENTITY_PROPOSAL,
ENTITY_QUOTE,
'dashboard',
'reports',
ENTITY_TICKET,
ENTITY_TASK,
ENTITY_VENDOR,
ENTITY_RECURRING_INVOICE,
];
define('PERMISSION_ENTITIES', json_encode($permissionEntities));
@ -95,6 +104,7 @@ if (! defined('APP_NAME')) {
define('ACCOUNT_MAP', 'import_map');
define('ACCOUNT_EXPORT', 'export');
define('ACCOUNT_TAX_RATES', 'tax_rates');
define('ACCOUNT_TICKETS', 'tickets');
define('ACCOUNT_PRODUCTS', 'products');
define('ACCOUNT_ADVANCED_SETTINGS', 'advanced_settings');
define('ACCOUNT_INVOICE_SETTINGS', 'invoice_settings');
@ -162,6 +172,16 @@ if (! defined('APP_NAME')) {
define('ACTIVITY_TYPE_DELETE_TASK', 45);
define('ACTIVITY_TYPE_RESTORE_TASK', 46);
define('ACTIVITY_TYPE_UPDATE_EXPENSE', 47);
define('ACTIVITY_TYPE_USER_UPDATE_TICKET', 48);
define('ACTIVITY_TYPE_USER_CLOSE_TICKET', 49);
define('ACTIVITY_TYPE_USER_MERGE_TICKET', 50);
define('ACTIVITY_TYPE_USER_SPLIT_TICKET', 51);
define('ACTIVITY_TYPE_CONTACT_OPEN_TICKET', 52);
define('ACTIVITY_TYPE_CONTACT_REOPEN_TICKET', 53);
define('ACTIVITY_TYPE_USER_REOPEN_TICKET', 54);
define('ACTIVITY_TYPE_CONTACT_REPLY_TICKET', 55);
define('ACTIVITY_TYPE_USER_VIEW_TICKET', 56);
define('DEFAULT_INVOICE_NUMBER', '0001');
define('RECENTLY_VIEWED_LIMIT', 20);
@ -361,7 +381,7 @@ if (! defined('APP_NAME')) {
define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com'));
define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest'));
define('NINJA_DATE', '2000-01-01');
define('NINJA_VERSION', '4.5.5' . env('NINJA_VERSION_SUFFIX'));
define('NINJA_VERSION', '4.5.9' . env('NINJA_VERSION_SUFFIX'));
define('NINJA_TERMS_VERSION', '1.0.1');
define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja'));
@ -371,9 +391,9 @@ if (! defined('APP_NAME')) {
define('NINJA_FORUM_URL', env('NINJA_FORUM_URL', 'https://www.invoiceninja.com/forums/forum/support/'));
define('NINJA_CONTACT_URL', env('NINJA_CONTACT_URL', 'https://www.invoiceninja.com/contact/'));
define('NINJA_FROM_EMAIL', env('NINJA_FROM_EMAIL', 'maildelivery@invoiceninja.com'));
define('NINJA_IOS_APP_URL', 'https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1220337560&mt=8');
define('NINJA_ANDROID_APP_URL', 'https://play.google.com/store/apps/details?id=com.invoiceninja.invoiceninja');
define('RELEASES_URL', env('RELEASES_URL', 'https://trello.com/b/63BbiVVe/invoice-ninja'));
define('NINJA_IOS_APP_URL', 'https://itunes.apple.com/us/app/invoice-ninja/id1435514417?ls=1&mt=8');
define('NINJA_ANDROID_APP_URL', 'https://play.google.com/store/apps/details?id=com.invoiceninja.flutter');
define('RELEASES_URL', env('RELEASES_URL', 'https://github.com/invoiceninja/invoiceninja/releases'));
define('ZAPIER_URL', env('ZAPIER_URL', 'https://zapier.com/zapbook/invoice-ninja'));
define('OUTDATE_BROWSER_URL', env('OUTDATE_BROWSER_URL', 'http://browsehappy.com/'));
define('PDFMAKE_DOCS', env('PDFMAKE_DOCS', 'http://pdfmake.org/playground.html'));
@ -574,6 +594,7 @@ if (! defined('APP_NAME')) {
define('FEATURE_MORE_INVOICE_DESIGNS', 'more_invoice_designs');
define('FEATURE_QUOTES', 'quotes');
define('FEATURE_TASKS', 'tasks');
define('FEATURE_TICKETS', 'tickets');
define('FEATURE_EXPENSES', 'expenses');
define('FEATURE_REPORTS', 'reports');
define('FEATURE_BUY_NOW_BUTTONS', 'buy_now_buttons');
@ -663,6 +684,45 @@ if (! defined('APP_NAME')) {
// Fix for mPDF: https://github.com/kartik-v/yii2-mpdf/issues/9
define('_MPDF_TTFONTDATAPATH', storage_path('framework/cache/'));
/** STD constatns */
if(!defined('STDIN')) define('STDIN', fopen('php://stdin', 'r'));
if(!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'w'));
if(!defined('STDERR')) define('STDERR', fopen('php://stderr', 'w'));
/** Tickets constants */
define('TICKET_PRIORITY_LOW', 10);
define('TICKET_PRIORITY_MEDIUM', 20);
define('TICKET_PRIORITY_HIGH', 30);
define('TICKET_STATUS_NEW', 1);
define('TICKET_STATUS_OPEN',2);
define('TICKET_STATUS_CLOSED',3);
define('TICKET_STATUS_MERGED',4);
define('TICKET_CLIENT_NEW', 'ticket_client_new');
define('TICKET_CLIENT_UPDATE', 'ticket_client_update');
define('TICKET_INBOUND_NEW', 'ticket_inbound_new');
define('TICKET_INBOUND_NEW_INTERNAL', 'ticket_inbound_new_internal');
define('TICKET_INBOUND_REPLY', 'ticket_inbound_reply');
define('TICKET_INBOUND_CONTACT_REPLY', 'ticket_inbound_contact_reply');
define('TICKET_INBOUND_AGENT_REPLY', 'ticket_inbound_agent_reply');
define('TICKET_INBOUND_ADMIN_REPLY', 'ticket_inbound_admin_reply');
define('TICKET_AGENT_UPDATE', 'ticket_agent_update');
define('TICKET_AGENT_NEW', 'ticket_agent_new');
define('TICKET_MERGE', 'ticket_merge');
define('TICKET_ASSIGNED', 'ticket_assigned');
define('TICKET_OVERDUE', 'ticket_overdue');
define('TICKET_AGENT_CLOSED', 'ticket_agent_closed');
define('TICKET_SAVE_ONLY', 'ticket_save_only');
/* Default ticket statuses - Category - support*/
$supportTicketStatuses = [
trans('texts.new'),
trans('texts.open'),
trans('texts.closed'),
trans('texts.merged')
];
function uctrans($text, $data = [])
{
$locale = Session::get(SESSION_LOCALE);

22
app/Constants/Domain.php Normal file → Executable file
View File

@ -30,4 +30,26 @@ class Domain
{
return 'maildelivery@' . static::getDomainFromId($id);
}
public static function getPostmarkTokenFromId($id)
{
switch($id)
{
case static::INVOICENINJA_COM:
return config('services.postmark_token');
case static::INVOICE_SERVICES:
return config('services.postmark_token_2');
}
}
public static function getSupportDomainFromId($id)
{
switch($id)
{
case static::INVOICENINJA_COM:
return config('ninja.tickets.ticket_support_domain');
case static::INVOICE_SERVICES:
return config('ninja.tickets.ticket_support_domain_2');
}
}
}

0
app/Events/ClientWasArchived.php Normal file → Executable file
View File

0
app/Events/ClientWasCreated.php Normal file → Executable file
View File

0
app/Events/ClientWasDeleted.php Normal file → Executable file
View File

0
app/Events/ClientWasRestored.php Normal file → Executable file
View File

0
app/Events/ClientWasUpdated.php Normal file → Executable file
View File

0
app/Events/CreditWasArchived.php Normal file → Executable file
View File

0
app/Events/CreditWasCreated.php Normal file → Executable file
View File

0
app/Events/CreditWasDeleted.php Normal file → Executable file
View File

0
app/Events/CreditWasRestored.php Normal file → Executable file
View File

0
app/Events/Event.php Normal file → Executable file
View File

0
app/Events/ExpenseWasArchived.php Normal file → Executable file
View File

0
app/Events/ExpenseWasCreated.php Normal file → Executable file
View File

0
app/Events/ExpenseWasDeleted.php Normal file → Executable file
View File

0
app/Events/ExpenseWasRestored.php Normal file → Executable file
View File

0
app/Events/ExpenseWasUpdated.php Normal file → Executable file
View File

0
app/Events/InvoiceInvitationWasEmailed.php Normal file → Executable file
View File

0
app/Events/InvoiceInvitationWasViewed.php Normal file → Executable file
View File

0
app/Events/InvoiceItemsWereCreated.php Normal file → Executable file
View File

0
app/Events/InvoiceItemsWereUpdated.php Normal file → Executable file
View File

0
app/Events/InvoiceWasArchived.php Normal file → Executable file
View File

0
app/Events/InvoiceWasCreated.php Normal file → Executable file
View File

0
app/Events/InvoiceWasDeleted.php Normal file → Executable file
View File

0
app/Events/InvoiceWasEmailed.php Normal file → Executable file
View File

0
app/Events/InvoiceWasRestored.php Normal file → Executable file
View File

0
app/Events/InvoiceWasUpdated.php Normal file → Executable file
View File

0
app/Events/PaymentCompleted.php Normal file → Executable file
View File

0
app/Events/PaymentFailed.php Normal file → Executable file
View File

0
app/Events/PaymentWasArchived.php Normal file → Executable file
View File

0
app/Events/PaymentWasCreated.php Normal file → Executable file
View File

0
app/Events/PaymentWasDeleted.php Normal file → Executable file
View File

0
app/Events/PaymentWasRefunded.php Normal file → Executable file
View File

0
app/Events/PaymentWasRestored.php Normal file → Executable file
View File

0
app/Events/PaymentWasVoided.php Normal file → Executable file
View File

0
app/Events/ProductWasCreated.php Normal file → Executable file
View File

0
app/Events/ProductWasDeleted.php Normal file → Executable file
View File

0
app/Events/ProductWasUpdated.php Normal file → Executable file
View File

0
app/Events/ProjectWasDeleted.php Normal file → Executable file
View File

0
app/Events/ProposalWasDeleted.php Normal file → Executable file
View File

0
app/Events/QuoteInvitationWasApproved.php Normal file → Executable file
View File

0
app/Events/QuoteInvitationWasEmailed.php Normal file → Executable file
View File

0
app/Events/QuoteInvitationWasViewed.php Normal file → Executable file
View File

0
app/Events/QuoteItemsWereCreated.php Normal file → Executable file
View File

0
app/Events/QuoteItemsWereUpdated.php Normal file → Executable file
View File

0
app/Events/QuoteWasArchived.php Normal file → Executable file
View File

0
app/Events/QuoteWasCreated.php Normal file → Executable file
View File

0
app/Events/QuoteWasDeleted.php Normal file → Executable file
View File

0
app/Events/QuoteWasEmailed.php Normal file → Executable file
View File

0
app/Events/QuoteWasRestored.php Normal file → Executable file
View File

0
app/Events/QuoteWasUpdated.php Normal file → Executable file
View File

0
app/Events/SubdomainWasRemoved.php Normal file → Executable file
View File

0
app/Events/SubdomainWasUpdated.php Normal file → Executable file
View File

0
app/Events/TaskWasArchived.php Normal file → Executable file
View File

0
app/Events/TaskWasCreated.php Normal file → Executable file
View File

0
app/Events/TaskWasDeleted.php Normal file → Executable file
View File

0
app/Events/TaskWasRestored.php Normal file → Executable file
View File

0
app/Events/TaskWasUpdated.php Normal file → Executable file
View File

29
app/Events/TicketUserViewed.php Executable file
View File

@ -0,0 +1,29 @@
<?php
namespace App\Events;
use App\Models\Ticket;
use Illuminate\Queue\SerializesModels;
/**
* Class TicketUserViewed.
*/
class TicketUserViewed extends Event
{
use SerializesModels;
/**
* @var Ticket
*/
public $ticket;
/**
* Create a new event instance.
*
* @param Ticket $ticket
*/
public function __construct(Ticket $ticket)
{
$this->ticket = $ticket;
}
}

0
app/Events/UserLoggedIn.php Normal file → Executable file
View File

0
app/Events/UserSettingsChanged.php Normal file → Executable file
View File

0
app/Events/UserSignedUp.php Normal file → Executable file
View File

0
app/Events/VendorWasArchived.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More