mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
php-cs-fixer clean up
This commit is contained in:
parent
371e842650
commit
1eb83a2642
@ -2,5 +2,4 @@
|
||||
|
||||
abstract class Command
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ Options:
|
||||
/**
|
||||
* Class CheckData
|
||||
*/
|
||||
class CheckData extends Command {
|
||||
class CheckData extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
@ -250,7 +251,6 @@ class CheckData extends Command {
|
||||
//$this->logMessage(var_dump($activities));
|
||||
|
||||
foreach ($activities as $activity) {
|
||||
|
||||
$activityFix = false;
|
||||
|
||||
if ($activity->invoice_id) {
|
||||
@ -423,5 +423,4 @@ class CheckData extends Command {
|
||||
['client_id', null, InputOption::VALUE_OPTIONAL, 'Client id', null],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ use Illuminate\Foundation\Inspiring;
|
||||
/**
|
||||
* Class Inspire
|
||||
*/
|
||||
class Inspire extends Command {
|
||||
class Inspire extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
@ -31,5 +32,4 @@ class Inspire extends Command {
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -169,6 +169,5 @@ class MakeClass extends GeneratorCommand
|
||||
}
|
||||
|
||||
return rtrim($str);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -94,5 +94,4 @@ class MakeModule extends Command
|
||||
array('migrate', null, InputOption::VALUE_OPTIONAL, 'The model attributes.', null),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
|
||||
use Utils;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
if (!defined('APP_NAME'))
|
||||
{
|
||||
if (!defined('APP_NAME')) {
|
||||
define('APP_NAME', env('APP_NAME', 'Invoice Ninja'));
|
||||
define('CONTACT_EMAIL', env('MAIL_FROM_ADDRESS', env('MAIL_USERNAME')));
|
||||
define('CONTACT_NAME', env('MAIL_FROM_NAME'));
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Credit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -9,7 +8,6 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class CreditWasArchived extends Event
|
||||
{
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@ -26,5 +24,4 @@ class CreditWasArchived extends Event
|
||||
{
|
||||
$this->credit = $credit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class CreditWasCreated extends Event
|
||||
{
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@ -22,5 +21,4 @@ class CreditWasCreated extends Event
|
||||
{
|
||||
$this->credit = $credit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ use Illuminate\Queue\SerializesModels;
|
||||
/**
|
||||
* Class CreditWasDeleted
|
||||
*/
|
||||
class CreditWasDeleted extends Event {
|
||||
|
||||
class CreditWasDeleted extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@ -24,5 +24,4 @@ class CreditWasDeleted extends Event {
|
||||
{
|
||||
$this->credit = $credit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Credit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class CreditWasRestored
|
||||
*/
|
||||
class CreditWasRestored extends Event {
|
||||
|
||||
class CreditWasRestored extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@ -25,5 +24,4 @@ class CreditWasRestored extends Event {
|
||||
{
|
||||
$this->credit = $credit;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class ExpenseWasArchived extends Event
|
||||
{
|
||||
$this->expense = $expense;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class ExpenseWasDeleted extends Event
|
||||
{
|
||||
$this->expense = $expense;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Expense;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -25,5 +24,4 @@ class ExpenseWasRestored extends Event
|
||||
{
|
||||
$this->expense = $expense;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Invitation;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -9,7 +8,6 @@ use Illuminate\Queue\SerializesModels;
|
||||
*/
|
||||
class InvoiceInvitationWasEmailed extends Event
|
||||
{
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
@ -32,5 +30,4 @@ class InvoiceInvitationWasEmailed extends Event
|
||||
$this->invitation = $invitation;
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ use Illuminate\Queue\SerializesModels;
|
||||
/**
|
||||
* Class InvoiceInvitationWasViewed
|
||||
*/
|
||||
class InvoiceInvitationWasViewed extends Event {
|
||||
|
||||
class InvoiceInvitationWasViewed extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
|
@ -24,5 +24,4 @@ class InvoiceWasArchived extends Event
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class InvoiceWasCreated extends Event
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -29,5 +28,4 @@ class InvoiceWasRestored extends Event
|
||||
$this->invoice = $invoice;
|
||||
$this->fromDeleted = $fromDeleted;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class PaymentCompleted extends Event
|
||||
{
|
||||
$this->payment = $payment;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class PaymentWasArchived extends Event
|
||||
{
|
||||
$this->payment = $payment;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Invitation;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
@ -30,5 +30,4 @@ class QuoteInvitationWasEmailed extends Event
|
||||
$this->invitation = $invitation;
|
||||
$this->notes = $notes;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,5 +16,4 @@ class QuoteWasArchived extends Event
|
||||
{
|
||||
$this->quote = $quote;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,5 +19,4 @@ class QuoteWasUpdated extends Event
|
||||
{
|
||||
$this->quote = $quote;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,5 +24,4 @@ class TaskWasArchived extends Event
|
||||
{
|
||||
$this->task = $task;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Task;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -24,5 +24,4 @@ class TaskWasDeleted extends Event
|
||||
{
|
||||
$this->task = $task;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Task;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
@ -25,5 +24,4 @@ class TaskWasRestored extends Event
|
||||
{
|
||||
$this->task = $task;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
|
||||
use App\Models\Task;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -14,7 +14,6 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Illuminate\Foundation\Validation\ValidationException;
|
||||
|
||||
|
||||
/**
|
||||
* Class Handler
|
||||
*/
|
||||
@ -71,7 +70,8 @@ class Handler extends ExceptionHandler
|
||||
{
|
||||
if ($e instanceof ModelNotFoundException) {
|
||||
return Redirect::to('/');
|
||||
} if ($e instanceof \Illuminate\Session\TokenMismatchException) {
|
||||
}
|
||||
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
|
||||
// prevent loop since the page auto-submits
|
||||
if ($request->path() != 'get_started') {
|
||||
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
|
||||
@ -84,10 +84,8 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
}
|
||||
|
||||
if($this->isHttpException($e))
|
||||
{
|
||||
switch ($e->getStatusCode())
|
||||
{
|
||||
if ($this->isHttpException($e)) {
|
||||
switch ($e->getStatusCode()) {
|
||||
// not found
|
||||
case 404:
|
||||
if ($request->header('X-Ninja-Token') != '') {
|
||||
@ -98,7 +96,6 @@ class Handler extends ExceptionHandler
|
||||
$headers = Utils::getApiHeaders();
|
||||
|
||||
return response()->make($error, 404, $headers);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -40,10 +40,8 @@ class InvoiceEventHandler
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -31,15 +31,15 @@ class AccountApiController extends BaseAPIController
|
||||
{
|
||||
$headers = Utils::getApiHeaders();
|
||||
|
||||
if(hash_equals(env(API_SECRET),$request->api_secret))
|
||||
if (hash_equals(env(API_SECRET), $request->api_secret)) {
|
||||
return Response::make(RESULT_SUCCESS, 200, $headers);
|
||||
else
|
||||
} else {
|
||||
return $this->errorResponse(['message'=>'API Secret does not match .env variable'], 400);
|
||||
}
|
||||
}
|
||||
|
||||
public function register(RegisterRequest $request)
|
||||
{
|
||||
|
||||
$account = $this->accountRepo->create($request->first_name, $request->last_name, $request->email, $request->password);
|
||||
$user = $account->users()->first();
|
||||
|
||||
@ -117,11 +117,10 @@ class AccountApiController extends BaseAPIController
|
||||
$account = Auth::user()->account;
|
||||
|
||||
//scan if this user has a token already registered (tokens can change, so we need to use the users email as key)
|
||||
$devices = json_decode($account->devices,TRUE);
|
||||
$devices = json_decode($account->devices, true);
|
||||
|
||||
|
||||
for($x=0; $x<count($devices); $x++)
|
||||
{
|
||||
for ($x=0; $x<count($devices); $x++) {
|
||||
if ($devices[$x]['email'] == Auth::user()->username) {
|
||||
$devices[$x]['token'] = $request->token; //update
|
||||
$account->devices = json_encode($devices);
|
||||
@ -139,10 +138,10 @@ class AccountApiController extends BaseAPIController
|
||||
'email' => $request->email,
|
||||
'device' => $request->device,
|
||||
'account_key' => $account->account_key,
|
||||
'notify_sent' => TRUE,
|
||||
'notify_viewed' => TRUE,
|
||||
'notify_approved' => TRUE,
|
||||
'notify_paid' => TRUE,
|
||||
'notify_sent' => true,
|
||||
'notify_viewed' => true,
|
||||
'notify_approved' => true,
|
||||
'notify_paid' => true,
|
||||
];
|
||||
|
||||
$devices[] = $newDevice;
|
||||
@ -150,23 +149,20 @@ class AccountApiController extends BaseAPIController
|
||||
$account->save();
|
||||
|
||||
return $this->response($newDevice);
|
||||
|
||||
}
|
||||
|
||||
public function updatePushNotifications(Request $request)
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
|
||||
$devices = json_decode($account->devices, TRUE);
|
||||
$devices = json_decode($account->devices, true);
|
||||
|
||||
if(count($devices) < 1)
|
||||
if (count($devices) < 1) {
|
||||
return $this->errorResponse(['message'=>'No registered devices.'], 400);
|
||||
}
|
||||
|
||||
for($x=0; $x<count($devices); $x++)
|
||||
{
|
||||
if($devices[$x]['email'] == Auth::user()->username)
|
||||
{
|
||||
|
||||
for ($x=0; $x<count($devices); $x++) {
|
||||
if ($devices[$x]['email'] == Auth::user()->username) {
|
||||
$newDevice = [
|
||||
'token' => $devices[$x]['token'],
|
||||
'email' => $devices[$x]['email'],
|
||||
@ -185,7 +181,6 @@ class AccountApiController extends BaseAPIController
|
||||
return $this->response($newDevice);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function oauthLogin(Request $request)
|
||||
|
@ -87,8 +87,7 @@ class AccountController extends BaseController
|
||||
ContactMailer $contactMailer,
|
||||
ReferralRepository $referralRepository,
|
||||
PaymentService $paymentService
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->accountRepo = $accountRepo;
|
||||
$this->userMailer = $userMailer;
|
||||
$this->contactMailer = $contactMailer;
|
||||
@ -161,7 +160,8 @@ class AccountController extends BaseController
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function changePlan() {
|
||||
public function changePlan()
|
||||
{
|
||||
$user = Auth::user();
|
||||
$account = $user->account;
|
||||
$company = $account->company;
|
||||
@ -226,7 +226,6 @@ class AccountController extends BaseController
|
||||
return Redirect::to('payment/' . $invitation->invitation_key);
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($plan == PLAN_FREE) {
|
||||
$company->discount = 0;
|
||||
} else {
|
||||
@ -1038,8 +1037,7 @@ class AccountController extends BaseController
|
||||
$extension = strtolower($uploaded->getClientOriginalExtension());
|
||||
if (empty(Document::$types[$extension]) && !empty(Document::$extraExtensions[$extension])) {
|
||||
$documentType = Document::$extraExtensions[$extension];
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$documentType = $extension;
|
||||
}
|
||||
|
||||
|
@ -488,5 +488,4 @@ class AccountGatewayController extends BaseController
|
||||
|
||||
return Redirect::to("gateways/{$accountGateway->public_id}/edit");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -127,7 +127,6 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function postLoginWrapper(Request $request)
|
||||
{
|
||||
|
||||
$userId = Auth::check() ? Auth::user()->id : null;
|
||||
$user = User::where('email', '=', $request->input('email'))->first();
|
||||
|
||||
@ -155,7 +154,6 @@ class AuthController extends Controller
|
||||
|
||||
$users = $this->accountRepo->loadAccounts(Auth::user()->id);
|
||||
Session::put(SESSION_USER_ACCOUNTS, $users);
|
||||
|
||||
} elseif ($user) {
|
||||
$user->failed_logins = $user->failed_logins + 1;
|
||||
$user->save();
|
||||
|
@ -34,5 +34,4 @@ class PasswordController extends Controller
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -181,7 +181,6 @@ class BaseAPIController extends Controller
|
||||
$headers = Utils::getApiHeaders();
|
||||
|
||||
return Response::make($error, $httpErrorCode, $headers);
|
||||
|
||||
}
|
||||
|
||||
protected function getRequestIncludes($data)
|
||||
|
@ -8,8 +8,10 @@ use Redirect;
|
||||
use URL;
|
||||
use Session;
|
||||
|
||||
class BlueVineController extends BaseController {
|
||||
public function signup() {
|
||||
class BlueVineController extends BaseController
|
||||
{
|
||||
public function signup()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$data = array(
|
||||
@ -70,7 +72,8 @@ class BlueVineController extends BaseController {
|
||||
return response()->json($quote_data);
|
||||
}
|
||||
|
||||
public function hideMessage() {
|
||||
public function hideMessage()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
if ($user) {
|
||||
@ -82,7 +85,8 @@ class BlueVineController extends BaseController {
|
||||
return 'success';
|
||||
}
|
||||
|
||||
public function handleCompleted() {
|
||||
public function handleCompleted()
|
||||
{
|
||||
Session::flash('message', trans('texts.bluevine_completed'));
|
||||
|
||||
return Redirect::to('/dashboard');
|
||||
|
@ -273,13 +273,13 @@ class BotController extends Controller
|
||||
$sig_enc = $token_arr[2];
|
||||
|
||||
// 2 base 64 url decoding
|
||||
$headers_arr = json_decode($this->base64_url_decode($headers_enc), TRUE);
|
||||
$claims_arr = json_decode($this->base64_url_decode($claims_enc), TRUE);
|
||||
$headers_arr = json_decode($this->base64_url_decode($headers_enc), true);
|
||||
$claims_arr = json_decode($this->base64_url_decode($claims_enc), true);
|
||||
$sig = $this->base64_url_decode($sig_enc);
|
||||
|
||||
// 3 get key list
|
||||
$keylist = file_get_contents('https://api.aps.skype.com/v1/keys');
|
||||
$keylist_arr = json_decode($keylist, TRUE);
|
||||
$keylist_arr = json_decode($keylist, true);
|
||||
foreach ($keylist_arr['keys'] as $key => $value) {
|
||||
|
||||
// 4 select one key (which matches)
|
||||
@ -301,7 +301,8 @@ class BotController extends Controller
|
||||
return ($token_valid == 1);
|
||||
}
|
||||
|
||||
private function base64_url_decode($arg) {
|
||||
private function base64_url_decode($arg)
|
||||
{
|
||||
$res = $arg;
|
||||
$res = str_replace('-', '+', $res);
|
||||
$res = str_replace('_', '/', $res);
|
||||
|
@ -174,5 +174,4 @@ class ClientApiController extends BaseAPIController
|
||||
|
||||
return $this->itemResponse($client);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -274,7 +274,9 @@ class ClientPortalController extends BaseController
|
||||
$query->where('activities.adjustment', '!=', 0);
|
||||
|
||||
return Datatable::query($query)
|
||||
->addColumn('activities.id', function ($model) { return Utils::timestampToDateTimeString(strtotime($model->created_at)); })
|
||||
->addColumn('activities.id', function ($model) {
|
||||
return Utils::timestampToDateTimeString(strtotime($model->created_at));
|
||||
})
|
||||
->addColumn('activity_type_id', function ($model) {
|
||||
$data = [
|
||||
'client' => Utils::getClientDisplayName($model),
|
||||
@ -289,8 +291,12 @@ class ClientPortalController extends BaseController
|
||||
|
||||
return trans("texts.activity_{$model->activity_type_id}", $data);
|
||||
})
|
||||
->addColumn('balance', function ($model) { return Utils::formatMoney($model->balance, $model->currency_id, $model->country_id); })
|
||||
->addColumn('adjustment', function ($model) { return $model->adjustment != 0 ? Utils::wrapAdjustment($model->adjustment, $model->currency_id, $model->country_id) : ''; })
|
||||
->addColumn('balance', function ($model) {
|
||||
return Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
|
||||
})
|
||||
->addColumn('adjustment', function ($model) {
|
||||
return $model->adjustment != 0 ? Utils::wrapAdjustment($model->adjustment, $model->currency_id, $model->country_id) : '';
|
||||
})
|
||||
->make();
|
||||
}
|
||||
|
||||
@ -404,12 +410,24 @@ class ClientPortalController extends BaseController
|
||||
$payments = $this->paymentRepo->findForContact($contact->id, Input::get('sSearch'));
|
||||
|
||||
return Datatable::query($payments)
|
||||
->addColumn('invoice_number', function ($model) { return $model->invitation_key ? link_to('/view/'.$model->invitation_key, $model->invoice_number)->toHtml() : $model->invoice_number; })
|
||||
->addColumn('transaction_reference', function ($model) { return $model->transaction_reference ? $model->transaction_reference : '<i>'.trans('texts.manual_entry').'</i>'; })
|
||||
->addColumn('payment_type', function ($model) { return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : ''); })
|
||||
->addColumn('amount', function ($model) { return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id); })
|
||||
->addColumn('payment_date', function ($model) { return Utils::dateToString($model->payment_date); })
|
||||
->addColumn('status', function ($model) { return $this->getPaymentStatusLabel($model); })
|
||||
->addColumn('invoice_number', function ($model) {
|
||||
return $model->invitation_key ? link_to('/view/'.$model->invitation_key, $model->invoice_number)->toHtml() : $model->invoice_number;
|
||||
})
|
||||
->addColumn('transaction_reference', function ($model) {
|
||||
return $model->transaction_reference ? $model->transaction_reference : '<i>'.trans('texts.manual_entry').'</i>';
|
||||
})
|
||||
->addColumn('payment_type', function ($model) {
|
||||
return ($model->payment_type && !$model->last4) ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
|
||||
})
|
||||
->addColumn('amount', function ($model) {
|
||||
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
|
||||
})
|
||||
->addColumn('payment_date', function ($model) {
|
||||
return Utils::dateToString($model->payment_date);
|
||||
})
|
||||
->addColumn('status', function ($model) {
|
||||
return $this->getPaymentStatusLabel($model);
|
||||
})
|
||||
->orderColumns('invoice_number', 'transaction_reference', 'payment_type', 'amount', 'payment_date')
|
||||
->make();
|
||||
}
|
||||
@ -560,7 +578,8 @@ class ClientPortalController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
private function getContact() {
|
||||
private function getContact()
|
||||
{
|
||||
$contactKey = session('contact_key');
|
||||
|
||||
if (!$contactKey) {
|
||||
@ -576,7 +595,8 @@ class ClientPortalController extends BaseController
|
||||
return $contact;
|
||||
}
|
||||
|
||||
public function getDocumentVFSJS($publicId, $name){
|
||||
public function getDocumentVFSJS($publicId, $name)
|
||||
{
|
||||
if (!$contact = $this->getContact()) {
|
||||
return $this->returnError();
|
||||
}
|
||||
@ -612,11 +632,13 @@ class ClientPortalController extends BaseController
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function canCreateZip(){
|
||||
protected function canCreateZip()
|
||||
{
|
||||
return function_exists('gmp_init');
|
||||
}
|
||||
|
||||
protected function getInvoiceZipDocuments($invoice, &$size=0){
|
||||
protected function getInvoiceZipDocuments($invoice, &$size=0)
|
||||
{
|
||||
$documents = $invoice->documents;
|
||||
|
||||
foreach ($invoice->expenses as $expense) {
|
||||
@ -629,7 +651,9 @@ class ClientPortalController extends BaseController
|
||||
$maxSize = MAX_ZIP_DOCUMENTS_SIZE * 1000;
|
||||
$toZip = [];
|
||||
foreach ($documents as $document) {
|
||||
if($size + $document->size > $maxSize)break;
|
||||
if ($size + $document->size > $maxSize) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!empty($toZip[$document->name])) {
|
||||
// This name is taken
|
||||
@ -649,10 +673,8 @@ class ClientPortalController extends BaseController
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$toZip[$document->name] = $document;
|
||||
$size += $document->size;
|
||||
}
|
||||
@ -661,7 +683,8 @@ class ClientPortalController extends BaseController
|
||||
return $toZip;
|
||||
}
|
||||
|
||||
public function getInvoiceDocumentsZip($invitationKey){
|
||||
public function getInvoiceDocumentsZip($invitationKey)
|
||||
{
|
||||
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||
return $this->returnError();
|
||||
}
|
||||
@ -682,11 +705,12 @@ class ClientPortalController extends BaseController
|
||||
$fileStream = $document->getStream();
|
||||
if ($fileStream) {
|
||||
$zip->init_file_stream_transfer($name, $document->size, ['time'=>$document->created_at->timestamp]);
|
||||
while ($buffer = fread($fileStream, 256000))$zip->stream_file_part($buffer);
|
||||
while ($buffer = fread($fileStream, 256000)) {
|
||||
$zip->stream_file_part($buffer);
|
||||
}
|
||||
fclose($fileStream);
|
||||
$zip->complete_file_stream();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$zip->add_file($name, $document->getRaw());
|
||||
}
|
||||
}
|
||||
@ -694,7 +718,8 @@ class ClientPortalController extends BaseController
|
||||
}, 200);
|
||||
}
|
||||
|
||||
public function getDocument($invitationKey, $publicId){
|
||||
public function getDocument($invitationKey, $publicId)
|
||||
{
|
||||
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||
return $this->returnError();
|
||||
}
|
||||
@ -795,7 +820,8 @@ class ClientPortalController extends BaseController
|
||||
return redirect()->to($client->account->enable_client_portal_dashboard?'/client/dashboard':'/client/payment_methods/');
|
||||
}
|
||||
|
||||
public function setDefaultPaymentMethod(){
|
||||
public function setDefaultPaymentMethod()
|
||||
{
|
||||
if (!$contact = $this->getContact()) {
|
||||
return $this->returnError();
|
||||
}
|
||||
@ -834,7 +860,8 @@ class ClientPortalController extends BaseController
|
||||
Utils::logError("Payment Method Error [{$type}]: " . ($exception ? Utils::getErrorString($exception) : $message), 'PHP', true);
|
||||
}
|
||||
|
||||
public function setAutoBill(){
|
||||
public function setAutoBill()
|
||||
{
|
||||
if (!$contact = $this->getContact()) {
|
||||
return $this->returnError();
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ class DocumentAPIController extends BaseAPIController
|
||||
$documents = Document::scope();
|
||||
|
||||
return $this->listResponse($documents);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,11 +64,12 @@ class DocumentAPIController extends BaseAPIController
|
||||
{
|
||||
$document = $request->entity();
|
||||
|
||||
if(array_key_exists($document->type, Document::$types))
|
||||
if (array_key_exists($document->type, Document::$types)) {
|
||||
return DocumentController::getDownloadResponse($document);
|
||||
else
|
||||
} else {
|
||||
return $this->errorResponse(['error'=>'Invalid mime type'], 400);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @SWG\Post(
|
||||
@ -94,7 +94,6 @@ class DocumentAPIController extends BaseAPIController
|
||||
*/
|
||||
public function store(CreateDocumentRequest $request)
|
||||
{
|
||||
|
||||
$document = $this->documentRepo->upload($request->all());
|
||||
|
||||
return $this->itemResponse($document);
|
||||
|
@ -26,7 +26,8 @@ class DocumentController extends BaseController
|
||||
return static::getDownloadResponse($request->entity());
|
||||
}
|
||||
|
||||
public static function getDownloadResponse($document){
|
||||
public static function getDownloadResponse($document)
|
||||
{
|
||||
$direct_url = $document->getDirectUrl();
|
||||
if ($direct_url) {
|
||||
return redirect($direct_url);
|
||||
@ -43,8 +44,7 @@ class DocumentController extends BaseController
|
||||
$response = Response::stream(function () use ($stream) {
|
||||
fpassthru($stream);
|
||||
}, 200, $headers);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$response = Response::make($document->getRaw(), 200);
|
||||
$response->header('content-type', Document::$types[$document->type]['mime']);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\Expense;
|
||||
use App\Ninja\Repositories\ExpenseRepository;
|
||||
use App\Services\ExpenseService;
|
||||
@ -145,8 +144,4 @@ class ExpenseApiController extends BaseAPIController
|
||||
|
||||
return $this->itemResponse($expense);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -100,5 +100,4 @@ class ExpenseCategoryController extends BaseController
|
||||
|
||||
return redirect()->to('/expense_categories');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -110,7 +110,6 @@ class ExpenseController extends BaseController
|
||||
foreach ($invoices as $invoice) {
|
||||
$actions[] = ['url' => 'javascript:submitAction("add_to_invoice", '.$invoice->public_id.')', 'label' => trans('texts.add_to_invoice', ['invoice' => $invoice->invoice_number])];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$actions[] = \DropdownButton::DIVIDER;
|
||||
@ -181,8 +180,7 @@ class ExpenseController extends BaseController
|
||||
$action = Input::get('action');
|
||||
$ids = Input::get('public_id') ? Input::get('public_id') : Input::get('ids');
|
||||
|
||||
switch($action)
|
||||
{
|
||||
switch ($action) {
|
||||
case 'invoice':
|
||||
case 'add_to_invoice':
|
||||
$expenses = Expense::scope($ids)->with('client')->get();
|
||||
@ -190,8 +188,7 @@ class ExpenseController extends BaseController
|
||||
$currencyId = null;
|
||||
|
||||
// Validate that either all expenses do not have a client or if there is a client, it is the same client
|
||||
foreach ($expenses as $expense)
|
||||
{
|
||||
foreach ($expenses as $expense) {
|
||||
if ($expense->client) {
|
||||
if (!$clientPublicId) {
|
||||
$clientPublicId = $expense->client->public_id;
|
||||
@ -223,7 +220,6 @@ class ExpenseController extends BaseController
|
||||
return Redirect::to("invoices/{$invoiceId}/edit")
|
||||
->with('expenseCurrencyId', $currencyId)
|
||||
->with('expenses', $ids);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -121,7 +121,6 @@ class ExportController extends BaseController
|
||||
$data = $this->getData($request);
|
||||
|
||||
return Excel::create($fileName, function ($excel) use ($user, $data) {
|
||||
|
||||
$excel->setTitle($data['title'])
|
||||
->setCreator($user->getDisplayName())
|
||||
->setLastModifiedBy($user->getDisplayName())
|
||||
|
@ -248,8 +248,11 @@ class InvoiceController extends BaseController
|
||||
|
||||
$ends = ['th','st','nd','rd','th','th','th','th','th','th'];
|
||||
for ($i = 1; $i < 31; $i++) {
|
||||
if ($i >= 11 && $i <= 13) $ordinal = $i. 'th';
|
||||
else $ordinal = $i . $ends[$i % 10];
|
||||
if ($i >= 11 && $i <= 13) {
|
||||
$ordinal = $i. 'th';
|
||||
} else {
|
||||
$ordinal = $i . $ends[$i % 10];
|
||||
}
|
||||
|
||||
$dayStr = str_pad($i, 2, '0', STR_PAD_LEFT);
|
||||
$str = trans('texts.day_of_month', ['ordinal'=>$ordinal]);
|
||||
@ -327,7 +330,6 @@ class InvoiceController extends BaseController
|
||||
'expenseCurrencyId' => Session::get('expenseCurrencyId') ?: null,
|
||||
'expenses' => Session::get('expenses') ? Expense::scope(Session::get('expenses'))->with('documents', 'expense_category')->get() : [],
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -467,7 +469,8 @@ class InvoiceController extends BaseController
|
||||
*/
|
||||
public function bulk($entityType = ENTITY_INVOICE)
|
||||
{
|
||||
$action = Input::get('bulk_action') ?: Input::get('action');;
|
||||
$action = Input::get('bulk_action') ?: Input::get('action');
|
||||
;
|
||||
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
||||
$count = $this->invoiceService->bulk($ids, $action);
|
||||
|
||||
@ -586,5 +589,4 @@ class InvoiceController extends BaseController
|
||||
|
||||
return $count ? RESULT_FAILURE : RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -210,7 +210,8 @@ class OnlinePaymentController extends BaseController
|
||||
* @param $routingNumber
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function getBankInfo($routingNumber) {
|
||||
public function getBankInfo($routingNumber)
|
||||
{
|
||||
if (strlen($routingNumber) != 9 || !preg_match('/\d{9}/', $routingNumber)) {
|
||||
return response()->json([
|
||||
'message' => 'Invalid routing number',
|
||||
|
@ -150,5 +150,4 @@ class PaymentApiController extends BaseAPIController
|
||||
|
||||
return $this->itemResponse($payment);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ class PaymentController extends BaseController
|
||||
PaymentRepository $paymentRepo,
|
||||
ContactMailer $contactMailer,
|
||||
PaymentService $paymentService
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->paymentRepo = $paymentRepo;
|
||||
$this->contactMailer = $contactMailer;
|
||||
$this->paymentService = $paymentService;
|
||||
|
@ -126,5 +126,4 @@ class PaymentTermController extends BaseController
|
||||
|
||||
return Redirect::to('settings/' . ACCOUNT_PAYMENT_TERMS);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -109,5 +109,4 @@ class ProjectController extends BaseController
|
||||
|
||||
return redirect()->to('/projects');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,5 +43,4 @@ class QuoteApiController extends BaseAPIController
|
||||
|
||||
return $this->listResponse($invoices);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -129,7 +129,8 @@ class QuoteController extends BaseController
|
||||
|
||||
public function bulk()
|
||||
{
|
||||
$action = Input::get('bulk_action') ?: Input::get('action');;
|
||||
$action = Input::get('bulk_action') ?: Input::get('action');
|
||||
;
|
||||
$ids = Input::get('bulk_public_id') ?: (Input::get('public_id') ?: Input::get('ids'));
|
||||
|
||||
if ($action == 'convert') {
|
||||
|
@ -38,5 +38,4 @@ class RecurringInvoiceController extends BaseController
|
||||
|
||||
return response()->view('list_wrapper', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,7 +117,5 @@ class TaskApiController extends BaseAPIController
|
||||
$task = $this->taskRepo->save($task->public_id, \Illuminate\Support\Facades\Input::all());
|
||||
|
||||
return $this->itemResponse($task);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,8 +54,7 @@ class TaskController extends BaseController
|
||||
TaskRepository $taskRepo,
|
||||
InvoiceRepository $invoiceRepo,
|
||||
TaskService $taskService
|
||||
)
|
||||
{
|
||||
) {
|
||||
// parent::__construct();
|
||||
|
||||
$this->taskRepo = $taskRepo;
|
||||
|
@ -157,5 +157,4 @@ class TokenController extends BaseController
|
||||
|
||||
return Redirect::to('settings/' . ACCOUNT_API_TOKENS);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
// vendor
|
||||
use App\Http\Requests\UpdateVendorRequest;
|
||||
use App\Http\Requests\VendorRequest;
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel {
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
@ -34,5 +35,4 @@ class Kernel extends HttpKernel {
|
||||
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
|
||||
'api' => 'App\Http\Middleware\ApiCheck',
|
||||
];
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,8 @@ use App\Models\AccountToken;
|
||||
/**
|
||||
* Class ApiCheck
|
||||
*/
|
||||
class ApiCheck {
|
||||
class ApiCheck
|
||||
{
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
@ -97,5 +98,4 @@ class ApiCheck {
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class PermissionsRequired
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
static protected $actions = [];
|
||||
protected static $actions = [];
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
|
@ -47,5 +47,4 @@ class RedirectIfAuthenticated
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class ClientRequest extends EntityRequest {
|
||||
|
||||
class ClientRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_CLIENT;
|
||||
|
||||
public function entity()
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
|
||||
|
||||
class CreateBankAccountRequest extends Request
|
||||
{
|
||||
// Expenses
|
||||
|
@ -43,5 +43,4 @@ class CreateDocumentRequest extends DocumentRequest
|
||||
//'file' => 'mimes:jpg'
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
use App\Models\Invoice;
|
||||
|
||||
|
||||
|
||||
class CreatePaymentAPIRequest extends PaymentRequest
|
||||
{
|
||||
/**
|
||||
@ -52,7 +50,4 @@ class CreatePaymentAPIRequest extends PaymentRequest
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
|
||||
|
||||
class CreateTaxRateRequest extends TaxRateRequest
|
||||
{
|
||||
// Expenses
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class CreditRequest extends EntityRequest {
|
||||
|
||||
class CreditRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_CREDIT;
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class DocumentRequest extends EntityRequest {
|
||||
|
||||
class DocumentRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_DOCUMENT;
|
||||
|
||||
}
|
@ -5,8 +5,8 @@ use Utils;
|
||||
use App\Libraries\HistoryUtils;
|
||||
use App\Models\EntityModel;
|
||||
|
||||
class EntityRequest extends Request {
|
||||
|
||||
class EntityRequest extends Request
|
||||
{
|
||||
protected $entityType;
|
||||
private $entity;
|
||||
|
||||
@ -67,5 +67,4 @@ class EntityRequest extends Request {
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class ExpenseCategoryRequest extends EntityRequest {
|
||||
|
||||
class ExpenseCategoryRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_EXPENSE_CATEGORY;
|
||||
|
||||
}
|
||||
|
@ -2,9 +2,8 @@
|
||||
|
||||
use App\Models\ExpenseCategory;
|
||||
|
||||
|
||||
class ExpenseRequest extends EntityRequest {
|
||||
|
||||
class ExpenseRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_EXPENSE;
|
||||
|
||||
public function entity()
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
use App\Models\Invoice;
|
||||
|
||||
class InvoiceRequest extends EntityRequest {
|
||||
|
||||
class InvoiceRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_INVOICE;
|
||||
|
||||
public function entity()
|
||||
@ -25,5 +25,4 @@ class InvoiceRequest extends EntityRequest {
|
||||
|
||||
return $invoice;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class PaymentRequest extends EntityRequest {
|
||||
|
||||
class PaymentRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_PAYMENT;
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class ProductRequest extends EntityRequest {
|
||||
|
||||
class ProductRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_PRODUCT;
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class ProjectRequest extends EntityRequest {
|
||||
|
||||
class ProjectRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_PROJECT;
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ class RegisterRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
|
||||
$rules = [
|
||||
'email' => 'required|unique:users',
|
||||
'first_name' => 'required',
|
||||
@ -44,13 +43,13 @@ class RegisterRequest extends Request
|
||||
public function response(array $errors)
|
||||
{
|
||||
/* If the user is not validating from a mobile app - pass through parent::response */
|
||||
if(!isset($this->req->api_secret))
|
||||
if (!isset($this->req->api_secret)) {
|
||||
return parent::response($errors);
|
||||
}
|
||||
|
||||
/* If the user is validating from a mobile app - pass through first error string and return error */
|
||||
foreach ($errors as $error) {
|
||||
foreach ($error as $key => $value) {
|
||||
|
||||
$message['error'] = ['message'=>$value];
|
||||
$message = json_encode($message, JSON_PRETTY_PRINT);
|
||||
$headers = Utils::getApiHeaders();
|
||||
@ -59,5 +58,4 @@ class RegisterRequest extends Request
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ use Response;
|
||||
use App\Libraries\Utils;
|
||||
|
||||
// https://laracasts.com/discuss/channels/general-discussion/laravel-5-modify-input-before-validation/replies/34366
|
||||
abstract class Request extends FormRequest {
|
||||
abstract class Request extends FormRequest
|
||||
{
|
||||
|
||||
// populate in subclass to auto load record
|
||||
protected $autoload = [];
|
||||
@ -61,7 +62,6 @@ abstract class Request extends FormRequest {
|
||||
/* If the user is validating from a mobile app - pass through first error string and return error */
|
||||
foreach ($errors as $error) {
|
||||
foreach ($error as $key => $value) {
|
||||
|
||||
$message['error'] = ['message'=>$value];
|
||||
$message = json_encode($message, JSON_PRETTY_PRINT);
|
||||
$headers = Utils::getApiHeaders();
|
||||
|
@ -54,5 +54,4 @@ class SaveClientPortalSettings extends Request
|
||||
|
||||
return $this->all();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,5 +23,4 @@ class SaveEmailSettings extends Request
|
||||
'bcc_email' => 'email',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class TaskRequest extends EntityRequest {
|
||||
|
||||
class TaskRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_TASK;
|
||||
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class TaxRateRequest extends EntityRequest {
|
||||
|
||||
class TaxRateRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_TAX_RATE;
|
||||
|
||||
}
|
@ -1,7 +1,5 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
|
||||
|
||||
class UpdateAccountRequest extends Request
|
||||
{
|
||||
/**
|
||||
|
@ -20,6 +20,5 @@ class UpdatePaymentRequest extends PaymentRequest
|
||||
public function rules()
|
||||
{
|
||||
return [];
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
|
||||
|
||||
class UpdateTaxRateRequest extends TaxRateRequest
|
||||
{
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
class VendorRequest extends EntityRequest {
|
||||
|
||||
class VendorRequest extends EntityRequest
|
||||
{
|
||||
protected $entityType = ENTITY_VENDOR;
|
||||
|
||||
public function entity()
|
||||
@ -15,5 +15,4 @@ class VendorRequest extends EntityRequest {
|
||||
|
||||
return $vendor;
|
||||
}
|
||||
|
||||
}
|
@ -287,8 +287,7 @@ Route::group(['middleware' => 'auth:user'], function() {
|
||||
});
|
||||
|
||||
// Route groups for API
|
||||
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function()
|
||||
{
|
||||
Route::group(['middleware' => 'api', 'prefix' => 'api/v1'], function () {
|
||||
Route::get('ping', 'AccountApiController@ping');
|
||||
Route::post('login', 'AccountApiController@login');
|
||||
Route::post('oauth_login', 'AccountApiController@oauthLogin');
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class parseCSV {
|
||||
class parseCSV
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
@ -85,49 +86,49 @@ class parseCSV {
|
||||
*/
|
||||
|
||||
# use first line/entry as field names
|
||||
var $heading = true;
|
||||
public $heading = true;
|
||||
|
||||
# override field names
|
||||
var $fields = [];
|
||||
public $fields = [];
|
||||
|
||||
# sort entries by this field
|
||||
var $sort_by = null;
|
||||
var $sort_reverse = false;
|
||||
public $sort_by = null;
|
||||
public $sort_reverse = false;
|
||||
|
||||
# delimiter (comma) and enclosure (double quote)
|
||||
var $delimiter = ',';
|
||||
var $enclosure = '"';
|
||||
public $delimiter = ',';
|
||||
public $enclosure = '"';
|
||||
|
||||
# basic SQL-like conditions for row matching
|
||||
var $conditions = null;
|
||||
public $conditions = null;
|
||||
|
||||
# number of rows to ignore from beginning of data
|
||||
var $offset = null;
|
||||
public $offset = null;
|
||||
|
||||
# limits the number of returned rows to specified amount
|
||||
var $limit = null;
|
||||
public $limit = null;
|
||||
|
||||
# number of rows to analyze when attempting to auto-detect delimiter
|
||||
var $auto_depth = 15;
|
||||
public $auto_depth = 15;
|
||||
|
||||
# characters to ignore when attempting to auto-detect delimiter
|
||||
var $auto_non_chars = "a-zA-Z0-9\n\r";
|
||||
public $auto_non_chars = "a-zA-Z0-9\n\r";
|
||||
|
||||
# preferred delimiter characters, only used when all filtering method
|
||||
# returns multiple possible delimiters (happens very rarely)
|
||||
var $auto_preferred = ",;\t.:|";
|
||||
public $auto_preferred = ",;\t.:|";
|
||||
|
||||
# character encoding options
|
||||
var $convert_encoding = false;
|
||||
var $input_encoding = 'ISO-8859-1';
|
||||
var $output_encoding = 'ISO-8859-1';
|
||||
public $convert_encoding = false;
|
||||
public $input_encoding = 'ISO-8859-1';
|
||||
public $output_encoding = 'ISO-8859-1';
|
||||
|
||||
# used by unparse(), save(), and output() functions
|
||||
var $linefeed = "\r\n";
|
||||
public $linefeed = "\r\n";
|
||||
|
||||
# only used by output() function
|
||||
var $output_delimiter = ',';
|
||||
var $output_filename = 'data.csv';
|
||||
public $output_delimiter = ',';
|
||||
public $output_filename = 'data.csv';
|
||||
|
||||
|
||||
/**
|
||||
@ -135,16 +136,16 @@ class parseCSV {
|
||||
*/
|
||||
|
||||
# current file
|
||||
var $file;
|
||||
public $file;
|
||||
|
||||
# loaded file contents
|
||||
var $file_data;
|
||||
public $file_data;
|
||||
|
||||
# array of field values in data parsed
|
||||
var $titles = [];
|
||||
public $titles = [];
|
||||
|
||||
# two dimentional array of CSV data
|
||||
var $data = [];
|
||||
public $data = [];
|
||||
|
||||
|
||||
/**
|
||||
@ -152,11 +153,20 @@ class parseCSV {
|
||||
* @param input CSV file or string
|
||||
* @return nothing
|
||||
*/
|
||||
function __construct ($input = null, $offset = null, $limit = null, $conditions = null) {
|
||||
if ( $offset !== null ) $this->offset = $offset;
|
||||
if ( $limit !== null ) $this->limit = $limit;
|
||||
if ( count($conditions) > 0 ) $this->conditions = $conditions;
|
||||
if ( !empty($input) ) $this->parse($input);
|
||||
public function __construct($input = null, $offset = null, $limit = null, $conditions = null)
|
||||
{
|
||||
if ($offset !== null) {
|
||||
$this->offset = $offset;
|
||||
}
|
||||
if ($limit !== null) {
|
||||
$this->limit = $limit;
|
||||
}
|
||||
if (count($conditions) > 0) {
|
||||
$this->conditions = $conditions;
|
||||
}
|
||||
if (!empty($input)) {
|
||||
$this->parse($input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -169,18 +179,27 @@ class parseCSV {
|
||||
* @param input CSV file or string
|
||||
* @return nothing
|
||||
*/
|
||||
function parse ($input = null, $offset = null, $limit = null, $conditions = null) {
|
||||
public function parse($input = null, $offset = null, $limit = null, $conditions = null)
|
||||
{
|
||||
if (!empty($input)) {
|
||||
if ( $offset !== null ) $this->offset = $offset;
|
||||
if ( $limit !== null ) $this->limit = $limit;
|
||||
if ( count($conditions) > 0 ) $this->conditions = $conditions;
|
||||
if ($offset !== null) {
|
||||
$this->offset = $offset;
|
||||
}
|
||||
if ($limit !== null) {
|
||||
$this->limit = $limit;
|
||||
}
|
||||
if (count($conditions) > 0) {
|
||||
$this->conditions = $conditions;
|
||||
}
|
||||
if (is_readable($input)) {
|
||||
$this->data = $this->parse_file($input);
|
||||
} else {
|
||||
$this->file_data = &$input;
|
||||
$this->data = $this->parse_string();
|
||||
}
|
||||
if ( $this->data === false ) return false;
|
||||
if ($this->data === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -193,8 +212,11 @@ class parseCSV {
|
||||
* @param fields field names
|
||||
* @return true or false
|
||||
*/
|
||||
function save ($file = null, $data = [], $append = false, $fields = []) {
|
||||
if ( empty($file) ) $file = &$this->file;
|
||||
public function save($file = null, $data = [], $append = false, $fields = [])
|
||||
{
|
||||
if (empty($file)) {
|
||||
$file = &$this->file;
|
||||
}
|
||||
$mode = ($append) ? 'at' : 'wt' ;
|
||||
$is_php = (preg_match('/\.php$/i', $file)) ? true : false ;
|
||||
return $this->_wfile($file, $this->unparse($data, $fields, $append, $is_php), $mode);
|
||||
@ -209,9 +231,14 @@ class parseCSV {
|
||||
* @param delimiter delimiter used to separate data
|
||||
* @return CSV data using delimiter of choice, or default
|
||||
*/
|
||||
function output ($output = true, $filename = null, $data = [], $fields = [], $delimiter = null) {
|
||||
if ( empty($filename) ) $filename = $this->output_filename;
|
||||
if ( $delimiter === null ) $delimiter = $this->output_delimiter;
|
||||
public function output($output = true, $filename = null, $data = [], $fields = [], $delimiter = null)
|
||||
{
|
||||
if (empty($filename)) {
|
||||
$filename = $this->output_filename;
|
||||
}
|
||||
if ($delimiter === null) {
|
||||
$delimiter = $this->output_delimiter;
|
||||
}
|
||||
$data = $this->unparse($data, $fields, null, null, $delimiter);
|
||||
if ($output) {
|
||||
header('Content-type: application/csv');
|
||||
@ -227,10 +254,15 @@ class parseCSV {
|
||||
* @param output output character encoding, uses default if left blank
|
||||
* @return nothing
|
||||
*/
|
||||
function encoding ($input = null, $output = null) {
|
||||
public function encoding($input = null, $output = null)
|
||||
{
|
||||
$this->convert_encoding = true;
|
||||
if ( $input !== null ) $this->input_encoding = $input;
|
||||
if ( $output !== null ) $this->output_encoding = $output;
|
||||
if ($input !== null) {
|
||||
$this->input_encoding = $input;
|
||||
}
|
||||
if ($output !== null) {
|
||||
$this->output_encoding = $output;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,18 +275,28 @@ class parseCSV {
|
||||
* @param enclosure enclosure character, default is double quote (").
|
||||
* @return delimiter character
|
||||
*/
|
||||
function auto ($file = null, $parse = true, $search_depth = null, $preferred = null, $enclosure = null) {
|
||||
public function auto($file = null, $parse = true, $search_depth = null, $preferred = null, $enclosure = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
$file = $this->file;
|
||||
}
|
||||
if (empty($search_depth)) {
|
||||
$search_depth = $this->auto_depth;
|
||||
}
|
||||
if ($enclosure === null) {
|
||||
$enclosure = $this->enclosure;
|
||||
}
|
||||
|
||||
if ( $file === null ) $file = $this->file;
|
||||
if ( empty($search_depth) ) $search_depth = $this->auto_depth;
|
||||
if ( $enclosure === null ) $enclosure = $this->enclosure;
|
||||
|
||||
if ( $preferred === null ) $preferred = $this->auto_preferred;
|
||||
if ($preferred === null) {
|
||||
$preferred = $this->auto_preferred;
|
||||
}
|
||||
|
||||
if (empty($this->file_data)) {
|
||||
if ($this->_check_data($file)) {
|
||||
$data = &$this->file_data;
|
||||
} else return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$data = &$this->file_data;
|
||||
}
|
||||
@ -315,10 +357,11 @@ class parseCSV {
|
||||
$this->delimiter = $delimiter;
|
||||
|
||||
// parse data
|
||||
if ( $parse ) $this->data = $this->parse_string();
|
||||
if ($parse) {
|
||||
$this->data = $this->parse_string();
|
||||
}
|
||||
|
||||
return $delimiter;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -331,9 +374,14 @@ class parseCSV {
|
||||
* @param file local CSV file
|
||||
* @return 2D array with CSV data, or false on failure
|
||||
*/
|
||||
function parse_file ($file = null) {
|
||||
if ( $file === null ) $file = $this->file;
|
||||
if ( empty($this->file_data) ) $this->load_data($file);
|
||||
public function parse_file($file = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
$file = $this->file;
|
||||
}
|
||||
if (empty($this->file_data)) {
|
||||
$this->load_data($file);
|
||||
}
|
||||
return (!empty($this->file_data)) ? $this->parse_string() : false ;
|
||||
}
|
||||
|
||||
@ -342,11 +390,14 @@ class parseCSV {
|
||||
* @param data CSV string
|
||||
* @return 2D array with CSV data, or false on failure
|
||||
*/
|
||||
function parse_string ($data = null) {
|
||||
public function parse_string($data = null)
|
||||
{
|
||||
if (empty($data)) {
|
||||
if ($this->_check_data()) {
|
||||
$data = &$this->file_data;
|
||||
} else return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$rows = [];
|
||||
@ -368,7 +419,9 @@ class parseCSV {
|
||||
// open and closing quotes
|
||||
if ($ch == $this->enclosure && (!$enclosed || $nch != $this->enclosure)) {
|
||||
$enclosed = ($enclosed) ? false : true ;
|
||||
if ( $enclosed ) $was_enclosed = true;
|
||||
if ($enclosed) {
|
||||
$was_enclosed = true;
|
||||
}
|
||||
|
||||
// inline quotes
|
||||
} elseif ($ch == $this->enclosure && $enclosed) {
|
||||
@ -377,7 +430,9 @@ class parseCSV {
|
||||
|
||||
// end of field/row
|
||||
} elseif (($ch == $this->delimiter || ($ch == "\n" && $pch != "\r") || $ch == "\r") && !$enclosed) {
|
||||
if ( !$was_enclosed ) $current = trim($current);
|
||||
if (!$was_enclosed) {
|
||||
$current = trim($current);
|
||||
}
|
||||
$key = (!empty($head[$col])) ? $head[$col] : $col ;
|
||||
$row[$key] = $current;
|
||||
$current = '';
|
||||
@ -393,10 +448,15 @@ class parseCSV {
|
||||
if (isset($rows[$row[$this->sort_by]])) {
|
||||
$rows[$row[$this->sort_by].'_0'] = &$rows[$row[$this->sort_by]];
|
||||
unset($rows[$row[$this->sort_by]]);
|
||||
for ( $sn=1; isset($rows[$row[$this->sort_by].'_'.$sn]); $sn++ ) {}
|
||||
for ($sn=1; isset($rows[$row[$this->sort_by].'_'.$sn]); $sn++) {
|
||||
}
|
||||
$rows[$row[$this->sort_by].'_'.$sn] = $row;
|
||||
} else $rows[$row[$this->sort_by]] = $row;
|
||||
} else $rows[] = $row;
|
||||
} else {
|
||||
$rows[$row[$this->sort_by]] = $row;
|
||||
}
|
||||
} else {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
$row = [];
|
||||
@ -432,10 +492,17 @@ class parseCSV {
|
||||
* @param delimiter field delimiter to use
|
||||
* @return CSV data (text string)
|
||||
*/
|
||||
function unparse ( $data = [], $fields = [], $append = false , $is_php = false, $delimiter = null) {
|
||||
if ( !is_array($data) || empty($data) ) $data = &$this->data;
|
||||
if ( !is_array($fields) || empty($fields) ) $fields = &$this->titles;
|
||||
if ( $delimiter === null ) $delimiter = $this->delimiter;
|
||||
public function unparse($data = [], $fields = [], $append = false, $is_php = false, $delimiter = null)
|
||||
{
|
||||
if (!is_array($data) || empty($data)) {
|
||||
$data = &$this->data;
|
||||
}
|
||||
if (!is_array($fields) || empty($fields)) {
|
||||
$fields = &$this->titles;
|
||||
}
|
||||
if ($delimiter === null) {
|
||||
$delimiter = $this->delimiter;
|
||||
}
|
||||
|
||||
$string = ($is_php) ? "<?php header('Status: 403'); die(' '); ?>".$this->linefeed : '' ;
|
||||
$entry = [];
|
||||
@ -466,7 +533,8 @@ class parseCSV {
|
||||
* @param input local CSV file
|
||||
* @return true or false
|
||||
*/
|
||||
function load_data ($input = null) {
|
||||
public function load_data($input = null)
|
||||
{
|
||||
$data = null;
|
||||
$file = null;
|
||||
if ($input === null) {
|
||||
@ -477,12 +545,18 @@ class parseCSV {
|
||||
$data = $input;
|
||||
}
|
||||
if (!empty($data) || $data = $this->_rfile($file)) {
|
||||
if ( $this->file != $file ) $this->file = $file;
|
||||
if ($this->file != $file) {
|
||||
$this->file = $file;
|
||||
}
|
||||
if (preg_match('/\.php$/i', $file) && preg_match('/<\?.*?\?>(.*)/ims', $data, $strip)) {
|
||||
$data = ltrim($strip[1]);
|
||||
}
|
||||
if ( $this->convert_encoding ) $data = iconv($this->input_encoding, $this->output_encoding, $data);
|
||||
if ( substr($data, -1) != "\n" ) $data .= "\n";
|
||||
if ($this->convert_encoding) {
|
||||
$data = iconv($this->input_encoding, $this->output_encoding, $data);
|
||||
}
|
||||
if (substr($data, -1) != "\n") {
|
||||
$data .= "\n";
|
||||
}
|
||||
$this->file_data = &$data;
|
||||
return true;
|
||||
}
|
||||
@ -500,7 +574,8 @@ class parseCSV {
|
||||
* @param conditions specified conditions that the row must match
|
||||
* @return true of false
|
||||
*/
|
||||
function _validate_row_conditions ($row = [], $conditions = null) {
|
||||
public function _validate_row_conditions($row = [], $conditions = null)
|
||||
{
|
||||
if (!empty($row)) {
|
||||
if (!empty($conditions)) {
|
||||
$conditions = (strpos($conditions, ' OR ') !== false) ? explode(' OR ', $conditions) : [$conditions] ;
|
||||
@ -530,7 +605,8 @@ class parseCSV {
|
||||
* @param condition specified condition that the row must match
|
||||
* @return true of false
|
||||
*/
|
||||
function _validate_row_condition ($row, $condition) {
|
||||
public function _validate_row_condition($row, $condition)
|
||||
{
|
||||
$operators = [
|
||||
'=', 'equals', 'is',
|
||||
'!=', 'is not',
|
||||
@ -589,8 +665,11 @@ class parseCSV {
|
||||
* @param current_row the current row number being processed
|
||||
* @return true of false
|
||||
*/
|
||||
function _validate_offset ($current_row) {
|
||||
if ( $this->sort_by === null && $this->offset !== null && $current_row < $this->offset ) return false;
|
||||
public function _validate_offset($current_row)
|
||||
{
|
||||
if ($this->sort_by === null && $this->offset !== null && $current_row < $this->offset) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -600,7 +679,8 @@ class parseCSV {
|
||||
* @param value string to process
|
||||
* @return Processed value
|
||||
*/
|
||||
function _enclose_value ($value = null) {
|
||||
public function _enclose_value($value = null)
|
||||
{
|
||||
if ($value !== null && $value != '') {
|
||||
$delimiter = preg_quote($this->delimiter, '/');
|
||||
$enclosure = preg_quote($this->enclosure, '/');
|
||||
@ -617,9 +697,12 @@ class parseCSV {
|
||||
* @param file local filename
|
||||
* @return true or false
|
||||
*/
|
||||
function _check_data ($file = null) {
|
||||
public function _check_data($file = null)
|
||||
{
|
||||
if (empty($this->file_data)) {
|
||||
if ( $file === null ) $file = $this->file;
|
||||
if ($file === null) {
|
||||
$file = $this->file;
|
||||
}
|
||||
return $this->load_data($file);
|
||||
}
|
||||
return true;
|
||||
@ -631,7 +714,8 @@ class parseCSV {
|
||||
* - only used by find_delimiter()
|
||||
* @return special string used for delimiter selection, or false
|
||||
*/
|
||||
function _check_count ($char, $array, $depth, $preferred) {
|
||||
public function _check_count($char, $array, $depth, $preferred)
|
||||
{
|
||||
if ($depth == count($array)) {
|
||||
$first = null;
|
||||
$equal = null;
|
||||
@ -653,7 +737,9 @@ class parseCSV {
|
||||
$pref = strpos($preferred, $char);
|
||||
$pref = ($pref !== false) ? str_pad($pref, 3, '0', STR_PAD_LEFT) : '999' ;
|
||||
return $pref.$match.'.'.(99999 - str_pad($first, 5, '0', STR_PAD_LEFT));
|
||||
} else return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -662,9 +748,12 @@ class parseCSV {
|
||||
* @param file local filename
|
||||
* @return Data from file, or false on failure
|
||||
*/
|
||||
function _rfile ($file = null) {
|
||||
public function _rfile($file = null)
|
||||
{
|
||||
if (is_readable($file)) {
|
||||
if ( !($fh = fopen($file, 'r')) ) return false;
|
||||
if (!($fh = fopen($file, 'r'))) {
|
||||
return false;
|
||||
}
|
||||
$data = fread($fh, filesize($file));
|
||||
fclose($fh);
|
||||
return $data;
|
||||
@ -680,16 +769,16 @@ class parseCSV {
|
||||
* @param lock flock() mode
|
||||
* @return true or false
|
||||
*/
|
||||
function _wfile ($file, $string = '', $mode = 'wb', $lock = 2) {
|
||||
public function _wfile($file, $string = '', $mode = 'wb', $lock = 2)
|
||||
{
|
||||
if ($fp = fopen($file, $mode)) {
|
||||
flock($fp, $lock);
|
||||
$re = fwrite($fp, $string);
|
||||
$re2 = fclose($fp);
|
||||
if ( $re != false && $re2 != false ) return true;
|
||||
if ($re != false && $re2 != false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -62,5 +62,4 @@ class SendNotificationEmail extends Job implements ShouldQueue
|
||||
{
|
||||
$userMailer->sendNotification($this->user, $this->invoice, $this->type, $this->payment);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,4 @@ class SendPaymentEmail extends Job implements ShouldQueue
|
||||
{
|
||||
$contactMailer->sendPaymentConfirmation($this->payment);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -48,5 +48,4 @@ class SendPushNotification extends Job implements ShouldQueue
|
||||
{
|
||||
$pushService->sendNotification($this->invoice, $this->type);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,5 @@ class CurlUtils
|
||||
//$response->getStatus();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,4 @@ use DateTime;
|
||||
|
||||
class DateUtils
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -43,8 +43,7 @@ class HistoryUtils
|
||||
->limit(100)
|
||||
->get();
|
||||
|
||||
foreach ($activities->reverse() as $activity)
|
||||
{
|
||||
foreach ($activities->reverse() as $activity) {
|
||||
if ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_CLIENT) {
|
||||
$entity = $activity->client;
|
||||
} elseif ($activity->activity_type_id == ACTIVITY_TYPE_CREATE_TASK || $activity->activity_type_id == ACTIVITY_TYPE_UPDATE_TASK) {
|
||||
@ -151,16 +150,14 @@ class HistoryUtils
|
||||
$history = Session::get(RECENTLY_VIEWED, []);
|
||||
$history = isset($history[$accountId]) ? $history[$accountId] : [];
|
||||
|
||||
foreach ($history as $item)
|
||||
{
|
||||
foreach ($history as $item) {
|
||||
if ($item->entityType == ENTITY_CLIENT && isset($clientMap[$item->client_id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$clientMap[$item->client_id] = true;
|
||||
|
||||
if ($lastClientId === false || $item->client_id != $lastClientId)
|
||||
{
|
||||
if ($lastClientId === false || $item->client_id != $lastClientId) {
|
||||
$icon = '<i class="fa fa-users" style="width:32px"></i>';
|
||||
if ($item->client_id) {
|
||||
$link = url('/clients/' . $item->client_id);
|
||||
|
@ -384,7 +384,8 @@ class Utils
|
||||
return intval($value);
|
||||
}
|
||||
|
||||
public static function getFromCache($id, $type) {
|
||||
public static function getFromCache($id, $type)
|
||||
{
|
||||
$cache = Cache::get($type);
|
||||
|
||||
if (! $cache) {
|
||||
@ -587,11 +588,12 @@ class Utils
|
||||
$format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT);
|
||||
$dateTime = DateTime::createFromFormat($format, $date);
|
||||
|
||||
if(!$dateTime)
|
||||
if (!$dateTime) {
|
||||
return $date;
|
||||
else
|
||||
} else {
|
||||
return $formatResult ? $dateTime->format('Y-m-d') : $dateTime;
|
||||
}
|
||||
}
|
||||
|
||||
public static function fromSqlDate($date, $formatResult = true)
|
||||
{
|
||||
@ -602,11 +604,12 @@ class Utils
|
||||
$format = Session::get(SESSION_DATE_FORMAT, DEFAULT_DATE_FORMAT);
|
||||
$dateTime = DateTime::createFromFormat('Y-m-d', $date);
|
||||
|
||||
if(!$dateTime)
|
||||
if (!$dateTime) {
|
||||
return $date;
|
||||
else
|
||||
} else {
|
||||
return $formatResult ? $dateTime->format($format) : $dateTime;
|
||||
}
|
||||
}
|
||||
|
||||
public static function fromSqlDateTime($date, $formatResult = true)
|
||||
{
|
||||
@ -758,11 +761,13 @@ class Utils
|
||||
|
||||
public static function getVendorDisplayName($model)
|
||||
{
|
||||
if(is_null($model))
|
||||
if (is_null($model)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if($model->vendor_name)
|
||||
if ($model->vendor_name) {
|
||||
return $model->vendor_name;
|
||||
}
|
||||
|
||||
return 'No vendor name';
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
<?
|
||||
<?php
|
||||
|
||||
class Entity
|
||||
{
|
||||
public $id;
|
||||
public $type;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
####################################################################
|
||||
|
||||
function autolink($text, $limit=30, $tagfill='', $auto_title = true){
|
||||
|
||||
function autolink($text, $limit=30, $tagfill='', $auto_title = true)
|
||||
{
|
||||
$text = autolink_do($text, '![a-z][a-z-]+://!i', $limit, $tagfill, $auto_title);
|
||||
$text = autolink_do($text, '!(mailto|skype):!i', $limit, $tagfill, $auto_title);
|
||||
$text = autolink_do($text, '!www\\.!i', $limit, $tagfill, $auto_title, 'http://');
|
||||
@ -35,25 +35,21 @@
|
||||
|
||||
####################################################################
|
||||
|
||||
function autolink_do($text, $sub, $limit, $tagfill, $auto_title, $force_prefix=null){
|
||||
|
||||
function autolink_do($text, $sub, $limit, $tagfill, $auto_title, $force_prefix=null)
|
||||
{
|
||||
$text_l = StrToLower($text);
|
||||
$cursor = 0;
|
||||
$loop = 1;
|
||||
$buffer = '';
|
||||
|
||||
while (($cursor < strlen($text)) && $loop) {
|
||||
|
||||
$ok = 1;
|
||||
$matched = preg_match($sub, $text_l, $m, PREG_OFFSET_CAPTURE, $cursor);
|
||||
|
||||
if (!$matched) {
|
||||
|
||||
$loop = 0;
|
||||
$ok = 0;
|
||||
|
||||
} else {
|
||||
|
||||
$pos = $m[0][1];
|
||||
$sub_len = strlen($m[0][0]);
|
||||
|
||||
@ -87,7 +83,6 @@
|
||||
#
|
||||
|
||||
if ($ok) {
|
||||
|
||||
if ($pre) {
|
||||
if (!preg_match('![\s\(\[\{>]$!s', $pre)) {
|
||||
|
||||
@ -106,7 +101,6 @@
|
||||
|
||||
if ($ok) {
|
||||
if (preg_match('/^([a-z0-9\-\.\/\-_%~!?=,:;&+*#@\(\)\$]+)/i', $post, $matches)) {
|
||||
|
||||
$url = $hit.$matches[1];
|
||||
|
||||
$cursor += strlen($url) + strlen($pre_hit);
|
||||
@ -140,11 +134,12 @@
|
||||
$link_url = $url;
|
||||
$display_url = $url;
|
||||
|
||||
if ($force_prefix) $link_url = $force_prefix.$link_url;
|
||||
if ($force_prefix) {
|
||||
$link_url = $force_prefix.$link_url;
|
||||
}
|
||||
|
||||
if ($GLOBALS['autolink_options']['strip_protocols']) {
|
||||
if (preg_match('!^(http|https)://!i', $display_url, $m)) {
|
||||
|
||||
$display_url = substr($display_url, strlen($m[1])+3);
|
||||
}
|
||||
}
|
||||
@ -158,11 +153,9 @@
|
||||
|
||||
$currentTagfill = $tagfill;
|
||||
if ($display_url != $link_url && !preg_match('@title=@msi', $currentTagfill) && $auto_title) {
|
||||
|
||||
$display_quoted = preg_quote($display_url, '!');
|
||||
|
||||
if (!preg_match("!^(http|https)://{$display_quoted}$!i", $link_url)) {
|
||||
|
||||
$currentTagfill .= ' title="'.$link_url.'"';
|
||||
}
|
||||
}
|
||||
@ -171,7 +164,6 @@
|
||||
$display_url_enc = HtmlSpecialChars($display_url);
|
||||
|
||||
$buffer .= "<a href=\"{$link_url_enc}\"$currentTagfill>{$display_url_enc}</a>";
|
||||
|
||||
} else {
|
||||
#echo "fail 3 at $cursor<br />\n";
|
||||
|
||||
@ -180,7 +172,6 @@
|
||||
$buffer .= $fail_text;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
@ -194,9 +185,11 @@
|
||||
|
||||
####################################################################
|
||||
|
||||
function autolink_label($text, $limit){
|
||||
|
||||
if (!$limit){ return $text; }
|
||||
function autolink_label($text, $limit)
|
||||
{
|
||||
if (!$limit) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
if (strlen($text) > $limit) {
|
||||
return substr($text, 0, $limit-3).'...';
|
||||
@ -207,8 +200,8 @@
|
||||
|
||||
####################################################################
|
||||
|
||||
function autolink_email($text, $tagfill=''){
|
||||
|
||||
function autolink_email($text, $tagfill='')
|
||||
{
|
||||
$atom = '[^()<>@,;:\\\\".\\[\\]\\x00-\\x20\\x7f]+'; # from RFC822
|
||||
|
||||
#die($atom);
|
||||
@ -228,12 +221,9 @@
|
||||
$pos = strpos($text_l, '@', $cursor);
|
||||
|
||||
if ($pos === false) {
|
||||
|
||||
$loop = 0;
|
||||
$ok = 0;
|
||||
|
||||
} else {
|
||||
|
||||
$pre = substr($text, $cursor, $pos-$cursor);
|
||||
$hit = substr($text, $pos, 1);
|
||||
$post = substr($text, $pos + 1);
|
||||
@ -273,7 +263,6 @@
|
||||
|
||||
$hit = substr($pre, $plen-$len).$hit;
|
||||
$pre = substr($pre, 0, $plen-$len);
|
||||
|
||||
} else {
|
||||
|
||||
#echo "fail 2 at $cursor ($pre)<br />\n";
|
||||
@ -297,7 +286,6 @@
|
||||
|
||||
$hit .= substr($post, 0, $len);
|
||||
$post = substr($post, $len);
|
||||
|
||||
} else {
|
||||
#echo "fail 3 at $cursor ($post)<br />\n";
|
||||
|
||||
@ -312,13 +300,10 @@
|
||||
#
|
||||
|
||||
if ($ok) {
|
||||
|
||||
$cursor += strlen($pre) + strlen($hit);
|
||||
$buffer .= $pre;
|
||||
$buffer .= "<a href=\"mailto:$hit\"$tagfill>$hit</a>";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
@ -330,6 +315,4 @@
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
####################################################################
|
||||
|
||||
?>
|
||||
####################################################################;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user