mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 23:22:52 +01:00
remove vendor email colums
This commit is contained in:
parent
f0ba86b699
commit
f0d61a8261
@ -187,17 +187,17 @@ class BrevoController extends BaseController
|
||||
$input = $request->all();
|
||||
|
||||
// validation for client mail credentials by recipient
|
||||
if ($request->has('company')) {
|
||||
if (!($request->has('token')))
|
||||
return response()->json(['message' => 'Unauthorized'], 403);
|
||||
// if ($request->has('company')) {
|
||||
// if (!($request->has('token')))
|
||||
// return response()->json(['message' => 'Unauthorized'], 403);
|
||||
|
||||
$company = MultiDB::findAndSetDbByCompanyId($request->has('company'));
|
||||
$company_brevo_secret = $company?->settings?->email_sending_method === 'client_brevo' && $company?->settings?->brevo_secret ? $company->settings->brevo_secret : null;
|
||||
if (!$company || !$company_brevo_secret || $request->get('token') !== $company_brevo_secret)
|
||||
return response()->json(['message' => 'Unauthorized'], 403);
|
||||
// $company = MultiDB::findAndSetDbByCompanyId($request->has('company'));
|
||||
// $company_brevo_secret = $company?->settings?->email_sending_method === 'client_brevo' && $company?->settings?->brevo_secret ? $company->settings->brevo_secret : null;
|
||||
// if (!$company || !$company_brevo_secret || $request->get('token') !== $company_brevo_secret)
|
||||
// return response()->json(['message' => 'Unauthorized'], 403);
|
||||
|
||||
} else if (!($request->has('token') && $request->get('token') == config('services.brevo.secret')))
|
||||
return response()->json(['message' => 'Unauthorized'], 403);
|
||||
// } else if (!($request->has('token') && $request->get('token') == config('services.brevo.secret')))
|
||||
// return response()->json(['message' => 'Unauthorized'], 403);
|
||||
|
||||
if (!array_key_exists('items', $input)) {
|
||||
Log::info('Failed: Message could not be parsed, because required parameters are missing.');
|
||||
|
@ -270,9 +270,6 @@ class PostMarkController extends BaseController
|
||||
public function inboundWebhook(Request $request)
|
||||
{
|
||||
|
||||
Log::info($request->all());
|
||||
Log::info($request->headers);
|
||||
|
||||
$input = $request->all();
|
||||
|
||||
if (!(array_key_exists("MessageStream", $input) && $input["MessageStream"] == "inbound") || !array_key_exists("To", $input) || !array_key_exists("From", $input) || !array_key_exists("MessageID", $input)) {
|
||||
|
@ -224,8 +224,6 @@ class InboundMailEngine
|
||||
return true;
|
||||
|
||||
// from vendors
|
||||
if ($company->inbound_mailbox_allow_vendors && $company->vendors()->where("invoicing_email", $email->from)->orWhere("invoicing_domain", $domain)->exists())
|
||||
return true;
|
||||
if ($company->inbound_mailbox_allow_vendors && VendorContact::where("company_id", $company->id)->where("email", $email->from)->exists())
|
||||
return true;
|
||||
|
||||
@ -238,9 +236,6 @@ class InboundMailEngine
|
||||
}
|
||||
private function getClient(Company $company, InboundMail $email)
|
||||
{
|
||||
// $parts = explode('@', $email->from);
|
||||
// $domain = array_pop($parts);
|
||||
|
||||
$clientContact = ClientContact::where("company_id", $company->id)->where("email", $email->from)->first();
|
||||
$client = $clientContact->client();
|
||||
|
||||
@ -248,16 +243,8 @@ class InboundMailEngine
|
||||
}
|
||||
private function getVendor(Company $company, InboundMail $email)
|
||||
{
|
||||
$parts = explode('@', $email->from);
|
||||
$domain = array_pop($parts);
|
||||
|
||||
$vendor = Vendor::where("company_id", $company->id)->where('invoicing_email', $email->from)->first();
|
||||
if ($vendor == null)
|
||||
$vendor = Vendor::where("company_id", $company->id)->where("invoicing_domain", $domain)->first();
|
||||
if ($vendor == null) {
|
||||
$vendorContact = VendorContact::where("company_id", $company->id)->where("email", $email->from)->first();
|
||||
$vendor = $vendorContact->vendor();
|
||||
}
|
||||
$vendorContact = VendorContact::where("company_id", $company->id)->where("email", $email->from)->first();
|
||||
$vendor = $vendorContact->vendor();
|
||||
|
||||
return $vendor;
|
||||
}
|
||||
|
@ -23,10 +23,6 @@ return new class extends Migration {
|
||||
$table->text("inbound_mailbox_blacklist_domains")->nullable();
|
||||
$table->text("inbound_mailbox_blacklist_senders")->nullable();
|
||||
});
|
||||
Schema::table('vendors', function (Blueprint $table) {
|
||||
$table->string("invoicing_email")->nullable();
|
||||
$table->string("invoicing_domain")->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
Loading…
Reference in New Issue
Block a user