mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Minor fixes for search
This commit is contained in:
parent
36022b041a
commit
4934af9ee5
@ -491,7 +491,10 @@ class CompanySettings extends BaseSettings
|
||||
|
||||
public $classification = ''; // individual, business, partnership, trust, charity, government, other
|
||||
|
||||
public $payment_email_all_contacts = false;
|
||||
|
||||
public static $casts = [
|
||||
'payment_email_all_contacts' => 'bool',
|
||||
'statement_design_id' => 'string',
|
||||
'delivery_note_design_id' => 'string',
|
||||
'payment_receipt_design_id' => 'string',
|
||||
|
@ -173,7 +173,7 @@ class SearchController extends Controller
|
||||
'integrations,api_tokens' => '/settings/integrations/api_tokens',
|
||||
'integrations,api_webhooks' => '/settings/integrations/api_webhooks',
|
||||
'integrations,analytics' => '/settings/integrations/analytics',
|
||||
'gateways' => '/settings/gateways',
|
||||
'gateways' => '/settings/online_payments',
|
||||
'gateways,create' => '/settings/gateways/create',
|
||||
'bank_accounts,transaction_rules' => '/settings/bank_accounts/transaction_rules',
|
||||
'bank_accounts,transaction_rules/create' => '/settings/bank_accounts/transaction_rules/create',
|
||||
|
@ -117,44 +117,46 @@ class SystemMaintenance implements ShouldQueue
|
||||
});
|
||||
}
|
||||
|
||||
private function cleanPdfs()
|
||||
{
|
||||
$company_keys = Company::query()
|
||||
->pluck('company_key')
|
||||
->toArray();
|
||||
//double check this is correct.
|
||||
|
||||
// private function cleanPdfs()
|
||||
// {
|
||||
// $company_keys = Company::query()
|
||||
// ->pluck('company_key')
|
||||
// ->toArray();
|
||||
|
||||
$directories = Storage::disk(config('filesystems.default'))->directories();
|
||||
// $directories = Storage::disk(config('filesystems.default'))->directories();
|
||||
|
||||
$del_dirs = ['quotes','invoices','credits','recurring_invoices', 'e_invoice'];
|
||||
// $del_dirs = ['quotes','invoices','credits','recurring_invoices', 'e_invoice'];
|
||||
|
||||
collect($directories)->each(function ($parent_directory) use ($del_dirs, $company_keys) {
|
||||
// collect($directories)->each(function ($parent_directory) use ($del_dirs, $company_keys) {
|
||||
|
||||
if (! in_array($parent_directory, $company_keys)) {
|
||||
nlog("Deleting {$parent_directory}");
|
||||
// if (! in_array($parent_directory, $company_keys)) {
|
||||
// nlog("Deleting {$parent_directory}");
|
||||
|
||||
/* Ensure we are not deleting the root folder */
|
||||
if (strlen($parent_directory) > 1) {
|
||||
nlog("Company No Longer Exists => deleting {$parent_directory}");
|
||||
Storage::disk(config('filesystems.default'))->deleteDirectory($parent_directory);
|
||||
return;
|
||||
}
|
||||
// /* Ensure we are not deleting the root folder */
|
||||
// if (strlen($parent_directory) > 1) {
|
||||
// nlog("Company No Longer Exists => deleting {$parent_directory}");
|
||||
// Storage::disk(config('filesystems.default'))->deleteDirectory($parent_directory);
|
||||
// return;
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
$sub_directories = Storage::allDirectories($parent_directory);
|
||||
// $sub_directories = Storage::allDirectories($parent_directory);
|
||||
|
||||
collect($sub_directories)->each(function ($sub_dir) use ($del_dirs) {
|
||||
foreach($del_dirs as $del_dir) {
|
||||
if(stripos($sub_dir, $del_dir) !== false) {
|
||||
nlog("Deleting {$sub_dir} as it matches {$del_dir}");
|
||||
Storage::deleteDirectory($sub_dir);
|
||||
}
|
||||
}
|
||||
// collect($sub_directories)->each(function ($sub_dir) use ($del_dirs) {
|
||||
// foreach($del_dirs as $del_dir) {
|
||||
// if(stripos($sub_dir, $del_dir) !== false) {
|
||||
// nlog("Deleting {$sub_dir} as it matches {$del_dir}");
|
||||
// Storage::deleteDirectory($sub_dir);
|
||||
// }
|
||||
// }
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
});
|
||||
// });
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
@ -72,6 +72,10 @@ class EmailPayment implements ShouldQueue
|
||||
|
||||
$email_builder = (new PaymentEmailEngine($this->payment, $this->contact))->build();
|
||||
|
||||
if($this->settings->payment_email_all_contacts && $this->payment->invoices && $this->payment->invoices->count() >= 1) {
|
||||
$this->emailAllContacts($email_builder);
|
||||
}
|
||||
|
||||
$invitation = null;
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
@ -100,4 +104,25 @@ class EmailPayment implements ShouldQueue
|
||||
event(new PaymentWasEmailed($this->payment, $this->payment->company, $this->contact, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
}
|
||||
}
|
||||
|
||||
private function emailAllContacts($email_builder): void
|
||||
{
|
||||
|
||||
$invoice = $this->payment->invoices->first();
|
||||
|
||||
$invoice->invitations->each(function ($invite) use ($email_builder){
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new TemplateEmail($email_builder, $invite->contact, $invite);
|
||||
$nmo->to_user = $invite->contact;
|
||||
$nmo->settings = $this->settings;
|
||||
$nmo->company = $this->company;
|
||||
$nmo->entity = $this->payment;
|
||||
(new NinjaMailerJob($nmo))->handle();
|
||||
|
||||
event(new PaymentWasEmailed($this->payment, $this->payment->company, $invite->contact, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ class PaymentRepository extends BaseRepository
|
||||
|
||||
/*Ensure payment number generated*/
|
||||
if (! $payment->number || strlen($payment->number) == 0) {
|
||||
// $payment->number = $payment->client->getNextPaymentNumber($payment->client, $payment);
|
||||
$payment->service()->applyNumber();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user