mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added and removed extra lables from activity messages
This commit is contained in:
parent
df3a103825
commit
b111adaf17
@ -60,7 +60,7 @@ class PublicClientController extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Input::has('phantomjs') && !Input::has('silent') && !Session::has($invitationKey)
|
if (!Input::has('phantomjs') && !Input::has('silent') && !Session::has($invitationKey)
|
||||||
&& (!Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
|
&& (!Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
|
||||||
if ($invoice->is_quote) {
|
if ($invoice->is_quote) {
|
||||||
event(new QuoteInvitationWasViewed($invoice, $invitation));
|
event(new QuoteInvitationWasViewed($invoice, $invitation));
|
||||||
@ -73,7 +73,7 @@ class PublicClientController extends BaseController
|
|||||||
Session::put('invitation_key', $invitationKey); // track current invitation
|
Session::put('invitation_key', $invitationKey); // track current invitation
|
||||||
|
|
||||||
$account->loadLocalizationSettings($client);
|
$account->loadLocalizationSettings($client);
|
||||||
|
|
||||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||||
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||||
$invoice->features = [
|
$invoice->features = [
|
||||||
@ -82,7 +82,7 @@ class PublicClientController extends BaseController
|
|||||||
'invoice_settings' => $account->hasFeature(FEATURE_INVOICE_SETTINGS),
|
'invoice_settings' => $account->hasFeature(FEATURE_INVOICE_SETTINGS),
|
||||||
];
|
];
|
||||||
$invoice->invoice_fonts = $account->getFontsData();
|
$invoice->invoice_fonts = $account->getFontsData();
|
||||||
|
|
||||||
if ($invoice->invoice_design_id == CUSTOM_DESIGN) {
|
if ($invoice->invoice_design_id == CUSTOM_DESIGN) {
|
||||||
$invoice->invoice_design->javascript = $account->custom_design;
|
$invoice->invoice_design->javascript = $account->custom_design;
|
||||||
} else {
|
} else {
|
||||||
@ -149,10 +149,10 @@ class PublicClientController extends BaseController
|
|||||||
'checkoutComDebug' => $checkoutComDebug,
|
'checkoutComDebug' => $checkoutComDebug,
|
||||||
'phantomjs' => Input::has('phantomjs'),
|
'phantomjs' => Input::has('phantomjs'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if($account->hasFeature(FEATURE_DOCUMENTS) && $this->canCreateZip()){
|
if($account->hasFeature(FEATURE_DOCUMENTS) && $this->canCreateZip()){
|
||||||
$zipDocs = $this->getInvoiceZipDocuments($invoice, $size);
|
$zipDocs = $this->getInvoiceZipDocuments($invoice, $size);
|
||||||
|
|
||||||
if(count($zipDocs) > 1){
|
if(count($zipDocs) > 1){
|
||||||
$data['documentsZipURL'] = URL::to("client/documents/{$invitation->invitation_key}");
|
$data['documentsZipURL'] = URL::to("client/documents/{$invitation->invitation_key}");
|
||||||
$data['documentsZipSize'] = $size;
|
$data['documentsZipSize'] = $size;
|
||||||
@ -173,6 +173,7 @@ class PublicClientController extends BaseController
|
|||||||
foreach ($paymentMethods as $paymentMethod) {
|
foreach ($paymentMethods as $paymentMethod) {
|
||||||
if ($paymentMethod->payment_type_id != PAYMENT_TYPE_ACH || $paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFIED) {
|
if ($paymentMethod->payment_type_id != PAYMENT_TYPE_ACH || $paymentMethod->status == PAYMENT_METHOD_STATUS_VERIFIED) {
|
||||||
$code = htmlentities(str_replace(' ', '', strtolower($paymentMethod->payment_type->name)));
|
$code = htmlentities(str_replace(' ', '', strtolower($paymentMethod->payment_type->name)));
|
||||||
|
$html = '';
|
||||||
|
|
||||||
if ($paymentMethod->payment_type_id == PAYMENT_TYPE_ACH) {
|
if ($paymentMethod->payment_type_id == PAYMENT_TYPE_ACH) {
|
||||||
if($paymentMethod->bank_data) {
|
if($paymentMethod->bank_data) {
|
||||||
@ -301,7 +302,7 @@ class PublicClientController extends BaseController
|
|||||||
$data['braintreeClientToken'] = $this->paymentService->getBraintreeClientToken($account);
|
$data['braintreeClientToken'] = $this->paymentService->getBraintreeClientToken($account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->view('invited.dashboard', $data);
|
return response()->view('invited.dashboard', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,9 +322,9 @@ class PublicClientController extends BaseController
|
|||||||
$data = [
|
$data = [
|
||||||
'client' => Utils::getClientDisplayName($model),
|
'client' => Utils::getClientDisplayName($model),
|
||||||
'user' => $model->is_system ? ('<i>' . trans('texts.system') . '</i>') : ($model->user_first_name . ' ' . $model->user_last_name),
|
'user' => $model->is_system ? ('<i>' . trans('texts.system') . '</i>') : ($model->user_first_name . ' ' . $model->user_last_name),
|
||||||
'invoice' => trans('texts.invoice') . ' ' . $model->invoice,
|
'invoice' => $model->invoice,
|
||||||
'contact' => Utils::getClientDisplayName($model),
|
'contact' => Utils::getClientDisplayName($model),
|
||||||
'payment' => trans('texts.payment') . ($model->payment ? ' ' . $model->payment : ''),
|
'payment' => $model->payment ? ' ' . $model->payment : '',
|
||||||
'credit' => $model->payment_amount ? Utils::formatMoney($model->credit, $model->currency_id, $model->country_id) : '',
|
'credit' => $model->payment_amount ? Utils::formatMoney($model->credit, $model->currency_id, $model->country_id) : '',
|
||||||
'payment_amount' => $model->payment_amount ? Utils::formatMoney($model->payment_amount, $model->currency_id, $model->country_id) : null,
|
'payment_amount' => $model->payment_amount ? Utils::formatMoney($model->payment_amount, $model->currency_id, $model->country_id) : null,
|
||||||
'adjustment' => $model->adjustment ? Utils::formatMoney($model->adjustment, $model->currency_id, $model->country_id) : null,
|
'adjustment' => $model->adjustment ? Utils::formatMoney($model->adjustment, $model->currency_id, $model->country_id) : null,
|
||||||
@ -349,7 +350,7 @@ class PublicClientController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'color' => $color,
|
'color' => $color,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
@ -420,7 +421,7 @@ class PublicClientController extends BaseController
|
|||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
||||||
$data = [
|
$data = [
|
||||||
'color' => $color,
|
'color' => $color,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
@ -469,7 +470,7 @@ class PublicClientController extends BaseController
|
|||||||
->orderColumns( 'invoice_number', 'transaction_reference', 'payment_type', 'amount', 'payment_date')
|
->orderColumns( 'invoice_number', 'transaction_reference', 'payment_type', 'amount', 'payment_date')
|
||||||
->make();
|
->make();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPaymentStatusLabel($model)
|
private function getPaymentStatusLabel($model)
|
||||||
{
|
{
|
||||||
$label = trans("texts.status_" . strtolower($model->payment_status_name));
|
$label = trans("texts.status_" . strtolower($model->payment_status_name));
|
||||||
@ -544,7 +545,7 @@ class PublicClientController extends BaseController
|
|||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
||||||
$data = [
|
$data = [
|
||||||
'color' => $color,
|
'color' => $color,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
@ -597,55 +598,55 @@ class PublicClientController extends BaseController
|
|||||||
|
|
||||||
return $invitation;
|
return $invitation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDocumentVFSJS($publicId, $name){
|
public function getDocumentVFSJS($publicId, $name){
|
||||||
if (!$invitation = $this->getInvitation()) {
|
if (!$invitation = $this->getInvitation()) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
$clientId = $invitation->invoice->client_id;
|
$clientId = $invitation->invoice->client_id;
|
||||||
$document = Document::scope($publicId, $invitation->account_id)->first();
|
$document = Document::scope($publicId, $invitation->account_id)->first();
|
||||||
|
|
||||||
|
|
||||||
if(!$document->isPDFEmbeddable()){
|
if(!$document->isPDFEmbeddable()){
|
||||||
return Response::view('error', array('error'=>'Image does not exist!'), 404);
|
return Response::view('error', array('error'=>'Image does not exist!'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$authorized = false;
|
$authorized = false;
|
||||||
if($document->expense && $document->expense->client_id == $invitation->invoice->client_id){
|
if($document->expense && $document->expense->client_id == $invitation->invoice->client_id){
|
||||||
$authorized = true;
|
$authorized = true;
|
||||||
} else if($document->invoice && $document->invoice->client_id == $invitation->invoice->client_id){
|
} else if($document->invoice && $document->invoice->client_id == $invitation->invoice->client_id){
|
||||||
$authorized = true;
|
$authorized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$authorized){
|
if(!$authorized){
|
||||||
return Response::view('error', array('error'=>'Not authorized'), 403);
|
return Response::view('error', array('error'=>'Not authorized'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr($name, -3)=='.js'){
|
if(substr($name, -3)=='.js'){
|
||||||
$name = substr($name, 0, -3);
|
$name = substr($name, 0, -3);
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = $document->preview?$document->getRawPreview():$document->getRaw();
|
$content = $document->preview?$document->getRawPreview():$document->getRaw();
|
||||||
$content = 'ninjaAddVFSDoc('.json_encode(intval($publicId).'/'.strval($name)).',"'.base64_encode($content).'")';
|
$content = 'ninjaAddVFSDoc('.json_encode(intval($publicId).'/'.strval($name)).',"'.base64_encode($content).'")';
|
||||||
$response = Response::make($content, 200);
|
$response = Response::make($content, 200);
|
||||||
$response->header('content-type', 'text/javascript');
|
$response->header('content-type', 'text/javascript');
|
||||||
$response->header('cache-control', 'max-age=31536000');
|
$response->header('cache-control', 'max-age=31536000');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function canCreateZip(){
|
protected function canCreateZip(){
|
||||||
return function_exists('gmp_init');
|
return function_exists('gmp_init');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getInvoiceZipDocuments($invoice, &$size=0){
|
protected function getInvoiceZipDocuments($invoice, &$size=0){
|
||||||
$documents = $invoice->documents;
|
$documents = $invoice->documents;
|
||||||
|
|
||||||
foreach($invoice->expenses as $expense){
|
foreach($invoice->expenses as $expense){
|
||||||
$documents = $documents->merge($expense->documents);
|
$documents = $documents->merge($expense->documents);
|
||||||
}
|
}
|
||||||
|
|
||||||
$documents = $documents->sortBy('size');
|
$documents = $documents->sortBy('size');
|
||||||
|
|
||||||
$size = 0;
|
$size = 0;
|
||||||
@ -653,16 +654,16 @@ class PublicClientController extends BaseController
|
|||||||
$toZip = array();
|
$toZip = array();
|
||||||
foreach($documents as $document){
|
foreach($documents as $document){
|
||||||
if($size + $document->size > $maxSize)break;
|
if($size + $document->size > $maxSize)break;
|
||||||
|
|
||||||
if(!empty($toZip[$document->name])){
|
if(!empty($toZip[$document->name])){
|
||||||
// This name is taken
|
// This name is taken
|
||||||
if($toZip[$document->name]->hash != $document->hash){
|
if($toZip[$document->name]->hash != $document->hash){
|
||||||
// 2 different files with the same name
|
// 2 different files with the same name
|
||||||
$nameInfo = pathinfo($document->name);
|
$nameInfo = pathinfo($document->name);
|
||||||
|
|
||||||
for($i = 1;; $i++){
|
for($i = 1;; $i++){
|
||||||
$name = $nameInfo['filename'].' ('.$i.').'.$nameInfo['extension'];
|
$name = $nameInfo['filename'].' ('.$i.').'.$nameInfo['extension'];
|
||||||
|
|
||||||
if(empty($toZip[$name])){
|
if(empty($toZip[$name])){
|
||||||
$toZip[$name] = $document;
|
$toZip[$name] = $document;
|
||||||
$size += $document->size;
|
$size += $document->size;
|
||||||
@ -672,7 +673,7 @@ class PublicClientController extends BaseController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -680,25 +681,25 @@ class PublicClientController extends BaseController
|
|||||||
$size += $document->size;
|
$size += $document->size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $toZip;
|
return $toZip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInvoiceDocumentsZip($invitationKey){
|
public function getInvoiceDocumentsZip($invitationKey){
|
||||||
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::put('invitation_key', $invitationKey); // track current invitation
|
Session::put('invitation_key', $invitationKey); // track current invitation
|
||||||
|
|
||||||
$invoice = $invitation->invoice;
|
$invoice = $invitation->invoice;
|
||||||
|
|
||||||
$toZip = $this->getInvoiceZipDocuments($invoice);
|
$toZip = $this->getInvoiceZipDocuments($invoice);
|
||||||
|
|
||||||
if(!count($toZip)){
|
if(!count($toZip)){
|
||||||
return Response::view('error', array('error'=>'No documents small enough'), 404);
|
return Response::view('error', array('error'=>'No documents small enough'), 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$zip = new ZipArchive($invitation->account->name.' Invoice '.$invoice->invoice_number.'.zip');
|
$zip = new ZipArchive($invitation->account->name.' Invoice '.$invoice->invoice_number.'.zip');
|
||||||
return Response::stream(function() use ($toZip, $zip) {
|
return Response::stream(function() use ($toZip, $zip) {
|
||||||
foreach($toZip as $name=>$document){
|
foreach($toZip as $name=>$document){
|
||||||
@ -716,28 +717,28 @@ class PublicClientController extends BaseController
|
|||||||
$zip->finish();
|
$zip->finish();
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDocument($invitationKey, $publicId){
|
public function getDocument($invitationKey, $publicId){
|
||||||
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
if (!$invitation = $this->invoiceRepo->findInvoiceByInvitation($invitationKey)) {
|
||||||
return $this->returnError();
|
return $this->returnError();
|
||||||
}
|
}
|
||||||
|
|
||||||
Session::put('invitation_key', $invitationKey); // track current invitation
|
Session::put('invitation_key', $invitationKey); // track current invitation
|
||||||
|
|
||||||
$clientId = $invitation->invoice->client_id;
|
$clientId = $invitation->invoice->client_id;
|
||||||
$document = Document::scope($publicId, $invitation->account_id)->firstOrFail();
|
$document = Document::scope($publicId, $invitation->account_id)->firstOrFail();
|
||||||
|
|
||||||
$authorized = false;
|
$authorized = false;
|
||||||
if($document->expense && $document->expense->client_id == $invitation->invoice->client_id){
|
if($document->expense && $document->expense->client_id == $invitation->invoice->client_id){
|
||||||
$authorized = true;
|
$authorized = true;
|
||||||
} else if($document->invoice && $document->invoice->client_id == $invitation->invoice->client_id){
|
} else if($document->invoice && $document->invoice->client_id == $invitation->invoice->client_id){
|
||||||
$authorized = true;
|
$authorized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$authorized){
|
if(!$authorized){
|
||||||
return Response::view('error', array('error'=>'Not authorized'), 403);
|
return Response::view('error', array('error'=>'Not authorized'), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DocumentController::getDownloadResponse($document);
|
return DocumentController::getDownloadResponse($document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user