Rollback to 2.6.5

This commit is contained in:
Hillel Coren 2016-07-21 15:35:23 +03:00
parent dc22611d2f
commit 498578cefc
236 changed files with 190789 additions and 2456 deletions

View File

@ -1,3 +1,3 @@
{
"directory": "resources/assets/bower"
"directory": "./public/vendor"
}

1
.gitignore vendored
View File

@ -8,7 +8,6 @@
/public/build
/public/packages
/public/vendor
/resources/assets/bower
/storage
/bootstrap/compiled.php
/bootstrap/environment.php

View File

@ -7,9 +7,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- Auto billing uses credits if they exist
- All assets (CSS, JS) are minfied now
## [2.6.4] - 2016-07-19

187
Gruntfile.js Normal file
View File

@ -0,0 +1,187 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dump_dir: (function() {
var out = {};
grunt.file.expand({ filter: 'isDirectory'}, 'public/fonts/invoice-fonts/*').forEach(function(path) {
var fontName = /[^/]*$/.exec(path)[0],
files = {},
license='';
// Add license text
grunt.file.expand({ filter: 'isFile'}, path+'/*.txt').forEach(function(path) {
var licenseText = grunt.file.read(path);
// Fix anything that could escape from the comment
licenseText = licenseText.replace(/\*\//g,'*\\/');
license += "/*\n"+licenseText+"\n*/";
});
// Create files list
files['public/js/vfs_fonts/'+fontName+'.js'] = [path+'/*.ttf'];
out[fontName] = {
options: {
pre: license+'window.ninjaFontVfs=window.ninjaFontVfs||{};window.ninjaFontVfs.'+fontName+'=',
rootPath: path+'/'
},
files: files
};
});
// Return the computed object
return out;
}()),
concat: {
options: {
process: function(src, filepath) {
var basepath = filepath.substring(7, filepath.lastIndexOf('/') + 1);
// Fix relative paths for css files
if(filepath.indexOf('.css', filepath.length - 4) !== -1) {
return src.replace(/(url\s*[\("']+)\s*([^'"\)]+)(['"\)]+;?)/gi, function(match, start, url, end, offset, string) {
if(url.indexOf('data:') === 0) {
// Skip data urls
return match;
} else if(url.indexOf('/') === 0) {
// Skip absolute urls
return match;
} else {
return start + basepath + url + end;
}
});
// Fix source maps locations
} else if(filepath.indexOf('.js', filepath.length - 4) !== -1) {
return src.replace(/(\/[*\/][#@]\s*sourceMappingURL=)([^\s]+)/gi, function(match, start, url, offset, string) {
if(url.indexOf('/') === 0) {
// Skip absolute urls
return match;
} else {
return start + basepath + url;
}
});
// Don't do anything for unknown file types
} else {
return src;
}
},
},
js: {
src: [
'public/vendor/jquery/dist/jquery.js',
'public/vendor/jquery-ui/jquery-ui.min.js',
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
'public/vendor/datatables/media/js/jquery.dataTables.js',
'public/vendor/datatables-bootstrap3/BS3/assets/js/datatables.js',
'public/vendor/knockout.js/knockout.js',
'public/vendor/knockout-mapping/build/output/knockout.mapping-latest.js',
'public/vendor/knockout-sortable/build/knockout-sortable.min.js',
'public/vendor/underscore/underscore.js',
'public/vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.da.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.pt-BR.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.nl.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.lt.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.no.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js',
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.sv.min.js',
'public/vendor/dropzone/dist/min/dropzone.min.js',
'public/vendor/typeahead.js/dist/typeahead.jquery.min.js',
'public/vendor/accounting/accounting.min.js',
'public/vendor/spectrum/spectrum.js',
'public/vendor/jspdf/dist/jspdf.min.js',
'public/vendor/moment/min/moment.min.js',
'public/vendor/moment-timezone/builds/moment-timezone-with-data.min.js',
'public/vendor/stacktrace-js/dist/stacktrace-with-polyfills.min.js',
'public/vendor/fuse.js/src/fuse.min.js',
//'public/vendor/moment-duration-format/lib/moment-duration-format.js',
//'public/vendor/handsontable/dist/jquery.handsontable.full.min.js',
//'public/vendor/pdfmake/build/pdfmake.min.js',
//'public/vendor/pdfmake/build/vfs_fonts.js',
//'public/js/vfs_fonts.js',
'public/js/bootstrap-combobox.js',
'public/js/script.js',
'public/js/pdf.pdfmake.js',
],
dest: 'public/built.js',
nonull: true
},
js_public: {
src: [
/*
'public/js/simpleexpand.js',
'public/js/valign.js',
'public/js/bootstrap.min.js',
'public/js/simpleexpand.js',
*/
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
'public/js/bootstrap-combobox.js',
],
dest: 'public/built.public.js',
nonull: true
},
css: {
src: [
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
'public/vendor/datatables/media/css/jquery.dataTables.css',
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
'public/vendor/font-awesome/css/font-awesome.min.css',
'public/vendor/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
'public/vendor/dropzone/dist/min/dropzone.min.css',
'public/vendor/spectrum/spectrum.css',
'public/css/bootstrap-combobox.css',
'public/css/typeahead.js-bootstrap.css',
//'public/vendor/handsontable/dist/jquery.handsontable.full.css',
'public/css/style.css',
],
dest: 'public/css/built.css',
nonull: true,
options: {
process: false
}
},
css_public: {
src: [
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
'public/vendor/font-awesome/css/font-awesome.min.css',
'public/css/bootstrap-combobox.css',
'public/vendor/datatables/media/css/jquery.dataTables.css',
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
'public/css/public.style.css',
],
dest: 'public/css/built.public.css',
nonull: true,
options: {
process: false
}
},
js_pdf: {
src: [
'public/js/pdf_viewer.js',
'public/js/compatibility.js',
'public/js/pdfmake.min.js',
'public/js/vfs.js',
],
dest: 'public/pdf.built.js',
nonull: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-dump-dir');
grunt.registerTask('default', ['dump_dir', 'concat']);
};

View File

@ -1,10 +1,5 @@
<?php
<?php namespace App\Commands;
namespace App\Commands;
/**
* Class Command
*/
abstract class Command
{

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Ninja\Mailers\ContactMailer as Mailer;
@ -41,7 +39,6 @@ class ChargeRenewalInvoices extends Command
/**
* ChargeRenewalInvoices constructor.
*
* @param Mailer $mailer
* @param AccountRepository $repo
* @param PaymentService $paymentService
@ -72,9 +69,6 @@ class ChargeRenewalInvoices extends Command
// check if account has switched to free since the invoice was created
$account = Account::find($invoice->client->public_id);
if ( ! $account) {
continue;
}
$company = $account->company;
if ( ! $company->plan || $company->plan == PLAN_FREE) {
continue;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use DB;
use Carbon;
@ -176,6 +174,7 @@ class CheckData extends Command {
foreach ($clients as $client) {
$this->info("=== Client:{$client->id} Balance:{$client->balance} Actual Balance:{$client->actual_balance} ===");
$foundProblem = false;
$lastBalance = 0;
$lastAdjustment = 0;
$lastCreatedAt = null;
@ -183,16 +182,8 @@ class CheckData extends Command {
$activities = DB::table('activities')
->where('client_id', '=', $client->id)
->orderBy('activities.id')
->get(
[
'activities.id',
'activities.created_at',
'activities.activity_type_id',
'activities.adjustment',
'activities.balance',
'activities.invoice_id'
]
);
->get(['activities.id', 'activities.created_at', 'activities.activity_type_id', 'activities.adjustment', 'activities.balance', 'activities.invoice_id']);
//$this->info(var_dump($activities));
foreach ($activities as $activity) {
@ -240,11 +231,13 @@ class CheckData extends Command {
// **Fix for allowing converting a recurring invoice to a normal one without updating the balance**
if ($noAdjustment && $invoice->invoice_type_id == INVOICE_TYPE_STANDARD && !$invoice->is_recurring) {
$this->info("No adjustment for new invoice:{$activity->invoice_id} amount:{$invoice->amount} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}");
$foundProblem = true;
$clientFix += $invoice->amount;
$activityFix = $invoice->amount;
// **Fix for updating balance when creating a quote or recurring invoice**
} elseif ($activity->adjustment != 0 && ($invoice->invoice_type_id == INVOICE_TYPE_QUOTE || $invoice->is_recurring)) {
$this->info("Incorrect adjustment for new invoice:{$activity->invoice_id} adjustment:{$activity->adjustment} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}");
$foundProblem = true;
$clientFix -= $activity->adjustment;
$activityFix = 0;
}
@ -252,6 +245,7 @@ class CheckData extends Command {
// **Fix for updating balance when deleting a recurring invoice**
if ($activity->adjustment != 0 && $invoice->is_recurring) {
$this->info("Incorrect adjustment for deleted invoice adjustment:{$activity->adjustment}");
$foundProblem = true;
if ($activity->balance != $lastBalance) {
$clientFix -= $activity->adjustment;
}
@ -261,6 +255,7 @@ class CheckData extends Command {
// **Fix for updating balance when archiving an invoice**
if ($activity->adjustment != 0 && !$invoice->is_recurring) {
$this->info("Incorrect adjustment for archiving invoice adjustment:{$activity->adjustment}");
$foundProblem = true;
$activityFix = 0;
$clientFix += $activity->adjustment;
}
@ -268,10 +263,12 @@ class CheckData extends Command {
// **Fix for updating balance when updating recurring invoice**
if ($activity->adjustment != 0 && $invoice->is_recurring) {
$this->info("Incorrect adjustment for updated recurring invoice adjustment:{$activity->adjustment}");
$foundProblem = true;
$clientFix -= $activity->adjustment;
$activityFix = 0;
} else if ((strtotime($activity->created_at) - strtotime($lastCreatedAt) <= 1) && $activity->adjustment > 0 && $activity->adjustment == $lastAdjustment) {
$this->info("Duplicate adjustment for updated invoice adjustment:{$activity->adjustment}");
$foundProblem = true;
$clientFix -= $activity->adjustment;
$activityFix = 0;
}
@ -279,6 +276,7 @@ class CheckData extends Command {
// **Fix for updating balance when updating a quote**
if ($activity->balance != $lastBalance) {
$this->info("Incorrect adjustment for updated quote adjustment:{$activity->adjustment}");
$foundProblem = true;
$clientFix += $lastBalance - $activity->balance;
$activityFix = 0;
}
@ -286,6 +284,7 @@ class CheckData extends Command {
// **Fix for deleting payment after deleting invoice**
if ($activity->adjustment != 0 && $invoice->is_deleted && $activity->created_at > $invoice->deleted_at) {
$this->info("Incorrect adjustment for deleted payment adjustment:{$activity->adjustment}");
$foundProblem = true;
$activityFix = 0;
$clientFix -= $activity->adjustment;
}

View File

@ -1,8 +1,5 @@
<?php
<?php namespace App\Console\Commands;
namespace App\Console\Commands;
use App\Models\Vendor;
use Auth;
use Utils;
use Illuminate\Console\Command;
@ -35,7 +32,6 @@ class CreateTestData extends Command
/**
* CreateTestData constructor.
*
* @param ClientRepository $clientRepo
* @param InvoiceRepository $invoiceRepo
* @param PaymentRepository $paymentRepo
@ -130,9 +126,9 @@ class CreateTestData extends Command
/**
* @param $client
* @param Invoice $invoice
* @param $invoice
*/
private function createPayment($client, Invoice $invoice)
private function createPayment($client, $invoice)
{
$data = [
'invoice_id' => $invoice->id,
@ -171,9 +167,9 @@ class CreateTestData extends Command
}
/**
* @param Vendor $vendor
* @param $vendor
*/
private function createExpense(Vendor $vendor)
private function createExpense($vendor)
{
for ($i=0; $i<$this->count; $i++) {
$data = [

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use File;
use Illuminate\Console\Command;

View File

@ -1,6 +1,4 @@
<?php
namespace InvoiceNinja\Console\Commands;
<?php namespace InvoiceNinja\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
@ -8,8 +6,8 @@ use Illuminate\Foundation\Inspiring;
/**
* Class Inspire
*/
class Inspire extends Command
{
class Inspire extends Command {
/**
* The console command name.
*
@ -31,7 +29,7 @@ class Inspire extends Command
*/
public function handle()
{
$this->comment(PHP_EOL . Inspiring::quote() . PHP_EOL);
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use DateTime;
use App\Models\Document;

View File

@ -1,6 +1,5 @@
<?php
<?php namespace App\Console\Commands;
namespace App\Console\Commands;
use Utils;
use Illuminate\Console\Command;
@ -10,6 +9,7 @@ use Illuminate\Console\Command;
*/
class ResetData extends Command
{
/**
* @var string
*/

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use DateTime;
use Illuminate\Console\Command;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use App\Models\Invoice;
use Illuminate\Console\Command;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use Utils;
use Illuminate\Console\Command;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Console\Commands;
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Services\BankAccountService;

View File

@ -15,7 +15,6 @@ class Kernel extends ConsoleKernel
'App\Console\Commands\SendRecurringInvoices',
'App\Console\Commands\RemoveOrphanedDocuments',
'App\Console\Commands\ResetData',
'App\Console\Commands\ResetInvoiceSchemaCounter',
'App\Console\Commands\CheckData',
'App\Console\Commands\PruneData',
'App\Console\Commands\CreateTestData',
@ -53,10 +52,5 @@ class Kernel extends ConsoleKernel
->sendOutputTo($logFile)
->daily();
}
// Reset the invoice schema counter at the turn of the year
$schedule
->command('ninja:reset-invoice-schema-counter')
->daily();
}
}

View File

@ -43,7 +43,7 @@ class Handler extends ExceptionHandler
return false;
}
if (Utils::isNinja() && !Utils::isTravis()) {
if (Utils::isNinja() && ! Utils::isTravis()) {
Utils::logError(Utils::getErrorString($e));
return false;
} else {
@ -56,7 +56,6 @@ class Handler extends ExceptionHandler
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
@ -79,8 +78,7 @@ class Handler extends ExceptionHandler
// In production, except for maintenance mode, we'll show a custom error screen
if (Utils::isNinjaProd()
&& !Utils::isDownForMaintenance()
&& !($e instanceof HttpResponseException)
) {
&& !($e instanceof HttpResponseException)) {
$data = [
'error' => get_class($e),
'hideHeader' => true,

View File

@ -1,39 +1,19 @@
<?php
<?php namespace App\Handlers;
namespace App\Handlers;
use App\Models\Invoice;
use App\Models\Payment;
use App\Ninja\Mailers\UserMailer;
use App\Ninja\Mailers\ContactMailer;
class InvoiceEventHandler
{
/**
* @var UserMailer
*/
protected $userMailer;
/**
* @var ContactMailer
*/
protected $contactMailer;
/**
* InvoiceEventHandler constructor.
*
* @param UserMailer $userMailer
* @param ContactMailer $contactMailer
*/
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer)
{
$this->userMailer = $userMailer;
$this->contactMailer = $contactMailer;
}
/**
* @param $events
*/
public function subscribe($events)
{
$events->listen('invoice.sent', 'InvoiceEventHandler@onSent');
@ -41,41 +21,29 @@ class InvoiceEventHandler
$events->listen('invoice.paid', 'InvoiceEventHandler@onPaid');
}
/**
* @param Invoice $invoice
*/
public function onSent(Invoice $invoice)
public function onSent($invoice)
{
$this->sendNotifications($invoice, 'sent');
}
/**
* @param Invoice $invoice
*/
public function onViewed(Invoice $invoice)
public function onViewed($invoice)
{
$this->sendNotifications($invoice, 'viewed');
}
/**
* @param Payment $payment
*/
public function onPaid(Payment $payment)
public function onPaid($payment)
{
$this->contactMailer->sendPaymentConfirmation($payment);
$this->sendNotifications($payment->invoice, 'paid', $payment);
}
/**
* @param Invoice $invoice
* @param $type
* @param null $payment
*/
private function sendNotifications(Invoice $invoice, $type, $payment = null)
private function sendNotifications($invoice, $type, $payment = null)
{
foreach ($invoice->account->users as $user)
{
if ($user->{'notify_' . $type})
{
foreach ($invoice->account->users as $user) {
if ($user->{'notify_' . $type}) {
$this->userMailer->sendNotification($user, $invoice, $type, $payment);
}
}

View File

@ -1461,6 +1461,7 @@ class AccountController extends BaseController
return trans('texts.create_invoice_for_sample');
}
/** @var \App\Models\Account $account */
$account = Auth::user()->account;
$invitation = $invoice->invitations->first();

View File

@ -1,6 +1,5 @@
<?php namespace App\Http\Controllers;
use Utils;
use Redirect;
use View;
use Response;
@ -96,10 +95,6 @@ class DocumentController extends BaseController
public function postUpload(CreateDocumentRequest $request)
{
if (!Utils::hasFeature(FEATURE_DOCUMENTS)) {
return;
}
$result = $this->documentRepo->upload($request->all(), $doc_array);
if(is_string($result)){

File diff suppressed because it is too large Load Diff

View File

@ -49,13 +49,6 @@ class Client extends EntityModel
'website',
];
/**
* @var array
*/
protected $appends = [
'display_name',
];
/**
* @var string
*/
@ -338,17 +331,6 @@ class Client extends EntityModel
return $contact->getDisplayName();
}
/**
* Making the virtual property display_name accessible
* via an accessor
*
* @return mixed|string
*/
public function getDisplayNameAttribute()
{
return $this->getDisplayName();
}
/**
* @return string
*/

View File

@ -140,9 +140,7 @@ class Invoice extends EntityModel implements BalanceAffecting
*/
public function getDisplayName()
{
return $this->is_recurring
? trans('texts.recurring')
: $this->invoice_number.' ('.$this->client->display_name.')';
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
}
/**

View File

@ -1,20 +1,12 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use URL;
use App\Models\AccountGateway;
/**
* Class AccountGatewayDatatable
*/
class AccountGatewayDatatable extends EntityDatatable
{
public $entityType = ENTITY_ACCOUNT_GATEWAY;
/**
* @return array
*/
public function columns()
{
return [
@ -56,9 +48,6 @@ class AccountGatewayDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [

View File

@ -1,19 +1,11 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
/**
* Class ActivityDatatable
*/
class ActivityDatatable extends EntityDatatable
{
public $entityType = ENTITY_ACTIVITY;
/**
* @return array
*/
public function columns()
{
return [

View File

@ -1,19 +1,11 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use URL;
/**
* Class BankAccountDatatable
*/
class BankAccountDatatable extends EntityDatatable
{
public $entityType = ENTITY_BANK_ACCOUNT;
/**
* @return array
*/
public function columns()
{
return [
@ -25,16 +17,13 @@ class BankAccountDatatable extends EntityDatatable
],
[
'bank_library_id',
function () {
function ($model) {
return 'OFX';
}
],
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -46,4 +35,6 @@ class BankAccountDatatable extends EntityDatatable
]
];
}
}

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class ClientDatatable
*/
class ClientDatatable extends EntityDatatable
{
public $entityType = ENTITY_CLIENT;
/**
* @return array
*/
public function columns()
{
return [
@ -58,9 +50,6 @@ class ClientDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -85,7 +74,7 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("tasks/create/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_TASK);
}
],
@ -94,7 +83,7 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("invoices/create/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_INVOICE);
}
],
@ -103,13 +92,13 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("quotes/create/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->hasFeature(FEATURE_QUOTES) && Auth::user()->can('create', ENTITY_INVOICE);
}
],
[
'--divider--', function(){return false;},
function () {
function ($model) {
$user = Auth::user();
return ($user->can('create', ENTITY_TASK) || $user->can('create', ENTITY_INVOICE)) && ($user->can('create', ENTITY_PAYMENT) || $user->can('create', ENTITY_CREDIT) || $user->can('create', ENTITY_EXPENSE));
}
@ -119,7 +108,7 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("payments/create/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_PAYMENT);
}
],
@ -128,7 +117,7 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("credits/create/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_CREDIT);
}
],
@ -137,7 +126,7 @@ class ClientDatatable extends EntityDatatable
function ($model) {
return URL::to("expenses/create/0/{$model->public_id}");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_EXPENSE);
}
]

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class CreditDatatable
*/
class CreditDatatable extends EntityDatatable
{
public $entityType = ENTITY_CREDIT;
/**
* @return array
*/
public function columns()
{
return [
@ -57,9 +49,6 @@ class CreditDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -68,7 +57,7 @@ class CreditDatatable extends EntityDatatable
function ($model) {
return URL::to("payments/create/{$model->client_public_id}") . '?paymentTypeId=1';
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_PAYMENT);
}
]

View File

@ -1,47 +1,22 @@
<?php
<?php namespace App\Ninja\Datatables;
namespace App\Ninja\Datatables;
/**
* Class EntityDatatable
*/
class EntityDatatable
{
public $entityType;
/**
* @var bool
*/
public $isBulkEdit;
/**
* @var bool
*/
public $hideClient;
/**
* EntityDatatable constructor.
*
* @param bool $isBulkEdit
* @param bool $hideClient
*/
public function __construct($isBulkEdit = true, $hideClient = false)
{
$this->isBulkEdit = $isBulkEdit;
$this->hideClient = $hideClient;
}
/**
* @return array
*/
public function columns()
{
return [];
}
/**
* @return array
*/
public function actions()
{
return [];

View File

@ -1,20 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class ExpenseCategoryDatatable
*/
class ExpenseCategoryDatatable extends EntityDatatable
{
public $entityType = ENTITY_EXPENSE_CATEGORY;
/**
* @return array
*/
public function columns()
{
return [
@ -32,9 +25,6 @@ class ExpenseCategoryDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class ExpenseDatatable
*/
class ExpenseDatatable extends EntityDatatable
{
public $entityType = ENTITY_EXPENSE;
/**
* @return array
*/
public function columns()
{
return [
@ -95,9 +87,6 @@ class ExpenseDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -131,13 +120,7 @@ class ExpenseDatatable extends EntityDatatable
];
}
/**
* @param $invoiceId
* @param $shouldBeInvoiced
* @param $balance
*
* @return string
*/
private function getStatusLabel($invoiceId, $shouldBeInvoiced, $balance)
{
if ($invoiceId) {
@ -158,4 +141,5 @@ class ExpenseDatatable extends EntityDatatable
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
}
}

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class InvoiceDatatable
*/
class InvoiceDatatable extends EntityDatatable
{
public $entityType = ENTITY_INVOICE;
/**
* @return array
*/
public function columns()
{
$entityType = $this->entityType;
@ -80,9 +72,6 @@ class InvoiceDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
$entityType = $this->entityType;
@ -102,7 +91,7 @@ class InvoiceDatatable extends EntityDatatable
function ($model) use ($entityType) {
return URL::to("{$entityType}s/{$model->public_id}/clone");
},
function () {
function ($model) {
return Auth::user()->can('create', ENTITY_INVOICE);
}
],
@ -166,11 +155,6 @@ class InvoiceDatatable extends EntityDatatable
];
}
/**
* @param $model
*
* @return string
*/
private function getStatusLabel($model)
{
$entityType = $this->entityType;
@ -205,4 +189,5 @@ class InvoiceDatatable extends EntityDatatable
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
}
}

View File

@ -1,32 +1,20 @@
<?php
<?php namespace App\Ninja\Datatables;
namespace App\Ninja\Datatables;
use App\Models\Payment;
use Utils;
use URL;
use Auth;
use App\Models\PaymentMethod;
/**
* Class PaymentDatatable
*/
class PaymentDatatable extends EntityDatatable
{
public $entityType = ENTITY_PAYMENT;
/**
* @var array
*/
protected static $refundableGateways = [
GATEWAY_STRIPE,
GATEWAY_BRAINTREE,
GATEWAY_WEPAY,
];
/**
* @return array
*/
public function columns()
{
return [
@ -113,9 +101,7 @@ class PaymentDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -148,12 +134,7 @@ class PaymentDatatable extends EntityDatatable
];
}
/**
* @param Payment $model
*
* @return string
*/
private function getStatusLabel(Payment $model)
private function getStatusLabel($model)
{
$label = trans('texts.status_' . strtolower($model->payment_status_name));
$class = 'default';

View File

@ -1,22 +1,14 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
use Str;
/**
* Class ProductDatatable
*/
class ProductDatatable extends EntityDatatable
{
public $entityType = ENTITY_PRODUCT;
/**
* @return array
*/
public function columns()
{
return [
@ -48,9 +40,6 @@ class ProductDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -62,4 +51,5 @@ class ProductDatatable extends EntityDatatable
]
];
}
}

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class RecurringInvoiceDatatable
*/
class RecurringInvoiceDatatable extends EntityDatatable
{
public $entityType = ENTITY_RECURRING_INVOICE;
/**
* @return array
*/
public function columns()
{
return [
@ -55,9 +47,6 @@ class RecurringInvoiceDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -72,4 +61,5 @@ class RecurringInvoiceDatatable extends EntityDatatable
]
];
}
}

View File

@ -1,22 +1,14 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
use App\Models\Task;
/**
* Class TaskDatatable
*/
class TaskDatatable extends EntityDatatable
{
public $entityType = ENTITY_TASK;
/**
* @return array
*/
public function columns()
{
return [
@ -58,9 +50,6 @@ class TaskDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -103,11 +92,6 @@ class TaskDatatable extends EntityDatatable
];
}
/**
* @param $model
*
* @return string
*/
private function getStatusLabel($model)
{
if ($model->invoice_number) {

View File

@ -1,19 +1,11 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use URL;
/**
* Class TaxRateDatatable
*/
class TaxRateDatatable extends EntityDatatable
{
public $entityType = ENTITY_TAX_RATE;
/**
* @return array
*/
public function columns()
{
return [
@ -32,9 +24,6 @@ class TaxRateDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [

View File

@ -1,19 +1,11 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use URL;
/**
* Class TokenDatatable
*/
class TokenDatatable extends EntityDatatable
{
public $entityType = ENTITY_TOKEN;
/**
* @return array
*/
public function columns()
{
return [
@ -32,9 +24,6 @@ class TokenDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [

View File

@ -1,19 +1,11 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use URL;
/**
* Class UserDatatable
*/
class UserDatatable extends EntityDatatable
{
public $entityType = ENTITY_USER;
/**
* @return array
*/
public function columns()
{
return [
@ -50,9 +42,6 @@ class UserDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -77,11 +66,6 @@ class UserDatatable extends EntityDatatable
];
}
/**
* @param $state
*
* @return string
*/
private function getStatusLabel($state)
{
$label = trans("texts.{$state}");

View File

@ -1,21 +1,13 @@
<?php
namespace App\Ninja\Datatables;
<?php namespace App\Ninja\Datatables;
use Utils;
use URL;
use Auth;
/**
* Class VendorDatatable
*/
class VendorDatatable extends EntityDatatable
{
public $entityType = ENTITY_VENDOR;
/**
* @return array
*/
public function columns()
{
return [
@ -52,9 +44,6 @@ class VendorDatatable extends EntityDatatable
];
}
/**
* @return array
*/
public function actions()
{
return [
@ -85,4 +74,6 @@ class VendorDatatable extends EntityDatatable
]
];
}
}

View File

@ -1,9 +1,8 @@
<?php
namespace App\Ninja\Mailers;
<?php namespace App\Ninja\Mailers;
use App\Models\Invitation;
use Utils;
use Event;
use Auth;
use App\Services\TemplateService;
use App\Models\Invoice;

View File

@ -1,9 +1,8 @@
<?php
namespace App\Ninja\Mailers;
<?php namespace App\Ninja\Mailers;
use Exception;
use Mail;
use App\Models\Invoice;
/**
* Class Mailer
@ -97,7 +96,6 @@ class Mailer
/**
* @param $exception
*
* @return string
*/
private function handleFailure($exception)

View File

@ -1,15 +1,11 @@
<?php
<?php namespace App\Ninja\Mailers;
namespace App\Ninja\Mailers;
use App\Models\Invitation;
use App\Models\Invoice;
use App\Models\Payment;
use App\Models\User;
/**
* Class UserMailer
*/
class UserMailer extends Mailer
{
/**

View File

@ -1,14 +1,6 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class AuthorizeNetAIMPaymentDriver
*/
class AuthorizeNetAIMPaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'refId';
}

View File

@ -1,9 +1,5 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\AccountGateway;
use App\Models\Invitation;
use URL;
use Session;
use Request;
@ -17,59 +13,26 @@ use App\Models\Payment;
use App\Models\PaymentMethod;
use App\Models\Country;
/**
* Class BasePaymentDriver
*/
class BasePaymentDriver
{
public $invitation;
/**
* @var AccountGateway
*/
public $accountGateway;
protected $gatewayType;
protected $gateway;
protected $customer;
protected $sourceId;
/**
* @var array
*/
protected $input;
protected $customerResponse;
protected $tokenResponse;
protected $purchaseResponse;
/**
* @var string
*/
protected $sourceReferenceParam = 'token';
/**
* @var string
*/
protected $customerReferenceParam;
/**
* @var string
*/
protected $transactionReferenceParam;
/**
* BasePaymentDriver constructor.
*
* @param AccountGateway $accountGateway
* @param Invitation $invitation
* @param bool $gatewayType
*/
public function __construct(
AccountGateway $accountGateway = null,
Invitation $invitation = null,
$gatewayType = false
)
public function __construct($accountGateway = false, $invitation = false, $gatewayType = false)
{
$this->accountGateway = $accountGateway;
$this->invitation = $invitation;
@ -91,9 +54,6 @@ class BasePaymentDriver
}
}
/**
* @return array
*/
public function gatewayTypes()
{
return [
@ -106,74 +66,44 @@ class BasePaymentDriver
return in_array($type, $this->gatewayTypes());
}
/**
* When set to true we won't pass the card details with the form
*
* @return bool
*/
// when set to true we won't pass the card details with the form
public function tokenize()
{
return false;
}
/**
* Set payment method as pending until confirmed
*
* @return bool
*/
// set payment method as pending until confirmed
public function isTwoStep()
{
return false;
}
/**
* @return string
*/
public function providerName()
{
return strtolower($this->accountGateway->gateway->provider);
}
/**
* @return mixed
*/
protected function invoice()
{
return $this->invitation->invoice;
}
/**
* @return mixed
*/
protected function contact()
{
return $this->invitation->contact;
}
/**
* @return mixed
*/
protected function client()
{
return $this->invoice()->client;
}
/**
* @return mixed
*/
protected function account()
{
return $this->client()->account;
}
/**
* @param array $input
* @param bool $sourceId
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
* @throws Exception
*/
public function startPurchase(array $input = null, $sourceId = false)
public function startPurchase($input = false, $sourceId = false)
{
$this->input = $input;
$this->sourceId = $sourceId;
@ -220,11 +150,7 @@ class BasePaymentDriver
return view($this->paymentView(), $data);
}
/**
* Check if a custom view exists for this provider
*
* @return mixed
*/
// check if a custom view exists for this provider
protected function paymentView()
{
$file = sprintf('%s/views/payments/%s/%s.blade.php', resource_path(), $this->providerName(), $this->gatewayType);
@ -236,11 +162,7 @@ class BasePaymentDriver
}
}
/**
* Check if a custom partial exists for this provider
*
* @return bool
*/
// check if a custom partial exists for this provider
public function partialView()
{
$file = sprintf('%s/views/payments/%s/partial.blade.php', resource_path(), $this->providerName());
@ -252,9 +174,6 @@ class BasePaymentDriver
}
}
/**
* @return array
*/
public function rules()
{
$rules = [];
@ -290,9 +209,6 @@ class BasePaymentDriver
return $rules;
}
/**
* @return mixed
*/
protected function gateway()
{
if ($this->gateway) {
@ -305,14 +221,7 @@ class BasePaymentDriver
return $this->gateway;
}
/**
* @param bool $input
* @param PaymentMethod $paymentMethod
*
* @return Payment|mixed|void
* @throws Exception
*/
public function completeOnsitePurchase($input = false, PaymentMethod $paymentMethod = null)
public function completeOnsitePurchase($input = false, $paymentMethod = false)
{
$this->input = count($input) ? $input : false;
$gateway = $this->gateway();
@ -406,12 +315,7 @@ class BasePaymentDriver
$client->save();
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$invoice = $this->invoice();
$completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $this->gatewayType);
@ -441,13 +345,9 @@ class BasePaymentDriver
return $data;
}
/**
* @param array $input
*
* @return array
*/
private function paymentDetailsFromInput(array $input)
private function paymentDetailsFromInput($input)
{
$invoice = $this->invoice();
$client = $this->client();
$data = [
@ -488,11 +388,9 @@ class BasePaymentDriver
return $data;
}
/**
* @return array
*/
public function paymentDetailsFromClient()
{
$invoice = $this->invoice();
$client = $this->client();
$contact = $this->invitation->contact ?: $client->contacts()->first();
@ -518,9 +416,6 @@ class BasePaymentDriver
];
}
/**
* @return bool
*/
protected function shouldCreateToken()
{
if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER)) {
@ -538,11 +433,19 @@ class BasePaymentDriver
return boolval(array_get($this->input, 'token_billing'));
}
/**
* @param bool $clientId
*
* @return null
/*
protected function tokenDetails()
{
$details = [];
if ($customer = $this->customer()) {
$details['customerReference'] = $customer->token;
}
return $details;
}
*/
public function customer($clientId = false)
{
if ($this->customer) {
@ -564,51 +467,27 @@ class BasePaymentDriver
return $this->customer;
}
/**
* @param $customer
*
* @return bool
*/
protected function checkCustomerExists($customer)
{
return true;
}
/**
* @param $client
* @param $publicId
* @param $amount1
* @param $amount2
*
* @throws Exception
*/
public function verifyBankAccount($client, $publicId, $amount1, $amount2)
{
throw new Exception('verifyBankAccount not implemented');
}
/**
* @param PaymentMethod $paymentMethod
* @throws Exception
*/
public function removePaymentMethod(PaymentMethod $paymentMethod)
public function removePaymentMethod($paymentMethod)
{
$paymentMethod->delete();
}
/**
* Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice
*
* @return null
*/
// Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice
public function createTransactionToken()
{
return null;
}
/**
* @return PaymentMethod
*/
public function createToken()
{
$account = $this->account();
@ -623,6 +502,17 @@ class BasePaymentDriver
$customer->save();
}
/*
// archive the old payment method
$paymentMethod = PaymentMethod::clientId($this->client()->id)
->isBankAccount($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER))
->first();
if ($paymentMethod) {
$paymentMethod->delete();
}
*/
$paymentMethod = $this->createPaymentMethod($customer);
if ($paymentMethod && ! $customer->default_payment_method_id) {
@ -633,24 +523,13 @@ class BasePaymentDriver
return $paymentMethod;
}
/**
* @param $customer
*
* @return mixed
*/
protected function creatingCustomer($customer)
{
return $customer;
}
/**
* @param $customer
*
* @return PaymentMethod
*/
public function createPaymentMethod($customer)
{
/** @var PaymentMethod $paymentMethod */
$paymentMethod = PaymentMethod::createNew($this->invitation);
$paymentMethod->contact_id = $this->contact()->id;
$paymentMethod->ip = Request::ip();
@ -665,12 +544,7 @@ class BasePaymentDriver
return $paymentMethod;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return PaymentMethod
*/
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
protected function creatingPaymentMethod($paymentMethod)
{
return $paymentMethod;
}
@ -680,13 +554,7 @@ class BasePaymentDriver
}
/**
* @param bool $ref
* @param PaymentMethod|null $paymentMethod
*
* @return Payment|mixed
*/
public function createPayment($ref = false, PaymentMethod $paymentMethod = null)
public function createPayment($ref = false, $paymentMethod = null)
{
$invitation = $this->invitation;
$invoice = $this->invoice();
@ -773,24 +641,12 @@ class BasePaymentDriver
return $payment;
}
/**
* @param Payment $payment
* @param $paymentMethod
*
* @return Payment
*/
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
protected function creatingPayment($payment, $paymentMethod)
{
return $payment;
}
/**
* @param Payment $payment
* @param int $amount
*
* @return bool
*/
public function refundPayment(Payment $payment, $amount = 0)
public function refundPayment($payment, $amount = 0)
{
if ($amount) {
$amount = min($amount, $payment->getCompletedAmount());
@ -822,13 +678,7 @@ class BasePaymentDriver
return false;
}
/**
* @param Payment $payment
* @param $amount
*
* @return array
*/
protected function refundDetails(Payment $payment, $amount)
protected function refundDetails($payment, $amount)
{
return [
'amount' => $amount,
@ -836,14 +686,7 @@ class BasePaymentDriver
];
}
/**
* @param $response
* @param Payment $payment
* @param $amount
*
* @return bool
*/
protected function attemptVoidPayment($response, Payment $payment, $amount)
protected function attemptVoidPayment($response, $payment, $amount)
{
// Partial refund not allowed for unsettled transactions
return $amount == $payment->amount;
@ -854,13 +697,7 @@ class BasePaymentDriver
return $payment;
}
/**
* @param $input
*
* @return bool|mixed
* @throws Exception
*/
public function completeOffsitePurchase(array $input)
public function completeOffsitePurchase($input)
{
$this->input = $input;
$ref = array_get($this->input, 'token') ?: $this->invitation->transaction_reference;
@ -893,9 +730,6 @@ class BasePaymentDriver
return $this->createPayment($ref);
}
/**
* @return array
*/
public function tokenLinks()
{
if ( ! $this->customer()) {
@ -933,9 +767,6 @@ class BasePaymentDriver
return $links;
}
/**
* @return array
*/
public function paymentLinks()
{
$links = [];
@ -954,11 +785,6 @@ class BasePaymentDriver
return $links;
}
/**
* @param $gatewayType
*
* @return string
*/
protected function paymentUrl($gatewayType)
{
$account = $this->account();
@ -976,11 +802,6 @@ class BasePaymentDriver
return $url;
}
/**
* @param $cardName
*
* @return mixed
*/
protected function parseCardType($cardName) {
$cardTypes = [
'visa' => PAYMENT_TYPE_VISA,
@ -1013,11 +834,6 @@ class BasePaymentDriver
}
}
/**
* @param $input
*
* @throws Exception
*/
public function handleWebHook($input)
{
throw new Exception('Unsupported gateway');

View File

@ -1,19 +1,12 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class BitPayPaymentDriver
*/
class BitPayPaymentDriver extends BasePaymentDriver
{
/**
* @return array
*/
public function gatewayTypes()
{
return [
GATEWAY_TYPE_BITCOIN
];
}
}

View File

@ -1,31 +1,14 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\PaymentMethod;
use Exception;
use Session;
use Braintree\Customer;
use App\Models\Payment;
/**
* Class BraintreePaymentDriver
*/
class BraintreePaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $customerReferenceParam = 'customerId';
/**
* @var string
*/
protected $sourceReferenceParam = 'paymentMethodToken';
/**
* @return array
*/
public function gatewayTypes()
{
$types = [
@ -40,36 +23,30 @@ class BraintreePaymentDriver extends BasePaymentDriver
return $types;
}
/**
* @return bool
*/
public function tokenize()
{
return true;
}
/**
* @param array $input
* @param bool $sourceId
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function startPurchase(array $input = null, $sourceId = false)
public function startPurchase($input = false, $sourceId = false)
{
$data = parent::startPurchase($input, $sourceId);
if ($this->isGatewayType(GATEWAY_TYPE_PAYPAL)) {
/*
if ( ! $sourceId || empty($input['device_data'])) {
throw new Exception();
}
Session::put($this->invitation->id . 'device_data', $input['device_data']);
*/
$data['details'] = ! empty($input['device_data']) ? json_decode($input['device_data']) : false;
}
return $data;
}
/**
* @param $customer
*
* @return bool
*/
protected function checkCustomerExists($customer)
{
if ( ! parent::checkCustomerExists($customer)) {
@ -83,12 +60,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
return ($customer instanceof Customer);
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails($paymentMethod);
@ -109,9 +81,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
return $data;
}
/**
* @return PaymentMethod|bool
*/
public function createToken()
{
if ($customer = $this->customer()) {
@ -144,9 +113,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
return parent::createToken();
}
/**
* @return array
*/
private function customerData()
{
return [
@ -159,11 +125,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
];
}
/**
* @param $customer
*
* @return mixed
*/
public function creatingCustomer($customer)
{
$customer->token = $this->tokenResponse->customerId;
@ -171,12 +132,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
return $customer;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return PaymentMethod|null
*/
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
protected function creatingPaymentMethod($paymentMethod)
{
$response = $this->tokenResponse;
@ -196,13 +152,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
return $paymentMethod;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return bool
* @throws Exception
*/
public function removePaymentMethod(PaymentMethod $paymentMethod)
public function removePaymentMethod($paymentMethod)
{
parent::removePaymentMethod($paymentMethod);
@ -217,14 +167,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
}
}
/**
* @param $response
* @param Payment $payment
* @param $amount
*
* @return bool
*/
protected function attemptVoidPayment($response, Payment $payment, $amount)
protected function attemptVoidPayment($response, $payment, $amount)
{
if ( ! parent::attemptVoidPayment($response, $payment, $amount)) {
return false;
@ -242,9 +185,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
return false;
}
/**
* @return mixed
*/
public function createTransactionToken()
{
return $this->gateway()

View File

@ -1,17 +1,7 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\PaymentMethod;
/**
* Class CheckoutComPaymentDriver
*/
class CheckoutComPaymentDriver extends BasePaymentDriver
{
/**
* @return bool
*/
public function createTransactionToken()
{
$response = $this->gateway()->purchase([
@ -31,12 +21,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
return false;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails();

View File

@ -1,24 +1,10 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class CybersourcePaymentDriver
*/
class CybersourcePaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'transaction_uuid';
/**
* @param array $input
*
* @return \App\Models\Payment|mixed
* @throws Exception
*/
public function completeOffsitePurchase(array $input)
public function completeOffsitePurchase($input)
{
if ($input['decision'] == 'ACCEPT') {
return $this->createPayment($input['bill_trans_ref_no']);

View File

@ -1,23 +1,12 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class DwollaPaymentDriver
*/
class DwollaPaymentDriver extends BasePaymentDriver
{
/**
* @return array
*/
public function gatewayTypes()
{
return [GATEWAY_TYPE_DWOLLA];
}
/**
* @return mixed
*/
protected function gateway()
{
$gateway = parent::gateway();

View File

@ -1,14 +1,6 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class EwayRapidSharedPaymentDriver
*/
class EwayRapidSharedPaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'AccessCode';
}

View File

@ -1,14 +1,6 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class GoCardlessPaymentDriver
*/
class GoCardlessPaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'signature';
}

View File

@ -1,18 +1,8 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class MolliePaymentDriver
*/
class MolliePaymentDriver extends BasePaymentDriver
{
/**
* @param $input
*
* @return \App\Models\Payment|mixed
*/
public function completeOffsitePurchase(array $input)
public function completeOffsitePurchase($input)
{
$details = $this->paymentDetails();

View File

@ -1,18 +1,10 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class PayFastPaymentDriver
*/
class PayFastPaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'm_payment_id';
public function completeOffsitePurchase(array $input)
public function completeOffsitePurchase($input)
{
if ($accountGateway->isGateway(GATEWAY_PAYFAST) && Request::has('pt')) {
$token = Request::query('pt');

View File

@ -1,18 +1,8 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\Payment;
use App\Models\PaymentMethod;
/**
* Class PayPalExpressPaymentDriver
*/
class PayPalExpressPaymentDriver extends BasePaymentDriver
{
/**
* @return array
*/
public function gatewayTypes()
{
return [
@ -20,12 +10,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
];
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails();
@ -34,13 +19,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
return $data;
}
/**
* @param Payment $payment
* @param PaymentMethod $paymentMethod
*
* @return Payment
*/
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
protected function creatingPayment($payment, $paymentMethod)
{
$payment->payer_id = $this->input['PayerID'];

View File

@ -1,17 +1,7 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\PaymentMethod;
/**
* Class PayPalProPaymentDriver
*/
class PayPalProPaymentDriver extends BasePaymentDriver
{
/**
* @return array
*/
public function gatewayTypes()
{
return [
@ -19,12 +9,7 @@ class PayPalProPaymentDriver extends BasePaymentDriver
];
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails();

View File

@ -1,25 +1,14 @@
<?php
namespace App\Ninja\PaymentDrivers;
<?php namespace App\Ninja\PaymentDrivers;
use Exception;
use Cache;
use App\Models\Payment;
use App\Models\PaymentMethod;
/**
* Class StripePaymentDriver
*/
class StripePaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $customerReferenceParam = 'customerReference';
/**
* @return array
*/
public function gatewayTypes()
{
$types = [
@ -34,17 +23,11 @@ class StripePaymentDriver extends BasePaymentDriver
return $types;
}
/**
* @return bool|mixed
*/
public function tokenize()
{
return $this->accountGateway->getPublishableStripeKey();
}
/**
* @return array
*/
public function rules()
{
$rules = parent::rules();
@ -56,11 +39,6 @@ class StripePaymentDriver extends BasePaymentDriver
return $rules;
}
/**
* @param $customer
*
* @return bool
*/
protected function checkCustomerExists($customer)
{
$response = $this->gateway()
@ -85,20 +63,12 @@ class StripePaymentDriver extends BasePaymentDriver
return true;
}
/**
* @return bool
*/
public function isTwoStep()
{
return $this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER) && empty($this->input['plaidPublicToken']);
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails($paymentMethod);
@ -123,10 +93,6 @@ class StripePaymentDriver extends BasePaymentDriver
return $data;
}
/**
* @return PaymentMethod
* @throws Exception
*/
public function createToken()
{
$invoice = $this->invitation->invoice;
@ -160,11 +126,6 @@ class StripePaymentDriver extends BasePaymentDriver
}
}
/**
* @param $customer
*
* @return mixed
*/
public function creatingCustomer($customer)
{
$customer->token = $this->tokenResponse['id'];
@ -172,12 +133,7 @@ class StripePaymentDriver extends BasePaymentDriver
return $customer;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return PaymentMethod|bool
*/
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
protected function creatingPaymentMethod($paymentMethod)
{
$data = $this->tokenResponse;
@ -219,30 +175,16 @@ class StripePaymentDriver extends BasePaymentDriver
return $paymentMethod;
}
/**
* @param Payment $payment
* @param PaymentMethod $paymentMethod
*
* @return Payment
*/
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
protected function creatingPayment($payment, $paymentMethod)
{
if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER, $paymentMethod)) {
$payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded'
? PAYMENT_STATUS_COMPLETED
: PAYMENT_STATUS_PENDING;
$payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded' ? PAYMENT_STATUS_COMPLETED : PAYMENT_STATUS_PENDING;
}
return $payment;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return bool
* @throws Exception
*/
public function removePaymentMethod(PaymentMethod $paymentMethod)
public function removePaymentMethod($paymentMethod)
{
parent::removePaymentMethod($paymentMethod);
@ -262,13 +204,6 @@ class StripePaymentDriver extends BasePaymentDriver
}
}
/**
* @param $publicToken
* @param $accountId
*
* @return mixed
* @throws Exception
*/
private function getPlaidToken($publicToken, $accountId)
{
$clientId = $this->accountGateway->getPlaidClientId();
@ -311,14 +246,6 @@ class StripePaymentDriver extends BasePaymentDriver
}
}
/**
* @param $client
* @param $publicId
* @param $amount1
* @param $amount2
*
* @return bool|mixed|string
*/
public function verifyBankAccount($client, $publicId, $amount1, $amount2)
{
$customer = $this->customer($client->id);
@ -349,13 +276,6 @@ class StripePaymentDriver extends BasePaymentDriver
return true;
}
/**
* @param $method
* @param $url
* @param null $body
*
* @return mixed|string
*/
public function makeStripeCall($method, $url, $body = null)
{
$apiKey = $this->accountGateway->getConfig()->apiKey;
@ -392,12 +312,6 @@ class StripePaymentDriver extends BasePaymentDriver
}
}
/**
* @param $input
*
* @return array|string
* @throws Exception
*/
public function handleWebHook($input)
{
$eventId = array_get($input, 'id');

View File

@ -1,24 +1,11 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
/**
* Class TwoCheckoutPaymentDriver
*/
class TwoCheckoutPaymentDriver extends BasePaymentDriver
{
/**
* @var string
*/
protected $transactionReferenceParam = 'cart_order_id';
/**
* Calling completePurchase results in an 'invalid key' error
*
* @param array $input
* @return \App\Models\Payment|mixed
*/
public function completeOffsitePurchase(array $input)
// Calling completePurchase results in an 'invalid key' error
public function completeOffsitePurchase($input)
{
return $this->createPayment($input['order_number']);
}

View File

@ -1,21 +1,12 @@
<?php
<?php namespace App\Ninja\PaymentDrivers;
namespace App\Ninja\PaymentDrivers;
use App\Models\PaymentMethod;
use Session;
use Utils;
use App\Models\Payment;
use Exception;
/**
* Class WePayPaymentDriver
*/
class WePayPaymentDriver extends BasePaymentDriver
{
/**
* @return array
*/
public function gatewayTypes()
{
$types = [
@ -30,27 +21,16 @@ class WePayPaymentDriver extends BasePaymentDriver
return $types;
}
/**
* @return bool
*/
public function tokenize()
{
return true;
}
/**
* @param $customer
*
* @return bool
*/
protected function checkCustomerExists($customer)
{
return true;
}
/**
* @return array
*/
public function rules()
{
$rules = parent::rules();
@ -65,12 +45,7 @@ class WePayPaymentDriver extends BasePaymentDriver
return $rules;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return array
*/
protected function paymentDetails(PaymentMethod $paymentMethod = null)
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails($paymentMethod);
@ -89,9 +64,6 @@ class WePayPaymentDriver extends BasePaymentDriver
return $data;
}
/**
* @return PaymentMethod
*/
public function createToken()
{
$wepay = Utils::setupWePay($this->accountGateway);
@ -105,6 +77,22 @@ class WePayPaymentDriver extends BasePaymentDriver
'payment_bank_id' => $token,
]);
} else {
// Authorize credit card
$tokenResponse = $wepay->request('credit_card/authorize', [
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
'credit_card_id' => $token,
]);
// Update the callback uri and get the card details
$tokenResponse = $wepay->request('credit_card/modify', [
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
'credit_card_id' => $token,
'auto_update' => WEPAY_AUTO_UPDATE,
'callback_uri' => $this->accountGateway->getWebhookUrl(),
]);
$this->tokenResponse = $wepay->request('credit_card', [
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
@ -115,12 +103,23 @@ class WePayPaymentDriver extends BasePaymentDriver
return parent::createToken();
}
/**
* @param PaymentMethod $paymentMethod
*
* @return PaymentMethod
/*
public function creatingCustomer($customer)
{
if ($gatewayResponse instanceof \Omnipay\WePay\Message\CustomCheckoutResponse) {
$wepay = \Utils::setupWePay($accountGateway);
$paymentMethodType = $gatewayResponse->getData()['payment_method']['type'];
$gatewayResponse = $wepay->request($paymentMethodType, array(
'client_id' => WEPAY_CLIENT_ID,
'client_secret' => WEPAY_CLIENT_SECRET,
$paymentMethodType.'_id' => $gatewayResponse->getData()['payment_method'][$paymentMethodType]['id'],
));
}
}
*/
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
protected function creatingPaymentMethod($paymentMethod)
{
$source = $this->tokenResponse;
@ -149,13 +148,7 @@ class WePayPaymentDriver extends BasePaymentDriver
return $paymentMethod;
}
/**
* @param PaymentMethod $paymentMethod
*
* @return bool
* @throws Exception
*/
public function removePaymentMethod(PaymentMethod $paymentMethod)
public function removePaymentMethod($paymentMethod)
{
parent::removePaymentMethod($paymentMethod);
@ -173,13 +166,7 @@ class WePayPaymentDriver extends BasePaymentDriver
}
}
/**
* @param Payment $payment
* @param $amount
*
* @return array
*/
protected function refundDetails(Payment $payment, $amount)
protected function refundDetails($payment, $amount)
{
$data = parent::refundDetails($payment, $amount);
@ -195,7 +182,7 @@ class WePayPaymentDriver extends BasePaymentDriver
return $data;
}
protected function attemptVoidPayment($response, Payment $payment, $amount)
protected function attemptVoidPayment($response, $payment, $amount)
{
if ( ! parent::attemptVoidPayment($response, $payment, $amount)) {
return false;
@ -237,6 +224,8 @@ class WePayPaymentDriver extends BasePaymentDriver
if ($source->state == 'deleted') {
$paymentMethod->delete();
} else {
//$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
}
return 'Processed successfully';

View File

@ -1,27 +1,14 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
/**
* Class AccountGatewayRepository
*/
class AccountGatewayRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\AccountGateway';
}
/**
* @param $accountId
*
* @return $this
*/
public function find($accountId)
{
$query = DB::table('account_gateways')

View File

@ -1,6 +1,4 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use Auth;
use Request;
@ -24,9 +22,6 @@ use App\Models\User;
use App\Models\UserAccount;
use App\Models\AccountToken;
/**
* Class AccountRepository
*/
class AccountRepository
{
public function create($firstName = '', $lastName = '', $email = '', $password = '')
@ -643,10 +638,7 @@ class AccountRepository
return $users;
}
/**
* @param Account $account
*/
public function unlinkAccount(Account $account) {
public function unlinkAccount($account) {
foreach ($account->users as $user) {
if ($userAccount = self::findUserAccounts($user->id)) {
$userAccount->removeUserId($user->id);
@ -689,11 +681,7 @@ class AccountRepository
return $code;
}
/**
* @param User $user
* @param $name
*/
public function createTokens(User $user, $name)
public function createTokens($user, $name)
{
$name = trim($name) ?: 'TOKEN';
$users = $this->findUsers($user);
@ -710,12 +698,7 @@ class AccountRepository
}
}
/**
* @param Account $account
*
* @return bool|mixed
*/
public function getUserAccountId(Account $account)
public function getUserAccountId($account)
{
$user = $account->users()->first();
$userAccount = $this->findUserAccounts($user->id);
@ -723,11 +706,7 @@ class AccountRepository
return $userAccount ? $userAccount->id : false;
}
/**
* @param $data
* @param Account $account
*/
public function save($data, Account $account)
public function save($data, $account)
{
$account->fill($data);
$account->save();

View File

@ -1,6 +1,4 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Auth;
@ -10,20 +8,8 @@ use App\Models\Activity;
use App\Models\Client;
use App\Models\Invitation;
/**
* Class ActivityRepository
*/
class ActivityRepository
{
/**
* @param $entity
* @param $activityTypeId
* @param int $balanceChange
* @param int $paidToDateChange
* @param null $altEntity
*
* @return Activity|mixed
*/
public function create($entity, $activityTypeId, $balanceChange = 0, $paidToDateChange = 0, $altEntity = null)
{
if ($entity instanceof Client) {
@ -57,11 +43,6 @@ class ActivityRepository
return $activity;
}
/**
* @param $entity
*
* @return Activity
*/
private function getBlank($entity)
{
$activity = new Activity();
@ -83,11 +64,6 @@ class ActivityRepository
return $activity;
}
/**
* @param $clientId
*
* @return $this
*/
public function findByClientId($clientId)
{
return DB::table('activities')

View File

@ -1,30 +1,17 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Crypt;
use App\Models\BankAccount;
use App\Models\BankSubaccount;
/**
* Class BankAccountRepository
*/
class BankAccountRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\BankAccount';
}
/**
* @param $accountId
*
* @return $this
*/
public function find($accountId)
{
return DB::table('bank_accounts')
@ -39,11 +26,6 @@ class BankAccountRepository extends BaseRepository
);
}
/**
* @param $input
*
* @return mixed
*/
public function save($input)
{
$bankAccount = BankAccount::createNew();

View File

@ -1,29 +1,19 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Cache;
use App\Models\Client;
use App\Models\Contact;
use App\Events\ClientWasCreated;
use App\Events\ClientWasUpdated;
/**
* Class ClientRepository
*/
class ClientRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\Client';
}
/**
* @return mixed
*/
public function all()
{
return Client::scope()
@ -33,12 +23,6 @@ class ClientRepository extends BaseRepository
->get();
}
/**
* @param null $filter
* @param bool $userId
*
* @return $this
*/
public function find($filter = null, $userId = false)
{
$query = DB::table('clients')
@ -84,13 +68,7 @@ class ClientRepository extends BaseRepository
return $query;
}
/**
* @param $data
* @param Client|null $client
*
* @return Client|mixed
*/
public function save($data, Client $client = null)
public function save($data, $client = null)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
@ -117,6 +95,12 @@ class ClientRepository extends BaseRepository
$client->fill($data);
$client->save();
/*
if ( ! isset($data['contact']) && ! isset($data['contacts'])) {
return $client;
}
*/
$first = true;
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
$contactIds = [];

View File

@ -1,19 +1,9 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use App\Models\Contact;
/**
* Class ContactRepository
*/
class ContactRepository extends BaseRepository
{
/**
* @param $data
*
* @return mixed
*/
public function save($data)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;

View File

@ -1,31 +1,17 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
use App\Models\Credit;
use App\Models\Client;
/**
* Class CreditRepository
*/
class CreditRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\Credit';
}
/**
* @param null $clientPublicId
* @param null $filter
*
* @return $this
*/
public function find($clientPublicId = null, $filter = null)
{
$query = DB::table('credits')
@ -72,13 +58,7 @@ class CreditRepository extends BaseRepository
return $query;
}
/**
* @param $input
* @param Credit|null $credit
*
* @return Credit|mixed
*/
public function save($input, Credit $credit = null)
public function save($input, $credit = null)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;

View File

@ -1,6 +1,4 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
@ -8,22 +6,14 @@ use App\Models\Document;
use Intervention\Image\ImageManager;
use Form;
/**
* Class DocumentRepository
*/
class DocumentRepository extends BaseRepository
{
/**
* @return string
*/
// Expenses
public function getClassName()
{
return 'App\Models\Document';
}
/**
* @return mixed
*/
public function all()
{
return Document::scope()
@ -31,9 +21,6 @@ class DocumentRepository extends BaseRepository
->get();
}
/**
* @return $this
*/
public function find()
{
$accountid = \Auth::user()->account_id;
@ -63,12 +50,6 @@ class DocumentRepository extends BaseRepository
return $query;
}
/**
* @param $data
* @param null $doc_array
*
* @return mixed
*/
public function upload($data, &$doc_array=null)
{
$uploaded = $data['file'];
@ -196,14 +177,6 @@ class DocumentRepository extends BaseRepository
return $document;
}
/**
* @param $contactId
* @param $entityType
* @param $search
*
* @return \Illuminate\Http\JsonResponse
* @throws \Exception
*/
public function getClientDatatable($contactId, $entityType, $search)
{

View File

@ -1,26 +1,17 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
use Auth;
use App\Models\ExpenseCategory;
class ExpenseCategoryRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\ExpenseCategory';
}
/**
* @param null $filter
*
* @return $this
*/
public function find($filter = null)
{
$query = DB::table('expense_categories')
@ -45,14 +36,10 @@ class ExpenseCategoryRepository extends BaseRepository
return $query;
}
/**
* @param array $input
* @param ExpenseCategory $category
*
* @return ExpenseCategory|mixed
*/
public function save(array $input, ExpenseCategory $category = false)
public function save($input, $category = false)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
if ( ! $category) {
$category = ExpenseCategory::createNew();
}

View File

@ -1,6 +1,4 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
@ -9,37 +7,21 @@ use App\Models\Expense;
use App\Models\Vendor;
use App\Models\Document;
/**
* Class ExpenseRepository
*/
class ExpenseRepository extends BaseRepository
{
/**
* @var DocumentRepository
*/
protected $documentRepo;
/**
* @return string
*/
// Expenses
public function getClassName()
{
return 'App\Models\Expense';
}
/**
* ExpenseRepository constructor.
*
* @param DocumentRepository $documentRepo
*/
public function __construct(DocumentRepository $documentRepo)
{
$this->documentRepo = $documentRepo;
}
/**
* @return mixed
*/
public function all()
{
return Expense::scope()
@ -49,11 +31,6 @@ class ExpenseRepository extends BaseRepository
->get();
}
/**
* @param $vendorPublicId
*
* @return mixed
*/
public function findVendor($vendorPublicId)
{
$vendorId = Vendor::getPrivateId($vendorPublicId);
@ -63,11 +40,6 @@ class ExpenseRepository extends BaseRepository
return $query;
}
/**
* @param null $filter
*
* @return $this
*/
public function find($filter = null)
{
$accountid = \Auth::user()->account_id;
@ -138,13 +110,7 @@ class ExpenseRepository extends BaseRepository
return $query;
}
/**
* @param array $input
* @param Expense|null $expense
*
* @return Expense|mixed
*/
public function save(array $input, Expense $expense = null)
public function save($input, $expense = null)
{
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
@ -208,12 +174,6 @@ class ExpenseRepository extends BaseRepository
return $expense;
}
/**
* @param $ids
* @param $action
*
* @return int
*/
public function bulk($ids, $action)
{
$expenses = Expense::withTrashed()->scope($ids)->get();
@ -234,6 +194,6 @@ class ExpenseRepository extends BaseRepository
}
}
return $expenses->count();
return count($tasks);
}
}

View File

@ -748,7 +748,6 @@ class InvoiceRepository extends BaseRepository
/**
* @param Invoice $recurInvoice
*
* @return mixed
*/
public function createRecurringInvoice(Invoice $recurInvoice)
@ -840,7 +839,6 @@ class InvoiceRepository extends BaseRepository
/**
* @param Account $account
*
* @return mixed
*/
public function findNeedingReminding(Account $account)

View File

@ -1,20 +1,10 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use App\Models\Account;
use App\Models\Company;
/**
* Class NinjaRepository
*/
class NinjaRepository
{
/**
* @param $clientPublicId
* @param array $data
*/
public function updatePlanDetails($clientPublicId, array $data)
public function updatePlanDetails($clientPublicId, $data)
{
$account = Account::whereId($clientPublicId)->first();
@ -22,7 +12,6 @@ class NinjaRepository
return;
}
/** @var Company $company */
$company = $account->company;
$company->plan = !empty($data['plan']) && $data['plan'] != PLAN_FREE?$data['plan']:null;
$company->plan_term = !empty($data['plan_term'])?$data['plan_term']:null;

View File

@ -1,31 +1,18 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
use App\Models\Payment;
use App\Models\Credit;
use App\Models\Invoice;
/**
* Class PaymentRepository
*/
class PaymentRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\Payment';
}
/**
* @param null $clientPublicId
* @param null $filter
*
* @return $this
*/
public function find($clientPublicId = null, $filter = null)
{
$query = DB::table('payments')
@ -100,12 +87,6 @@ class PaymentRepository extends BaseRepository
return $query;
}
/**
* @param null $contactId
* @param null $filter
*
* @return $this
*/
public function findForContact($contactId = null, $filter = null)
{
$query = DB::table('payments')
@ -161,13 +142,7 @@ class PaymentRepository extends BaseRepository
return $query;
}
/**
* @param array $input
* @param Payment|null $payment
*
* @return Payment|mixed
*/
public function save(array $input, Payment $payment = null)
public function save($input, $payment = null)
{
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
@ -226,11 +201,6 @@ class PaymentRepository extends BaseRepository
return $payment;
}
/**
* @param $payment
*
* @return bool
*/
public function delete($payment)
{
if ($payment->invoice->is_deleted) {
@ -240,11 +210,6 @@ class PaymentRepository extends BaseRepository
parent::delete($payment);
}
/**
* @param $payment
*
* @return bool
*/
public function restore($payment)
{
if ($payment->invoice->is_deleted) {

View File

@ -1,27 +1,18 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
class PaymentTermRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\PaymentTerm';
}
/**
* @param int $accountId
*
* @return $this
*/
public function find($accountId = 0)
{
return DB::table('payment_terms')
//->where('payment_terms.account_id', '=', $accountId)
->where('payment_terms.deleted_at', '=', null)
->select('payment_terms.public_id', 'payment_terms.name', 'payment_terms.num_days', 'payment_terms.deleted_at');
}

View File

@ -1,26 +1,15 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use App\Models\Product;
/**
* Class ProductRepository
*/
class ProductRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\Product';
}
/**
* @return mixed
*/
public function all()
{
return Product::scope()
@ -28,11 +17,6 @@ class ProductRepository extends BaseRepository
->get();
}
/**
* @param $accountId
*
* @return $this
*/
public function find($accountId)
{
return DB::table('products')
@ -53,13 +37,7 @@ class ProductRepository extends BaseRepository
);
}
/**
* @param array $data
* @param Product|null $product
*
* @return Product|mixed
*/
public function save(array $data, Product $product = null)
public function save($data, $product = null)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;

View File

@ -1,19 +1,9 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use App\Models\Account;
/**
* Class ReferralRepository
*/
class ReferralRepository
{
/**
* @param $userId
*
* @return array
*/
public function getCounts($userId)
{
$accounts = Account::where('referral_user_id', $userId)->get();

View File

@ -1,23 +1,12 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use Auth;
use Session;
use App\Models\Client;
use App\Models\Task;
/**
* Class TaskRepository
*/
class TaskRepository
{
/**
* @param null $clientPublicId
* @param null $filter
*
* @return $this
*/
public function find($clientPublicId = null, $filter = null)
{
$query = \DB::table('tasks')
@ -73,14 +62,7 @@ class TaskRepository
return $query;
}
/**
* @param $publicId
* @param array $data
* @param Task|null $task
*
* @return Task|mixed
*/
public function save($publicId, array $data, Task $task = null)
public function save($publicId, $data, $task = null)
{
if ($task) {
// do nothing
@ -127,12 +109,6 @@ class TaskRepository
return $task;
}
/**
* @param $ids
* @param $action
*
* @return int
*/
public function bulk($ids, $action)
{
$tasks = Task::withTrashed()->scope($ids)->get();

View File

@ -1,28 +1,16 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Utils;
use App\Models\TaxRate;
/**
* Class TaxRateRepository
*/
class TaxRateRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\TaxRate';
}
/**
* @param $accountId
*
* @return $this
*/
public function find($accountId)
{
return DB::table('tax_rates')
@ -31,13 +19,7 @@ class TaxRateRepository extends BaseRepository
->select('tax_rates.public_id', 'tax_rates.name', 'tax_rates.rate', 'tax_rates.deleted_at');
}
/**
* @param array $data
* @param TaxRate|null $taxRate
*
* @return TaxRate|mixed
*/
public function save(array $data, TaxRate $taxRate = null)
public function save($data, $taxRate = null)
{
if ($taxRate) {
// do nothing
@ -53,4 +35,41 @@ class TaxRateRepository extends BaseRepository
return $taxRate;
}
/*
public function save($taxRates)
{
$taxRateIds = [];
foreach ($taxRates as $record) {
if (!isset($record->rate) || (isset($record->is_deleted) && $record->is_deleted)) {
continue;
}
if (!isset($record->name) || !trim($record->name)) {
continue;
}
if ($record->public_id) {
$taxRate = TaxRate::scope($record->public_id)->firstOrFail();
} else {
$taxRate = TaxRate::createNew();
}
$taxRate->rate = Utils::parseFloat($record->rate);
$taxRate->name = trim($record->name);
$taxRate->save();
$taxRateIds[] = $taxRate->public_id;
}
$taxRates = TaxRate::scope()->get();
foreach ($taxRates as $taxRate) {
if (!in_array($taxRate->public_id, $taxRateIds)) {
$taxRate->delete();
}
}
}
*/
}

View File

@ -1,29 +1,16 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use Session;
use App\Models\Token;
/**
* Class TokenRepository
*/
class TokenRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\AccountToken';
}
/**
* @param $userId
*
* @return $this
*/
public function find($userId)
{
$query = DB::table('account_tokens')

View File

@ -1,29 +1,16 @@
<?php
<?php namespace App\Ninja\Repositories;
namespace App\Ninja\Repositories;
use App\Models\User;
use DB;
use Session;
use App\Models\User;
/**
* Class UserRepository
*/
class UserRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\User';
}
/**
* @param $accountId
*
* @return $this
*/
public function find($accountId)
{
$query = DB::table('users')
@ -38,13 +25,7 @@ class UserRepository extends BaseRepository
return $query;
}
/**
* @param array $data
* @param User $user
*
* @return User
*/
public function save(array $data, User $user)
public function save($data, $user)
{
$user->fill($data);
$user->save();

View File

@ -1,25 +1,18 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use App\Models\Vendor;
use App\Models\VendorContact;
/**
* Class VendorContactRepository
*/
// vendor
class VendorContactRepository extends BaseRepository
{
/**
* @param array $data
* @return mixed
*/
public function save(array $data)
public function save($data)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
if (!$publicId || $publicId == '-1') {
/** @var VendorContact $contact */
$contact = VendorContact::createNew();
//$contact->send_invoice = true;
$contact->vendor_id = $data['vendor_id'];
$contact->is_primary = VendorContact::scope()->where('vendor_id', '=', $contact->vendor_id)->count() == 0;
} else {

View File

@ -1,26 +1,16 @@
<?php
namespace App\Ninja\Repositories;
<?php namespace App\Ninja\Repositories;
use DB;
use App\Models\Vendor;
/**
* Class VendorRepository
*/
// vendor
class VendorRepository extends BaseRepository
{
/**
* @return string
*/
public function getClassName()
{
return 'App\Models\Vendor';
}
/**
* @return mixed
*/
public function all()
{
return Vendor::scope()
@ -30,11 +20,6 @@ class VendorRepository extends BaseRepository
->get();
}
/**
* @param null $filter
*
* @return $this
*/
public function find($filter = null)
{
$query = DB::table('vendors')
@ -75,13 +60,7 @@ class VendorRepository extends BaseRepository
return $query;
}
/**
* @param array $data
* @param Vendor|null $vendor
*
* @return Vendor|mixed
*/
public function save(array $data, Vendor $vendor = null)
public function save($data, $vendor = null)
{
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
@ -97,6 +76,14 @@ class VendorRepository extends BaseRepository
$vendor->fill($data);
$vendor->save();
$first = true;
$vendorcontacts = isset($data['vendor_contact']) ? [$data['vendor_contact']] : $data['vendor_contacts'];
foreach ($vendorcontacts as $vendorcontact) {
$vendorcontact = $vendor->addVendorContact($vendorcontact, $first);
$first = false;
}
return $vendor;
}
}

View File

@ -2,10 +2,4 @@
namespace App\Policies;
/**
* Class ClientPolicy
*/
class ClientPolicy extends EntityPolicy
{
}
class ClientPolicy extends EntityPolicy {}

View File

@ -2,10 +2,4 @@
namespace App\Policies;
/**
* Class CreditPolicy
*/
class CreditPolicy extends EntityPolicy
{
}
class CreditPolicy extends EntityPolicy {}

View File

@ -2,7 +2,6 @@
namespace App\Policies;
use App\Models\Document;
use App\Models\User;
/**
@ -12,7 +11,6 @@ class DocumentPolicy extends EntityPolicy
{
/**
* @param User $user
*
* @return bool
*/
public static function create(User $user)
@ -22,11 +20,10 @@ class DocumentPolicy extends EntityPolicy
/**
* @param User $user
* @param $item
*
* @param Document $document
* @return bool
*/
public static function view(User $user, $item)
public static function view(User $user, $document)
{
if ($user->hasPermission('view_all')) {
return true;

View File

@ -4,9 +4,6 @@ namespace App\Policies;
use App\Models\User;
/**
* Class ExpensePolicy
*/
class ExpensePolicy extends EntityPolicy
{
/**

View File

@ -2,10 +2,4 @@
namespace App\Policies;
/**
* Class InvoicePolicy
*/
class InvoicePolicy extends EntityPolicy
{
}
class InvoicePolicy extends EntityPolicy {}

View File

@ -2,10 +2,4 @@
namespace App\Policies;
/**
* Class PaymentPolicy
*/
class PaymentPolicy extends EntityPolicy
{
}
class PaymentPolicy extends EntityPolicy {}

View File

@ -2,28 +2,12 @@
namespace App\Policies;
use App\Models\User;
/**
* Class TokenPolicy
*/
class TokenPolicy extends EntityPolicy {
/**
* @param User $user
* @param $item
*
* @return bool
*/
public static function edit(User $user, $item) {
public static function edit($user, $item) {
return $user->hasPermission('admin');
}
/**
* @param User $user
*
* @return bool
*/
public static function create(User $user) {
public static function create($user) {
return $user->hasPermission('admin');
}
}

View File

@ -4,14 +4,10 @@ namespace App\Policies;
use App\Models\User;
/**
* Class VendorPolicy
*/
class VendorPolicy extends EntityPolicy
{
/**
* @param User $user
*
* @return bool
*/
public static function create(User $user) {

View File

@ -17,11 +17,6 @@ class ComposerServiceProvider extends ServiceProvider
['accounts.details', 'clients.edit', 'payments.edit', 'invoices.edit', 'accounts.localization'],
'App\Http\ViewComposers\TranslationComposer'
);
view()->composer(
['header', 'tasks.edit'],
'App\Http\ViewComposers\AppLanguageComposer'
);
}
/**

View File

@ -3,10 +3,8 @@
"version": "0.9.0",
"dependencies": {
"jquery": "1.11.3",
"jquery-ui": "1.11.2",
"bootstrap": "3.3.1",
"bootstrap-combobox": "1.1.7",
"bootstrap-datepicker": "1.4.0",
"jquery-ui": "1.11.2",
"datatables": "1.10.4",
"datatables-bootstrap3": "*",
"knockout.js": "3.1.0",
@ -15,13 +13,13 @@
"font-awesome": "~4.*",
"underscore": "1.7.0",
"jspdf": "1.0.272",
"jsPDF-plugins": "*",
"bootstrap-datepicker": "1.4.0",
"typeahead.js": "0.11.1",
"accounting": "0.3.2",
"spectrum": "1.3.4",
"d3": "3.4.11",
"handsontable": "*",
"pdfmake": "0.1.17",
"pdfmake": "*",
"moment": "*",
"jsoneditor": "*",
"moment-timezone": "~0.4.0",
@ -29,8 +27,7 @@
"datetimepicker": "~2.4.5",
"stacktrace-js": "~1.0.1",
"fuse.js": "~2.0.2",
"dropzone": "~4.3.0",
"lightbox2": "~2.8.2"
"dropzone": "~4.3.0"
},
"resolutions": {
"jquery": "~1.11"

View File

@ -13,10 +13,6 @@
}
],
"require": {
"php": ">=5.5.9",
"ext-mcrypt": "*",
"ext-gmp": "*",
"ext-gd": "*",
"turbo124/laravel-push-notification": "dev-laravel5",
"omnipay/mollie": "dev-master#22956c1a62a9662afa5f5d119723b413770ac525",
"omnipay/2checkout": "dev-master#e9c079c2dde0d7ba461903b3b7bd5caf6dee1248",

135
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "5221e980b2241bf56d9393aac82dfa1f",
"content-hash": "da4f765b1dd362a4f4690cff06e20afc",
"hash": "96184bcd2d0fb39c87a98b223efc5c1c",
"content-hash": "361daf07da39682d74bdc2bfead14fb9",
"packages": [
{
"name": "agmscode/omnipay-agms",
@ -323,20 +323,20 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.18.31",
"version": "3.18.27",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b"
"reference": "8cc3d3231d9fb9da528205f3b905097a37ac3df3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b",
"reference": "dad0b7db5fa8f3c7a3805efb2a1e86a50f11fe8b",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/8cc3d3231d9fb9da528205f3b905097a37ac3df3",
"reference": "8cc3d3231d9fb9da528205f3b905097a37ac3df3",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "^5.3.1|^6.2.1",
"guzzlehttp/guzzle": "~5.3|~6.0.1|~6.1",
"guzzlehttp/promises": "~1.0",
"guzzlehttp/psr7": "~1.3.1",
"mtdowling/jmespath.php": "~2.2",
@ -399,7 +399,7 @@
"s3",
"sdk"
],
"time": "2016-07-19 17:25:45"
"time": "2016-07-07 23:09:15"
},
{
"name": "barracudanetworks/archivestream-php",
@ -443,16 +443,16 @@
},
{
"name": "braintree/braintree_php",
"version": "3.15.0",
"version": "3.14.0",
"source": {
"type": "git",
"url": "https://github.com/braintree/braintree_php.git",
"reference": "1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca"
"reference": "0c13b6235bc99c287d18e8cfc02359e66abaa3fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca",
"reference": "1026b6cca5f2dd5dfdd5447843b920cc74d2b8ca",
"url": "https://api.github.com/repos/braintree/braintree_php/zipball/0c13b6235bc99c287d18e8cfc02359e66abaa3fb",
"reference": "0c13b6235bc99c287d18e8cfc02359e66abaa3fb",
"shasum": ""
},
"require": {
@ -486,7 +486,7 @@
}
],
"description": "Braintree PHP Client Library",
"time": "2016-07-18 21:55:50"
"time": "2016-06-23 15:36:49"
},
{
"name": "cardgate/omnipay-cardgate",
@ -1745,16 +1745,16 @@
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.8.0",
"version": "v4.7.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2"
"reference": "ae1828d955112356f7677c465f94f7deb7d27a40"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2",
"reference": "d0c392f77d2f2a3dcf7fcb79e2a1e2b8804e75b2",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/ae1828d955112356f7677c465f94f7deb7d27a40",
"reference": "ae1828d955112356f7677c465f94f7deb7d27a40",
"shasum": ""
},
"require": {
@ -1785,7 +1785,7 @@
"keywords": [
"html"
],
"time": "2016-07-16 12:58:58"
"time": "2015-08-05 01:03:42"
},
{
"name": "fotografde/omnipay-checkoutcom",
@ -2048,27 +2048,27 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "6.2.1",
"version": "6.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427"
"reference": "d094e337976dff9d8e2424e8485872194e768662"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427",
"reference": "3f808fba627f2c5b69e2501217bf31af349c1427",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662",
"reference": "d094e337976dff9d8e2424e8485872194e768662",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.3.1",
"php": ">=5.5"
"guzzlehttp/promises": "~1.0",
"guzzlehttp/psr7": "~1.1",
"php": ">=5.5.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.0",
"psr/log": "^1.0"
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"type": "library",
"extra": {
@ -2106,7 +2106,7 @@
"rest",
"web service"
],
"time": "2016-07-15 17:22:37"
"time": "2016-03-21 20:02:09"
},
{
"name": "guzzlehttp/promises",
@ -2765,16 +2765,16 @@
},
{
"name": "laravel/framework",
"version": "v5.2.40",
"version": "v5.2.39",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "6195211140ed0881e89d79a296f893abc56987be"
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/6195211140ed0881e89d79a296f893abc56987be",
"reference": "6195211140ed0881e89d79a296f893abc56987be",
"url": "https://api.github.com/repos/laravel/framework/zipball/c2a77050269b4e03bd9a735a9f24e573a7598b8a",
"reference": "c2a77050269b4e03bd9a735a9f24e573a7598b8a",
"shasum": ""
},
"require": {
@ -2831,8 +2831,7 @@
"illuminate/support": "self.version",
"illuminate/translation": "self.version",
"illuminate/validation": "self.version",
"illuminate/view": "self.version",
"tightenco/collect": "self.version"
"illuminate/view": "self.version"
},
"require-dev": {
"aws/aws-sdk-php": "~3.0",
@ -2891,7 +2890,7 @@
"framework",
"laravel"
],
"time": "2016-07-19 19:46:25"
"time": "2016-06-17 19:25:12"
},
{
"name": "laravel/socialite",
@ -3048,16 +3047,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.25",
"version": "1.0.24",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "a76afa4035931be0c78ca8efc6abf3902362f437"
"reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a76afa4035931be0c78ca8efc6abf3902362f437",
"reference": "a76afa4035931be0c78ca8efc6abf3902362f437",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9aca859a303fdca30370f42b8c611d9cf0dedf4b",
"reference": "9aca859a303fdca30370f42b8c611d9cf0dedf4b",
"shasum": ""
},
"require": {
@ -3070,7 +3069,7 @@
"ext-fileinfo": "*",
"mockery/mockery": "~0.9",
"phpspec/phpspec": "^2.2",
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~4.8 || ~5.0"
},
"suggest": {
"ext-fileinfo": "Required for MimeType",
@ -3127,7 +3126,7 @@
"sftp",
"storage"
],
"time": "2016-07-18 12:22:57"
"time": "2016-06-03 19:11:39"
},
{
"name": "league/flysystem-aws-s3-v3",
@ -3455,16 +3454,16 @@
},
{
"name": "maatwebsite/excel",
"version": "v2.1.3",
"version": "v2.1.2",
"source": {
"type": "git",
"url": "https://github.com/Maatwebsite/Laravel-Excel.git",
"reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9"
"reference": "aae17dbd6f39606cf8f588359a7a79438ab5aa53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9",
"reference": "c6ab521e8a5f2a4acc83cb575c4a09733a5e17c9",
"url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/aae17dbd6f39606cf8f588359a7a79438ab5aa53",
"reference": "aae17dbd6f39606cf8f588359a7a79438ab5aa53",
"shasum": ""
},
"require": {
@ -3492,7 +3491,8 @@
"type": "library",
"autoload": {
"classmap": [
"src/Maatwebsite/Excel"
"src/Maatwebsite/Excel",
"tests/TestCase.php"
],
"psr-0": {
"Maatwebsite\\Excel\\": "src/"
@ -3518,7 +3518,7 @@
"import",
"laravel"
],
"time": "2016-07-09 09:40:10"
"time": "2016-03-01 17:45:44"
},
{
"name": "meebio/omnipay-creditcall",
@ -4054,16 +4054,16 @@
},
{
"name": "omnipay/authorizenet",
"version": "2.4.2",
"version": "2.4.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/omnipay-authorizenet.git",
"reference": "6e1990f5d22f0f8e4dfe363b89c9776d0d803c34"
"reference": "439bb6e649a4c57cddc24d6d704301a8ee5c3c3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/omnipay-authorizenet/zipball/6e1990f5d22f0f8e4dfe363b89c9776d0d803c34",
"reference": "6e1990f5d22f0f8e4dfe363b89c9776d0d803c34",
"url": "https://api.github.com/repos/thephpleague/omnipay-authorizenet/zipball/439bb6e649a4c57cddc24d6d704301a8ee5c3c3f",
"reference": "439bb6e649a4c57cddc24d6d704301a8ee5c3c3f",
"shasum": ""
},
"require": {
@ -4109,7 +4109,7 @@
"pay",
"payment"
],
"time": "2016-07-16 21:00:00"
"time": "2016-06-16 10:06:24"
},
{
"name": "omnipay/bitpay",
@ -8734,16 +8734,16 @@
},
{
"name": "codeception/c3",
"version": "2.0.7",
"version": "2.0.6",
"source": {
"type": "git",
"url": "https://github.com/Codeception/c3.git",
"reference": "51eec2c3a8e093deb621f58004f0393dc0871983"
"reference": "dc4d39b36d585c2eda58129407e78855ea67b1ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Codeception/c3/zipball/51eec2c3a8e093deb621f58004f0393dc0871983",
"reference": "51eec2c3a8e093deb621f58004f0393dc0871983",
"url": "https://api.github.com/repos/Codeception/c3/zipball/dc4d39b36d585c2eda58129407e78855ea67b1ca",
"reference": "dc4d39b36d585c2eda58129407e78855ea67b1ca",
"shasum": ""
},
"require": {
@ -8780,7 +8780,7 @@
"code coverage",
"codecoverage"
],
"time": "2016-06-27 16:49:12"
"time": "2016-02-09 23:31:08"
},
{
"name": "codeception/codeception",
@ -9262,16 +9262,16 @@
},
{
"name": "phpspec/phpspec",
"version": "2.5.1",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/phpspec.git",
"reference": "531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d"
"reference": "385ecb015e97c13818074f1517928b24d4a26067"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d",
"reference": "531d00ee76e9ae98279ed4dbb2419e5e0f7fb82d",
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/385ecb015e97c13818074f1517928b24d4a26067",
"reference": "385ecb015e97c13818074f1517928b24d4a26067",
"shasum": ""
},
"require": {
@ -9289,7 +9289,7 @@
},
"require-dev": {
"behat/behat": "^3.0.11",
"ciaranmcnulty/versionbasedtestskipper": "^0.2.1",
"bossa/phpspec2-expect": "~1.0",
"phpunit/phpunit": "~4.4",
"symfony/filesystem": "~2.1|~3.0"
},
@ -9302,7 +9302,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5.x-dev"
"dev-master": "2.2.x-dev"
}
},
"autoload": {
@ -9336,7 +9336,7 @@
"testing",
"tests"
],
"time": "2016-07-16 08:34:07"
"time": "2016-03-20 20:34:32"
},
{
"name": "phpspec/prophecy",
@ -10444,11 +10444,6 @@
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5.9",
"ext-mcrypt": "*",
"ext-gmp": "*",
"ext-gd": "*"
},
"platform": [],
"platform-dev": []
}

View File

@ -1,140 +1,16 @@
var elixir = require('laravel-elixir');
/**
* Configure Elixir to explicitly generate source maps
*
* @type {boolean}
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Less
| file for our application, as well as publishing vendor resources.
|
*/
elixir.config.sourcemaps = true;
/**
* Directory for JS assets that are not handled by Bower
*
* @type {string}
*/
var resourcesJsDirectory = './resources/assets/js/';
/**
* Directory for CSS assets that are not handled by Bower
*
* @type {string}
*/
var resourcesCssDirectory = './resources/assets/css/';
/**
* Directory for JS source files that are handled by Bower.
* Bower source file directory.
*
* @type {string}
*/
var bowerDirectoy = './resources/assets/bower/';
elixir(function(mix) {
// Built built.css
mix.styles([
bowerDirectoy + 'bootstrap/dist/css/bootstrap.css',
bowerDirectoy + 'bootstrap-combobox/css/bootstrap-combobox.css',
bowerDirectoy + 'bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
bowerDirectoy + 'datatables/media/css/jquery.dataTables.css',
bowerDirectoy + 'datatables-bootstrap3/BS3/assets/css/datatables.css',
bowerDirectoy + 'font-awesome/css/font-awesome.css',
bowerDirectoy + 'dropzone/dist/dropzone.css',
bowerDirectoy + 'spectrum/spectrum.css',
resourcesCssDirectory + 'typeahead.js-bootstrap.css',
resourcesCssDirectory + 'style.css'
], 'public/css/built.min.css');
// Built built.public.css
mix.styles([
bowerDirectoy + 'bootstrap/dist/css/bootstrap.css',
bowerDirectoy + 'bootstrap-combobox/css/bootstrap-combobox.css',
bowerDirectoy + 'font-awesome/css/font-awesome.css',
bowerDirectoy + 'datatables/media/css/jquery.dataTables.css',
bowerDirectoy + 'datatables-bootstrap3/BS3/assets/css/datatables.css',
resourcesCssDirectory + 'public.style.css'
], 'public/css/built.public.min.css');
mix.copy(resourcesCssDirectory + 'themes', 'public/css/themes');
// Copy other CSS files to public
mix.styles(bowerDirectoy + 'quill/dist/quill.snow.css', 'public/css/quill.snow.min.css')
.styles(bowerDirectoy + 'lightbox2/dist/css/lightbox.css', 'public/css/lightbox.min.css')
.styles(bowerDirectoy + 'datetimepicker/jquery.datetimepicker.css', 'public/css/jquery.datetimepicker.min.css')
.styles(bowerDirectoy + 'jsoneditor/dist/jsoneditor.css', 'public/css/jsoneditor.min.css')
.styles(bowerDirectoy + 'bootstrap/dist/css/bootstrap.css', 'public/css/bootstrap.min.css')
.styles(resourcesCssDirectory + 'app.css', 'public/css/app.min.css')
.styles(resourcesCssDirectory + 'customCss.css', 'public/css/customCss.min.css')
.styles(resourcesCssDirectory + 'style.css', 'public/css/style.min.css')
.styles(resourcesCssDirectory + 'public.style.css', 'public/public.style.min.css');
// Built built.js
mix.scripts([
bowerDirectoy + 'jquery/dist/jquery.js',
bowerDirectoy + 'jquery-ui/jquery-ui.js',
bowerDirectoy + 'bootstrap/dist/js/bootstrap.js',
bowerDirectoy + 'bootstrap-datepicker/dist/js/bootstrap-datepicker.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.da.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.pt-BR.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.nl.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.lt.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.no.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js',
bowerDirectoy + 'bootstrap-datepicker/dist/locales/bootstrap-datepicker.sv.min.js',
bowerDirectoy + 'datatables/media/js/jquery.dataTables.js',
bowerDirectoy + 'datatables-bootstrap3/BS3/assets/js/datatables.js',
bowerDirectoy + 'knockout.js/knockout.js',
bowerDirectoy + 'knockout-mapping/build/output/knockout.mapping-latest.js',
bowerDirectoy + 'knockout-sortable/build/knockout-sortable.min.js',
bowerDirectoy + 'underscore/underscore.js',
bowerDirectoy + 'dropzone/dist/dropzone.js',
bowerDirectoy + 'typeahead.js/dist/typeahead.jquery.js',
bowerDirectoy + 'accounting/accounting.js',
bowerDirectoy + 'spectrum/spectrum.js',
bowerDirectoy + 'jspdf/dist/jspdf.min.js',
bowerDirectoy + 'jsPDF-plugins/plugins/split_text_to_size.js',
bowerDirectoy + 'moment/moment.js',
bowerDirectoy + 'moment-timezone/builds/moment-timezone-with-data.js',
bowerDirectoy + 'stacktrace-js/dist/stacktrace-with-promises-and-json-polyfills.min.js',
bowerDirectoy + 'fuse.js/src/fuse.js',
bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js',
resourcesJsDirectory + 'script.js',
resourcesJsDirectory + 'pdfmake-ninja.js'
], 'public/built.js');
// Built built.public.js
mix.scripts([
bowerDirectoy + 'bootstrap/dist/js/bootstrap.js',
bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js'
], 'public/built.public.js');
// Built pdf.built.js
mix.scripts([
resourcesJsDirectory + 'compatibility.js',
resourcesJsDirectory + 'pdf_viewer.js',
bowerDirectoy + 'pdfmake/build/pdfmake.js',
resourcesJsDirectory + 'vfs.js'
], 'public/pdf.built.js');
// Copy VFS Fonts to public directory
mix.copy(resourcesJsDirectory + 'vfs_fonts', 'public/js/vfs_fonts');
// Copy SVG file for Jsoneditor to public directory
mix.copy(bowerDirectoy + 'jsoneditor/dist/img', 'public/css/img');
// Copy other JS files to public
mix.scripts(resourcesJsDirectory + 'Chart.js', 'public/js/Chart.min.js')
.scripts(bowerDirectoy + 'datetimepicker/build/jquery.datetimepicker.full.js', 'public/js/jquery.datetimepicker.min.js')
.scripts(bowerDirectoy + 'd3/d3.js', 'public/js/d3.min.js')
.scripts(bowerDirectoy + 'quill/dist/quill.js', 'public/js/quill.min.js')
.scripts(bowerDirectoy + 'lightbox2/dist/js/lightbox.js', 'public/js/lightbox.min.js')
.scripts(bowerDirectoy + 'bootstrap-combobox/js/bootstrap-combobox.js', 'public/js/bootstrap-combobox.min.js')
.scripts(bowerDirectoy + 'jsoneditor/dist/jsoneditor.js', 'public/js/jsoneditor.min.js')
.scripts(resourcesJsDirectory + 'pdf.js', 'public/js/pdf.min.js')
.scripts(resourcesJsDirectory + 'pdf_viewer.worker.js', 'public/js/pdf_viewer.worker.js')
.scripts(resourcesJsDirectory + 'script.js', 'public/js/script.js');
mix.less('app.less');
});

File diff suppressed because one or more lines are too long

429
public/built.public.js Executable file → Normal file

File diff suppressed because one or more lines are too long

6233
public/css/app.css vendored Normal file

File diff suppressed because it is too large Load Diff

70
public/css/bootstrap-combobox.css vendored Normal file
View File

@ -0,0 +1,70 @@
.combobox-container {
margin-bottom: 5px;
*zoom: 1;
}
.combobox-container:before,
.combobox-container:after {
display: table;
content: "";
}
.combobox-container:after {
clear: both;
}
.combobox-container input,
.combobox-container .uneditable-input {
-webkit-border-radius: 0 3px 3px 0;
-moz-border-radius: 0 3px 3px 0;
border-radius: 0 3px 3px 0;
}
.combobox-container input:focus,
.combobox-container .uneditable-input:focus {
position: relative;
z-index: 2;
}
.combobox-container .uneditable-input {
border-left-color: #ccc;
}
.combobox-container .active {
background-color: #a9dba9;
border-color: #46a546;
}
.combobox-container input,
.combobox-container .uneditable-input {
float: left;
-webkit-border-radius: 3px 0 0 3px;
-moz-border-radius: 3px 0 0 3px;
border-radius: 3px 0 0 3px;
}
.combobox-container .uneditable-input {
border-left-color: #eee;
border-right-color: #ccc;
}
.combobox-container input:first-child {
*margin-left: -160px;
}
.combobox-container select {
display: inline-block;
width: 0;
height: 0;
border: 0;
padding: 0;
margin: 0;
text-indent: -99999px;
*text-indent: 0;
}
.form-search .combobox-container,
.form-inline .combobox-container {
display: inline-block;
margin-bottom: 0;
vertical-align: top;
}
.combobox-selected .caret {
display: none;
}
.typeahead-long {
max-height: 300px;
overflow-y: auto;
}
.combobox-container:not(.combobox-selected) .fa-times {
display: none;
}

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