Merge pull request #7615 from turbo124/v5-develop

v5.4.8
This commit is contained in:
David Bomba 2022-07-05 09:55:52 +10:00 committed by GitHub
commit 8075849e7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 39 additions and 19 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

@ -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

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

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

@ -84,9 +84,6 @@ class TemplateEngine
public function build()
{
if ($this->template == 'email_template_null')
$this->template = 'email_template_purchase_order';
return $this->setEntity()
->setSettingsObject()
@ -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', ''),