Преглед изворни кода

Fix addresses not being set when document is created

Alan Lam пре 3 година
родитељ
комит
11c56a2609
1 измењених фајлова са 7 додато и 0 уклоњено
  1. 7 0
      controllers/document.php

+ 7 - 0
controllers/document.php

@@ -167,6 +167,13 @@ $controller = new class($document_type, $document_number) {
 		$document->user_id = $this->user->id;
 		$document->supplier_id = $supplier->id ?? null;
 		$document->location_id = $location->id ?? null;
+
+		if($location) {
+			$address = $location->getAddress();
+			$document->billing_address = (string) $address;
+			$document->delivery_address = (string) $address;
+		}
+
 		$document->type = $type;
 		$document->number = Document::getNextNumber($type);
 		$document->date = date("Y-m-d");