mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge remote-tracking branch 'upstream/develop' into wepay-integration
This commit is contained in:
commit
6ddbbbc64d
@ -18,7 +18,7 @@ class AddDocuments extends Migration {
|
|||||||
$table->boolean('invoice_embed_documents')->default(1);
|
$table->boolean('invoice_embed_documents')->default(1);
|
||||||
$table->boolean('document_email_attachment')->default(1);
|
$table->boolean('document_email_attachment')->default(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
\DB::table('accounts')->update(array('logo' => ''));
|
\DB::table('accounts')->update(array('logo' => ''));
|
||||||
Schema::dropIfExists('documents');
|
Schema::dropIfExists('documents');
|
||||||
Schema::create('documents', function($t)
|
Schema::create('documents', function($t)
|
||||||
@ -41,14 +41,14 @@ class AddDocuments extends Migration {
|
|||||||
|
|
||||||
$t->timestamps();
|
$t->timestamps();
|
||||||
|
|
||||||
$t->foreign('account_id')->references('id')->on('accounts');
|
$t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||||
$t->foreign('user_id')->references('id')->on('users');
|
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||||
$t->foreign('invoice_id')->references('id')->on('invoices');
|
$t->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
||||||
$t->foreign('expense_id')->references('id')->on('expenses');
|
$t->foreign('expense_id')->references('id')->on('expenses')->onDelete('cascade');
|
||||||
|
|
||||||
|
|
||||||
$t->unique( array('account_id','public_id') );
|
$t->unique( array('account_id','public_id') );
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
@ -65,7 +65,7 @@ class AddDocuments extends Migration {
|
|||||||
$table->dropColumn('invoice_embed_documents');
|
$table->dropColumn('invoice_embed_documents');
|
||||||
$table->dropColumn('document_email_attachment');
|
$table->dropColumn('document_email_attachment');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::dropIfExists('documents');
|
Schema::dropIfExists('documents');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1311,6 +1311,7 @@ $LANG = array(
|
|||||||
'new_start_date' => 'New start date',
|
'new_start_date' => 'New start date',
|
||||||
'security' => 'Security',
|
'security' => 'Security',
|
||||||
'see_whats_new' => 'See what\'s new in v:version',
|
'see_whats_new' => 'See what\'s new in v:version',
|
||||||
|
'wait_for_upload' => 'Please wait for the document upload to complete.',
|
||||||
|
|
||||||
'view_dashboard' => 'View Dashboard',
|
'view_dashboard' => 'View Dashboard',
|
||||||
'client_session_expired' => 'Session Expired',
|
'client_session_expired' => 'Session Expired',
|
||||||
|
@ -249,7 +249,7 @@
|
|||||||
public_id:document.public_id(),
|
public_id:document.public_id(),
|
||||||
status:Dropzone.SUCCESS,
|
status:Dropzone.SUCCESS,
|
||||||
accepted:true,
|
accepted:true,
|
||||||
url:document.preview_url()||document.url(),
|
url:document.url(),
|
||||||
mock:true,
|
mock:true,
|
||||||
index:i
|
index:i
|
||||||
};
|
};
|
||||||
|
@ -998,47 +998,59 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Initialize document upload
|
// Initialize document upload
|
||||||
dropzone = new Dropzone('#document-upload .dropzone', {
|
window.dropzone = false;
|
||||||
url:{!! json_encode(url('document')) !!},
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
params:{
|
if (window.dropzone) {
|
||||||
_token:"{{ Session::getToken() }}"
|
return;
|
||||||
},
|
|
||||||
acceptedFiles:{!! json_encode(implode(',',\App\Models\Document::$allowedMimes)) !!},
|
|
||||||
addRemoveLinks:true,
|
|
||||||
@foreach(['default_message', 'fallback_message', 'fallback_text', 'file_too_big', 'invalid_file_type', 'response_error', 'cancel_upload', 'cancel_upload_confirmation', 'remove_file'] as $key)
|
|
||||||
"dict{{Utils::toClassCase($key)}}":"{{trans('texts.dropzone_'.$key)}}",
|
|
||||||
@endforeach
|
|
||||||
maxFileSize:{{floatval(MAX_DOCUMENT_SIZE/1000)}},
|
|
||||||
});
|
|
||||||
if(dropzone instanceof Dropzone){
|
|
||||||
dropzone.on("addedfile",handleDocumentAdded);
|
|
||||||
dropzone.on("removedfile",handleDocumentRemoved);
|
|
||||||
dropzone.on("success",handleDocumentUploaded);
|
|
||||||
for (var i=0; i<model.invoice().documents().length; i++) {
|
|
||||||
var document = model.invoice().documents()[i];
|
|
||||||
var mockFile = {
|
|
||||||
name:document.name(),
|
|
||||||
size:document.size(),
|
|
||||||
type:document.type(),
|
|
||||||
public_id:document.public_id(),
|
|
||||||
status:Dropzone.SUCCESS,
|
|
||||||
accepted:true,
|
|
||||||
url:document.preview_url()||document.url(),
|
|
||||||
mock:true,
|
|
||||||
index:i
|
|
||||||
};
|
|
||||||
|
|
||||||
dropzone.emit('addedfile', mockFile);
|
|
||||||
dropzone.emit('complete', mockFile);
|
|
||||||
if(document.preview_url()){
|
|
||||||
dropzone.emit('thumbnail', mockFile, document.preview_url()||document.url());
|
|
||||||
}
|
|
||||||
else if(document.type()=='jpeg' || document.type()=='png' || document.type()=='svg'){
|
|
||||||
dropzone.emit('thumbnail', mockFile, document.url());
|
|
||||||
}
|
|
||||||
dropzone.files.push(mockFile);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
var target = $(e.target).attr('href') // activated tab
|
||||||
|
if (target != '#attached-documents') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.dropzone = new Dropzone('#document-upload .dropzone', {
|
||||||
|
url:{!! json_encode(url('document')) !!},
|
||||||
|
params:{
|
||||||
|
_token:"{{ Session::getToken() }}"
|
||||||
|
},
|
||||||
|
acceptedFiles:{!! json_encode(implode(',',\App\Models\Document::$allowedMimes)) !!},
|
||||||
|
addRemoveLinks:true,
|
||||||
|
@foreach(['default_message', 'fallback_message', 'fallback_text', 'file_too_big', 'invalid_file_type', 'response_error', 'cancel_upload', 'cancel_upload_confirmation', 'remove_file'] as $key)
|
||||||
|
"dict{{Utils::toClassCase($key)}}":"{{trans('texts.dropzone_'.$key)}}",
|
||||||
|
@endforeach
|
||||||
|
maxFileSize:{{floatval(MAX_DOCUMENT_SIZE/1000)}},
|
||||||
|
});
|
||||||
|
if(dropzone instanceof Dropzone){
|
||||||
|
dropzone.on("addedfile",handleDocumentAdded);
|
||||||
|
dropzone.on("removedfile",handleDocumentRemoved);
|
||||||
|
dropzone.on("success",handleDocumentUploaded);
|
||||||
|
for (var i=0; i<model.invoice().documents().length; i++) {
|
||||||
|
var document = model.invoice().documents()[i];
|
||||||
|
var mockFile = {
|
||||||
|
name:document.name(),
|
||||||
|
size:document.size(),
|
||||||
|
type:document.type(),
|
||||||
|
public_id:document.public_id(),
|
||||||
|
status:Dropzone.SUCCESS,
|
||||||
|
accepted:true,
|
||||||
|
url:document.url(),
|
||||||
|
mock:true,
|
||||||
|
index:i
|
||||||
|
};
|
||||||
|
|
||||||
|
dropzone.emit('addedfile', mockFile);
|
||||||
|
dropzone.emit('complete', mockFile);
|
||||||
|
if(document.preview_url()){
|
||||||
|
dropzone.emit('thumbnail', mockFile, document.preview_url());
|
||||||
|
}
|
||||||
|
else if(document.type()=='jpeg' || document.type()=='png' || document.type()=='svg'){
|
||||||
|
dropzone.emit('thumbnail', mockFile, document.url());
|
||||||
|
}
|
||||||
|
dropzone.files.push(mockFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1222,7 +1234,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preparePdfData('');
|
submitAction('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSendToEmails() {
|
function getSendToEmails() {
|
||||||
@ -1257,6 +1269,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onFormSubmit(event) {
|
function onFormSubmit(event) {
|
||||||
|
if (window.countUploadingDocuments > 0) {
|
||||||
|
alert("{!! trans('texts.wait_for_upload') !!}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isSaveValid()) {
|
if (!isSaveValid()) {
|
||||||
model.showClientForm();
|
model.showClientForm();
|
||||||
return false;
|
return false;
|
||||||
@ -1431,6 +1448,7 @@
|
|||||||
model.invoice().invoice_number(number);
|
model.invoice().invoice_number(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.countUploadingDocuments = 0;
|
||||||
@if ($account->hasFeature(FEATURE_DOCUMENTS))
|
@if ($account->hasFeature(FEATURE_DOCUMENTS))
|
||||||
function handleDocumentAdded(file){
|
function handleDocumentAdded(file){
|
||||||
// open document when clicked
|
// open document when clicked
|
||||||
@ -1442,6 +1460,7 @@
|
|||||||
if(file.mock)return;
|
if(file.mock)return;
|
||||||
file.index = model.invoice().documents().length;
|
file.index = model.invoice().documents().length;
|
||||||
model.invoice().addDocument({name:file.name, size:file.size, type:file.type});
|
model.invoice().addDocument({name:file.name, size:file.size, type:file.type});
|
||||||
|
window.countUploadingDocuments++;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDocumentRemoved(file){
|
function handleDocumentRemoved(file){
|
||||||
@ -1452,6 +1471,7 @@
|
|||||||
function handleDocumentUploaded(file, response){
|
function handleDocumentUploaded(file, response){
|
||||||
file.public_id = response.document.public_id
|
file.public_id = response.document.public_id
|
||||||
model.invoice().documents()[file.index].update(response.document);
|
model.invoice().documents()[file.index].update(response.document);
|
||||||
|
window.countUploadingDocuments--;
|
||||||
refreshPDF(true);
|
refreshPDF(true);
|
||||||
|
|
||||||
if(response.document.preview_url){
|
if(response.document.preview_url){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user