1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Remove project name unique constraint

This commit is contained in:
David Bomba 2020-10-19 21:59:58 +11:00
parent 57e06cb2ec
commit a3afa8ede9
9 changed files with 102 additions and 41 deletions

View File

@ -220,6 +220,7 @@ class EmailTemplateDefaults
public static function emailReminder3Template()
{
return '';
// return Parsedown::instance()->line('Third Email Reminder Text');
}
@ -231,17 +232,20 @@ class EmailTemplateDefaults
public static function emailReminderEndlessTemplate()
{
return ctrans('Endless Email Reminder Text');
return '';
// return ctrans('');
}
public static function emailStatementSubject()
{
return ctrans('Statement Subject needs texts record!');
return '';
// return ctrans('');
}
public static function emailStatementTemplate()
{
return ctrans('Statement Templates needs texts record!');
return '';
// return ctrans('');
}
private static function transformText($string)

View File

@ -33,7 +33,16 @@ class ExpenseFactory
$expense->tax_rate3 = 0;
$expense->date = null;
$expense->payment_date = null;
$expense->amount = 0;
$expense->foreign_amount = 0;
$expense->private_notes = '';
$expense->public_notes = '';
$expense->transaction_reference = '';
$expense->custom_value1 = '';
$expense->custom_value2 = '';
$expense->custom_value3 = '';
$expense->custom_value4 = '';
return $expense;
}
}

View File

@ -60,10 +60,9 @@ class BaseController extends Controller
private $first_load = [
'account',
'user.company_user',
'token.company_user',
'company.activities',
'company.users.company_user',
'company.users.company_users',
'company.tax_rates',
'company.groups',
'company.company_gateways.gateway',
@ -203,60 +202,60 @@ class BaseController extends Controller
$updated_at = date('Y-m-d H:i:s', $updated_at);
$query->with(
[
[ 'user.company_users',
'company' => function ($query) use ($updated_at) {
$query->whereNotNull('updated_at')->with('documents');
},
'company.clients' => function ($query) use ($updated_at) {
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts', 'gateway_tokens','documents');
},
'company.tax_rates' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.groups' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens','documents','company');
},
'company.company_gateways' => function ($query) {
$query->whereNotNull('updated_at');
},
'company.products' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('documents');
'company.credits'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents',);
},
'company.recurring_invoices'=> function ($query) use ($updated_at) {
'company.designs'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('company');
},
'company.invoices'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'company', 'documents');
'company.documents'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.recurring_invoices'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'company', 'documents');
'company.expenses'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('documents' );
},
'company.groups' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.invoices'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
},
'company.payments'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('paymentables','documents');
},
'company.quotes'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
},
'company.credits'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
$query->where('updated_at', '>=', $updated_at)->with('paymentables','documents', );
},
'company.payment_terms'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.vendors'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('contacts');
},
'company.expenses'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.tasks'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
'company.products' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('documents');
},
'company.projects'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('documents' );
},
'company.quotes'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents',);
},
'company.recurring_invoices'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
},
'company.tasks'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('documents' );
},
'company.tax_rates' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
},
'company.designs'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('company');
'company.vendors'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('contacts','documents' );
},
]
);

View File

@ -53,7 +53,7 @@ class QueryLogging
Log::info($request->method().' - '.$request->url().": $count queries - ".$time);
// if($count > 50)
// Log::info($queries);
// Log::info($queries);
}
}

View File

@ -16,6 +16,7 @@ use App\Models\ClientContact;
use App\Models\Company;
use App\Models\CompanyToken;
use App\Models\User;
use Illuminate\Support\Str;
/**
* Class MultiDB.
@ -237,7 +238,7 @@ class MultiDB
public static function findAndSetDbByInvitation($entity, $invitation_key)
{
$class = 'App\Models\\'.ucfirst($entity).'Invitation';
$class = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
foreach (self::$dbs as $db) {
if ($invite = $class::on($db)->whereRaw('BINARY `key`= ?', [$invitation_key])->first()) {

View File

@ -28,7 +28,6 @@ class InvoiceInvitation extends BaseModel
use Inviteable;
protected $fillable = [
//'key',
'client_contact_id',
];

View File

@ -69,5 +69,16 @@ class RecurringInvoiceInvitation extends BaseModel
return $this->belongsTo(Company::class);
}
public function markViewed()
{
$this->viewed_date = Carbon::now();
$this->save();
}
public function markOpened()
{
$this->opened_date = Carbon::now();
$this->save();
}
}

View File

@ -23,6 +23,7 @@ class ExpenseTransformer extends EntityTransformer
{
use MakesHash;
use SoftDeletes;
protected $defaultIncludes = [
'documents',
];

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ProjectNameUniqueRemoval extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('projects', function (Blueprint $table) {
$table->dropUnique('projects_company_id_name_unique');
});
Schema::table('expenses', function (Blueprint $table) {
$table->unsignedInteger('invoice_currency_id')->nullable()->change();
$table->unsignedInteger('expense_currency_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}