mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
88c7f0436b
@ -1 +1 @@
|
|||||||
5.6.4
|
5.6.5
|
@ -48,7 +48,6 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
$this->tax_rate1 = $item->tax_rate1;
|
$this->tax_rate1 = $item->tax_rate1;
|
||||||
|
|
||||||
$this->tax_name1 = $item->tax_name1;
|
$this->tax_name1 = $item->tax_name1;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -117,6 +116,9 @@ class Rule extends BaseRule implements RuleInterface
|
|||||||
if(in_array($this->tax_data?->txbService,['Y','L'])) {
|
if(in_array($this->tax_data?->txbService,['Y','L'])) {
|
||||||
$this->default($item);
|
$this->default($item);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$this->taxExempt($item);
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,24 @@ class ExpenseFilters extends QueryFilters
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter expenses that only have invoices
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
public function has_invoices(string $value = ''): Builder
|
public function has_invoices(string $value = ''): Builder
|
||||||
{
|
{
|
||||||
if ($value == 'true') {
|
$split = explode(",", $value);
|
||||||
return $this->builder->whereNotNull('invoice_id');
|
|
||||||
|
if (is_array($split) && in_array($split[0], ['client', 'project'])) {
|
||||||
|
|
||||||
|
$search_key = $split[0] == 'client' ? 'client_id' : 'project_id';
|
||||||
|
|
||||||
|
return $this->builder->whereHas('invoice', function ($query) use ($search_key, $split){
|
||||||
|
$query->where($search_key, $this->decodePrimaryKey($split[1]))
|
||||||
|
->whereIn('status_id', [\App\Models\Invoice::STATUS_DRAFT, \App\Models\Invoice::STATUS_SENT, \App\Models\Invoice::STATUS_PARTIAL]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->builder;
|
return $this->builder;
|
||||||
|
@ -90,14 +90,15 @@ class ConnectedAccountController extends BaseController
|
|||||||
|
|
||||||
private function handleMicrosoftOauth($request)
|
private function handleMicrosoftOauth($request)
|
||||||
{
|
{
|
||||||
nlog($request->all());
|
$access_token = false;
|
||||||
|
$access_token = $request->has('access_token') ? $request->input('access_token') : $request->input('accessToken');
|
||||||
|
|
||||||
if (!$request->has('access_token')) {
|
if (!$access_token) {
|
||||||
return response()->json(['message' => 'No access_token parameter found!'], 400);
|
return response()->json(['message' => 'No access_token parameter found!'], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = new \Microsoft\Graph\Graph();
|
$graph = new \Microsoft\Graph\Graph();
|
||||||
$graph->setAccessToken($request->input('access_token'));
|
$graph->setAccessToken($access_token);
|
||||||
|
|
||||||
$user = $graph->createRequest("GET", "/me")
|
$user = $graph->createRequest("GET", "/me")
|
||||||
->setReturnType(Model\User::class)
|
->setReturnType(Model\User::class)
|
||||||
|
@ -408,7 +408,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoice->service()
|
$invoice->service()
|
||||||
->triggeredActions($request)
|
->triggeredActions($request)
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->adjustInventory($old_invoice);
|
->adjustInventory($old_invoice);
|
||||||
|
|
||||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
@ -740,7 +740,8 @@ class InvoiceController extends BaseController
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'cancel':
|
case 'cancel':
|
||||||
$invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
$invoice = $invoice->service()->handleCancellation()->deletePdf()->save();
|
||||||
|
// $invoice = $invoice->service()->handleCancellation()->touchPdf()->save();
|
||||||
|
|
||||||
if (! $bulk) {
|
if (! $bulk) {
|
||||||
$this->itemResponse($invoice);
|
$this->itemResponse($invoice);
|
||||||
|
@ -362,7 +362,7 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
$this->invoice
|
$this->invoice
|
||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
|
@ -243,19 +243,20 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
case 'gmail':
|
case 'gmail':
|
||||||
$this->mailer = 'gmail';
|
$this->mailer = 'gmail';
|
||||||
$this->setGmailMailer();
|
$this->setGmailMailer();
|
||||||
return;
|
return $this;
|
||||||
case 'office365':
|
case 'office365':
|
||||||
|
case 'microsoft':
|
||||||
$this->mailer = 'office365';
|
$this->mailer = 'office365';
|
||||||
$this->setOfficeMailer();
|
$this->setOfficeMailer();
|
||||||
return;
|
return $this;
|
||||||
case 'client_postmark':
|
case 'client_postmark':
|
||||||
$this->mailer = 'postmark';
|
$this->mailer = 'postmark';
|
||||||
$this->setPostmarkMailer();
|
$this->setPostmarkMailer();
|
||||||
return;
|
return $this;
|
||||||
case 'client_mailgun':
|
case 'client_mailgun':
|
||||||
$this->mailer = 'mailgun';
|
$this->mailer = 'mailgun';
|
||||||
$this->setMailgunMailer();
|
$this->setMailgunMailer();
|
||||||
return;
|
return $this;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -264,6 +265,8 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
if (Ninja::isSelfHost()) {
|
if (Ninja::isSelfHost()) {
|
||||||
$this->setSelfHostMultiMailer();
|
$this->setSelfHostMultiMailer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,85 +11,89 @@
|
|||||||
|
|
||||||
namespace App\Jobs\Util;
|
namespace App\Jobs\Util;
|
||||||
|
|
||||||
use App\DataMapper\Analytics\MigrationFailure;
|
use Exception;
|
||||||
use App\DataMapper\CompanySettings;
|
use App\Models\Task;
|
||||||
use App\Exceptions\ClientHostedMigrationException;
|
use App\Models\User;
|
||||||
use App\Exceptions\MigrationValidatorFailed;
|
use App\Utils\Ninja;
|
||||||
use App\Exceptions\ResourceDependencyMissing;
|
use App\Models\Quote;
|
||||||
|
use App\Models\Client;
|
||||||
|
use App\Models\Credit;
|
||||||
|
use App\Models\Vendor;
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Expense;
|
||||||
|
use App\Models\Invoice;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\Product;
|
||||||
|
use App\Models\Project;
|
||||||
|
use App\Models\TaxRate;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Models\Document;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\TaskStatus;
|
||||||
|
use App\Models\PaymentTerm;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use App\Factory\UserFactory;
|
||||||
|
use App\Factory\QuoteFactory;
|
||||||
|
use App\Models\ClientContact;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
use App\Factory\ClientFactory;
|
use App\Factory\ClientFactory;
|
||||||
use App\Factory\CompanyLedgerFactory;
|
|
||||||
use App\Factory\CreditFactory;
|
use App\Factory\CreditFactory;
|
||||||
|
use App\Factory\VendorFactory;
|
||||||
|
use App\Models\CompanyGateway;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
use App\Factory\InvoiceFactory;
|
use App\Factory\InvoiceFactory;
|
||||||
use App\Factory\PaymentFactory;
|
use App\Factory\PaymentFactory;
|
||||||
use App\Factory\ProductFactory;
|
use App\Factory\ProductFactory;
|
||||||
use App\Factory\QuoteFactory;
|
|
||||||
use App\Factory\RecurringInvoiceFactory;
|
|
||||||
use App\Factory\TaxRateFactory;
|
use App\Factory\TaxRateFactory;
|
||||||
use App\Factory\UserFactory;
|
use App\Jobs\Util\VersionCheck;
|
||||||
use App\Factory\VendorFactory;
|
|
||||||
use App\Http\Requests\Company\UpdateCompanyRequest;
|
|
||||||
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
|
||||||
use App\Http\ValidationRules\ValidUserForCompany;
|
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
|
||||||
use App\Jobs\Mail\NinjaMailerJob;
|
|
||||||
use App\Jobs\Mail\NinjaMailerObject;
|
|
||||||
use App\Jobs\Ninja\CheckCompanyData;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Mail\Migration\StripeConnectMigration;
|
|
||||||
use App\Mail\MigrationCompleted;
|
|
||||||
use App\Models\Activity;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\ClientContact;
|
|
||||||
use App\Models\ClientGatewayToken;
|
|
||||||
use App\Models\Company;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\Credit;
|
|
||||||
use App\Models\Document;
|
|
||||||
use App\Models\Expense;
|
|
||||||
use App\Models\ExpenseCategory;
|
use App\Models\ExpenseCategory;
|
||||||
use App\Models\Invoice;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Models\Payment;
|
use App\Mail\MigrationCompleted;
|
||||||
use App\Models\PaymentTerm;
|
|
||||||
use App\Models\Product;
|
|
||||||
use App\Models\Project;
|
|
||||||
use App\Models\Quote;
|
|
||||||
use App\Models\RecurringExpense;
|
use App\Models\RecurringExpense;
|
||||||
use App\Models\RecurringInvoice;
|
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;
|
|
||||||
use App\Repositories\CreditRepository;
|
|
||||||
use App\Repositories\Migration\InvoiceMigrationRepository;
|
|
||||||
use App\Repositories\Migration\PaymentMigrationRepository;
|
|
||||||
use App\Repositories\ProductRepository;
|
|
||||||
use App\Repositories\UserRepository;
|
|
||||||
use App\Repositories\VendorContactRepository;
|
|
||||||
use App\Repositories\VendorRepository;
|
|
||||||
use App\Utils\Ninja;
|
|
||||||
use App\Utils\Traits\CleanLineItems;
|
|
||||||
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
use App\Utils\Traits\SavesDocuments;
|
|
||||||
use App\Utils\Traits\Uploadable;
|
use App\Utils\Traits\Uploadable;
|
||||||
use Exception;
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Http\UploadedFile;
|
||||||
|
use App\Models\ClientGatewayToken;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\DataMapper\CompanySettings;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Jobs\Ninja\CheckCompanyData;
|
||||||
|
use App\Repositories\UserRepository;
|
||||||
|
use App\Utils\Traits\CleanLineItems;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Factory\CompanyLedgerFactory;
|
||||||
|
use App\Repositories\ClientRepository;
|
||||||
|
use App\Repositories\CreditRepository;
|
||||||
|
use App\Repositories\VendorRepository;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Turbo124\Beacon\Facades\LightLogs;
|
||||||
|
use App\Repositories\CompanyRepository;
|
||||||
|
use App\Repositories\ProductRepository;
|
||||||
|
use App\Factory\RecurringInvoiceFactory;
|
||||||
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Modules\Admin\Jobs\Account\NinjaUser;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Http\UploadedFile;
|
use App\DataMapper\ClientRegistrationFields;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use App\Exceptions\MigrationValidatorFailed;
|
||||||
|
use App\Exceptions\ResourceDependencyMissing;
|
||||||
|
use App\Repositories\ClientContactRepository;
|
||||||
|
use App\Repositories\VendorContactRepository;
|
||||||
|
use App\DataMapper\Analytics\MigrationFailure;
|
||||||
|
use App\Mail\Migration\StripeConnectMigration;
|
||||||
|
use App\Http\ValidationRules\ValidUserForCompany;
|
||||||
|
use App\Exceptions\ClientHostedMigrationException;
|
||||||
|
use App\Http\Requests\Company\UpdateCompanyRequest;
|
||||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver;
|
||||||
use Illuminate\Support\Carbon;
|
use App\Repositories\Migration\InvoiceMigrationRepository;
|
||||||
use Illuminate\Support\Facades\App;
|
use App\Repositories\Migration\PaymentMigrationRepository;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Turbo124\Beacon\Facades\LightLogs;
|
|
||||||
|
|
||||||
class Import implements ShouldQueue
|
class Import implements ShouldQueue
|
||||||
{
|
{
|
||||||
@ -1505,7 +1509,19 @@ class Import implements ShouldQueue
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->saveDocument($uploaded_file, $entity, $is_public = true);
|
// $this->saveDocument($uploaded_file, $entity, $is_public = true);
|
||||||
|
|
||||||
|
$document = (new \App\Jobs\Util\UploadFile(
|
||||||
|
$uploaded_file,
|
||||||
|
\App\Jobs\Util\UploadFile::DOCUMENT,
|
||||||
|
$this->user,
|
||||||
|
$this->company,
|
||||||
|
$entity,
|
||||||
|
null,
|
||||||
|
true
|
||||||
|
))->handle();
|
||||||
|
|
||||||
|
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
//do nothing, gracefully :)
|
//do nothing, gracefully :)
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,8 @@ class ReminderJob implements ShouldQueue
|
|||||||
->markSent()
|
->markSent()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$invoice->service()->touchPdf(true);
|
//30-6-2023 - fix for duplicate touching
|
||||||
|
// $invoice->service()->touchPdf(true);
|
||||||
|
|
||||||
$enabled_reminder = 'enable_'.$reminder_template;
|
$enabled_reminder = 'enable_'.$reminder_template;
|
||||||
if ($reminder_template == 'endless_reminder') {
|
if ($reminder_template == 'endless_reminder') {
|
||||||
@ -268,7 +269,6 @@ class ReminderJob implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [$late_fee_amount, $late_fee_percent];
|
return [$late_fee_amount, $late_fee_percent];
|
||||||
// return $this->setLateFee($invoice, $late_fee_amount, $late_fee_percent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,15 +11,17 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Support\Carbon;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Jobs\Entity\CreateRawPdf;
|
||||||
use App\Jobs\Util\WebhookHandler;
|
use App\Jobs\Util\WebhookHandler;
|
||||||
use App\Models\Traits\Excludable;
|
use App\Models\Traits\Excludable;
|
||||||
use App\Utils\Traits\MakesHash;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Jobs\Vendor\CreatePurchaseOrderPdf;
|
||||||
use App\Utils\Traits\UserSessionAttributes;
|
use App\Utils\Traits\UserSessionAttributes;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BaseModel
|
* Class BaseModel
|
||||||
@ -255,4 +257,30 @@ class BaseModel extends Model
|
|||||||
WebhookHandler::dispatch($event_id, $this, $this->company, $additional_data);
|
WebhookHandler::dispatch($event_id, $this, $this->company, $additional_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the base64 encoded PDF string of the entity
|
||||||
|
*/
|
||||||
|
public function fullscreenPdfViewer($invitation = null): string
|
||||||
|
{
|
||||||
|
|
||||||
|
if (! $invitation) {
|
||||||
|
if ($this->invitations()->exists()) {
|
||||||
|
$invitation = $this->invitations()->first();
|
||||||
|
} else {
|
||||||
|
$this->service()->createInvitations();
|
||||||
|
$invitation = $this->invitations()->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $invitation) {
|
||||||
|
throw new \Exception('Hard fail, could not create an invitation.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this instanceof \App\Models\PurchaseOrder)
|
||||||
|
return "data:application/pdf;base64,".base64_encode((new CreatePurchaseOrderPdf($invitation, $invitation->company->db))->rawPdf());
|
||||||
|
|
||||||
|
return "data:application/pdf;base64,".base64_encode((new CreateRawPdf($invitation, $invitation->company->db))->handle());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,9 +544,9 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
return $this->settings->{$setting};
|
return $this->settings->{$setting};
|
||||||
} elseif (is_bool($this->settings->{$setting})) {
|
} elseif (is_bool($this->settings->{$setting})) {
|
||||||
return $this->settings->{$setting};
|
return $this->settings->{$setting};
|
||||||
} elseif (is_int($this->settings->{$setting})) { //10-08-2022 integer client values are not being passed back! This resolves it.
|
} elseif (is_int($this->settings->{$setting})) {
|
||||||
return $this->settings->{$setting};
|
return $this->settings->{$setting};
|
||||||
} elseif(is_float($this->settings->{$setting})) { //10-08-2022 integer client values are not being passed back! This resolves it.
|
} elseif(is_float($this->settings->{$setting})) {
|
||||||
return $this->settings->{$setting};
|
return $this->settings->{$setting};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ namespace App\Models;
|
|||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
|
use App\Jobs\Entity\CreateRawPdf;
|
||||||
use App\Helpers\Invoice\InvoiceSum;
|
use App\Helpers\Invoice\InvoiceSum;
|
||||||
use App\Jobs\Entity\CreateEntityPdf;
|
use App\Jobs\Entity\CreateEntityPdf;
|
||||||
use App\Utils\Traits\MakesReminders;
|
use App\Utils\Traits\MakesReminders;
|
||||||
@ -683,6 +684,7 @@ class Invoice extends BaseModel
|
|||||||
|
|
||||||
public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false)
|
public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (! $invitation) {
|
if (! $invitation) {
|
||||||
if ($this->invitations()->exists()) {
|
if ($this->invitations()->exists()) {
|
||||||
$invitation = $this->invitations()->first();
|
$invitation = $this->invitations()->first();
|
||||||
@ -725,7 +727,6 @@ class Invoice extends BaseModel
|
|||||||
return Storage::disk(config('filesystems.default'))->{$type}($file_path);
|
return Storage::disk(config('filesystems.default'))->{$type}($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$file_exists = Storage::disk('public')->exists($file_path);
|
$file_exists = Storage::disk('public')->exists($file_path);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -525,7 +525,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
$invoice->service()->touchPdf();
|
$invoice->service()->deletePdf();
|
||||||
});
|
});
|
||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
@ -570,7 +570,7 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
$invoices->each(function ($invoice) {
|
$invoices->each(function ($invoice) {
|
||||||
$invoice->service()->touchPdf();
|
$invoice->service()->deletePdf();
|
||||||
});
|
});
|
||||||
|
|
||||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
|
||||||
|
@ -70,12 +70,17 @@ class CreditCard
|
|||||||
|
|
||||||
$response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
|
$response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
|
||||||
|
|
||||||
$response_status = ErrorCode::getStatus($response->ResponseMessage);
|
if(property_exists($response, 'ResponseMessage'))
|
||||||
|
$response_status = ErrorCode::getStatus($response->ResponseMessage);
|
||||||
|
|
||||||
if (! $response_status['success']) {
|
if (! $response_status['success']) {
|
||||||
|
|
||||||
$this->eway_driver->sendFailureMail($response_status['message']);
|
$this->eway_driver->sendFailureMail($response_status['message']);
|
||||||
|
|
||||||
throw new PaymentFailed($response_status['message'], 400);
|
$this->logResponse($response);
|
||||||
|
|
||||||
|
|
||||||
|
throw new PaymentFailed($response_status['message'] ?? 'Unknown response from gateway, please contact you merchant.', 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
//success
|
//success
|
||||||
@ -94,6 +99,8 @@ class CreditCard
|
|||||||
|
|
||||||
$token = $this->eway_driver->storeGatewayToken($cgt, []);
|
$token = $this->eway_driver->storeGatewayToken($cgt, []);
|
||||||
|
|
||||||
|
$this->logResponse($response);
|
||||||
|
|
||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +142,7 @@ class CreditCard
|
|||||||
|
|
||||||
$amount = array_sum(array_column($this->eway_driver->payment_hash->invoices(), 'amount')) + $this->eway_driver->payment_hash->fee_total;
|
$amount = array_sum(array_column($this->eway_driver->payment_hash->invoices(), 'amount')) + $this->eway_driver->payment_hash->fee_total;
|
||||||
|
|
||||||
$description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->eway_driver->client->present()->name()}";
|
// $description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->eway_driver->client->present()->name()}";
|
||||||
|
|
||||||
$transaction = [
|
$transaction = [
|
||||||
'Payment' => [
|
'Payment' => [
|
||||||
@ -152,29 +159,6 @@ class CreditCard
|
|||||||
|
|
||||||
$this->logResponse($response);
|
$this->logResponse($response);
|
||||||
|
|
||||||
// if(!$response || !property_exists($response, 'ResponseMessage'))
|
|
||||||
// throw new PaymentFailed('The gateway did not return a valid response. Please check your gateway credentials.', 400);
|
|
||||||
|
|
||||||
// $response_status = ErrorCode::getStatus($response->ResponseMessage);
|
|
||||||
|
|
||||||
// if(!$response_status['success']){
|
|
||||||
|
|
||||||
// if($response->getErrors())
|
|
||||||
// {
|
|
||||||
// $message = false;
|
|
||||||
|
|
||||||
// foreach ($response->getErrors() as $error) {
|
|
||||||
// $message = \Eway\Rapid::getMessage($error);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $return_message = $message ?: $response_status['message'];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $this->eway_driver->sendFailureMail($response_status['message']);
|
|
||||||
|
|
||||||
// throw new PaymentFailed($response_status['message'], 400);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($response->TransactionStatus) {
|
if ($response->TransactionStatus) {
|
||||||
$payment = $this->storePayment($response);
|
$payment = $this->storePayment($response);
|
||||||
} else {
|
} else {
|
||||||
|
@ -123,6 +123,7 @@ class CreditCard
|
|||||||
'city' => $this->paytrace->client->city,
|
'city' => $this->paytrace->client->city,
|
||||||
'state' => $this->paytrace->client->state,
|
'state' => $this->paytrace->client->state,
|
||||||
'zip' => $this->paytrace->client->postal_code,
|
'zip' => $this->paytrace->client->postal_code,
|
||||||
|
'country' => $this->paytrace->client->country->iso_3166_2
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@ -177,6 +178,7 @@ class CreditCard
|
|||||||
'customer_id' => $token,
|
'customer_id' => $token,
|
||||||
'integrator_id' => $this->paytrace->company_gateway->getConfigField('integratorId'),
|
'integrator_id' => $this->paytrace->company_gateway->getConfigField('integratorId'),
|
||||||
'amount' => $request->input('amount_with_fee'),
|
'amount' => $request->input('amount_with_fee'),
|
||||||
|
'invoice_id' => $this->harvestInvoiceId(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->paytrace->gatewayRequest('/v1/transactions/sale/by_customer', $data);
|
$response = $this->paytrace->gatewayRequest('/v1/transactions/sale/by_customer', $data);
|
||||||
|
@ -38,13 +38,15 @@ class TaskStatusRepository extends BaseRepository
|
|||||||
|
|
||||||
public function archive($task_status)
|
public function archive($task_status)
|
||||||
{
|
{
|
||||||
$task_status = TaskStatus::where('id', $task_status->id)
|
$task_status = TaskStatus::withTrashed()
|
||||||
|
->where('id', $task_status->id)
|
||||||
->where('company_id', $task_status->company_id)
|
->where('company_id', $task_status->company_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
$new_status = $task_status ? $task_status->id : null;
|
$new_status = $task_status ? $task_status->id : null;
|
||||||
|
|
||||||
Task::where('status_id', $task_status->id)
|
Task::withTrashed()
|
||||||
|
->where('status_id', $task_status->id)
|
||||||
->where('company_id', $task_status->company_id)
|
->where('company_id', $task_status->company_id)
|
||||||
->update(['status_id' => $new_status]);
|
->update(['status_id' => $new_status]);
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class ApplyPayment
|
|||||||
->updateBalance($this->amount_applied * -1)
|
->updateBalance($this->amount_applied * -1)
|
||||||
->updatePaidToDate($this->amount_applied)
|
->updatePaidToDate($this->amount_applied)
|
||||||
->updateStatus()
|
->updateStatus()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$this->credit
|
$this->credit
|
||||||
@ -147,7 +147,7 @@ class ApplyPayment
|
|||||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
if ((int) $this->invoice->balance == 0) {
|
if ((int) $this->invoice->balance == 0) {
|
||||||
$this->invoice->service()->touchPdf();
|
$this->invoice->service()->deletePdf();
|
||||||
$this->invoice = $this->invoice->fresh();
|
$this->invoice = $this->invoice->fresh();
|
||||||
event(new InvoiceWasPaid($this->invoice, $this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new InvoiceWasPaid($this->invoice, $this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,17 @@
|
|||||||
|
|
||||||
namespace App\Services\Credit;
|
namespace App\Services\Credit;
|
||||||
|
|
||||||
use App\Factory\PaymentFactory;
|
use App\Utils\Ninja;
|
||||||
use App\Jobs\Entity\CreateEntityPdf;
|
|
||||||
use App\Jobs\Util\UnlinkFile;
|
|
||||||
use App\Models\Credit;
|
use App\Models\Credit;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
|
use App\Jobs\Util\UnlinkFile;
|
||||||
|
use App\Factory\PaymentFactory;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Jobs\Entity\CreateEntityPdf;
|
||||||
use App\Repositories\CreditRepository;
|
use App\Repositories\CreditRepository;
|
||||||
use App\Repositories\PaymentRepository;
|
use App\Repositories\PaymentRepository;
|
||||||
use App\Utils\Traits\MakesHash;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class CreditService
|
class CreditService
|
||||||
{
|
{
|
||||||
@ -235,7 +237,24 @@ class CreditService
|
|||||||
public function deletePdf()
|
public function deletePdf()
|
||||||
{
|
{
|
||||||
$this->credit->invitations->each(function ($invitation) {
|
$this->credit->invitations->each(function ($invitation) {
|
||||||
(new UnlinkFile(config('filesystems.default'), $this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf'))->handle();
|
// (new UnlinkFile(config('filesystems.default'), $this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf'))->handle();
|
||||||
|
|
||||||
|
//30-06-2023
|
||||||
|
try {
|
||||||
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
Storage::disk(config('filesystems.default'))->delete($this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
|
Storage::disk('public')->delete($this->credit->client->credit_filepath($invitation).$this->credit->numberFormatter().'.pdf');
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
nlog($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -42,7 +42,7 @@ class MarkSent
|
|||||||
->setStatus(Credit::STATUS_SENT)
|
->setStatus(Credit::STATUS_SENT)
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->adjustBalance($this->credit->amount)
|
->adjustBalance($this->credit->amount)
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$this->client
|
$this->client
|
||||||
|
@ -432,6 +432,7 @@ class Email implements ShouldQueue
|
|||||||
$this->setGmailMailer();
|
$this->setGmailMailer();
|
||||||
return $this;
|
return $this;
|
||||||
case 'office365':
|
case 'office365':
|
||||||
|
case 'microsoft':
|
||||||
$this->mailer = 'office365';
|
$this->mailer = 'office365';
|
||||||
$this->setOfficeMailer();
|
$this->setOfficeMailer();
|
||||||
return $this;
|
return $this;
|
||||||
@ -445,7 +446,8 @@ class Email implements ShouldQueue
|
|||||||
return $this;
|
return $this;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
$this->mailer = config('mail.default');
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ninja::isSelfHost()) {
|
if (Ninja::isSelfHost()) {
|
||||||
|
@ -307,9 +307,6 @@ class EmailDefaults
|
|||||||
|
|
||||||
$xinvoice_path = $this->email->email_object->entity->service()->getEInvoice();
|
$xinvoice_path = $this->email->email_object->entity->service()->getEInvoice();
|
||||||
|
|
||||||
// $xinvoice_path = (new CreateEInvoice($this->email->email_object->entity, true, stream_get_meta_data($tempfile)['uri']))->handle();
|
|
||||||
// $this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode($pdf), 'name' => $this->email->email_object->entity->numberFormatter().'.pdf']]);
|
|
||||||
|
|
||||||
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_path))
|
if(Storage::disk(config('filesystems.default'))->exists($xinvoice_path))
|
||||||
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode(Storage::get($xinvoice_path)), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-xinvoice.xml"]]);
|
$this->email->email_object->attachments = array_merge($this->email->email_object->attachments, [['file' => base64_encode(Storage::get($xinvoice_path)), 'name' => explode(".", $this->email->email_object->entity->getFileName('xml'))[0]."-xinvoice.xml"]]);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class ApplyPayment extends AbstractService
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->invoice->service()->applyNumber()->workFlow()->touchPdf()->save();
|
$this->invoice->service()->applyNumber()->workFlow()->deletePdf()->save();
|
||||||
|
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,7 @@ class HandleCancellation extends AbstractService
|
|||||||
$this->invoice->balance = 0;
|
$this->invoice->balance = 0;
|
||||||
$this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save();
|
$this->invoice = $this->invoice->service()->setStatus(Invoice::STATUS_CANCELLED)->save();
|
||||||
|
|
||||||
//adjust client balance
|
|
||||||
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
||||||
// $this->invoice->fresh();
|
|
||||||
|
|
||||||
$this->invoice->service()->workFlow()->save();
|
$this->invoice->service()->workFlow()->save();
|
||||||
|
|
||||||
@ -54,16 +52,6 @@ class HandleCancellation extends AbstractService
|
|||||||
|
|
||||||
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
event('eloquent.updated: App\Models\Invoice', $this->invoice);
|
||||||
|
|
||||||
$transaction = [
|
|
||||||
'invoice' => $this->invoice->transaction_event(),
|
|
||||||
'payment' => [],
|
|
||||||
'client' => $this->invoice->client->transaction_event(),
|
|
||||||
'credit' => [],
|
|
||||||
'metadata' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
// TransactionLog::dispatch(TransactionEvent::INVOICE_CANCELLED, $transaction, $this->invoice->company->db);
|
|
||||||
|
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,6 @@ class InvoiceService
|
|||||||
*/
|
*/
|
||||||
public function applyPayment(Payment $payment, float $payment_amount)
|
public function applyPayment(Payment $payment, float $payment_amount)
|
||||||
{
|
{
|
||||||
// $this->deletePdf();
|
|
||||||
$this->invoice = $this->markSent()->save();
|
$this->invoice = $this->markSent()->save();
|
||||||
|
|
||||||
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
|
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
|
||||||
@ -339,7 +338,7 @@ class InvoiceService
|
|||||||
return $item;
|
return $item;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$this->touchPdf();
|
$this->deletePdf();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -348,13 +347,15 @@ class InvoiceService
|
|||||||
{
|
{
|
||||||
$this->invoice->load('invitations');
|
$this->invoice->load('invitations');
|
||||||
|
|
||||||
|
//30-06-2023
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
try {
|
try {
|
||||||
if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
Storage::disk('public')->delete($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf');
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -371,11 +372,12 @@ class InvoiceService
|
|||||||
|
|
||||||
$this->invoice->invitations->each(function ($invitation) {
|
$this->invoice->invitations->each(function ($invitation) {
|
||||||
try {
|
try {
|
||||||
if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
||||||
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
Storage::disk(config('filesystems.default'))->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"))) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
Storage::disk('public')->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
Storage::disk('public')->delete($this->invoice->client->e_invoice_filepath($invitation).$this->invoice->getFileName("xml"));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -403,7 +405,7 @@ class InvoiceService
|
|||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
$this->invoice = $this->invoice->calc()->getInvoice();
|
||||||
$this->touchPdf();
|
$this->deletePdf();
|
||||||
|
|
||||||
/* 24-03-2022 */
|
/* 24-03-2022 */
|
||||||
$new_balance = $this->invoice->balance;
|
$new_balance = $this->invoice->balance;
|
||||||
|
@ -102,7 +102,7 @@ class MarkPaid extends AbstractService
|
|||||||
$this->invoice
|
$this->invoice
|
||||||
->service()
|
->service()
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
|
@ -54,7 +54,7 @@ class TriggeredActions extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') {
|
if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') {
|
||||||
$this->invoice->service()->markSent()->touchPdf()->save();
|
$this->invoice->service()->markSent()->save();
|
||||||
$this->sendEmail();
|
$this->sendEmail();
|
||||||
$this->updated = false;
|
$this->updated = false;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class UpdateInvoicePayment
|
|||||||
$invoice = $invoice->service()
|
$invoice = $invoice->service()
|
||||||
->clearPartial()
|
->clearPartial()
|
||||||
->updateStatus()
|
->updateStatus()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->workFlow()
|
->workFlow()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
@ -19,11 +19,8 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
|
|
||||||
class GetPurchaseOrderPdf extends AbstractService
|
class GetPurchaseOrderPdf extends AbstractService
|
||||||
{
|
{
|
||||||
public function __construct(PurchaseOrder $purchase_order, VendorContact $contact = null)
|
public function __construct(public PurchaseOrder $purchase_order, public ?VendorContact $contact = null)
|
||||||
{
|
{
|
||||||
$this->purchase_order = $purchase_order;
|
|
||||||
|
|
||||||
$this->contact = $contact;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
|
@ -43,10 +43,6 @@ class TriggeredActions extends AbstractService
|
|||||||
$this->purchase_order = $this->purchase_order->service()->markSent()->touchPdf()->save();
|
$this->purchase_order = $this->purchase_order->service()->markSent()->touchPdf()->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($this->request->has('cancel') && $this->request->input('cancel') == 'true') {
|
|
||||||
// $this->purchase_order = $this->purchase_order->service()->handleCancellation()->save();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') {
|
if ($this->request->has('save_default_footer') && $this->request->input('save_default_footer') == 'true') {
|
||||||
$company = $this->purchase_order->company;
|
$company = $this->purchase_order->company;
|
||||||
$settings = $company->settings;
|
$settings = $company->settings;
|
||||||
|
@ -47,7 +47,7 @@ class MarkSent
|
|||||||
->service()
|
->service()
|
||||||
->setStatus(Quote::STATUS_SENT)
|
->setStatus(Quote::STATUS_SENT)
|
||||||
->applyNumber()
|
->applyNumber()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
@ -19,6 +19,7 @@ use App\Exceptions\QuoteConversion;
|
|||||||
use App\Jobs\Entity\CreateEntityPdf;
|
use App\Jobs\Entity\CreateEntityPdf;
|
||||||
use App\Repositories\QuoteRepository;
|
use App\Repositories\QuoteRepository;
|
||||||
use App\Events\Quote\QuoteWasApproved;
|
use App\Events\Quote\QuoteWasApproved;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class QuoteService
|
class QuoteService
|
||||||
{
|
{
|
||||||
@ -115,7 +116,7 @@ class QuoteService
|
|||||||
$this->invoice
|
$this->invoice
|
||||||
->service()
|
->service()
|
||||||
->markSent()
|
->markSent()
|
||||||
->touchPdf()
|
->deletePdf()
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +225,22 @@ class QuoteService
|
|||||||
public function deletePdf()
|
public function deletePdf()
|
||||||
{
|
{
|
||||||
$this->quote->invitations->each(function ($invitation) {
|
$this->quote->invitations->each(function ($invitation) {
|
||||||
(new UnlinkFile(config('filesystems.default'), $this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf'))->handle();
|
// (new UnlinkFile(config('filesystems.default'), $this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf'))->handle();
|
||||||
|
|
||||||
|
//30-06-2023
|
||||||
|
try {
|
||||||
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
Storage::disk(config('filesystems.default'))->delete($this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
|
Storage::disk('public')->delete($this->quote->client->quote_filepath($invitation).$this->quote->numberFormatter().'.pdf');
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
nlog($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -11,11 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Services\Recurring;
|
namespace App\Services\Recurring;
|
||||||
|
|
||||||
|
use App\Utils\Ninja;
|
||||||
use App\Jobs\Util\UnlinkFile;
|
use App\Jobs\Util\UnlinkFile;
|
||||||
use App\Models\RecurringQuote;
|
use App\Models\RecurringQuote;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use App\Models\RecurringExpense;
|
use App\Models\RecurringExpense;
|
||||||
use App\Models\RecurringInvoice;
|
use App\Models\RecurringInvoice;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Jobs\RecurringInvoice\SendRecurring;
|
use App\Jobs\RecurringInvoice\SendRecurring;
|
||||||
|
|
||||||
class RecurringService
|
class RecurringService
|
||||||
@ -88,7 +90,22 @@ class RecurringService
|
|||||||
public function deletePdf()
|
public function deletePdf()
|
||||||
{
|
{
|
||||||
$this->recurring_entity->invitations->each(function ($invitation) {
|
$this->recurring_entity->invitations->each(function ($invitation) {
|
||||||
(new UnlinkFile(config('filesystems.default'), $this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf'))->handle();
|
// (new UnlinkFile(config('filesystems.default'), $this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf'))->handle();
|
||||||
|
|
||||||
|
//30-06-2023
|
||||||
|
try {
|
||||||
|
Storage::disk(config('filesystems.default'))->delete($this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf');
|
||||||
|
// if (Storage::disk(config('filesystems.default'))->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (Ninja::isHosted() && Storage::disk('public')->exists($this->invoice->client->invoice_filepath($invitation).$this->invoice->numberFormatter().'.pdf')) {
|
||||||
|
Storage::disk('public')->delete($this->recurring_entity->client->recurring_invoice_filepath($invitation) . $this->recurring_entity->numberFormatter().'.pdf');
|
||||||
|
if (Ninja::isHosted()) {
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
nlog($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class SubscriptionService
|
|||||||
//update the invoice and attach to the recurring invoice!!!!!
|
//update the invoice and attach to the recurring invoice!!!!!
|
||||||
$invoice->recurring_id = $recurring_invoice->id;
|
$invoice->recurring_id = $recurring_invoice->id;
|
||||||
$invoice->is_proforma = false;
|
$invoice->is_proforma = false;
|
||||||
$invoice->service()->touchPdf();
|
$invoice->service()->deletePdf();
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
$contact = $invoice->client->contacts()->whereNotNull('email')->first();
|
$contact = $invoice->client->contacts()->whereNotNull('email')->first();
|
||||||
@ -821,13 +821,15 @@ class SubscriptionService
|
|||||||
$invoice->is_proforma = false;
|
$invoice->is_proforma = false;
|
||||||
$invoice->save();
|
$invoice->save();
|
||||||
|
|
||||||
|
// 29-06-2023 handle webhooks for payment intent - user may not be present.
|
||||||
|
|
||||||
$context = [
|
$context = [
|
||||||
'context' => 'change_plan',
|
'context' => 'change_plan',
|
||||||
'recurring_invoice' => $recurring_invoice->hashed_id,
|
'recurring_invoice' => $recurring_invoice->hashed_id,
|
||||||
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
|
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
|
||||||
'client' => $recurring_invoice->client->hashed_id,
|
'client' => $recurring_invoice->client->hashed_id,
|
||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
'contact' => auth()->guard('contact')->user()->hashed_id,
|
'contact' => auth()->guard('contact')->user()?->hashed_id ?? $recurring_invoice->client->contacts()->first()->hashed_id,
|
||||||
'account_key' => $recurring_invoice->client->custom_value2,
|
'account_key' => $recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'has_e_invoice_certificate_passphrase' => $company->e_invoice_certificate_passphrase ? true : false,
|
'has_e_invoice_certificate_passphrase' => $company->e_invoice_certificate_passphrase ? true : false,
|
||||||
'invoice_task_project_header' => (bool) $company->invoice_task_project_header,
|
'invoice_task_project_header' => (bool) $company->invoice_task_project_header,
|
||||||
'invoice_task_item_description' => (bool) $company->invoice_task_item_description,
|
'invoice_task_item_description' => (bool) $company->invoice_task_item_description,
|
||||||
|
'origin_tax_data' => $company->origin_tax_data ?: new \stdClass,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@ namespace App\Transformers;
|
|||||||
use App\Models\Vendor;
|
use App\Models\Vendor;
|
||||||
use App\Models\Expense;
|
use App\Models\Expense;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Document;
|
|
||||||
use App\Models\ExpenseCategory;
|
use App\Models\ExpenseCategory;
|
||||||
|
use App\Transformers\ExpenseCategoryTransformer;
|
||||||
|
use App\Models\Document;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Transformers\ExpenseCategoryTransformer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class ExpenseTransformer.
|
* class ExpenseTransformer.
|
||||||
|
@ -15,8 +15,8 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => '5.6.4',
|
'app_version' => '5.6.5',
|
||||||
'app_tag' => '5.6.4',
|
'app_tag' => '5.6.5',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', ''),
|
'api_secret' => env('API_SECRET', ''),
|
||||||
|
@ -25,9 +25,12 @@ return new class extends Migration
|
|||||||
Language::create(['id' => 38, 'name' => 'Khmer', 'locale' => 'km_KH']);
|
Language::create(['id' => 38, 'name' => 'Khmer', 'locale' => 'km_KH']);
|
||||||
}
|
}
|
||||||
|
|
||||||
Schema::table('companies', function (Blueprint $table) {
|
if (Schema::hasColumn('companies', 'enable_e_invoice'))
|
||||||
$table->dropColumn('enable_e_invoice');
|
{
|
||||||
});
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('enable_e_invoice');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Company::query()->cursor()->each(function ($company){
|
Company::query()->cursor()->each(function ($company){
|
||||||
$company->tax_data = new TaxModel();
|
$company->tax_data = new TaxModel();
|
||||||
|
@ -6,8 +6,6 @@ parameters:
|
|||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#Call to an undefined method .*badMethod\(\)#'
|
- '#Call to an undefined method .*badMethod\(\)#'
|
||||||
- '#Call to an undefined method Illuminate\Database\Eloquent\Builder::exclude#'
|
- '#Call to an undefined method Illuminate\Database\Eloquent\Builder::exclude#'
|
||||||
parallel:
|
|
||||||
maximumNumberOfProcesses: 8
|
|
||||||
level: 4
|
level: 4
|
||||||
paths:
|
paths:
|
||||||
- 'app/'
|
- 'app/'
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
<iframe src="{{ $credit->pdf_file_path(null, 'url', true) }}"
|
<iframe src="{{ $credit->fullscreenPdfViewer($invitation) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
||||||
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
|
||||||
|
<!-- <iframe src="{{ $credit->pdf_file_path(null, 'url', true) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe> -->
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<iframe src="{{ $invoice->pdf_file_path($invitation, 'url', true) }}"
|
<iframe src="{{ $invoice->fullscreenPdfViewer($invitation) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
||||||
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
<!-- <iframe src="{{ $invoice->pdf_file_path($invitation, 'url', true) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe> -->
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
<iframe src="{{ $purchase_order->fullscreenPdfViewer($invitation) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
||||||
|
<!-- <iframe src="{{ $purchase_order->pdf_file_path($invitation, 'url', true) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe> -->
|
@ -1,2 +1,3 @@
|
|||||||
<iframe src="{{ $quote->pdf_file_path(null,'url',true) }}"
|
<iframe src="{{ $quote->fullscreenPdfViewer($invitation) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
||||||
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>
|
|
||||||
|
<!-- <iframe src="{{ $quote->pdf_file_path(null,'url',true) }}" style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe> -->
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@include('portal.ninja2020.components.pdf-viewer', ['url' => route('client.statement.raw')])
|
@include('portal.ninja2020.components.pdf-viewer', ['url' => route('client.statement.raw')])
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
|
@ -40,7 +40,7 @@ Route::get('tmp_pdf/{hash}', [App\Http\Controllers\ClientPortal\TempRouteControl
|
|||||||
|
|
||||||
Route::get('client/key_login/{contact_key}', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'login'])->name('client.contact_login')->middleware(['domain_db','contact_key_login']);
|
Route::get('client/key_login/{contact_key}', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'login'])->name('client.contact_login')->middleware(['domain_db','contact_key_login']);
|
||||||
Route::get('client/magic_link/{magic_link}', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'magicLink'])->name('client.contact_magic_link')->middleware(['domain_db','contact_key_login']);
|
Route::get('client/magic_link/{magic_link}', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'magicLink'])->name('client.contact_magic_link')->middleware(['domain_db','contact_key_login']);
|
||||||
Route::get('documents/{document_hash}', [App\Http\Controllers\ClientPortal\DocumentController::class, 'publicDownload'])->name('documents.public_download')->middleware(['domain_db','token_auth']);
|
Route::get('documents/{document_hash}', [App\Http\Controllers\ClientPortal\DocumentController::class, 'publicDownload'])->name('documents.public_download')->middleware(['api_db','token_auth']);
|
||||||
Route::get('error', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'errorPage'])->name('client.error');
|
Route::get('error', [App\Http\Controllers\ClientPortal\ContactHashLoginController::class, 'errorPage'])->name('client.error');
|
||||||
Route::get('client/payment/{contact_key}/{payment_id}', [App\Http\Controllers\ClientPortal\InvitationController::class, 'paymentRouter'])->middleware(['domain_db','contact_key_login']);
|
Route::get('client/payment/{contact_key}/{payment_id}', [App\Http\Controllers\ClientPortal\InvitationController::class, 'paymentRouter'])->middleware(['domain_db','contact_key_login']);
|
||||||
Route::get('client/ninja/{contact_key}/{company_key}', [App\Http\Controllers\ClientPortal\NinjaPlanController::class, 'index'])->name('client.ninja_contact_login')->middleware(['domain_db']);
|
Route::get('client/ninja/{contact_key}/{company_key}', [App\Http\Controllers\ClientPortal\NinjaPlanController::class, 'index'])->name('client.ninja_contact_login')->middleware(['domain_db']);
|
||||||
|
@ -31,6 +31,8 @@ class ExpenseApiTest extends TestCase
|
|||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
use MockAccountData;
|
use MockAccountData;
|
||||||
|
|
||||||
|
public $faker;
|
||||||
|
|
||||||
protected function setUp() :void
|
protected function setUp() :void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user