Merge branch 'v5-develop' into v5-stable

This commit is contained in:
David Bomba 2022-07-05 09:56:22 +10:00
commit e3f5e7f8cd
24 changed files with 195231 additions and 194817 deletions

View File

@ -1 +1 @@
5.4.7
5.4.8

View File

@ -17,12 +17,15 @@ use App\Http\Middleware\UserVerified;
use App\Http\Requests\Email\SendEmailRequest;
use App\Jobs\Entity\EmailEntity;
use App\Jobs\Mail\EntitySentMailer;
use App\Jobs\PurchaseOrder\PurchaseOrderEmail;
use App\Models\Credit;
use App\Models\Invoice;
use App\Models\PurchaseOrder;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Transformers\CreditTransformer;
use App\Transformers\InvoiceTransformer;
use App\Transformers\PurchaseOrderTransformer;
use App\Transformers\QuoteTransformer;
use App\Transformers\RecurringInvoiceTransformer;
use App\Utils\Ninja;
@ -125,6 +128,10 @@ class EmailController extends BaseController
'body' => $body
];
if($entity == 'purchaseOrder' || $template == 'purchase_order'){
return $this->sendPurchaseOrder($entity_obj, $data);
}
$entity_obj->invitations->each(function ($invitation) use ($data, $entity_string, $entity_obj, $template) {
if (!$invitation->contact->trashed() && $invitation->contact->email) {
@ -176,4 +183,17 @@ class EmailController extends BaseController
return $this->itemResponse($entity_obj->fresh());
}
private function sendPurchaseOrder($entity_obj, $data)
{
$this->entity_type = PurchaseOrder::class;
$this->entity_transformer = PurchaseOrderTransformer::class;
PurchaseOrderEmail::dispatch($entity_obj, $entity_obj->company, $data);
return $this->itemResponse($entity_obj);
}
}

View File

@ -13,6 +13,7 @@ namespace App\Http\Requests\Email;
use App\Http\Requests\Request;
use App\Utils\Traits\MakesHash;
use Illuminate\Support\Str;
class SendEmailRequest extends Request
{
@ -60,7 +61,7 @@ class SendEmailRequest extends Request
$input['entity_id'] = $this->decodePrimaryKey($input['entity_id']);
if(array_key_exists('entity', $input))
$input['entity'] = "App\Models\\".ucfirst($input['entity']);
$input['entity'] = "App\Models\\".ucfirst(Str::camel($input['entity']));
$this->replace($input);
}

View File

@ -399,7 +399,7 @@ class NinjaMailerJob implements ShouldQueue
return false;
}
return $user->oauth_user_refresh_token;
return $user->oauth_user_token;
}

View File

@ -85,7 +85,6 @@ class SendRecurring implements ShouldQueue
$invoice = $invoice->service()
->markSent()
->applyNumber()
//->createInvitations() //need to only link invitations to those in the recurring invoice
->fillDefaults()
->adjustInventory()
->save();

View File

@ -275,7 +275,12 @@ class Import implements ShouldQueue
info('Completed🚀🚀🚀🚀🚀 at '.now());
unlink($this->file_path);
try{
unlink($this->file_path);
}
catch(\Exception $e){
nlog("problem unsetting file");
}
}
private function fixData()

View File

@ -33,7 +33,7 @@ class Account extends BaseModel
use PresentableTrait;
use MakesHash;
private $free_plan_email_quota = 100;
private $free_plan_email_quota = 50;
private $paid_plan_email_quota = 500;
/**

View File

@ -210,7 +210,6 @@ class ClientContact extends Authenticatable implements HasLocalePreference
NinjaMailerJob::dispatch($nmo);
//$this->notify(new ClientContactResetPassword($token));
}
public function preferredLocale()

View File

@ -0,0 +1,93 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Notifications\Ninja;
use App\Models\Company;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class EmailQualityNotification extends Notification
{
/**
* Create a new notification instance.
*
* @return void
*/
protected Company $company;
protected string $spam_string;
public function __construct(Company $company, string $spam_string)
{
$this->company = $company;
$this->spam_string = $spam_string;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['slack'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return MailMessage
*/
public function toMail($notifiable)
{
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
public function toSlack($notifiable)
{
$content = "Email Quality notification for Company {$this->company->company_key} \n";
$owner = $this->company->owner();
$content .= "Owner {$owner->present()->name() } | {$owner->email} \n";
$content .= "Spam trigger: {$this->spam_string}";
return (new SlackMessage)
->success()
->from(ctrans('texts.notification_bot'))
->image('https://app.invoiceninja.com/favicon.png')
->content($content);
}
}

View File

@ -78,10 +78,10 @@ class NewAccountNotification extends Notification
public function toSlack($notifiable)
{
$content = "New Trial Started\n";
$content = "{$this->client->name}\n";
$content = "Account key: {$this->account->key}\n";
$content = "Users: {$this->account->users()->pluck('email')}\n";
$content = "Contacts: {$this->client->contacts()->pluck('email')}\n";
$content .= "{$this->client->name}\n";
$content .= "Account key: {$this->account->key}\n";
$content .= "Users: {$this->account->users()->pluck('email')}\n";
$content .= "Contacts: {$this->client->contacts()->pluck('email')}\n";
return (new SlackMessage)

View File

@ -32,7 +32,7 @@ class VendorContactRepository extends BaseRepository
}
/* Get array of IDs which have been removed from the contacts array and soft delete each contact */
$vendor->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) {
$vendor->contacts->pluck('hashed_id')->diff($contacts->pluck('id'))->each(function ($contact) {
VendorContact::destroy($contact);
});

View File

@ -43,12 +43,10 @@ class ApplyNumber extends AbstractService
switch ($this->client->getSetting('counter_number_applied')) {
case 'when_saved':
$this->trySaving();
// $this->invoice->number = $this->getNextInvoiceNumber($this->client, $this->invoice, $this->invoice->recurring_id);
break;
case 'when_sent':
if ($this->invoice->status_id == Invoice::STATUS_SENT) {
$this->trySaving();
// $this->invoice->number = $this->getNextInvoiceNumber($this->client, $this->invoice, $this->invoice->recurring_id);
}
break;

View File

@ -40,7 +40,7 @@ class PurchaseOrderService
public function applyNumber()
{
$this->invoice = (new ApplyNumber($this->purchase_order->vendor, $this->purchase_order))->run();
$this->purchase_order = (new ApplyNumber($this->purchase_order->vendor, $this->purchase_order))->run();
return $this;
}

View File

@ -14,6 +14,7 @@ namespace App\Transformers;
use App\Models\Document;
use App\Models\Task;
use App\Utils\Traits\MakesHash;
use League\Fractal\Resource\Item;
/**
* class TaskTransformer.
@ -30,6 +31,7 @@ class TaskTransformer extends EntityTransformer
* @var array
*/
protected $availableIncludes = [
'client',
];
public function includeDocuments(Task $task)
@ -39,6 +41,13 @@ class TaskTransformer extends EntityTransformer
return $this->includeCollection($task->documents, $transformer, Document::class);
}
public function includeClient(Task $task): Item
{
$transformer = new ClientTransformer($this->serializer);
return $this->includeItem($task->client, $transformer, Client::class);
}
public function transform(Task $task)
{
return [

View File

@ -85,9 +85,6 @@ class TemplateEngine
public function build()
{
if ($this->template == 'email_template_null')
$this->template = 'email_template_purchase_order';
return $this->setEntity()
->setSettingsObject()
->setTemplates()
@ -185,7 +182,8 @@ class TemplateEngine
'allow_unsafe_links' => false,
]);
$this->body = $converter->convert($this->body);
$this->body = $converter->convert($this->body)->getContent();
}
private function entityValues($contact)

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.4.7',
'app_tag' => '5.4.7',
'app_version' => '5.4.8',
'app_tag' => '5.4.8',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

View File

@ -8,12 +8,12 @@ const RESOURCES = {
"canvaskit/profiling/canvaskit.js": "ae2949af4efc61d28a4a80fffa1db900",
"canvaskit/profiling/canvaskit.wasm": "95e736ab31147d1b2c7b25f11d4c32cd",
"canvaskit/canvaskit.wasm": "4b83d89d9fecbea8ca46f2f760c5a9ba",
"/": "0ba127947d7857ad97e39c264e308461",
"/": "822ce4d633db3626533357f47cfc8974",
"flutter.js": "0816e65a103ba8ba51b174eeeeb2cb67",
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
"version.json": "d72bd323e3b8e22ce5acdc247f4e6f62",
"version.json": "8c5f080db352df2d10c481aab911e2fb",
"favicon.ico": "51636d3a390451561744c42188ccd628",
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
"assets/fonts/MaterialIcons-Regular.otf": "95db9098c58fd6db106f1116bae85a0b",
@ -39,7 +39,7 @@ const RESOURCES = {
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "b62641afc9ab487008e996a5c5865e56",
"assets/NOTICES": "9b6b63256d3a6491659b71127ee9f3b6",
"main.dart.js": "739fb98bd5601a93da8be6b4358508d2"
"main.dart.js": "a94c1dac6570caa3cd122344d13fad8e"
};
// The application shell files that are downloaded before a service worker can

192995
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

189245
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"app_name":"invoiceninja_flutter","version":"5.0.85","build_number":"85","package_name":"invoiceninja_flutter"}
{"app_name":"invoiceninja_flutter","version":"5.0.86","build_number":"86","package_name":"invoiceninja_flutter"}

View File

@ -4633,6 +4633,7 @@ $LANG = array(
'vendor_information' => 'Vendor Information',
'notification_purchase_order_accepted_subject' => 'Purchase Order :purchase_order was accepted by :vendor',
'notification_purchase_order_accepted' => 'The following vendor :vendor accepted Purchase Order :purchase_order for :amount.',
'amount_received' => 'Amount received',
);
return $LANG;