diff --git a/app/Models/PurchaseOrder.php b/app/Models/PurchaseOrder.php index 3a82bb9215f8..9f8a46f50405 100644 --- a/app/Models/PurchaseOrder.php +++ b/app/Models/PurchaseOrder.php @@ -159,7 +159,7 @@ class PurchaseOrder extends BaseModel if(!$invitation) throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?'); - $file_path = $this->client->credit_filepath($invitation).$this->numberFormatter().'.pdf'; + $file_path = $this->vendor->purchase_order_filepath($invitation).$this->numberFormatter().'.pdf'; if(Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)){ return Storage::disk(config('filesystems.default'))->{$type}($file_path); diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index 1076ecb29528..3a23d5d7b8bf 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -146,4 +146,10 @@ class Vendor extends BaseModel return ''; } + + public function purchase_order_filepath($invitation) + { + $contact_key = $invitation->contact->contact_key; + return $this->company->company_key.'/'.$this->vendor_hash.'/'.$contact_key.'/purchase_orders/'; + } }