mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
94e371e6cb
@ -148,12 +148,10 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailPaymentTemplate()
|
||||
{
|
||||
$converter = new CommonMarkConverter([
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
|
||||
return $converter->convertToHtml(self::transformText('payment_message'));
|
||||
$payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
|
||||
|
||||
return $payment_message;
|
||||
|
||||
}
|
||||
|
||||
@ -166,12 +164,11 @@ class EmailTemplateDefaults
|
||||
|
||||
public static function emailPaymentPartialTemplate()
|
||||
{
|
||||
$converter = new CommonMarkConverter([
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
|
||||
return $converter->convertToHtml(self::transformText('payment_message'));
|
||||
$payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
|
||||
|
||||
return $payment_message;
|
||||
|
||||
}
|
||||
|
||||
public static function emailPaymentPartialSubject()
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Events\Quote;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\QuoteInvitation;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,8 @@ use App\Events\Misc\InvitationWasViewed;
|
||||
use App\Events\Quote\QuoteWasViewed;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\RecurringInvoiceInvitation;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
|
@ -227,6 +227,8 @@ class MigrationController extends BaseController
|
||||
|
||||
$account = auth()->user()->account;
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
$company->is_disabled = true;
|
||||
$company->save();
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
@ -288,6 +290,9 @@ class MigrationController extends BaseController
|
||||
$account = auth()->user()->account;
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
|
||||
$company->is_disabled = true;
|
||||
$company->save();
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
@ -322,7 +327,10 @@ class MigrationController extends BaseController
|
||||
|
||||
$account = auth()->user()->account;
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
|
||||
|
||||
$company->is_disabled = true;
|
||||
$company->save();
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
@ -354,6 +362,10 @@ class MigrationController extends BaseController
|
||||
$account = auth()->user()->account;
|
||||
$company = (new ImportMigrations())->getCompany($account);
|
||||
|
||||
$company->is_disabled = true;
|
||||
$company->save();
|
||||
|
||||
|
||||
$company_token = new CompanyToken();
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
|
@ -31,15 +31,15 @@ class Request extends FormRequest
|
||||
|
||||
public function globalRules($rules)
|
||||
{
|
||||
$rules = [];
|
||||
$merge_rules = [];
|
||||
|
||||
foreach($this->all() as $key => $value)
|
||||
{
|
||||
if(method_exists($this, $key))
|
||||
$rules = $this->{$key}($rules);
|
||||
$merge_rules = $this->{$key}($rules);
|
||||
}
|
||||
|
||||
return $rules;
|
||||
return array_merge($merge_rules, $rules);
|
||||
}
|
||||
|
||||
private function assigned_user_id($rules)
|
||||
|
@ -38,11 +38,10 @@ class StoreTaskRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if ($this->input('number')) {
|
||||
$rules['number'] = 'unique:tasks,number,'.$this->id.',id,company_id,'.auth()->user()->company()->id;
|
||||
}
|
||||
|
||||
return $this->globalRules($rules);
|
||||
$rules['number'] = Rule::unique('tasks')
|
||||
->where('company_id', auth()->user()->company()->id);
|
||||
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
|
@ -37,11 +37,10 @@ class UpdateTaskRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$rules = [];
|
||||
/* Ensure we have a client name, and that all emails are unique*/
|
||||
|
||||
if ($this->input('number')) {
|
||||
$rules['number'] = 'unique:tasks,number,'.$this->id.',id,company_id,'.$this->task->company_id;
|
||||
}
|
||||
$rules['number'] = Rule::unique('tasks')
|
||||
->where('company_id', auth()->user()->company()->id)
|
||||
->ignore($this->task->id);
|
||||
|
||||
return $this->globalRules($rules);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ use App\Factory\QuoteFactory;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Factory\TaxRateFactory;
|
||||
use App\Factory\UserFactory;
|
||||
use App\Factory\VendorFactory;
|
||||
use App\Http\Requests\Company\UpdateCompanyRequest;
|
||||
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||
use App\Http\ValidationRules\ValidUserForCompany;
|
||||
@ -44,14 +45,19 @@ use App\Models\CompanyGateway;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Document;
|
||||
use App\Models\Expense;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentTerm;
|
||||
use App\Models\Product;
|
||||
use App\Models\Project;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskStatus;
|
||||
use App\Models\TaxRate;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Repositories\ClientContactRepository;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Repositories\CompanyRepository;
|
||||
@ -63,6 +69,8 @@ use App\Repositories\PaymentRepository;
|
||||
use App\Repositories\ProductRepository;
|
||||
use App\Repositories\QuoteRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Repositories\VendorContactRepository;
|
||||
use App\Repositories\VendorRepository;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -103,6 +111,8 @@ class Import implements ShouldQueue
|
||||
'payment_terms',
|
||||
'tax_rates',
|
||||
'clients',
|
||||
'vendors',
|
||||
'projects',
|
||||
'products',
|
||||
'invoices',
|
||||
'recurring_invoices',
|
||||
@ -111,6 +121,10 @@ class Import implements ShouldQueue
|
||||
'payments',
|
||||
'company_gateways',
|
||||
'client_gateway_tokens',
|
||||
'expense_categories',
|
||||
'task_statuses',
|
||||
'expenses',
|
||||
'tasks',
|
||||
// //'documents',
|
||||
];
|
||||
|
||||
@ -441,6 +455,68 @@ class Import implements ShouldQueue
|
||||
$client_repository = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @throws Exception
|
||||
*/
|
||||
private function processVendors(array $data): void
|
||||
{
|
||||
Vendor::unguard();
|
||||
|
||||
$contact_repository = new VendorContactRepository();
|
||||
$vendor_repository = new VendorRepository($contact_repository);
|
||||
|
||||
foreach ($data as $key => $resource) {
|
||||
$modified = $resource;
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->processUserId($resource);
|
||||
|
||||
unset($modified['id']);
|
||||
unset($modified['contacts']);
|
||||
|
||||
$vendor = $vendor_repository->save(
|
||||
$modified,
|
||||
VendorFactory::create(
|
||||
$this->company->id,
|
||||
$modified['user_id']
|
||||
)
|
||||
);
|
||||
|
||||
$vendor->contacts()->forceDelete();
|
||||
|
||||
if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json
|
||||
$modified_contacts = $resource['contacts'];
|
||||
|
||||
foreach ($modified_contacts as $key => $vendor_contacts) {
|
||||
$modified_contacts[$key]['company_id'] = $this->company->id;
|
||||
$modified_contacts[$key]['user_id'] = $this->processUserId($resource);
|
||||
$modified_contacts[$key]['vendor_id'] = $vendor->id;
|
||||
$modified_contacts[$key]['password'] = 'mysuperpassword'; // @todo, and clean up the code..
|
||||
unset($modified_contacts[$key]['id']);
|
||||
}
|
||||
|
||||
$saveable_contacts['contacts'] = $modified_contacts;
|
||||
|
||||
$contact_repository->save($saveable_contacts, $vendor);
|
||||
}
|
||||
|
||||
$key = "vendors_{$resource['id']}";
|
||||
|
||||
$this->ids['vendors'][$key] = [
|
||||
'old' => $resource['id'],
|
||||
'new' => $vendor->id,
|
||||
];
|
||||
}
|
||||
|
||||
Vendor::reguard();
|
||||
|
||||
/*Improve memory handling by setting everything to null when we have finished*/
|
||||
$data = null;
|
||||
$contact_repository = null;
|
||||
$client_repository = null;
|
||||
}
|
||||
|
||||
|
||||
private function processProducts(array $data): void
|
||||
{
|
||||
Product::unguard();
|
||||
@ -906,6 +982,183 @@ class Import implements ShouldQueue
|
||||
$data = null;
|
||||
}
|
||||
|
||||
private function processTaskStatuses(array $data) :void
|
||||
{info('in task statuses');
|
||||
TaskStatus::unguard();
|
||||
|
||||
foreach ($data as $resource) {
|
||||
$modified = $resource;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->transformId('users', $resource['user_id']);
|
||||
|
||||
$task_status = TaskStatus::Create($modified);
|
||||
|
||||
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
|
||||
|
||||
$this->ids['task_statuses'] = [
|
||||
"task_statuses_{$old_user_key}" => [
|
||||
'old' => $resource['id'],
|
||||
'new' => $task_status->id,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
TaskStatus::reguard();
|
||||
|
||||
$data = null;
|
||||
info('finished task statuses');
|
||||
}
|
||||
|
||||
private function processExpenseCategories(array $data) :void
|
||||
{
|
||||
ExpenseCategory::unguard();
|
||||
|
||||
foreach ($data as $resource) {
|
||||
$modified = $resource;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->transformId('users', $resource['user_id']);
|
||||
|
||||
$expense_category = ExpenseCategory::Create($modified);
|
||||
|
||||
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
|
||||
|
||||
$this->ids['expense_categories'] = [
|
||||
"expense_categories_{$old_user_key}" => [
|
||||
'old' => $resource['id'],
|
||||
'new' => $expense_category->id,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
ExpenseCategory::reguard();
|
||||
|
||||
$data = null;
|
||||
}
|
||||
|
||||
private function processTasks(array $data) :void
|
||||
{
|
||||
Task::unguard();
|
||||
|
||||
foreach ($data as $resource) {
|
||||
$modified = $resource;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->transformId('users', $resource['user_id']);
|
||||
|
||||
if(isset($modified['client_id']))
|
||||
$modified['client_id'] = $this->transformId('clients', $resource['client_id']);
|
||||
|
||||
if(isset($modified['invoice_id']))
|
||||
$modified['invoice_id'] = $this->transformId('invoices', $resource['invoice_id']);
|
||||
|
||||
if(isset($modified['project_id']))
|
||||
$modified['project_id'] = $this->transformId('projects', $resource['project_id']);
|
||||
|
||||
if(isset($modified['status_id']))
|
||||
$modified['status_id'] = $this->transformId('task_statuses', $resource['status_id']);
|
||||
|
||||
$task = Task::Create($modified);
|
||||
|
||||
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
|
||||
|
||||
$this->ids['tasks'] = [
|
||||
"tasks_{$old_user_key}" => [
|
||||
'old' => $resource['id'],
|
||||
'new' => $task->id,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Task::reguard();
|
||||
|
||||
$data = null;
|
||||
}
|
||||
|
||||
private function processProjects(array $data) :void
|
||||
{
|
||||
Project::unguard();
|
||||
|
||||
foreach ($data as $resource) {
|
||||
$modified = $resource;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->transformId('users', $resource['user_id']);
|
||||
|
||||
if(isset($modified['client_id']))
|
||||
$modified['client_id'] = $this->transformId('clients', $resource['client_id']);
|
||||
|
||||
$project = Project::Create($modified);
|
||||
|
||||
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
|
||||
|
||||
$this->ids['projects'] = [
|
||||
"projects_{$old_user_key}" => [
|
||||
'old' => $resource['id'],
|
||||
'new' => $project->id,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Project::reguard();
|
||||
|
||||
$data = null;
|
||||
}
|
||||
|
||||
private function processExpenses(array $data) :void
|
||||
{
|
||||
|
||||
Expense::unguard();
|
||||
|
||||
foreach ($data as $resource) {
|
||||
$modified = $resource;
|
||||
|
||||
unset($modified['id']);
|
||||
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->transformId('users', $resource['user_id']);
|
||||
|
||||
if(isset($resource['client_id']))
|
||||
$modified['client_id'] = $this->transformId('clients', $resource['client_id']);
|
||||
|
||||
if(isset($resource['category_id']))
|
||||
$modified['category_id'] = $this->transformId('expense_categories', $resource['category_id']);
|
||||
|
||||
if(isset($resource['invoice_id']))
|
||||
$modified['invoice_id'] = $this->transformId('invoices', $resource['invoice_id']);
|
||||
|
||||
if(isset($resource['project_id']))
|
||||
$modified['project_id'] = $this->transformId('projects', $resource['project_id']);
|
||||
|
||||
if(isset($resource['vendor_id']))
|
||||
$modified['vendor_id'] = $this->transformId('vendors', $resource['vendor_id']);
|
||||
|
||||
$expense = Expense::Create($modified);
|
||||
|
||||
$old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id;
|
||||
|
||||
$this->ids['expenses'] = [
|
||||
"expenses_{$old_user_key}" => [
|
||||
'old' => $resource['id'],
|
||||
'new' => $expense->id,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
Expense::reguard();
|
||||
|
||||
$data = null;
|
||||
|
||||
}
|
||||
/**
|
||||
* |--------------------------------------------------------------------------
|
||||
* | Additional migration methods.
|
||||
@ -938,7 +1191,7 @@ class Import implements ShouldQueue
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public function transformId(string $resource, string $old): int
|
||||
public function transformId($resource, string $old): int
|
||||
{
|
||||
if (! array_key_exists($resource, $this->ids)) {
|
||||
throw new Exception("Resource {$resource} not available.");
|
||||
|
@ -52,9 +52,9 @@ class QuoteApprovedActivity implements ShouldQueue
|
||||
$fields->client_id = $event->quote->client_id;
|
||||
$fields->user_id = $event->quote->user_id;
|
||||
$fields->client_contact_id = $event->contact->id;
|
||||
$fields->company_id = $event->payment->company_id;
|
||||
$fields->activity_type_id = Activity::RESTORE_PAYMENT;
|
||||
$fields->company_id = $event->quote->company_id;
|
||||
$fields->activity_type_id = Activity::APPROVE_QUOTE;
|
||||
|
||||
$this->activity_repo->save($fields, $event->payment, $event->event_vars);
|
||||
$this->activity_repo->save($fields, $event->quote, $event->event_vars);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class Expense extends BaseModel
|
||||
'assigned_user_id',
|
||||
'vendor_id',
|
||||
'invoice_id',
|
||||
'expense_currency_id',
|
||||
'currency_id',
|
||||
'date',
|
||||
'invoice_currency_id',
|
||||
'amount',
|
||||
|
@ -74,6 +74,7 @@ class VendorContact extends Authenticatable implements HasLocalePreference
|
||||
'custom_value4',
|
||||
'email',
|
||||
'is_primary',
|
||||
'vendor_id',
|
||||
];
|
||||
|
||||
public function getEntityType()
|
||||
|
@ -87,8 +87,8 @@ use App\Listeners\Invoice\InvoiceArchivedActivity;
|
||||
use App\Listeners\Invoice\InvoiceCancelledActivity;
|
||||
use App\Listeners\Invoice\InvoiceDeletedActivity;
|
||||
use App\Listeners\Invoice\InvoiceEmailActivity;
|
||||
use App\Listeners\Invoice\InvoiceEmailedNotification;
|
||||
use App\Listeners\Invoice\InvoiceEmailFailedActivity;
|
||||
use App\Listeners\Invoice\InvoiceEmailedNotification;
|
||||
use App\Listeners\Invoice\InvoicePaidActivity;
|
||||
use App\Listeners\Invoice\InvoiceRestoredActivity;
|
||||
use App\Listeners\Invoice\InvoiceReversedActivity;
|
||||
@ -98,6 +98,7 @@ use App\Listeners\Invoice\UpdateInvoiceInvitations;
|
||||
use App\Listeners\Misc\InvitationViewedListener;
|
||||
use App\Listeners\Payment\PaymentNotification;
|
||||
use App\Listeners\Payment\PaymentRestoredActivity;
|
||||
use App\Listeners\Quote\QuoteApprovedActivity;
|
||||
use App\Listeners\Quote\QuoteArchivedActivity;
|
||||
use App\Listeners\Quote\QuoteDeletedActivity;
|
||||
use App\Listeners\Quote\QuoteEmailActivity;
|
||||
@ -262,6 +263,7 @@ class EventServiceProvider extends ServiceProvider
|
||||
],
|
||||
QuoteWasApproved::class => [
|
||||
ReachWorkflowSettings::class,
|
||||
QuoteApprovedActivity::class,
|
||||
],
|
||||
QuoteWasCreated::class => [
|
||||
CreatedQuoteActivity::class,
|
||||
|
@ -51,7 +51,7 @@ class TaskRepository extends BaseRepository
|
||||
$task->fill($data);
|
||||
$task->save();
|
||||
|
||||
$task->number = empty($task->number) ? $this->getNextTaskNumber($task) : $task->number;
|
||||
$task->number = empty($task->number) ? $this->getNextTaskNumber($task) : $data['number'];
|
||||
|
||||
if (isset($data['description'])) {
|
||||
$task->description = trim($data['description']);
|
||||
|
@ -23,14 +23,17 @@ class VendorContactRepository extends BaseRepository
|
||||
{
|
||||
public $is_primary;
|
||||
|
||||
public function save($contacts, Vendor $vendor) : void
|
||||
public function save(array $data, Vendor $vendor) : void
|
||||
{
|
||||
|
||||
/* Convert array to collection */
|
||||
$contacts = collect($contacts);
|
||||
if (isset($data['contacts'])) {
|
||||
$contacts = collect($data['contacts']);
|
||||
} else {
|
||||
$contacts = collect();
|
||||
}
|
||||
|
||||
/* Get array of IDs which have been removed from the contacts array and soft delete each contact */
|
||||
collect($vendor->contacts->pluck('id'))->diff($contacts->pluck('id'))->each(function ($contact) {
|
||||
$vendor->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) {
|
||||
VendorContact::destroy($contact);
|
||||
});
|
||||
|
||||
@ -62,9 +65,7 @@ class VendorContactRepository extends BaseRepository
|
||||
$update_contact->fill($contact);
|
||||
|
||||
if (array_key_exists('password', $contact) && strlen($contact['password']) > 1) {
|
||||
|
||||
$update_contact->password = Hash::make($contact['password']);
|
||||
|
||||
}
|
||||
|
||||
$update_contact->save();
|
||||
@ -73,7 +74,7 @@ class VendorContactRepository extends BaseRepository
|
||||
$vendor->load('contacts');
|
||||
|
||||
//always made sure we have one blank contact to maintain state
|
||||
if ($contacts->count() == 0) {
|
||||
if ($vendor->contacts->count() == 0) {
|
||||
$new_contact = new VendorContact;
|
||||
$new_contact->vendor_id = $vendor->id;
|
||||
$new_contact->company_id = $vendor->company_id;
|
||||
|
@ -70,7 +70,7 @@ class VendorRepository extends BaseRepository
|
||||
$vendor->save();
|
||||
|
||||
if (isset($data['contacts'])) {
|
||||
$contacts = $this->contact_repo->save($data['contacts'], $vendor);
|
||||
$contacts = $this->contact_repo->save($data, $vendor);
|
||||
}
|
||||
|
||||
if (empty($data['name'])) {
|
||||
|
@ -58,7 +58,8 @@ class ExpenseTransformer extends EntityTransformer
|
||||
'client_id' => $this->encodePrimaryKey($expense->client_id),
|
||||
'bank_id' => (string) $expense->bank_id ?: '',
|
||||
'invoice_currency_id' => (string) $expense->invoice_currency_id ?: '',
|
||||
'expense_currency_id' => (string) $expense->expense_currency_id ?: '',
|
||||
'expense_currency_id' => '', //todo remove redundant in 5.0.25
|
||||
'currency_id' => (string) $expense->expense_currency_id ?: '',
|
||||
'category_id' => $this->encodePrimaryKey($expense->category_id),
|
||||
'payment_type_id' => (string) $expense->payment_type_id ?: '',
|
||||
'recurring_expense_id' => (string) $expense->recurring_expense_id ?: '',
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeExpenseCurrencyIdColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('expenses', function(Blueprint $table){
|
||||
$table->renameColumn('expense_currency_id', 'currency_id');
|
||||
});
|
||||
|
||||
Schema::table('companies', function(Blueprint $table){
|
||||
$table->boolean('is_disabled')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
@ -50,6 +50,7 @@ class ImportTest extends TestCase
|
||||
$this->makeTestData();
|
||||
|
||||
$migration_file = base_path().'/tests/Unit/Migration/migration.json';
|
||||
|
||||
$this->migration_array = json_decode(file_get_contents($migration_file), 1);
|
||||
}
|
||||
|
||||
@ -60,6 +61,20 @@ class ImportTest extends TestCase
|
||||
$this->assertTrue($status);
|
||||
}
|
||||
|
||||
public function testAllImport()
|
||||
{
|
||||
|
||||
$this->invoice->forceDelete();
|
||||
$this->quote->forceDelete();
|
||||
|
||||
$this->user->setCompany($this->company);
|
||||
auth()->login($this->user, true);
|
||||
|
||||
Import::dispatchNow($this->migration_array, $this->company, $this->user);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
// public function testExceptionOnUnavailableResource()
|
||||
// {
|
||||
// $data['panda_bears'] = [
|
||||
@ -139,16 +154,7 @@ class ImportTest extends TestCase
|
||||
|
||||
// }
|
||||
|
||||
// public function testAllImport()
|
||||
// {
|
||||
|
||||
// $this->invoice->forceDelete();
|
||||
// $this->quote->forceDelete();
|
||||
|
||||
// Import::dispatchNow($this->migration_array, $this->company, $this->user);
|
||||
|
||||
// $this->assertTrue(true);
|
||||
// }
|
||||
|
||||
// public function testClientAttributes()
|
||||
// {
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user