1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-23 18:01:35 +02:00

Merge pull request #7382 from turbo124/v5-stable

v5.3.81
This commit is contained in:
David Bomba 2022-04-20 12:08:58 +09:30 committed by GitHub
commit b820a259c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 137277 additions and 136488 deletions

View File

@ -1 +1 @@
5.3.80
5.3.81

View File

@ -596,7 +596,7 @@ class ClientController extends BaseController
*
*
*
* @OA\Put(
* @OA\Post(
* path="/api/v1/clients/{id}/purge",
* operationId="purgeClient",
* tags={"clients"},

View File

@ -111,9 +111,6 @@ class SelfUpdateController extends BaseController
copy($this->getDownloadUrl(), storage_path('app/invoiceninja.zip'));
// $contents = file_get_contents($this->getDownloadUrl());
// Storage::disk('local')->put('invoiceninja.zip', $contents);
$file = Storage::disk('local')->path('invoiceninja.zip');
$zipFile = new \PhpZip\ZipFile();

View File

@ -83,11 +83,17 @@ class InvoiceTransformer extends BaseTransformer {
}
else {
//could be a generate invoices.csv file
$calculated_tax_rate = 0;
if($this->getFloat( $record, 'Invoice Tax Total' ) != 0 && $this->getFloat( $record, 'Invoice Total' ) != 0)
$calculated_tax_rate = round($this->getFloat( $record, 'Invoice Tax Total' ) / $this->getFloat( $record, 'Invoice Total' ) * 100,2);
$line_items[] = [
'notes' => 'Imported Invoice',
'cost' => $this->getFloat( $record, 'Invoice Total' ),
'tax_name1' => 'Tax',
'tax_rate1' => round($this->getFloat( $record, 'Invoice Tax Total' ) / $this->getFloat( $record, 'Invoice Total' ) * 100,2),
'tax_rate1' => $calculated_tax_rate,
'quantity' => 1,
];

View File

@ -81,10 +81,19 @@ class ReminderJob implements ShouldQueue
$invoice = $this->calcLateFee($invoice, $reminder_template);
$invoice->service()->touchPdf();
//20-04-2022 fixes for endless reminders - generic template naming was wrong
$enabled_reminder = "enable_".$reminder_template;
if($reminder_template == 'endless_reminder')
$enabled_reminder = 'enable_reminder_endless';
//check if this reminder needs to be emailed
//15-01-2022 - insert addition if block if send_reminders is definitely set
if(in_array($reminder_template, ['reminder1','reminder2','reminder3','reminder_endless']) && $invoice->client->getSetting("enable_".$reminder_template) && $invoice->client->getSetting("send_reminders") && $invoice->company->account->isPaidHostedClient())
if(in_array($reminder_template, ['reminder1','reminder2','reminder3','reminder_endless','endless_reminder']) &&
$invoice->client->getSetting($enabled_reminder) &&
$invoice->client->getSetting("send_reminders") &&
(Ninja::isSelfHost() || $invoice->company->account->isPaidHostedClient()))
{
$invoice->invitations->each(function ($invitation) use ($invoice, $reminder_template) {
EmailEntity::dispatch($invitation, $invitation->company, $reminder_template);

View File

@ -39,21 +39,21 @@ class CreateInvoicePdf implements ShouldQueue
if(isset($event->invoice))
{
$event->invoice->invitations->each(function ($invitation) {
CreateEntityPdf::dispatch($invitation);
CreateEntityPdf::dispatch($invitation->load("invoice", "contact.client.company"));
});
}
if(isset($event->quote))
{
$event->quote->invitations->each(function ($invitation) {
CreateEntityPdf::dispatch($invitation);
CreateEntityPdf::dispatch($invitation->load("quote", "contact.client.company"));
});
}
if(isset($event->credit))
{
$event->credit->invitations->each(function ($invitation) {
CreateEntityPdf::dispatch($invitation);
CreateEntityPdf::dispatch($invitation->load("credit", "contact.client.company"));
});
}

View File

@ -466,6 +466,7 @@ class Invoice extends BaseModel
{
$this->invitations->each(function ($invitation) {
if (! isset($invitation->sent_date)) {
$invitation->load('invoice');
$invitation->sent_date = Carbon::now();
$invitation->save();
}

View File

@ -99,6 +99,29 @@ class CreditCard
$response = $this->paytrace->gatewayRequest('/v1/customer/pt_protect_create', $post_data);
if(!$response->success)
{
$error = 'Error creating customer in gateway';
$error_code = isset($response->response_code) ? $response->response_code : 'PT_ERR';
if(isset($response->errors))
{
foreach($response->errors as $err)
{
$error = end($err);
}
}
$data = [
'response' => $response,
'error' => $error,
'error_code' => $error_code,
];
return $this->paytrace->processUnsuccessfulTransaction($data);
}
$cgt = [];
$cgt['token'] = $response->customer_id;
$cgt['payment_method_id'] = GatewayType::CREDIT_CARD;
@ -124,7 +147,6 @@ class CreditCard
$profile = $this->paytrace->gatewayRequest('/v1/customer/export', [
'integrator_id' => $this->paytrace->company_gateway->getConfigField('integratorId'),
'customer_id' => $customer_id,
// 'include_bin' => true,
]);
return $profile->customers[0];

View File

@ -173,6 +173,52 @@ class PaytracePaymentDriver extends BaseDriver
$this->processUnsuccessfulTransaction($data, false);
}
public function getClientRequiredFields(): array
{
$fields = [];
if ($this->company_gateway->require_client_name) {
$fields[] = ['name' => 'client_name', 'label' => ctrans('texts.client_name'), 'type' => 'text', 'validation' => 'required'];
}
if ($this->company_gateway->require_contact_name) {
$fields[] = ['name' => 'contact_first_name', 'label' => ctrans('texts.first_name'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'contact_last_name', 'label' => ctrans('texts.last_name'), 'type' => 'text', 'validation' => 'required'];
}
if ($this->company_gateway->require_contact_email) {
$fields[] = ['name' => 'contact_email', 'label' => ctrans('texts.email'), 'type' => 'text', 'validation' => 'required,email:rfc'];
}
if ($this->company_gateway->require_client_phone) {
$fields[] = ['name' => 'client_phone', 'label' => ctrans('texts.client_phone'), 'type' => 'tel', 'validation' => 'required'];
}
if ($this->company_gateway->require_billing_address) {
$fields[] = ['name' => 'client_address_line_1', 'label' => ctrans('texts.address1'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_city', 'label' => ctrans('texts.city'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_state', 'label' => ctrans('texts.state'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_country_id', 'label' => ctrans('texts.country'), 'type' => 'text', 'validation' => 'required'];
}
if($this->company_gateway->require_postal_code) {
$fields[] = ['name' => 'client_postal_code', 'label' => ctrans('texts.postal_code'), 'type' => 'text', 'validation' => 'required'];
}
if ($this->company_gateway->require_shipping_address) {
$fields[] = ['name' => 'client_shipping_address_line_1', 'label' => ctrans('texts.shipping_address1'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_shipping_city', 'label' => ctrans('texts.shipping_city'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_shipping_state', 'label' => ctrans('texts.shipping_state'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_shipping_postal_code', 'label' => ctrans('texts.shipping_postal_code'), 'type' => 'text', 'validation' => 'required'];
$fields[] = ['name' => 'client_shipping_country_id', 'label' => ctrans('texts.shipping_country'), 'type' => 'text', 'validation' => 'required'];
}
return $fields;
}
public function processWebhookRequest(PaymentWebhookRequest $request, Payment $payment = null)
{
}

View File

@ -191,7 +191,7 @@ class WePayPaymentDriver extends BaseDriver
if ($objectType == 'credit_card') {
$payment_method = ClientGatewayToken::where('token', $objectId)->first();
if (! $paymentMethod)
if (! $payment_method)
throw new \Exception('Unknown payment method');
$source = $this->wepay->request('credit_card', array(

View File

@ -70,7 +70,6 @@ class AppServiceProvider extends ServiceProvider
app()->instance(TruthSource::class, new TruthSource());
// Model::preventLazyLoading(
// !$this->app->isProduction()
// );

View File

@ -110,12 +110,20 @@ class ActivityRepository extends BaseRepository
private function generateHtml($entity)
{
$entity_design_id = '';
$entity_type = '';
if ($entity instanceof Invoice || $entity instanceof RecurringInvoice) {
if ($entity instanceof Invoice ) {
$entity_type = 'invoice';
$entity_design_id = 'invoice_design_id';
} elseif ($entity instanceof Quote) {
} elseif ($entity instanceof RecurringInvoice){
$entity_type = 'recurring_invoice';
$entity_design_id = 'invoice_design_id';
}
elseif ($entity instanceof Quote) {
$entity_type = 'quote';
$entity_design_id = 'quote_design_id';
} elseif ($entity instanceof Credit) {
$entity_type = 'credit';
$entity_design_id = 'credit_design_id';
}
@ -132,7 +140,7 @@ class ActivityRepository extends BaseRepository
$entity->load('client.company', 'invitations');
$html = new HtmlEngine($entity->invitations->first());
$html = new HtmlEngine($entity->invitations->first()->load($entity_type, "contact"));
if ($design->is_custom) {
$options = [

View File

@ -242,7 +242,7 @@ class InvoiceService
public function triggeredActions($request)
{
$this->invoice = (new TriggeredActions($this->invoice, $request))->run();
$this->invoice = (new TriggeredActions($this->invoice->load('invitations'), $request))->run();
return $this;
}

View File

@ -221,7 +221,7 @@ class QuoteService
public function triggeredActions($request)
{
$this->quote = (new TriggeredActions($this->quote, $request))->run();
$this->quote = (new TriggeredActions($this->quote->load('invitations'), $request))->run();
return $this;
}

View File

@ -58,7 +58,7 @@ class HtmlEngine
$this->company = $invitation->company;
$this->contact = $invitation->contact;
$this->contact = $invitation->contact->load('client');
$this->client = $this->contact->client->load('company','country');

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.80',
'app_tag' => '5.3.80',
'app_version' => '5.3.81',
'app_tag' => '5.3.81',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

273633
public/main.next.dart.js vendored

File diff suppressed because one or more lines are too long